Base class supporting Shape sensitivity derivatives. More...
Public Member Functions | |
TypeName ("ShapeSensitivitiesBase") | |
Runtime type information. More... | |
ShapeSensitivitiesBase (const fvMesh &mesh, const dictionary &dict, adjointSolver &adjointSolver) | |
Construct from components. More... | |
virtual | ~ShapeSensitivitiesBase ()=default |
Destructor. More... | |
virtual bool | readDict (const dictionary &dict) |
Read dict if changed. More... | |
const labelHashSet & | sensitivityPatchIDs () const |
Get patch IDs on which sensitivities are computed. More... | |
void | setSensitivityPatchIDs (const labelHashSet &sensPatchIDs) |
Overwrite sensitivityPatchIDs. More... | |
virtual const labelHashSet & | geometryVariationIntegrationPatches () const |
Return set of patches on which to compute direct sensitivities. More... | |
virtual void | accumulateIntegrand (const scalar dt) |
Accumulate sensitivity integrands. More... | |
void | clearSensitivities () |
Zero sensitivity fields and their constituents. More... | |
virtual void | write (const word &baseName=word::null) |
Write sensitivity fields. More... | |
tmp< volVectorField > | getWallFaceSensVec () |
Get wall face sensitivity vectors field. More... | |
tmp< volScalarField > | getWallFaceSensNormal () |
Get wall face sensitivity projected to normal field. More... | |
tmp< volVectorField > | getWallFaceSensNormalVec () |
Get wall face normal sens as vectors field. More... | |
tmp< pointVectorField > | getWallPointSensVec () |
Get wall point sensitivity vectors field. More... | |
tmp< pointScalarField > | getWallPointSensNormal () |
Get wall point sensitivity projected to normal field. More... | |
tmp< pointVectorField > | getWallPointSensNormalVec () |
Get wall point sens as vectors field. More... | |
virtual const boundaryVectorField & | getWallFaceSensVecBoundary () const |
Get wall face sensitivity vectors field. More... | |
virtual const boundaryScalarField & | getWallFaceSensNormalBoundary () const |
Get wall face sensitivity projected to normal field. More... | |
virtual const boundaryVectorField & | getWallFaceSensNormalVecBoundary () const |
Get wall face normal sens as vectors field. More... | |
Public Member Functions inherited from adjointSensitivity | |
TypeName ("adjointSensitivity") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, adjointSensitivity, dictionary,(const fvMesh &mesh, const dictionary &dict, adjointSolver &adjointSolver),(mesh, dict, adjointSolver)) | |
adjointSensitivity (const fvMesh &mesh, const dictionary &dict, adjointSolver &adjointSolver) | |
Construct from components. More... | |
virtual | ~adjointSensitivity ()=default |
Destructor. More... | |
const adjointSolver & | getAdjointSolver () const |
Const access to adjoint solver. More... | |
adjointSolver & | getAdjointSolver () |
Non-const access to adjoint solver. More... | |
bool | includeDistance () const |
Should the adjoint eikonal PDE should be solved. More... | |
autoPtr< adjointEikonalSolver > & | getAdjointEikonalSolver () |
Return the adjoint eikonal solver. More... | |
autoPtr< adjointMeshMovementSolver > & | getAdjointMeshMovementSolver () |
Return the adjoint eikonal solver. More... | |
void | setSuffix (const word &suffix) |
Set suffix. More... | |
const word & | getSuffix () const |
Get suffix. More... | |
virtual bool | computeDxDbInternalField () const |
Should the parameterization compute the internalField of dxdb. More... | |
virtual void | assembleSensitivities (autoPtr< designVariables > &designVars) |
Assemble sensitivities. More... | |
virtual const scalarField & | calculateSensitivities (autoPtr< designVariables > &designVars) |
Calculates and returns sensitivity fields. More... | |
const scalarField & | getSensitivities () const |
Returns the sensitivity fields. More... | |
const autoPtr< volTensorField > & | gradDxDbMult () const |
autoPtr< volTensorField > & | gradDxDbMult () |
const autoPtr< scalarField > & | divDxDbMult () const |
const autoPtr< boundaryVectorField > & | dxdbMult () const |
const autoPtr< boundaryVectorField > & | dSfdbMult () const |
const autoPtr< boundaryVectorField > & | dnfdbMult () const |
const autoPtr< boundaryVectorField > & | dxdbDirectMult () const |
const autoPtr< pointBoundaryVectorField > & | pointDxDbDirectMult () const |
const autoPtr< boundaryVectorField > & | bcDxDbMult () const |
const autoPtr< vectorField > & | optionsDxDbMult () const |
Public Member Functions inherited from sensitivity | |
TypeName ("sensitivity") | |
Runtime type information. More... | |
sensitivity (const fvMesh &mesh, const dictionary &dict) | |
Construct from components. More... | |
virtual | ~sensitivity ()=default |
Destructor. More... | |
const fvMesh & | mesh () const |
Return reference to mesh. More... | |
const dictionary & | dict () const |
Return the construction dictionary. More... | |
const autoPtr< volScalarField > & | fieldSensPtr () const |
Get the fieldSensPtr. More... | |
Protected Member Functions | |
void | allocateEikonalSolver () |
Allocate the adjoint eikonal solver. More... | |
bool | hasMultiplier (bool(objective::*hasFunction)() const) |
Check if any of the available objective has a certain multiplier, provided through a function object. More... | |
template<class Type > | |
void | constructAndWriteSensitivityField (const autoPtr< typename GeometricField< Type, fvPatchField, volMesh >::Boundary > &sensFieldPtr, const word &name) const |
Constructs volField based on boundaryField and writes it. More... | |
template<class Type > | |
void | constructAndWriteSensitivtyPointField (const autoPtr< List< Field< Type >>> &sensFieldPtr, const word &name) const |
Constructs pointField based on boundaryField and writes it. More... | |
template<class Type > | |
tmp< GeometricField< Type, fvPatchField, volMesh > > | constructVolSensitivtyField (const autoPtr< typename GeometricField< Type, fvPatchField, volMesh >::Boundary > &sensFieldPtr, const word &name) const |
Constructs volField based on boundaryField and writes it. More... | |
void | writeFaceBasedSens () const |
Write face-based sensitivities, if present. More... | |
void | writePointBasedSens () const |
Write point-based sensitivities, if present. More... | |
void | clearSurfaceFields () |
Clear surface/point fields. More... | |
void | allocateMultipliers () |
Allocate multiplier fields. More... | |
void | clearMultipliers () |
Clear multipliers. More... | |
Protected Attributes | |
labelHashSet | sensitivityPatchIDs_ |
Patches on which to compute shape sensitivities. More... | |
bool | writeAllSurfaceFiles_ |
Whether to write all surface sensitivity fields. More... | |
autoPtr< boundaryVectorField > | wallFaceSensVecPtr_ |
Wall face sens w.r.t. (x,y.z) More... | |
autoPtr< boundaryScalarField > | wallFaceSensNormalPtr_ |
Wall face sens projected to normal. More... | |
autoPtr< boundaryVectorField > | wallFaceSensNormalVecPtr_ |
Normal sens as vectors. More... | |
autoPtr< pointBoundaryVectorField > | wallPointSensVecPtr_ |
Wall point sens w.r.t. (x,y.z) More... | |
autoPtr< pointBoundaryScalarField > | wallPointSensNormalPtr_ |
Wall point sens projected to normal. More... | |
autoPtr< pointBoundaryVectorField > | wallPointSensNormalVecPtr_ |
Normal sens as vectors. More... | |
Protected Attributes inherited from adjointSensitivity | |
adjointSolver & | adjointSolver_ |
Reference to the underlaying adjoint solver. More... | |
scalarField | derivatives_ |
The sensitivity derivative values. More... | |
word | suffix_ |
Append this word to files related to the sensitivities. More... | |
bool | includeDistance_ |
Include distance variation in sensitivity computations. More... | |
autoPtr< adjointEikonalSolver > | eikonalSolver_ |
Adjoint eikonal equation solver. More... | |
autoPtr< adjointMeshMovementSolver > | adjointMeshMovementSolver_ |
Adjoint grid displacement solver. More... | |
autoPtr< volTensorField > | gradDxDbMult_ |
Multiplier of grad(dx/b) More... | |
autoPtr< scalarField > | divDxDbMult_ |
Multiplier of div(dx/db) More... | |
autoPtr< boundaryVectorField > | dxdbMult_ |
Multiplier of face dx/db. More... | |
autoPtr< boundaryVectorField > | dSfdbMult_ |
Multiplier of dSf/db. More... | |
autoPtr< boundaryVectorField > | dnfdbMult_ |
Multiplier of dnf/db. More... | |
autoPtr< boundaryVectorField > | dxdbDirectMult_ |
Multiplier of dCf/db, found in the objective function. More... | |
autoPtr< pointBoundaryVectorField > | pointDxDbDirectMult_ |
Multiplier of dx/db computed at points, found in the objective function. More... | |
autoPtr< boundaryVectorField > | bcDxDbMult_ |
Multiplier of dx/db, coming from boundary conditions that depend on the geometry, like rotatingWallVelocity. More... | |
autoPtr< vectorField > | optionsDxDbMult_ |
dx/db multiplier coming from fvOptions More... | |
Protected Attributes inherited from sensitivity | |
const fvMesh & | mesh_ |
dictionary | dict_ |
bool | writeFieldSens_ |
autoPtr< volScalarField > | fieldSensPtr_ |
Additional Inherited Members | |
Static Public Member Functions inherited from adjointSensitivity | |
static autoPtr< adjointSensitivity > | New (const fvMesh &mesh, const dictionary &dict, adjointSolver &adjointSolver) |
Return a reference to the selected turbulence model. More... | |
Base class supporting Shape sensitivity derivatives.
For the FI formulation see Kavvadias, I., Papoutsis-Kiachagias, E., & Giannakoglou, K. (2015). On the proper treatment of grid sensitivities in continuous adjoint methods for shape optimization. Journal of Computational Physics, 301, 1–18. http://doi.org/10.1016/j.jcp.2015.08.012 The ESI formulation is derived in a slightly different way than the one described in this paper, to provide a common mathematical formulation for both low- and high-Re meshes and to produce numerically identical results as the FI formulation. In brief, the boundary-bound part of the sensitivities is the patchInternalField of the tensor multiplying grad(dxdb) in the FI formulation.
Definition at line 75 of file ShapeSensitivitiesBase.H.
ShapeSensitivitiesBase | ( | const fvMesh & | mesh, |
const dictionary & | dict, | ||
adjointSolver & | adjointSolver | ||
) |
Construct from components.
Definition at line 273 of file ShapeSensitivitiesBase.C.
|
virtualdefault |
Destructor.
|
protected |
Allocate the adjoint eikonal solver.
Definition at line 39 of file ShapeSensitivitiesBase.C.
References adjointSensitivity::adjointSolver_, sensitivity::dict(), adjointSensitivity::eikonalSolver_, ShapeSensitivitiesBase::geometryVariationIntegrationPatches(), adjointSensitivity::includeDistance_, and sensitivity::mesh_.
|
protected |
Check if any of the available objective has a certain multiplier, provided through a function object.
Definition at line 59 of file ShapeSensitivitiesBase.C.
|
protected |
Constructs volField based on boundaryField and writes it.
Definition at line 34 of file ShapeSensitivitiesBaseTemplates.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), Foam::dimless, Foam::name(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, and Foam::Zero.
|
protected |
Constructs pointField based on boundaryField and writes it.
Definition at line 67 of file ShapeSensitivitiesBaseTemplates.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), Foam::dimless, Foam::name(), MeshObject< polyMesh, UpdateableMeshObject, pointMesh >::New(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), regIOobject::write(), and Foam::Zero.
|
protected |
Constructs volField based on boundaryField and writes it.
Definition at line 106 of file ShapeSensitivitiesBaseTemplates.C.
References forAll, Foam::name(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, and GeometricField< Type, PatchField, GeoMesh >::ref().
|
protected |
Write face-based sensitivities, if present.
Definition at line 74 of file ShapeSensitivitiesBase.C.
|
protected |
Write point-based sensitivities, if present.
Definition at line 111 of file ShapeSensitivitiesBase.C.
|
protected |
Clear surface/point fields.
Definition at line 151 of file ShapeSensitivitiesBase.C.
|
protected |
Allocate multiplier fields.
Definition at line 192 of file ShapeSensitivitiesBase.C.
References Foam::dimLength, Foam::dimTime, objective::hasDivDxDbMult(), objective::hasdndbMult(), objective::hasdSdbMult(), objective::hasdxdbDirectMult(), IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, Foam::pow3(), Foam::sqr(), and Foam::Zero.
|
protected |
Clear multipliers.
Definition at line 231 of file ShapeSensitivitiesBase.C.
References field(), and Foam::Zero.
TypeName | ( | "ShapeSensitivitiesBase" | ) |
Runtime type information.
|
virtual |
Read dict if changed.
Reimplemented from adjointSensitivity.
Reimplemented in sensitivitySurfacePoints, and sensitivityShapeESI.
Definition at line 307 of file ShapeSensitivitiesBase.C.
References dict, adjointSensitivity::readDict(), and keyType::REGEX_RECURSIVE.
Referenced by sensitivityShapeESI::readDict().
|
inline |
Get patch IDs on which sensitivities are computed.
Definition at line 262 of file ShapeSensitivitiesBase.H.
References ShapeSensitivitiesBase::sensitivityPatchIDs_.
|
inline |
Overwrite sensitivityPatchIDs.
Definition at line 270 of file ShapeSensitivitiesBase.H.
References ShapeSensitivitiesBase::sensitivityPatchIDs_.
|
virtual |
Return set of patches on which to compute direct sensitivities.
Reimplemented in sensitivitySurfacePoints.
Definition at line 340 of file ShapeSensitivitiesBase.C.
Referenced by ShapeSensitivitiesBase::allocateEikonalSolver(), sensitivityShapeESI::computeDxDbMult(), and adjointMeshMovementSolver::meshMovementSensitivities().
|
virtual |
Accumulate sensitivity integrands.
Common function for the FI and E-SI approaches
Implements adjointSensitivity.
Definition at line 346 of file ShapeSensitivitiesBase.C.
|
virtual |
Zero sensitivity fields and their constituents.
Reimplemented from adjointSensitivity.
Definition at line 380 of file ShapeSensitivitiesBase.C.
References adjointSensitivity::clearSensitivities().
|
virtual |
Write sensitivity fields.
If valid, copies boundaryFields to volFields and writes them.
Reimplemented from adjointSensitivity.
Reimplemented in sensitivitySurfacePoints.
Definition at line 388 of file ShapeSensitivitiesBase.C.
References adjointSensitivity::write().
Referenced by sensitivitySurfacePoints::write().
Foam::tmp< Foam::volVectorField > getWallFaceSensVec | ( | ) |
Get wall face sensitivity vectors field.
Definition at line 397 of file ShapeSensitivitiesBase.C.
References Foam::dimless, Foam::endl(), and WarningInFunction.
Foam::tmp< Foam::volScalarField > getWallFaceSensNormal | ( | ) |
Get wall face sensitivity projected to normal field.
Definition at line 428 of file ShapeSensitivitiesBase.C.
References Foam::dimless, Foam::endl(), and WarningInFunction.
Foam::tmp< Foam::volVectorField > getWallFaceSensNormalVec | ( | ) |
Get wall face normal sens as vectors field.
Definition at line 458 of file ShapeSensitivitiesBase.C.
References Foam::dimless, Foam::endl(), and WarningInFunction.
Foam::tmp< Foam::pointVectorField > getWallPointSensVec | ( | ) |
Get wall point sensitivity vectors field.
Definition at line 490 of file ShapeSensitivitiesBase.C.
References volPointInterpolation::interpolate().
Foam::tmp< Foam::pointScalarField > getWallPointSensNormal | ( | ) |
Get wall point sensitivity projected to normal field.
Definition at line 500 of file ShapeSensitivitiesBase.C.
References volPointInterpolation::interpolate().
Foam::tmp< Foam::pointVectorField > getWallPointSensNormalVec | ( | ) |
Get wall point sens as vectors field.
Definition at line 510 of file ShapeSensitivitiesBase.C.
References volPointInterpolation::interpolate().
|
virtual |
Get wall face sensitivity vectors field.
Definition at line 520 of file ShapeSensitivitiesBase.C.
|
virtual |
Get wall face sensitivity projected to normal field.
Definition at line 527 of file ShapeSensitivitiesBase.C.
|
virtual |
Get wall face normal sens as vectors field.
Definition at line 534 of file ShapeSensitivitiesBase.C.
|
protected |
Patches on which to compute shape sensitivities.
Definition at line 87 of file ShapeSensitivitiesBase.H.
Referenced by sensitivitySurfacePoints::computePointDerivativesSize(), ShapeSensitivitiesBase::sensitivityPatchIDs(), ShapeSensitivitiesBase::setSensitivityPatchIDs(), sensitivitySurface::smoothSensitivities(), and sensitivitySurfacePoints::write().
|
protected |
Whether to write all surface sensitivity fields.
Definition at line 92 of file ShapeSensitivitiesBase.H.
|
protected |
Wall face sens w.r.t. (x,y.z)
Definition at line 103 of file ShapeSensitivitiesBase.H.
Referenced by sensitivitySurface::smoothSensitivities().
|
protected |
Wall face sens projected to normal.
Definition at line 108 of file ShapeSensitivitiesBase.H.
|
protected |
Normal sens as vectors.
Definition at line 113 of file ShapeSensitivitiesBase.H.
|
protected |
Wall point sens w.r.t. (x,y.z)
Definition at line 121 of file ShapeSensitivitiesBase.H.
Referenced by sensitivitySurfacePoints::finalisePointSensitivities().
|
protected |
Wall point sens projected to normal.
Definition at line 126 of file ShapeSensitivitiesBase.H.
|
protected |
Normal sens as vectors.
Definition at line 131 of file ShapeSensitivitiesBase.H.