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 const scalarField & | calculateSensitivities () |
Calculates and returns sensitivity fields. More... | |
const scalarField & | getSensitivities () const |
Returns the sensitivity fields. More... | |
tmp< volTensorField > | computeGradDxDbMultiplier () |
Compute the volTensorField multiplying grad(dxdb) for the volume-based approach to compute shape sensitivity derivatives. More... | |
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... | |
Protected Member Functions | |
void | addGeometricSens () |
Add sensitivities from dSd/db and dnf/db computed at points and mapped to faces. More... | |
void | setSuffixName () |
Set suffix name for sensitivity fields. More... | |
void | smoothSensitivities () |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'. More... | |
scalar | computeRadius (const faMesh &aMesh) |
Compute the physical smoothing radius based on the average boundary face 'length'. 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... | |
bool | writeGeometricInfo_ |
Write geometric info for use by external programs. More... | |
bool | smoothSensitivities_ |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'. More... | |
autoPtr< adjointEikonalSolver > | eikonalSolver_ |
autoPtr< adjointMeshMovementSolver > | meshMovementSolver_ |
autoPtr< volVectorField > | nfOnPatchPtr_ |
autoPtr< volVectorField > | SfOnPatchPtr_ |
autoPtr< volVectorField > | CfOnPatchPtr_ |
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 faces.
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 77 of file sensitivitySurfaceIncompressible.H.
sensitivitySurface | ( | const fvMesh & | mesh, |
const dictionary & | dict, | ||
incompressibleAdjointSolver & | adjointSolver | ||
) |
Construct from components.
Definition at line 399 of file sensitivitySurfaceIncompressible.C.
References IOobjectOption::AUTO_WRITE, mesh, IOobjectOption::NO_READ, and Foam::read().
|
virtualdefault |
Destructor.
|
protected |
Add sensitivities from dSd/db and dnf/db computed at points and mapped to faces.
Definition at line 55 of file sensitivitySurfaceIncompressible.C.
References fvMesh::boundary(), polyMesh::boundaryMesh(), polyMesh::faces(), forAll, objectiveManager::getObjectiveFunctions(), Foam::I, sensitivitySurface::includeObjective_, deltaBoundary::makeFaceCentresAndAreas_d(), sensitivity::mesh_, primitiveMesh::nPoints(), adjointSensitivity::objectiveManager_, p, Foam::foamVersion::patch, face::points(), polyMesh::points(), UList< T >::size(), syncTools::syncPointList(), and Foam::Zero.
Referenced by sensitivitySurface::accumulateIntegrand().
|
protected |
Set suffix name for sensitivity fields.
Definition at line 193 of file sensitivitySurfaceIncompressible.C.
References adjointSensitivity::adjointVars_, sensitivity::dict(), sensitivitySurface::includeMeshMovement_, word::null, shapeSensitivitiesBase::setSuffix(), and variablesSet::solverName().
Referenced by sensitivitySurface::write().
|
protected |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'.
Definition at line 214 of file sensitivitySurfaceIncompressible.C.
References dictionary::add(), aMesh(), fvMesh::boundary(), TimePaths::caseSystem(), sensitivitySurface::computeRadius(), polyMesh::dbDir(), DebugInfo, sensitivity::dict(), Foam::dimArea, Foam::dimless, Foam::constant::electromagnetic::e, Foam::endl(), faceLabels(), Time::findInstance(), Foam::gMax(), Foam::Info, iters(), Foam::fam::laplacian(), Foam::mag(), sensitivity::mesh_, faMesh::meshSubDir, IOobjectOption::MUST_READ, Foam::nl, IOobjectOption::NO_READ, IOobjectOption::NO_WRITE, patchID, GeometricField< Type, PatchField, GeoMesh >::primitiveFieldRef(), Time::printExecutionTime(), IOobjectOption::READ_IF_PRESENT, autoPtr< T >::ref(), autoPtr< T >::reset(), Foam::fam::Sp(), Foam::sqr(), Foam::sqrt(), dictionary::subDictOrAdd(), fvMesh::time(), Time::timeName(), vsm(), Foam::Zero, and faPatchFieldBase::zeroGradientType().
Referenced by sensitivitySurface::assembleSensitivities().
|
protected |
Compute the physical smoothing radius based on the average boundary face 'length'.
Definition at line 378 of file sensitivitySurfaceIncompressible.C.
References aMesh(), polyMesh::bounds(), sensitivity::dict(), forAll, Foam::gAverage(), polyMesh::geometricD(), dictionary::getOrDefault(), sensitivity::mesh_, polyMesh::nGeometricD(), Foam::pow(), 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 495 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().
|
virtual |
Read dict if changed.
Reimplemented from sensitivity.
Definition at line 555 of file sensitivitySurfaceIncompressible.C.
References sensitivity::dict(), sensitivitySurface::eikonalSolver_, sensitivitySurface::meshMovementSolver_, and sensitivity::readDict().
Referenced by SIBase::readDict().
|
virtual |
Compute the number of faces on sensitivityPatchIDs_.
Reimplemented from sensitivity.
Definition at line 576 of file sensitivitySurfaceIncompressible.C.
References fvMesh::boundary(), adjointSensitivity::derivatives_, sensitivity::mesh_, List< T >::setSize(), and UPtrList< T >::size().
|
virtual |
Accumulate sensitivity integrands.
Implements adjointSensitivity.
Definition at line 587 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_, GeometricField< tensor, fvPatchField, volMesh >::New(), adjointSensitivity::objectiveManager_, p, incompressibleVars::p(), incompressibleAdjointMeanFlowVars::pa(), Foam::foamVersion::patch, adjointSensitivity::primalVars_, autoPtr< T >::ref(), tmp< T >::ref(), 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 803 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_, Foam::foamVersion::patch, 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 896 of file sensitivitySurfaceIncompressible.C.
References shapeSensitivitiesBase::clearSensitivities(), adjointSensitivity::clearSensitivities(), sensitivitySurface::eikonalSolver_, sensitivitySurface::includeDistance_, sensitivitySurface::includeMeshMovement_, and sensitivitySurface::meshMovementSolver_.
Referenced by SIBase::clearSensitivities().
autoPtr< adjointEikonalSolver > & getAdjointEikonalSolver | ( | ) |
Get adjoint eikonal solver.
Definition at line 913 of file sensitivitySurfaceIncompressible.C.
References sensitivitySurface::eikonalSolver_.
|
virtual |
Write sensitivity maps.
Reimplemented from adjointSensitivity.
Definition at line 919 of file sensitivitySurfaceIncompressible.C.
References sensitivitySurface::CfOnPatchPtr_, sensitivitySurface::nfOnPatchPtr_, sensitivitySurface::setSuffixName(), sensitivitySurface::SfOnPatchPtr_, shapeSensitivitiesBase::write(), adjointSensitivity::write(), and sensitivitySurface::writeGeometricInfo_.
Referenced by SIBase::write().
|
inline |
Get access to the includeObjective bool.
Definition at line 31 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeObjective_.
Referenced by SIBase::read().
|
inline |
Get access to the includeSurfaceArea bool.
Definition at line 37 of file sensitivitySurfaceIncompressibleI.H.
References sensitivitySurface::includeSurfaceArea_.
|
inline |
Set includeObjective bool.
Definition at line 44 of file sensitivitySurfaceIncompressibleI.H.
Referenced by SIBase::read().
|
inline |
Set includeSurfaceArea bool.
Definition at line 53 of file sensitivitySurfaceIncompressibleI.H.
Referenced by SIBase::read().
|
protected |
Include surface area in sens computation.
Definition at line 90 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::getIncludeSurfaceArea(), and sensitivitySurface::read().
|
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 100 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include the transpose part of the adjoint stresses.
Definition at line 105 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 110 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 115 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), and sensitivitySurface::read().
|
protected |
Include distance variation in sens computation.
Definition at line 120 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 125 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 130 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::addGeometricSens(), sensitivitySurface::getIncludeObjective(), and sensitivitySurface::read().
|
protected |
Write geometric info for use by external programs.
Definition at line 135 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), sensitivitySurface::read(), and sensitivitySurface::write().
|
protected |
Smooth sensitivity derivatives based on the computation of the 'Sobolev gradient'.
Definition at line 141 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), and sensitivitySurface::read().
|
protected |
Definition at line 143 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), sensitivitySurface::getAdjointEikonalSolver(), sensitivitySurface::read(), and sensitivitySurface::readDict().
|
protected |
Definition at line 145 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::accumulateIntegrand(), sensitivitySurface::assembleSensitivities(), sensitivitySurface::clearSensitivities(), sensitivitySurface::read(), and sensitivitySurface::readDict().
|
protected |
Definition at line 148 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), and sensitivitySurface::write().
|
protected |
Definition at line 149 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), and sensitivitySurface::write().
|
protected |
Definition at line 150 of file sensitivitySurfaceIncompressible.H.
Referenced by sensitivitySurface::assembleSensitivities(), and sensitivitySurface::write().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.