55 auto& resGrad = tresGrad.ref();
80 const word surfFieldName(
"interpolated" +
name +
"ForBoundaryGrad");
82 surfFieldType* surfFieldPtr =
83 mesh.objectRegistry::template getObjectPtr<surfFieldType>(surfFieldName);
92 mesh,
mesh.interpolationScheme(
"interpolate(" +
name +
")")
94 surfFieldPtr->rename(surfFieldName);
99 if (surfFieldPtr->upToDate(
field))
111 mesh,
mesh.interpolationScheme(
"interpolate(" +
name +
")")
113 surfFieldPtr->rename(surfFieldName);
117 surfFieldType& surfField = *surfFieldPtr;
131 for (
const label faceI : cellI)
133 label
patchID =
mesh.boundaryMesh().whichPatch(faceI);
136 const label own = owner[faceI];
152 const label boundaryFaceI = faceI - patchForFlux.
start();
156 *surfField.boundaryField()[
patchID][boundaryFaceI];
160 resGrad[fI] /= V[cI];
166 resGrad = nf*bField.
snGrad() + (resGrad - nf*(nf & resGrad));
175 if (!addATCUaGradUTerm_.good())
191 patch_(adjointBC.patch_),
192 managerName_(adjointBC.managerName_),
193 adjointSolverName_(adjointBC.adjointSolverName_),
194 simulationType_(adjointBC.simulationType_),
199 adjointBC.managerName_,
200 adjointBC.adjointSolverName_,
201 adjointBC.simulationType_,
216 const word& solverName
220 managerName_(
"objectiveManager" + solverName),
221 adjointSolverName_(solverName),
222 simulationType_(
"incompressible"),
223 boundaryContrPtr_(nullptr),
224 addATCUaGradUTerm_(
Switch::INVALID)
264 boundaryContrPtr_.reset
278 <<
"No objectiveManager " << managerName_ <<
" available." <<
nl
279 <<
"Setting boundaryAdjointContributionPtr to nullptr. " <<
nl
280 <<
"OK for decomposePar."
287boundaryAdjointContribution&
298 patch_.boundaryMesh().mesh().template
Base class for selecting the adjoint transpose convection model. Inherits from regIOobject to add loo...
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Generic GeometricField class.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Base class for solution control classes.
const word & objectiveManagerName() const
Return objectiveManager name.
const ATCModel & getATC() const
ATC type might be useful for a number of BCs. Return here.
const word & adjointSolverName() const
Return adjointSolverName.
boundaryAdjointContribution & getBoundaryAdjContribution()
Get boundaryContribution.
autoPtr< boundaryAdjointContribution > boundaryContrPtr_
Engine to manage contributions of the objective functions to the adjoint boundary conditions.
const word & simulationType() const
Return the simulationType.
adjointBoundaryCondition(const fvPatch &p, const DimensionedField< Type, volMesh > &iF, const word &solverName)
Construct from field and base name.
word adjointSolverName_
adjointSolver name corresponding to field
virtual void updatePrimalBasedQuantities()
Update the primal based quantities related to the adjoint boundary conditions.
tmp< Field< typename Foam::outerProduct< Foam::vector, Type2 >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
Switch addATCUaGradUTerm_
Whether to add the extra term from the UaGradU formulation.
const fvPatch & patch_
Reference to patch.
virtual tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > dxdbMult() const
Return contribution to sensitivity derivatives.
word simulationType_
simulationType corresponding to field.
word managerName_
objectiveManager name corresponding to field
void setBoundaryContributionPtr()
Set the ptr to the correct boundaryAdjointContribution.
bool addATCUaGradUTerm()
Whether to add the extra term from the UaGradU formulation.
Abstract base class for computing contributions of the objective functions to the adjoint boundary co...
static autoPtr< boundaryAdjointContribution > New(const word &managerName, const word &adjointSolverName, const word &simulationType, const fvPatch &patch)
Return a reference to the selected turbulence model.
A cell is defined as a list of faces with extra functionality.
Smooth ATC in cells next to a set of patches supplied by type.
Mesh data needed to do the Finite Volume discretisation.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
label start() const noexcept
The patch start within the polyMesh face list.
bool foundObject(const word &name, const bool recursive=false) const
Contains the named Type?
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
const polyMesh & mesh() const noexcept
Return the mesh reference.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
bool store()
Register object with its registry and transfer ownership to the registry.
static void cachePrintMessage(const char *message, const word &name, const FieldType &fld)
Helper for printing cache message.
static tmp< surfaceInterpolationScheme< Type > > New(const fvMesh &mesh, Istream &schemeData)
Return new tmp interpolation scheme.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.