48 Field<typename Foam::outerProduct<Foam::vector, Type2>::type>
55 auto& resGrad = tresGrad.ref();
80 const word surfFieldName(
"interpolated" +
name +
"ForBoundaryGrad");
82 surfFieldType* surfFieldPtr =
83 mesh.objectRegistry::template getObjectPtr<surfFieldType>(surfFieldName);
94 surfFieldPtr->rename(surfFieldName);
99 if (surfFieldPtr->upToDate(
field))
113 surfFieldPtr->rename(surfFieldName);
117 surfFieldType& surfField = *surfFieldPtr;
131 for (
const label faceI : cellI)
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_)
177 addATCUaGradUTerm_.reset(
new bool(isA<ATCUaGradU>(getATC())));
179 return addATCUaGradUTerm_();
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_,
205 addATCUaGradUTerm_(adjointBC.addATCUaGradUTerm_)
216 const word& solverName
220 managerName_(
"objectiveManager" + solverName),
221 adjointSolverName_(solverName),
222 simulationType_(
"incompressible"),
223 boundaryContrPtr_(nullptr),
224 addATCUaGradUTerm_(nullptr)
243 return adjointSolverName_;
250 return simulationType_;
264 boundaryContrPtr_.
reset
278 <<
"No objectiveManager " << managerName_ <<
" available." <<
nl
279 <<
"Setting boundaryAdjointContributionPtr to nullptr. " <<
nl
280 <<
"OK for decomposePar."
290 return boundaryContrPtr_();
298 patch_.boundaryMesh().mesh().template
299 lookupObject<ATCModel>(
"ATCModel" + adjointSolverName_);
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 GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
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.
const word & simulationType() const
Return the simulationType.
virtual void updatePrimalBasedQuantities()
tmp< Field< typename Foam::outerProduct< Foam::vector, Type2 >::type > > computePatchGrad(word name)
Get gradient of field on a specific boundary.
virtual tmp< Field< typename Foam::outerProduct< Foam::vector, Type >::type > > dxdbMult() const
Return contribution to sensitivity derivatives.
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...
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.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const labelUList & owner() const
Internal face owner. Note bypassing virtual mechanism so.
const surfaceVectorField & Sf() const
Return cell face area vectors.
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.
virtual label start() const
Return start label of this patch in the polyMesh face list.
bool foundObject(const word &name, const bool recursive=false) const
Is the named Type found?
const Type & lookupObject(const word &name, const bool recursive=false) const
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
const polyMesh & mesh() const noexcept
Return the mesh reference.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
const cellList & cells() const
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
ITstream & interpolationScheme(const word &name) const
Get interpolation scheme for given name, or default.
static void cachePrintMessage(const char *message, const word &name, const FieldType &vf)
Helper for printing cache message.
A class for managing temporary objects.
type
Volume classification types.
A class for handling words, derived from Foam::string.
#define WarningInFunction
Report a warning using Foam::Warning.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0)
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.