Calculation of adjoint based sensitivities at wall faces. More...
Public Member Functions | |
TypeName ("surface") | |
Runtime type information. More... | |
sensitivitySurface (const fvMesh &mesh, const dictionary &dict, incompressibleAdjointSolver &adjointSolver) | |
Construct from components. More... | |
virtual | ~sensitivitySurface ()=default |
Destructor. More... | |
void | read () |
Read controls and update solver pointers if necessary. More... | |
virtual bool | readDict (const dictionary &dict) |
Read dict if changed. More... | |
void | computeDerivativesSize () |
Compute the number of faces on sensitivityPatchIDs_. 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... | |
autoPtr< adjointEikonalSolver > & | getAdjointEikonalSolver () |
Get adjoint eikonal solver. More... | |
virtual void | write (const word &baseName=word::null) |
Write sensitivity maps. More... | |
bool | getIncludeObjective () const |
Get access to the includeObjective bool. More... | |
bool | getIncludeSurfaceArea () const |
Get access to the includeSurfaceArea bool. More... | |
void | setIncludeObjective (const bool includeObjective) |
Set includeObjective bool. More... | |
void | setIncludeSurfaceArea (const bool includeSurfaceArea) |
Set includeSurfaceArea bool. 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 | addGeometricSens () |
void | setSuffixName () |
Set suffix name for sensitivity fields. More... | |
void | smoothSensitivities () |
scalar | computeRadius (const faMesh &aMesh) |
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 faces.
Reference:
The computation of the sensitivity derivatives follows the (E-)SI formulation of Kavvadias, I. S., Papoutsis-Kiachagias, E. M., Giannakoglou, K. C. (2015). On the proper treatment of grid sensitivities in continuous adjoint methods for shape optimization. Journal of computational physics, 301, 1-18. https://doi.org/10.1016/j.jcp.2015.08.012 whereas their smoothing based on the computation of the 'Sobolev gradient' is derived from Vassberg J. C., Jameson A. (2006). Aerodynamic Shape Optimization Part I: Theoretical Background. VKI Lecture Series, Introduction to Optimization and Multidisciplinary Design, Brussels, Belgium, 8 March, 2006.
Definition at line 81 of file sensitivitySurfaceIncompressible.H.
sensitivitySurface | ( | const fvMesh & | mesh, |
const dictionary & | dict, | ||
incompressibleAdjointSolver & | adjointSolver | ||
) |
Construct from components.
Definition at line 405 of file sensitivitySurfaceIncompressible.C.
References IOobject::AUTO_WRITE, sensitivitySurface::CfOnPatchPtr_, sensitivitySurface::computeDerivativesSize(), mesh, sensitivity::mesh_, sensitivitySurface::nfOnPatchPtr_, IOobject::NO_READ, sensitivitySurface::read(), sensitivitySurface::setSuffixName(), sensitivitySurface::SfOnPatchPtr_, fvMesh::time(), Time::timeName(), and sensitivitySurface::writeGeometricInfo_.
|
virtualdefault |
Destructor.
|
protected |
Add sensitivities from dSd/db and dnf/db computed at points and mapped to faces
Definition at line 62 of file sensitivitySurfaceIncompressible.C.
References fvMesh::boundary(), polyMesh::boundaryMesh(), polyMesh::faces(), forAll, objectiveManager::getObjectiveFunctions(), Tensor< scalar >::I, sensitivitySurface::includeObjective_, deltaBoundary::makeFaceCentresAndAreas_d(), sensitivity::mesh_, primitiveMesh::nPoints(), adjointSensitivity::objectiveManager_, p, polyMesh::points(), face::points(), PrimitivePatchInterpolation< Patch >::pointToFaceInterpolate(), UList< T >::size(), syncTools::syncPointList(), and Foam::Zero.
Referenced by sensitivitySurface::accumulateIntegrand().
|
protected |
Set suffix name for sensitivity fields.
Definition at line 200 of file sensitivitySurfaceIncompressible.C.
References adjointSensitivity::adjointVars_, sensitivity::dict(), sensitivitySurface::includeMeshMovement_, shapeSensitivitiesBase::setSuffix(), and variablesSet::solverName().
Referenced by sensitivitySurface::sensitivitySurface(), and sensitivitySurface::write().
|
protected |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'
Definition at line 221 of file sensitivitySurfaceIncompressible.C.
References dictionary::add(), aMesh(), fvMesh::boundary(), GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), TimePaths::caseSystem(), sensitivitySurface::computeRadius(), polyMesh::dbDir(), DebugInfo, sensitivity::dict(), Foam::dimArea, Foam::dimless, Foam::endl(), Time::findInstance(), Foam::gMax(), Foam::Info, iters(), Foam::fam::laplacian(), Foam::mag(), volSurfaceMapping::mapToSurface(), volSurfaceMapping::mapToVolume(), sensitivity::mesh_, faMesh::meshSubDir, IOobject::MUST_READ, Foam::nl, IOobject::NO_READ, IOobject::NO_WRITE, patchID, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), Time::printExecutionTime(), IOobject::READ_IF_PRESENT, autoPtr< T >::ref(), faMatrix< Type >::relax(), autoPtr< T >::reset(), faMatrix< Type >::solve(), Foam::fam::Sp(), Foam::sqr(), Foam::sqrt(), dictionary::subDictOrAdd(), fvMesh::time(), Time::timeName(), IOobject::typeHeaderOk(), vsm(), regIOobject::write(), and Foam::Zero.
Referenced by sensitivitySurface::assembleSensitivities().
|
protected |
Compute the physical smoothing radius based on the average boundary face 'length'
Definition at line 385 of file sensitivitySurfaceIncompressible.C.
References aMesh(), polyMesh::bounds(), sensitivity::dict(), DimensionedField< Type, GeoMesh >::field(), forAll, Foam::gAverage(), polyMesh::geometricD(), dictionary::getOrDefault(), sensitivity::mesh_, polyMesh::nGeometricD(), Foam::pow(), faMesh::S(), and boundBox::span().
Referenced by sensitivitySurface::smoothSensitivities().
TypeName | ( | "surface" | ) |
Runtime type information.
void read | ( | ) |
Read controls and update solver pointers if necessary.
Definition at line 502 of file sensitivitySurfaceIncompressible.C.
References incompressibleAdjointVars::adjointTurbulence(), adjointSensitivity::adjointVars_, sensitivity::dict(), sensitivity::dict_, sensitivitySurface::eikonalSolver_, dictionary::getOrDefault(), sensitivitySurface::includeDistance_, sensitivitySurface::includeDivTerm_, sensitivitySurface::includeGradStressTerm_, sensitivitySurface::includeMeshMovement_, sensitivitySurface::includeObjective_, sensitivitySurface::includePressureTerm_, sensitivitySurface::includeSurfaceArea_, sensitivitySurface::includeTransposeStresses_, sensitivity::mesh_, sensitivitySurface::meshMovementSolver_, adjointSensitivity::primalVars_, incompressibleVars::RASModelVariables(), sensitivitySurface::smoothSensitivities_, sensitivitySurface::useSnGradInTranposeStresses_, and sensitivitySurface::writeGeometricInfo_.
Referenced by SIBase::read(), and sensitivitySurface::sensitivitySurface().
|
virtual |
Read dict if changed.
Reimplemented from sensitivity.
Definition at line 562 of file sensitivitySurfaceIncompressible.C.
References sensitivity::dict(), sensitivitySurface::eikonalSolver_, and sensitivitySurface::meshMovementSolver_.
Referenced by SIBase::readDict().
|
virtual |
Compute the number of faces on sensitivityPatchIDs_.
Reimplemented from sensitivity.
Definition at line 583 of file sensitivitySurfaceIncompressible.C.
References fvMesh::boundary(), adjointSensitivity::derivatives_, sensitivity::mesh_, nFaces(), List< T >::setSize(), and UPtrList< T >::size().
Referenced by sensitivitySurface::sensitivitySurface().
|
virtual |
Accumulate sensitivity integrands.
Implements adjointSensitivity.
Definition at line 594 of file sensitivitySurfaceIncompressible.C.
References sensitivitySurface::addGeometricSens(), 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, sensitivitySurface::eikonalSolver_, Foam::endl(), forAll, objectiveManager::getObjectiveFunctions(), Foam::fvc::grad(), sensitivitySurface::includeDistance_, sensitivitySurface::includeDivTerm_, sensitivitySurface::includeGradStressTerm_, sensitivitySurface::includeMeshMovement_, sensitivitySurface::includeObjective_, sensitivitySurface::includePressureTerm_, sensitivitySurface::includeTransposeStresses_, sensitivity::mesh_, sensitivitySurface::meshMovementSolver_, Time::New(), adjointSensitivity::objectiveManager_, p, incompressibleVars::p(), incompressibleAdjointMeanFlowVars::pa(), adjointSensitivity::primalVars_, autoPtr< T >::ref(), tmp< T >::ref(), UList< T >::size(), Foam::sqr(), Foam::twoSymm(), U, incompressibleVars::U(), incompressibleAdjointMeanFlowVars::Ua(), Foam::unzipRow(), sensitivitySurface::useSnGradInTranposeStresses_, and Foam::Zero.
Referenced by SIBase::accumulateIntegrand().
|
virtual |
Assemble sensitivities.
Implements adjointSensitivity.
Definition at line 810 of file sensitivitySurfaceIncompressible.C.
References fvMesh::boundary(), sensitivitySurface::CfOnPatchPtr_, adjointSensitivity::derivatives_, sensitivitySurface::eikonalSolver_, forAll, sensitivitySurface::includeDistance_, sensitivitySurface::includeMeshMovement_, sensitivitySurface::includeSurfaceArea_, sensitivity::mesh_, sensitivitySurface::meshMovementSolver_, sensitivitySurface::nfOnPatchPtr_, autoPtr< T >::reset(), sensitivitySurface::SfOnPatchPtr_, sensitivitySurface::smoothSensitivities(), sensitivitySurface::smoothSensitivities_, and sensitivitySurface::writeGeometricInfo_.
Referenced by sensitivityBezier::assembleSensitivities(), and sensitivityVolBSplines::assembleSensitivities().
|
virtual |
Zero sensitivity fields and their constituents.
Reimplemented from adjointSensitivity.
Definition at line 903 of file sensitivitySurfaceIncompressible.C.
References adjointSensitivity::clearSensitivities(), shapeSensitivitiesBase::clearSensitivities(), sensitivitySurface::eikonalSolver_, sensitivitySurface::includeDistance_, sensitivitySurface::includeMeshMovement_, and sensitivitySurface::meshMovementSolver_.
Referenced by SIBase::clearSensitivities().
autoPtr< adjointEikonalSolver > & getAdjointEikonalSolver | ( | ) |
Get adjoint eikonal solver.
Definition at line 920 of file sensitivitySurfaceIncompressible.C.
References sensitivitySurface::eikonalSolver_.
|
virtual |
Write sensitivity maps.
Reimplemented from adjointSensitivity.
Definition at line 926 of file sensitivitySurfaceIncompressible.C.
References sensitivitySurface::CfOnPatchPtr_, sensitivitySurface::nfOnPatchPtr_, sensitivitySurface::setSuffixName(), sensitivitySurface::SfOnPatchPtr_, ObukhovLength::write(), shapeSensitivitiesBase::write(), and sensitivitySurface::writeGeometricInfo_.
Referenced by SIBase::write().
|
inline |
Get access to the includeObjective bool.
Definition at line 38 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeObjective_.
Referenced by SIBase::read().
|
inline |
Get access to the includeSurfaceArea bool.
Definition at line 44 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeSurfaceArea_.
|
inline |
Set includeObjective bool.
Definition at line 50 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeObjective_.
Referenced by SIBase::read().
|
inline |
Set includeSurfaceArea bool.
Definition at line 59 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeSurfaceArea_.
Referenced by SIBase::read().
|
protected |
Include surface area in sens computation.
Definition at line 92 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::getIncludeSurfaceArea(), sensitivitySurface::read(), and sensitivitySurface::setIncludeSurfaceArea().
|
protected |
Include the adjoint pressure term in sens computation.
Definition at line 95 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include the term containing the grad of the stress at the boundary.
Definition at line 98 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include the transpose part of the adjoint stresses.
Definition at line 101 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Use snGrad in the transpose part of the adjoint stresses.
Definition at line 104 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include the term from the deviatoric part of the stresses.
Definition at line 107 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include distance variation in sens computation.
Definition at line 110 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), and sensitivitySurface::read().
|
protected |
Include mesh movement variation in sens computation.
Definition at line 113 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), sensitivitySurface::read(), and sensitivitySurface::setSuffixName().
|
protected |
Include terms directly emerging from the objective function.
Definition at line 116 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::addGeometricSens(), sensitivitySurface::getIncludeObjective(), sensitivitySurface::read(), and sensitivitySurface::setIncludeObjective().
|
protected |
Write geometric info for use by external programs.
Definition at line 119 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::read(), sensitivitySurface::sensitivitySurface(), and sensitivitySurface::write().
|
protected |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'
Definition at line 123 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), and sensitivitySurface::read().
|
protected |
Definition at line 125 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), sensitivitySurface::getAdjointEikonalSolver(), sensitivitySurface::read(), and sensitivitySurface::readDict().
|
protected |
Definition at line 127 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), sensitivitySurface::read(), and sensitivitySurface::readDict().
|
protected |
Definition at line 130 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::sensitivitySurface(), and sensitivitySurface::write().
|
protected |
Definition at line 131 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::sensitivitySurface(), and sensitivitySurface::write().
|
protected |
Definition at line 132 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::sensitivitySurface(), and sensitivitySurface::write().