mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
INT: integration updates
- Minor code style - virtual functions - added some noexcept
This commit is contained in:
committed by
Andrew Heather
parent
bd84860e9b
commit
adaac7257f
@ -30,7 +30,6 @@ Class
|
||||
Foam::adjointOutletVelocityFluxFvPatchVectorField
|
||||
|
||||
Description
|
||||
|
||||
An outlet boundary condition for patches in which the primal flow exhibits
|
||||
recirculation. Adds the contribution of the objective as an adjoint
|
||||
momentum flux directly to the PDEs, without the need to first compute an
|
||||
|
||||
@ -31,7 +31,7 @@ Group
|
||||
grpFvOptionsSources
|
||||
|
||||
Description
|
||||
Impelements Brinkman penalisation terms for topology optimisation.
|
||||
Implements Brinkman penalisation terms for topology optimisation.
|
||||
Looks up the indicator field (beta) from the registry, through
|
||||
topOVariablesBase
|
||||
|
||||
|
||||
@ -88,15 +88,15 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update d (x) / db multiplier. Surface and volume-based sensitivity
|
||||
//- term
|
||||
void update_dxdbDirectMultiplier();
|
||||
virtual void update_dxdbDirectMultiplier();
|
||||
|
||||
//- Update d (normal dS) / db multiplier. Surface and volume-based
|
||||
//- sensitivity term
|
||||
void update_dSdbMultiplier();
|
||||
virtual void update_dSdbMultiplier();
|
||||
|
||||
//- Write initial volume for continuation
|
||||
virtual bool writeData(Ostream& os) const;
|
||||
|
||||
@ -91,7 +91,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Contribution to field sensitivities
|
||||
virtual void update_dJdb();
|
||||
|
||||
@ -75,7 +75,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- from components
|
||||
//- From components
|
||||
objectiveTopOVolume
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -92,7 +92,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Contribution to field sensitivities
|
||||
virtual void update_dJdb();
|
||||
|
||||
@ -85,19 +85,19 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~objectiveFlowRate() = default;
|
||||
virtual ~objectiveFlowRate() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_boundarydJdv();
|
||||
virtual void update_boundarydJdv();
|
||||
|
||||
//- Update values to be added to the adjoint outlet pressure
|
||||
void update_boundarydJdvn();
|
||||
virtual void update_boundarydJdvn();
|
||||
|
||||
// Helper write functions
|
||||
|
||||
|
||||
@ -92,13 +92,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_boundarydJdv();
|
||||
virtual void update_boundarydJdv();
|
||||
|
||||
//- Update values to be added to the adjoint outlet pressure
|
||||
void update_boundarydJdvn();
|
||||
virtual void update_boundarydJdvn();
|
||||
|
||||
// Helper write functions
|
||||
|
||||
|
||||
@ -96,28 +96,28 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint wall velocity
|
||||
void update_boundarydJdp();
|
||||
virtual void update_boundarydJdp();
|
||||
|
||||
//- Update delta(n dS)/delta b multiplier
|
||||
void update_dSdbMultiplier();
|
||||
virtual void update_dSdbMultiplier();
|
||||
|
||||
//- Update delta(x)/delta b multiplier
|
||||
void update_dxdbMultiplier();
|
||||
virtual void update_dxdbMultiplier();
|
||||
|
||||
//- Update dJ/dnut multiplier
|
||||
void update_boundarydJdnut();
|
||||
virtual void update_boundarydJdnut();
|
||||
|
||||
//- Update dJ/dGradU multiplier
|
||||
void update_boundarydJdGradU();
|
||||
virtual void update_boundarydJdGradU();
|
||||
|
||||
//- Return denominator, without density
|
||||
virtual scalar denom() const;
|
||||
|
||||
//- Return force direction
|
||||
const vector& forceDirection() const;
|
||||
virtual const vector& forceDirection() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -354,20 +354,20 @@ public:
|
||||
virtual bool write(const bool valid = true) const;
|
||||
|
||||
//- Inline functions for checking whether pointers are set or not
|
||||
inline bool hasdJdv() const;
|
||||
inline bool hasdJdp() const;
|
||||
inline bool hasdJdT() const;
|
||||
inline bool hasdJdTMVar1() const;
|
||||
inline bool hasdJdTMVar2() const;
|
||||
inline bool hasBoundarydJdv() const;
|
||||
inline bool hasBoundarydJdvn() const;
|
||||
inline bool hasBoundarydJdvt() const;
|
||||
inline bool hasBoundarydJdp() const;
|
||||
inline bool hasBoundarydJdT() const;
|
||||
inline bool hasBoundarydJdTMVar1() const;
|
||||
inline bool hasBoundarydJdTMVar2() const;
|
||||
inline bool hasBoundarydJdnut() const;
|
||||
inline bool hasBoundarydJdGradU() const;
|
||||
inline bool hasdJdv() const noexcept;
|
||||
inline bool hasdJdp() const noexcept;
|
||||
inline bool hasdJdT() const noexcept;
|
||||
inline bool hasdJdTMVar1() const noexcept;
|
||||
inline bool hasdJdTMVar2() const noexcept;
|
||||
inline bool hasBoundarydJdv() const noexcept;
|
||||
inline bool hasBoundarydJdvn() const noexcept;
|
||||
inline bool hasBoundarydJdvt() const noexcept;
|
||||
inline bool hasBoundarydJdp() const noexcept;
|
||||
inline bool hasBoundarydJdT() const noexcept;
|
||||
inline bool hasBoundarydJdTMVar1() const noexcept;
|
||||
inline bool hasBoundarydJdTMVar2() const noexcept;
|
||||
inline bool hasBoundarydJdnut() const noexcept;
|
||||
inline bool hasBoundarydJdGradU() const noexcept;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -213,85 +213,85 @@ Foam::objectiveIncompressible::boundarydJdGradU()
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasdJdv() const
|
||||
inline bool Foam::objectiveIncompressible::hasdJdv() const noexcept
|
||||
{
|
||||
return bool(dJdvPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasdJdp() const
|
||||
inline bool Foam::objectiveIncompressible::hasdJdp() const noexcept
|
||||
{
|
||||
return bool(dJdpPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasdJdT() const
|
||||
inline bool Foam::objectiveIncompressible::hasdJdT() const noexcept
|
||||
{
|
||||
return bool(dJdTPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasdJdTMVar1() const
|
||||
inline bool Foam::objectiveIncompressible::hasdJdTMVar1() const noexcept
|
||||
{
|
||||
return bool(dJdTMvar1Ptr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasdJdTMVar2() const
|
||||
inline bool Foam::objectiveIncompressible::hasdJdTMVar2() const noexcept
|
||||
{
|
||||
return bool(dJdTMvar2Ptr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdv() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdv() const noexcept
|
||||
{
|
||||
return bool(bdJdvPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdvn() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdvn() const noexcept
|
||||
{
|
||||
return bool(bdJdvnPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdvt() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdvt() const noexcept
|
||||
{
|
||||
return bool(bdJdvtPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdp() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdp() const noexcept
|
||||
{
|
||||
return bool(bdJdpPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdT() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdT() const noexcept
|
||||
{
|
||||
return bool(bdJdTPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar1() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar1() const noexcept
|
||||
{
|
||||
return bool(bdJdTMvar1Ptr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar2() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdTMVar2() const noexcept
|
||||
{
|
||||
return bool(bdJdTMvar2Ptr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdnut() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdnut() const noexcept
|
||||
{
|
||||
return bool(bdJdnutPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdGradU() const
|
||||
inline bool Foam::objectiveIncompressible::hasBoundarydJdGradU() const noexcept
|
||||
{
|
||||
return bool(bdJdGradUPtr_);
|
||||
}
|
||||
|
||||
@ -97,30 +97,30 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update mean drag and lift values
|
||||
void update_meanValues();
|
||||
virtual void update_meanValues();
|
||||
|
||||
//- Update values to be added to the adjoint wall velocity
|
||||
void update_boundarydJdp();
|
||||
virtual void update_boundarydJdp();
|
||||
|
||||
//- Update delta(n dS)/delta b multiplier
|
||||
void update_dSdbMultiplier();
|
||||
virtual void update_dSdbMultiplier();
|
||||
|
||||
//- Update delta(x)/delta b multiplier
|
||||
void update_dxdbMultiplier();
|
||||
virtual void update_dxdbMultiplier();
|
||||
|
||||
//- Update delta(x)/delta b multiplier coming directly from the
|
||||
//- objective
|
||||
void update_dxdbDirectMultiplier();
|
||||
virtual void update_dxdbDirectMultiplier();
|
||||
|
||||
//- Update dJ/dnut multiplier
|
||||
void update_boundarydJdnut();
|
||||
virtual void update_boundarydJdnut();
|
||||
|
||||
//- Update dJ/dGradU multiplier
|
||||
/* WIP
|
||||
void update_boundarydJdGradU();
|
||||
virtual void update_boundarydJdGradU();
|
||||
*/
|
||||
};
|
||||
|
||||
|
||||
@ -116,20 +116,20 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_dJdv();
|
||||
virtual void update_dJdv();
|
||||
|
||||
//- Update field to be added to the first adjoint turbulence model PDE
|
||||
void update_dJdTMvar1();
|
||||
virtual void update_dJdTMvar1();
|
||||
|
||||
//- Update field to be added to the second adjoint turbulence model PDE
|
||||
void update_dJdTMvar2();
|
||||
virtual void update_dJdTMvar2();
|
||||
|
||||
//- Update field to be added to be added to volume-based
|
||||
//- sensitivity derivatives, emerging from delta ( dV ) / delta b
|
||||
void update_divDxDbMultiplier();
|
||||
virtual void update_divDxDbMultiplier();
|
||||
|
||||
//- Add source terms to the adjoint turbulence model equations
|
||||
virtual void addSource(fvScalarMatrix& matrix);
|
||||
|
||||
@ -97,16 +97,16 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_dJdv();
|
||||
virtual void update_dJdv();
|
||||
|
||||
//- Update field to be added to the first adjoint turbulence model PDE
|
||||
void update_dJdTMvar1();
|
||||
virtual void update_dJdTMvar1();
|
||||
|
||||
//- Update field to be added to the second adjoint turbulence model PDE
|
||||
void update_dJdTMvar2();
|
||||
virtual void update_dJdTMvar2();
|
||||
|
||||
//- Update div(dx/db multiplier). Volume-based sensitivity term
|
||||
virtual void update_divDxDbMultiplier();
|
||||
|
||||
@ -52,32 +52,7 @@ addToRunTimeSelectionTable
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
objectivePtLosses::objectivePtLosses
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& adjointSolverName,
|
||||
const word& primalSolverName
|
||||
)
|
||||
:
|
||||
objectiveIncompressible(mesh, dict, adjointSolverName, primalSolverName),
|
||||
patches_(0),
|
||||
patchPt_(0)
|
||||
{
|
||||
// Find inlet/outlet patches
|
||||
initialize();
|
||||
|
||||
// Allocate boundary field pointers
|
||||
bdJdpPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvnPtr_.reset(createZeroBoundaryPtr<scalar>(mesh_));
|
||||
bdJdvtPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void objectivePtLosses::initialize()
|
||||
{
|
||||
@ -132,6 +107,33 @@ void objectivePtLosses::initialize()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
objectivePtLosses::objectivePtLosses
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& adjointSolverName,
|
||||
const word& primalSolverName
|
||||
)
|
||||
:
|
||||
objectiveIncompressible(mesh, dict, adjointSolverName, primalSolverName),
|
||||
patches_(0),
|
||||
patchPt_(0)
|
||||
{
|
||||
// Find inlet/outlet patches
|
||||
initialize();
|
||||
|
||||
// Allocate boundary field pointers
|
||||
bdJdpPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvnPtr_.reset(createZeroBoundaryPtr<scalar>(mesh_));
|
||||
bdJdvtPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalar objectivePtLosses::J()
|
||||
{
|
||||
J_ = Zero;
|
||||
|
||||
@ -66,6 +66,12 @@ class objectivePtLosses
|
||||
scalarField patchPt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return the objectiveReportPatches
|
||||
void initialize();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -90,23 +96,20 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the objectiveReportPatches
|
||||
void initialize();
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint inlet velocity
|
||||
void update_boundarydJdp();
|
||||
virtual void update_boundarydJdp();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_boundarydJdv();
|
||||
virtual void update_boundarydJdv();
|
||||
|
||||
//- Update values to be added to the adjoint outlet pressure
|
||||
void update_boundarydJdvn();
|
||||
virtual void update_boundarydJdvn();
|
||||
|
||||
//- Update values to be added to the adjoint outlet tangential velocity
|
||||
void update_boundarydJdvt();
|
||||
virtual void update_boundarydJdvt();
|
||||
|
||||
// Helper write functions
|
||||
|
||||
|
||||
@ -97,14 +97,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the objectiveReportPatches
|
||||
void initialize();
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_dJdv();
|
||||
virtual void update_dJdv();
|
||||
|
||||
//- Update div( dx/db multiplier). Volume-based sensitivity term
|
||||
virtual void update_divDxDbMultiplier();
|
||||
|
||||
@ -51,32 +51,7 @@ addToRunTimeSelectionTable
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
objectiveUniformityPatch::objectiveUniformityPatch
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& adjointSolverName,
|
||||
const word& primalSolverName
|
||||
)
|
||||
:
|
||||
objectiveIncompressible(mesh, dict, adjointSolverName, primalSolverName),
|
||||
patches_(),
|
||||
UMean_(),
|
||||
UVar_()
|
||||
{
|
||||
// Find inlet/outlet patches
|
||||
initialize();
|
||||
|
||||
// Allocate boundary field pointers
|
||||
bdJdvPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvnPtr_.reset(createZeroBoundaryPtr<scalar>(mesh_));
|
||||
bdJdvtPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void objectiveUniformityPatch::initialize()
|
||||
{
|
||||
@ -132,6 +107,33 @@ void objectiveUniformityPatch::initialize()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
objectiveUniformityPatch::objectiveUniformityPatch
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& adjointSolverName,
|
||||
const word& primalSolverName
|
||||
)
|
||||
:
|
||||
objectiveIncompressible(mesh, dict, adjointSolverName, primalSolverName),
|
||||
patches_(),
|
||||
UMean_(),
|
||||
UVar_()
|
||||
{
|
||||
// Find inlet/outlet patches
|
||||
initialize();
|
||||
|
||||
// Allocate boundary field pointers
|
||||
bdJdvPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
bdJdvnPtr_.reset(createZeroBoundaryPtr<scalar>(mesh_));
|
||||
bdJdvtPtr_.reset(createZeroBoundaryPtr<vector>(mesh_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
scalar objectiveUniformityPatch::J()
|
||||
{
|
||||
J_ = Zero;
|
||||
|
||||
@ -70,6 +70,12 @@ class objectiveUniformityPatch
|
||||
scalarField UVar_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return the objectiveReportPatches
|
||||
void initialize();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -94,20 +100,17 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the objectiveReportPatches
|
||||
void initialize();
|
||||
|
||||
//- Return the objective function value
|
||||
scalar J();
|
||||
virtual scalar J();
|
||||
|
||||
//- Update values to be added to the adjoint outlet velocity
|
||||
void update_boundarydJdv();
|
||||
virtual void update_boundarydJdv();
|
||||
|
||||
//- Update values to be added to the adjoint outlet pressure
|
||||
void update_boundarydJdvn();
|
||||
virtual void update_boundarydJdvn();
|
||||
|
||||
//- Update values to be added to the adjoint outlet tangential velocity
|
||||
void update_boundarydJdvt();
|
||||
virtual void update_boundarydJdvt();
|
||||
|
||||
// Helper write functions
|
||||
|
||||
|
||||
@ -266,36 +266,31 @@ public:
|
||||
//- Return the objective function of the optimisation cycle.
|
||||
// This corresponds to the mean value, if it exists, or the
|
||||
// instantaneous value otherwise
|
||||
scalar JCycle(bool negate = false) const;
|
||||
virtual scalar JCycle(bool negate = false) const;
|
||||
|
||||
//- Accumulate contribution for the mean objective value
|
||||
// For steady-state runs
|
||||
void accumulateJMean(solverControl& solverControl);
|
||||
virtual void accumulateJMean(solverControl& solverControl);
|
||||
|
||||
|
||||
//- Accumulate contribution for the mean objective value
|
||||
// For unsteady runs
|
||||
void accumulateJMean();
|
||||
virtual void accumulateJMean();
|
||||
|
||||
//- Return the objective function weight
|
||||
scalar weight() const;
|
||||
|
||||
//- Return the normalization factor
|
||||
const autoPtr<scalar>& normFactor() const;
|
||||
|
||||
//- Return the objective target value
|
||||
const autoPtr<scalar>& target() const;
|
||||
virtual scalar weight() const;
|
||||
|
||||
//- Is the objective normalized
|
||||
bool normalize() const;
|
||||
virtual bool normalize() const;
|
||||
|
||||
//- Normalize all fields allocated by the objective
|
||||
virtual void doNormalization();
|
||||
|
||||
//- Check whether this is an objective integration time
|
||||
bool isWithinIntegrationTime() const;
|
||||
virtual bool isWithinIntegrationTime() const;
|
||||
|
||||
//- Increment integration times
|
||||
void incrementIntegrationTimes(const scalar timeSpan);
|
||||
virtual void incrementIntegrationTimes(const scalar timeSpan);
|
||||
|
||||
//- Contribution to field sensitivities
|
||||
inline const volScalarField& dJdb() const;
|
||||
@ -450,22 +445,23 @@ public:
|
||||
inline void setWrite(const bool shouldWrite);
|
||||
|
||||
// Inline functions for checking whether pointers are set or not
|
||||
inline bool hasdJdb() const;
|
||||
inline bool hasdJdbField() const;
|
||||
inline bool hasBoundarydJdb() const;
|
||||
inline bool hasdSdbMult() const;
|
||||
inline bool hasdndbMult() const;
|
||||
inline bool hasdxdbMult() const;
|
||||
inline bool hasdxdbDirectMult() const;
|
||||
inline bool hasBoundaryEdgeContribution() const;
|
||||
inline bool hasDivDxDbMult() const;
|
||||
inline bool hasGradDxDbMult() const;
|
||||
inline bool hasdJdb() const noexcept;
|
||||
inline bool hasdJdbField() const noexcept;
|
||||
inline bool hasBoundarydJdb() const noexcept;
|
||||
inline bool hasdSdbMult() const noexcept;
|
||||
inline bool hasdndbMult() const noexcept;
|
||||
inline bool hasdxdbMult() const noexcept;
|
||||
inline bool hasdxdbDirectMult() const noexcept;
|
||||
inline bool hasBoundaryEdgeContribution() const noexcept;
|
||||
inline bool hasDivDxDbMult() const noexcept;
|
||||
inline bool hasGradDxDbMult() const noexcept;
|
||||
|
||||
// Inline functions for checking whether integration times are set
|
||||
inline bool hasIntegrationStartTime() const;
|
||||
inline bool hasIntegrationEndTime() const;
|
||||
// Set the computed status of the objective
|
||||
inline void setComputed(const bool isComputed);
|
||||
inline bool hasIntegrationStartTime() const noexcept;
|
||||
inline bool hasIntegrationEndTime() const noexcept;
|
||||
|
||||
//- Set the computed status of the objective
|
||||
inline void setComputed(const bool isComputed) noexcept;
|
||||
|
||||
//- Return objective dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
@ -167,79 +167,79 @@ inline const Foam::volTensorField& Foam::objective::gradDxDbMultiplier() const
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdJdb() const
|
||||
inline bool Foam::objective::hasdJdb() const noexcept
|
||||
{
|
||||
return bool(dJdbPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdJdbField() const
|
||||
inline bool Foam::objective::hasdJdbField() const noexcept
|
||||
{
|
||||
return bool(dJdbFieldPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasBoundarydJdb() const
|
||||
inline bool Foam::objective::hasBoundarydJdb() const noexcept
|
||||
{
|
||||
return bool(bdJdbPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdSdbMult() const
|
||||
inline bool Foam::objective::hasdSdbMult() const noexcept
|
||||
{
|
||||
return bool(bdSdbMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdndbMult() const
|
||||
inline bool Foam::objective::hasdndbMult() const noexcept
|
||||
{
|
||||
return bool(bdndbMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdxdbMult() const
|
||||
inline bool Foam::objective::hasdxdbMult() const noexcept
|
||||
{
|
||||
return bool(bdxdbMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasdxdbDirectMult() const
|
||||
inline bool Foam::objective::hasdxdbDirectMult() const noexcept
|
||||
{
|
||||
return bool(bdxdbDirectMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasBoundaryEdgeContribution() const
|
||||
inline bool Foam::objective::hasBoundaryEdgeContribution() const noexcept
|
||||
{
|
||||
return bool(bEdgeContribution_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasDivDxDbMult() const
|
||||
inline bool Foam::objective::hasDivDxDbMult() const noexcept
|
||||
{
|
||||
return bool(divDxDbMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasGradDxDbMult() const
|
||||
inline bool Foam::objective::hasGradDxDbMult() const noexcept
|
||||
{
|
||||
return bool(gradDxDbMultPtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasIntegrationStartTime() const
|
||||
inline bool Foam::objective::hasIntegrationStartTime() const noexcept
|
||||
{
|
||||
return bool(integrationStartTimePtr_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::objective::hasIntegrationEndTime() const
|
||||
inline bool Foam::objective::hasIntegrationEndTime() const noexcept
|
||||
{
|
||||
return bool(integrationEndTimePtr_);
|
||||
}
|
||||
|
||||
|
||||
inline void Foam::objective::setComputed(const bool isComputed)
|
||||
inline void Foam::objective::setComputed(const bool isComputed) noexcept
|
||||
{
|
||||
computed_ = isComputed;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ protected:
|
||||
//- Which of the design variables will be updated
|
||||
labelList activeDesignVariables_;
|
||||
|
||||
//- Copy of old design variables. Usefull when performing line-search
|
||||
//- Copy of old design variables. Useful when performing line-search
|
||||
autoPtr<scalarField> oldDesignVariables_;
|
||||
|
||||
//- Maximum design variables' change in the first optimisation cycle
|
||||
|
||||
@ -119,7 +119,7 @@ tmp<scalarField> sigmoidalHeaviside::derivative(const scalarField& arg) const
|
||||
const scalar pi = constant::mathematical::pi;
|
||||
scalarField argLimited(max(min(dNB_, arg), -dNB_));
|
||||
DebugInfo
|
||||
<< type() << "::interpolate:: t, dNB " << t << ", " << dNB_ << endl;
|
||||
<< type() << "::derivative:: t, dNB " << t << ", " << dNB_ << endl;
|
||||
|
||||
deriv = 0.5*(scalar(1) + cos(pi*argLimited/dNB_))/dNB_;
|
||||
|
||||
|
||||
@ -43,14 +43,14 @@ Description
|
||||
\endverbatim
|
||||
|
||||
The implemented approach borrows from the references therein, but does not
|
||||
follow any of them exactly. The underlaying field of the design variables
|
||||
follow any of them exactly. The underlying field of the design variables
|
||||
is not the level-set field but affects the latter through:
|
||||
a) a regularisation approach similar to that used in porosity-based topO
|
||||
(see the regularisation class and references therein) and
|
||||
b) a re-initialisation strategy. Since solving a modified Hamilton-Jacobi
|
||||
equation poses a number of numerical challenges, the signed distance field
|
||||
is obtained by identifying the zero level-set contour using the
|
||||
cutFaceIso, cutCellIso infrastucture (see references therein for the
|
||||
cutFaceIso, cutCellIso infrastructure (see references therein for the
|
||||
methodology) and using these "cut-faces" as seeds for meshWave.
|
||||
|
||||
SourceFiles
|
||||
@ -96,7 +96,7 @@ protected:
|
||||
//- into signed distances
|
||||
volScalarField aTilda_;
|
||||
|
||||
//- Function to transorm signed distances to the indicator field beta_
|
||||
//- Function to transform signed distances to the indicator field beta_
|
||||
autoPtr<topOInterpolationFunction> interpolation_;
|
||||
|
||||
//- The indicator field
|
||||
@ -105,7 +105,7 @@ protected:
|
||||
//- Fix aTilda values in fixed{Zero}PorousZones and IOcells
|
||||
bool fixATildaValues_;
|
||||
|
||||
//- Write all fields related to the distance calculation (debuging)
|
||||
//- Write all fields related to the distance calculation (debugging)
|
||||
bool writeAllDistanceFields_;
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ Foam::dynamicTopODesignVariables::dynamicTopODesignVariables
|
||||
topODesignVariables(mesh, dict, size),
|
||||
marchCells_(mesh, dict.subDict("marchingCoeffs"))
|
||||
{
|
||||
// Rest of the contrsuctor initialization
|
||||
// Rest of the constructor initialization
|
||||
initialize();
|
||||
}
|
||||
|
||||
@ -100,10 +100,7 @@ Foam::dynamicTopODesignVariables::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return autoPtr<dynamicTopODesignVariables>
|
||||
(
|
||||
new dynamicTopODesignVariables(mesh, dict)
|
||||
);
|
||||
return autoPtr<dynamicTopODesignVariables>::New(mesh, dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,8 +100,7 @@ Foam::fieldRegularisation::fieldRegularisation
|
||||
)
|
||||
{
|
||||
DebugInfo
|
||||
<< "Regularise " << Switch(regularise_) << endl;
|
||||
DebugInfo
|
||||
<< "Regularise " << Switch(regularise_) << nl
|
||||
<< "Project " << Switch(project_) << endl;
|
||||
}
|
||||
|
||||
@ -160,7 +159,7 @@ void Foam::fieldRegularisation::postProcessSens(scalarField& sens)
|
||||
{
|
||||
sens *= sharpenFunction_->derivative(betaArg_);
|
||||
}
|
||||
// Add part due to regulatisation
|
||||
// Add part due to regularisation
|
||||
if (regularise_)
|
||||
{
|
||||
// Solve the adjoint to the regularisation equation
|
||||
|
||||
@ -69,7 +69,6 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Solve the regularisationPDE only on a subset mesh made of the
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
|
||||
@ -174,7 +174,7 @@ void Foam::topODesignVariables::setActiveDesignVariables
|
||||
label varI(activeDesignVariables_.size());
|
||||
activeDesignVariables_.setSize(offset + mesh_.nCells(), -1);
|
||||
// Set active design variables
|
||||
// If specific porosity zones are perscribed, use them directly
|
||||
// If specific porosity zones are prescribed, use them directly
|
||||
if (!zones_.adjointPorousZoneIDs().empty())
|
||||
{
|
||||
for (label cellZoneID : zones_.adjointPorousZoneIDs())
|
||||
@ -346,10 +346,7 @@ Foam::autoPtr<Foam::topODesignVariables> Foam::topODesignVariables::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return autoPtr<topODesignVariables>
|
||||
(
|
||||
new topODesignVariables(mesh, dict)
|
||||
);
|
||||
return autoPtr<topODesignVariables>::New(mesh, dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- A subfield of the design variables correponding to the porosity
|
||||
//- A subfield of the design variables corresponding to the porosity
|
||||
//- field.
|
||||
// Usually the same as *this
|
||||
SubField<scalar> alpha_;
|
||||
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Cell zones usefull for defining the constant and changing parts
|
||||
//- Cell zones useful for defining the constant and changing parts
|
||||
//- of the domain in topO
|
||||
topOZones zones_;
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
// field
|
||||
// - 0 distance contour for levelSet or
|
||||
// - 0.5 beta contour for porosity-based topO.
|
||||
// For levelSet topO, the process of identitying the contour sets also
|
||||
// For levelSet topO, the process of identifying the contour sets also
|
||||
// the seeds for computing the distance field in the entire domain
|
||||
void writeFluidSolidInterface
|
||||
(
|
||||
|
||||
@ -89,7 +89,7 @@ protected:
|
||||
//- Get zone IDs corresponding to a wordList, read from a dict.
|
||||
// Avoid going through ZoneMesh.indices() since this practically sorts
|
||||
// the IDs from smallest to largest while we need to keep them in the
|
||||
// same order as that perscribed in the wordList
|
||||
// same order as that prescribed in the wordList
|
||||
labelList getZoneIDs(const dictionary& dict, const word& zoneGroup);
|
||||
|
||||
//- Add a cellZone containing the cells next to IO patches
|
||||
|
||||
@ -167,7 +167,7 @@ void Foam::incompressiblePrimalSolver::correctBoundaryConditions()
|
||||
// including averaged ones, if present
|
||||
vars.correctBoundaryConditions();
|
||||
|
||||
// phi cannot be updated through correctBoundayrConditions.
|
||||
// phi cannot be updated through correctBoundaryConditions.
|
||||
// Re-compute based on the Rhie-Chow interpolation scheme.
|
||||
// This is a non-linear process
|
||||
// (phi depends on UEqn().A() which depends on phi)
|
||||
|
||||
Reference in New Issue
Block a user