37 namespace incompressible
51 for (
const label patchI : sensitivityPatchIDs_)
56 const scalar wei(func.weight());
57 dSfdbMult_()[patchI] += wei*func.dSdbMultiplier(patchI)*dt;
58 dnfdbMult_()[patchI] += wei*func.dndbMultiplier(patchI)*magSfDt;
60 wei*func.dxdbDirectMultiplier(patchI)*magSfDt;
71 tmp<boundaryVectorField> DvDbMult(
dvdbMult());
74 for (
const label patchI : sensitivityPatchIDs_)
78 if (isA<adjointVectorBoundaryCondition>(Uab))
83 & refCast<adjointVectorBoundaryCondition>(Uab).dxdbMult()
92 tmp<boundaryVectorField>
93 tres(createZeroBoundaryPtr<vector>(meshShape_).ptr());
99 const autoPtr<incompressibleAdjoint::adjointRASModel>& adjointTurbulence =
103 const autoPtr<incompressible::RASModelVariables>&
107 tmp<volTensorField> tgradUa =
fvc::grad(Ua);
110 for (
const label patchI : sensitivityPatchIDs_)
112 const fvPatch&
patch = meshShape_.boundary()[patchI];
113 tmp<vectorField> tnf =
patch.nf();
118 nuEff.boundaryField()[patchI]
120 Ua.boundaryField()[patchI].snGrad()
121 + (gradUabf[patchI] & nf)
124 - (nf*pa.boundaryField()[patchI])
125 + adjointTurbulence().adjointMomentumBCSource()[patchI];
134 shapeSensitivities::shapeSensitivities
autoPtr< boundaryVectorField > dxdbDirectMult_
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
const incompressibleVars & primalVars_
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
defineTypeNameAndDebug(adjointEikonalSolver, 0)
fvPatchField< vector > fvPatchVectorField
virtual void accumulateDirectSensitivityIntegrand(const scalar dt)
Accumulate direct sensitivities.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
PtrList< objective > & getObjectiveFunctions()
Return reference to objective functions.
volVectorField::Boundary boundaryVectorField
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
Base class for adjoint solvers.
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
GeometricBoundaryField< tensor, fvPatchField, volMesh > Boundary
Type of boundary fields.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
GeometricField< vector, fvPatchField, volMesh > volVectorField
objectiveManager & objectiveManager_
Base class for incompressibleAdjoint solvers.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
autoPtr< boundaryVectorField > dnfdbMult_
const volScalarField & pa() const
Return const reference to pressure.
autoPtr< typename GeometricField< Type, fvPatchField, volMesh >::Boundary > createZeroBoundaryPtr(const fvMesh &mesh, bool printAllocation=false)
const singlePhaseTransportModel & laminarTransport() const
Return const reference to transport model.
A class for handling words, derived from Foam::string.
Abstract base class for adjoint-based sensitivities in incompressible flows.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const volVectorField & Ua() const
Return const reference to velocity.
const autoPtr< incompressibleAdjoint::adjointRASModel > & adjointTurbulence() const
Return const reference to the adjointRASModel.
Abstract base class for objective functions. No point in making this runTime selectable since its chi...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
void write()
Write sensitivity fields.
const autoPtr< incompressible::RASModelVariables > & RASModelVariables() const
Return const reference to the turbulence model variables.
void clearSensitivities()
Zero sensitivity fields and their constituents.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
tmp< boundaryVectorField > dvdbMult() const
Compute multiplier of dv_i/db.
Mesh data needed to do the Finite Volume discretisation.
const std::string patch
OpenFOAM patch number as a std::string.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
autoPtr< boundaryVectorField > bcDxDbMult_
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Field< vector > vectorField
Specialisation of Field<T> for vector.
incompressibleAdjointVars & adjointVars_
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
Base class supporting shape sensitivity derivatives for incompressible flows.
virtual void accumulateBCSensitivityIntegrand(const scalar dt)
Accumulate sensitivities enamating from the boundary conditions.