Calculation of adjoint based sensitivities at wall points. More...
Public Member Functions | |
TypeName ("surfacePoints") | |
Runtime type information. More... | |
sensitivitySurfacePoints (const fvMesh &mesh, const dictionary &dict, incompressibleAdjointSolver &adjointSolver) | |
Construct from components. More... | |
virtual | ~sensitivitySurfacePoints ()=default |
Destructor. More... | |
virtual bool | readDict (const dictionary &dict) |
Read dict if changed. More... | |
virtual void | accumulateIntegrand (const scalar dt) |
Accumulate sensitivity integrands. More... | |
virtual void | assembleSensitivities () |
Assemble sensitivities. More... | |
virtual void | clearSensitivities () |
Zero sensitivity fields and their constituents. More... | |
virtual void | write (const word &baseName=word::null) |
Write sensitivity fields. More... | |
Public Member Functions inherited from adjointSensitivity | |
TypeName ("adjointSensitivity") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, adjointSensitivity, dictionary,(const fvMesh &mesh, const dictionary &dict, incompressibleAdjointSolver &adjointSolver),(mesh, dict, adjointSolver)) | |
adjointSensitivity (const fvMesh &mesh, const dictionary &dict, incompressibleAdjointSolver &adjointSolver) | |
Construct from components. More... | |
virtual | ~adjointSensitivity ()=default |
Destructor. More... | |
const incompressibleVars & | primalVars () const |
Get primal variables. More... | |
const incompressibleAdjointVars & | adjointVars () const |
Get adjoint variables. More... | |
const incompressibleAdjointSolver & | adjointSolver () const |
Get adjoint solver. More... | |
virtual void | accumulateIntegrand (const scalar dt)=0 |
Accumulate sensitivity integrands. More... | |
virtual void | assembleSensitivities ()=0 |
Assemble sensitivities. More... | |
virtual const scalarField & | calculateSensitivities () |
Calculates and returns sensitivity fields. More... | |
const scalarField & | getSensitivities () const |
Returns the sensitivity fields. More... | |
virtual void | clearSensitivities () |
Zero sensitivity fields and their constituents. More... | |
virtual void | write (const word &baseName=word::null) |
Write sensitivity fields. More... | |
tmp< volTensorField > | computeGradDxDbMultiplier () |
tmp< volVectorField > | adjointMeshMovementSource () |
Compute source term for adjoint mesh movement equation. More... | |
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 dictionary & | dict () const |
Return the construction dictionary. More... | |
virtual bool | readDict (const dictionary &dict) |
Read dictionary if changed. More... | |
virtual void | computeDerivativesSize () |
Compute design variables number. Does nothing in the base. More... | |
virtual const scalarField & | calculateSensitivities ()=0 |
Calculates and returns sensitivity fields. More... | |
virtual void | write (const word &baseName=word::null) |
Write sensitivity fields. More... | |
Protected Member Functions | |
void | read () |
Read controls and update solver pointers if necessary. More... | |
void | finaliseFaceMultiplier () |
void | finalisePointSensitivities () |
void | constructGlobalPointNormalsAndAreas (vectorField &pointNormals, scalarField &pointMagSf) |
Construct globally correct point normals and point areas. More... | |
void | setSuffixName () |
Set suffix name for sensitivity fields. More... | |
Protected Attributes | |
bool | includeSurfaceArea_ |
Include surface area in sens computation. More... | |
bool | includePressureTerm_ |
Include the adjoint pressure term in sens computation. More... | |
bool | includeGradStressTerm_ |
Include the term containing the grad of the stress at the boundary. More... | |
bool | includeTransposeStresses_ |
Include the transpose part of the adjoint stresses. More... | |
bool | useSnGradInTranposeStresses_ |
Use snGrad in the transpose part of the adjoint stresses. More... | |
bool | includeDivTerm_ |
Include the term from the deviatoric part of the stresses. More... | |
bool | includeDistance_ |
Include distance variation in sens computation. More... | |
bool | includeMeshMovement_ |
Include mesh movement variation in sens computation. More... | |
bool | includeObjective_ |
Include terms directly emerging from the objective function. More... | |
autoPtr< adjointEikonalSolver > | eikonalSolver_ |
autoPtr< adjointMeshMovementSolver > | meshMovementSolver_ |
autoPtr< boundaryVectorField > | wallFaceSens_ |
The face-based part of the sensitivities. More... | |
autoPtr< boundaryVectorField > | dSfdbMult_ |
Multipliers of d(Sf)/db and d(nf)/db. More... | |
autoPtr< boundaryVectorField > | dnfdbMult_ |
Protected Attributes inherited from adjointSensitivity | |
scalarField | derivatives_ |
incompressibleAdjointSolver & | adjointSolver_ |
const incompressibleVars & | primalVars_ |
incompressibleAdjointVars & | adjointVars_ |
objectiveManager & | objectiveManager_ |
Protected Attributes inherited from sensitivity | |
const fvMesh & | mesh_ |
dictionary | dict_ |
autoPtr< volScalarField > | fieldSensPtr_ |
Additional Inherited Members | |
Static Public Member Functions inherited from adjointSensitivity | |
static autoPtr< adjointSensitivity > | New (const fvMesh &mesh, const dictionary &dict, incompressibleAdjointSolver &adjointSolver) |
Return a reference to the selected turbulence model. More... | |
Calculation of adjoint based sensitivities at wall points.
Definition at line 59 of file sensitivitySurfacePointsIncompressible.H.
sensitivitySurfacePoints | ( | const fvMesh & | mesh, |
const dictionary & | dict, | ||
incompressibleAdjointSolver & | adjointSolver | ||
) |
Construct from components.
Definition at line 333 of file sensitivitySurfacePointsIncompressible.C.
References polyMesh::boundaryMesh(), adjointSensitivity::derivatives_, sensitivity::mesh_, nPoints, sensitivitySurfacePoints::read(), Foam::returnReduce(), and Foam::Zero.
|
virtualdefault |
Destructor.
|
protected |
Read controls and update solver pointers if necessary.
Definition at line 55 of file sensitivitySurfacePointsIncompressible.C.
References incompressibleAdjointVars::adjointTurbulence(), adjointSensitivity::adjointVars_, sensitivity::dict(), sensitivitySurfacePoints::eikonalSolver_, dictionary::getOrDefault(), sensitivitySurfacePoints::includeDistance_, sensitivitySurfacePoints::includeDivTerm_, sensitivitySurfacePoints::includeGradStressTerm_, sensitivitySurfacePoints::includeMeshMovement_, sensitivitySurfacePoints::includeObjective_, sensitivitySurfacePoints::includePressureTerm_, sensitivitySurfacePoints::includeSurfaceArea_, sensitivitySurfacePoints::includeTransposeStresses_, sensitivity::mesh_, sensitivitySurfacePoints::meshMovementSolver_, adjointSensitivity::primalVars_, incompressibleVars::RASModelVariables(), and sensitivitySurfacePoints::useSnGradInTranposeStresses_.
Referenced by sensitivitySurfacePoints::sensitivitySurfacePoints().
|
protected |
Add terms related to post-processing PDEs (i.e. adjoint Eikonal, adjoint mesh movement) and add local face area
Definition at line 113 of file sensitivitySurfacePointsIncompressible.C.
References fvMesh::boundary(), sensitivitySurfacePoints::dnfdbMult_, sensitivitySurfacePoints::eikonalSolver_, sensitivitySurfacePoints::includeDistance_, sensitivitySurfacePoints::includeMeshMovement_, sensitivity::mesh_, sensitivitySurfacePoints::meshMovementSolver_, autoPtr< T >::reset(), and sensitivitySurfacePoints::wallFaceSens_.
Referenced by sensitivitySurfacePoints::assembleSensitivities().
|
protected |
Converts face sensitivities to point sensitivities and adds the ones directly computed in points (i.e. dSf/db and dnf/db).
Definition at line 174 of file sensitivitySurfacePointsIncompressible.C.
References fvMesh::boundary(), sensitivitySurfacePoints::dnfdbMult_, sensitivitySurfacePoints::dSfdbMult_, polyMesh::faces(), forAll, Tensor< scalar >::I, sensitivitySurfacePoints::includeObjective_, deltaBoundary::makeFaceCentresAndAreas_d(), sensitivity::mesh_, p, polyMesh::points(), face::points(), UList< T >::size(), sensitivitySurfacePoints::wallFaceSens_, and Foam::Zero.
Referenced by sensitivitySurfacePoints::assembleSensitivities().
|
protected |
Construct globally correct point normals and point areas.
Definition at line 259 of file sensitivitySurfacePointsIncompressible.C.
References fvMesh::boundary(), forAll, sensitivity::mesh_, and syncTools::syncPointList().
Referenced by sensitivitySurfacePoints::assembleSensitivities().
|
protected |
Set suffix name for sensitivity fields.
Definition at line 310 of file sensitivitySurfacePointsIncompressible.C.
References adjointSensitivity::adjointVars_, sensitivity::dict(), sensitivitySurfacePoints::includeMeshMovement_, shapeSensitivitiesBase::setSuffix(), and variablesSet::solverName().
Referenced by sensitivitySurfacePoints::write().
TypeName | ( | "surfacePoints" | ) |
Runtime type information.
|
virtual |
Read dict if changed.
Reimplemented from sensitivity.
Definition at line 386 of file sensitivitySurfacePointsIncompressible.C.
References sensitivity::dict(), sensitivitySurfacePoints::eikonalSolver_, and sensitivitySurfacePoints::meshMovementSolver_.
|
virtual |
Accumulate sensitivity integrands.
Implements adjointSensitivity.
Definition at line 407 of file sensitivitySurfacePointsIncompressible.C.
References incompressibleAdjointSolver::additionalSensitivityMapTerms(), adjointSensitivity::adjointSolver_, incompressibleAdjointVars::adjointTurbulence(), adjointSensitivity::adjointVars_, fvMesh::boundary(), GeometricField< Type, PatchField, GeoMesh >::boundaryField(), tmp< T >::clear(), Field< Type >::component(), tmp< T >::cref(), DebugInfo, Foam::dimVelocity, sensitivitySurfacePoints::dnfdbMult_, sensitivitySurfacePoints::dSfdbMult_, sensitivitySurfacePoints::eikonalSolver_, Foam::endl(), forAll, objectiveManager::getObjectiveFunctions(), Foam::fvc::grad(), sensitivitySurfacePoints::includeDistance_, sensitivitySurfacePoints::includeDivTerm_, sensitivitySurfacePoints::includeGradStressTerm_, sensitivitySurfacePoints::includeMeshMovement_, sensitivitySurfacePoints::includeObjective_, sensitivitySurfacePoints::includePressureTerm_, sensitivitySurfacePoints::includeTransposeStresses_, sensitivity::mesh_, sensitivitySurfacePoints::meshMovementSolver_, Time::New(), adjointSensitivity::objectiveManager_, p, incompressibleVars::p(), incompressibleAdjointMeanFlowVars::pa(), adjointSensitivity::primalVars_, autoPtr< T >::ref(), tmp< T >::ref(), Foam::sqr(), Foam::twoSymm(), U, incompressibleVars::U(), incompressibleAdjointMeanFlowVars::Ua(), Foam::unzipRow(), sensitivitySurfacePoints::useSnGradInTranposeStresses_, sensitivitySurfacePoints::wallFaceSens_, and Foam::Zero.
|
virtual |
Assemble sensitivities.
Implements adjointSensitivity.
Definition at line 620 of file sensitivitySurfacePointsIncompressible.C.
References Pstream::allGatherList(), polyMesh::boundaryMesh(), sensitivitySurfacePoints::constructGlobalPointNormalsAndAreas(), adjointSensitivity::derivatives_, sensitivitySurfacePoints::finaliseFaceMultiplier(), sensitivitySurfacePoints::finalisePointSensitivities(), forAll, sensitivitySurfacePoints::includeSurfaceArea_, Foam::mag(), sensitivity::mesh_, processorFaPatch::myProcNo(), primitiveMesh::nPoints(), PstreamBuffers::nProcs(), List< T >::setSize(), UList< T >::size(), syncTools::syncPointList(), and Foam::Zero.
|
virtual |
Zero sensitivity fields and their constituents.
Reimplemented from adjointSensitivity.
Definition at line 737 of file sensitivitySurfacePointsIncompressible.C.
References adjointSensitivity::clearSensitivities(), shapeSensitivitiesBase::clearSensitivities(), sensitivitySurfacePoints::dnfdbMult_, sensitivitySurfacePoints::dSfdbMult_, sensitivitySurfacePoints::eikonalSolver_, sensitivitySurfacePoints::includeDistance_, sensitivitySurfacePoints::includeMeshMovement_, sensitivitySurfacePoints::meshMovementSolver_, and sensitivitySurfacePoints::wallFaceSens_.
|
virtual |
Write sensitivity fields.
If valid, copies boundaryFields to volFields and writes them. Virtual to be reimplemented by control points-based methods (Bezier, RBF) which do not need to write fields
Reimplemented from adjointSensitivity.
Definition at line 760 of file sensitivitySurfacePointsIncompressible.C.
References sensitivitySurfacePoints::setSuffixName(), ObukhovLength::write(), and shapeSensitivitiesBase::write().
|
protected |
Include surface area in sens computation.
Definition at line 70 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::assembleSensitivities(), and sensitivitySurfacePoints::read().
|
protected |
Include the adjoint pressure term in sens computation.
Definition at line 73 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), and sensitivitySurfacePoints::read().
|
protected |
Include the term containing the grad of the stress at the boundary.
Definition at line 76 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), and sensitivitySurfacePoints::read().
|
protected |
Include the transpose part of the adjoint stresses.
Definition at line 79 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), and sensitivitySurfacePoints::read().
|
protected |
Use snGrad in the transpose part of the adjoint stresses.
Definition at line 82 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), and sensitivitySurfacePoints::read().
|
protected |
Include the term from the deviatoric part of the stresses.
Definition at line 85 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), and sensitivitySurfacePoints::read().
|
protected |
Include distance variation in sens computation.
Definition at line 88 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), sensitivitySurfacePoints::finaliseFaceMultiplier(), and sensitivitySurfacePoints::read().
|
protected |
Include mesh movement variation in sens computation.
Definition at line 91 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), sensitivitySurfacePoints::finaliseFaceMultiplier(), sensitivitySurfacePoints::read(), and sensitivitySurfacePoints::setSuffixName().
|
protected |
Include terms directly emerging from the objective function.
Definition at line 94 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::finalisePointSensitivities(), and sensitivitySurfacePoints::read().
|
protected |
Definition at line 96 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), sensitivitySurfacePoints::finaliseFaceMultiplier(), sensitivitySurfacePoints::read(), and sensitivitySurfacePoints::readDict().
|
protected |
Definition at line 98 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), sensitivitySurfacePoints::finaliseFaceMultiplier(), sensitivitySurfacePoints::read(), and sensitivitySurfacePoints::readDict().
|
protected |
The face-based part of the sensitivities.
i.e. terms that multiply dxFace/dxPoint. Sensitivities DO include locale surface area, to get the correct weighting from the contributions of various faces. Normalized at the end.
Definition at line 105 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), sensitivitySurfacePoints::finaliseFaceMultiplier(), and sensitivitySurfacePoints::finalisePointSensitivities().
|
protected |
Multipliers of d(Sf)/db and d(nf)/db.
Definition at line 108 of file sensitivitySurfacePointsIncompressible.H.
Referenced by sensitivitySurfacePoints::accumulateIntegrand(), sensitivitySurfacePoints::clearSensitivities(), and sensitivitySurfacePoints::finalisePointSensitivities().
|
protected |