51 nBezier_(dict_.subDict(
"Bezier").
get<label>(
"nBezier")),
55 dict_.subDict(
"Bezier").
get<
boolList>(
"confineXmovement")
59 dict_.subDict(
"Bezier").
get<
boolList>(
"confineYmovement")
63 dict_.subDict(
"Bezier").
get<
boolList>(
"confineZmovement")
65 confineMovement_(3,
boolList(nBezier_, false)),
66 activeDesignVariables_(3*nBezier_)
76 <<
"confineMovement lists sizes " 80 <<
"are incompatible with nBezier " <<
nBezier_ 90 for (label iDir = 0; iDir < 3; ++iDir)
92 for (label iCP = 0; iCP <
nBezier_; ++iCP)
103 for (label iCP = 0; iCP <
nBezier_; ++iCP)
167 bool returnDimensionedNormalSens
175 auto& dndbSens = tdndbSens.ref();
179 const label patchStart = ppatch.
start();
192 facePointDerivs[pI] = dxdbInt[fGlobal[pI]];
196 if (returnDimensionedNormalSens)
199 deltaBoundary.makeFaceCentresAndAreas_d
208 deltaBoundary.makeFaceCentresAndAreas_d
224 bool returnDimensionedNormalSens
228 const polyPatch& ppatch =
patch.patch();
232 auto& dndbSens = tdndbSens.
ref();
235 deltaBoundary deltaBoundary(
mesh_);
236 const label patchStart = ppatch.start();
239 unzipRow(dxdbInt, vector::components(idir), dxdbDir);
244 const face& fGlobal =
mesh_.
faces()[fI + patchStart];
251 facePointDerivs[pI] = dxdbDir[fGlobal[pI]];
255 if (returnDimensionedNormalSens)
258 deltaBoundary.makeFaceCentresAndAreas_d
260 facePoints, facePointDerivs
266 deltaBoundary.makeFaceCentresAndAreas_d
293 deltaBoundary deltaBoundary(
mesh_);
294 const label patchStart =
patch.start();
300 const face& fGlobal =
mesh_.
faces()[fI + patchStart];
307 facePointDerivs[pI] = dxdbInt[fGlobal[pI]];
310 deltaBoundary.makeFaceCentresAndAreas_d
320 PrimitivePatchInterpolation<polyPatch> patchInter(
patch);
321 dxdbFace = patchInter.pointToFaceInterpolate
323 dxidXj_[cpI].boundaryField()[patchI].patchInternalField()()
347 deltaBoundary deltaBoundary(
mesh_);
348 const label patchStart =
patch.start();
351 dxdbDir.
replace(0, dxdbInt.component(3*idir));
352 dxdbDir.replace(1, dxdbInt.component(3*idir + 1));
353 dxdbDir.replace(2, dxdbInt.component(3*idir + 2));
358 const face& fGlobal =
mesh_.
faces()[fI + patchStart];
365 facePointDerivs[pI] = dxdbDir[fGlobal[pI]];
368 deltaBoundary.makeFaceCentresAndAreas_d
378 PrimitivePatchInterpolation<polyPatch> patchInter(
patch);
383 dxidXj_[cpI].boundaryField()[patchI].patchInternalField()().
386 dxdbFace = patchInter.pointToFaceInterpolate(dxdb)();
394 const label globalFaceI,
398 const face& faceI(
mesh_.
faces()[globalFaceI]);
402 fPoints_d[fpI] =
dxidXj_[cpI].primitiveField()[faceI[fpI]];
410 const label globalFaceI,
415 const face& faceI(
mesh_.
faces()[globalFaceI]);
419 const tensor& dxdbTensor =
dxidXj_[cpI].primitiveField()[faceI[fpI]];
420 fPoints_d[fpI].x() = dxdbTensor.component(3*idir);
421 fPoints_d[fpI].y() = dxdbTensor.component(3*idir + 1);
422 fPoints_d[fpI].z() = dxdbTensor.component(3*idir + 2);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
const boolListList & confineMovement() const
Info about confining movement in all directions.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Differentiation of the mesh data structure.
const boolList & confineXmovement() const
Confine x movement.
void unzipRow(const FieldField< Field, SymmTensor< Cmpt >> &input, const direction idx, FieldField< Field, Vector< Cmpt >> &result)
Extract a symmTensor field field row (x,y,z) == (0,1,2)
const Time & time() const
Return the top-level database.
void replace(const direction, const UList< cmptType > &)
Replace a component field of the field.
const labelList & getActiveDesignVariables() const
Return active design variables.
GeometricField< tensor, pointPatchField, pointMesh > pointTensorField
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
tensorField facePoints_d(const label globalFaceI, const label cpI) const
For a given (global) face ID, return the change of the face points.
pointField points(const UList< point > &pts) const
Return the points corresponding to this face.
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
boolListList confineMovement_
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
label nBezier() const
Number of Bezier control points.
virtual const faceList & faces() const
Return raw faces.
boolList confineYmovement_
labelList activeDesignVariables_
tmp< tensorField > dndbBasedSensitivities(const label patchI, const label cpI, bool returnDimensionedNormalSens=true) const
Compute derivative of the normal vector for a Bezier parameterized patch.
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
defineTypeNameAndDebug(combustionModel, 0)
const boolList & confineYmovement() const
Confine y movement.
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Calculation of adjoint based sensitivities for Bezier control points.
PtrList< pointTensorField > dxidXj_
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
boolList confineXmovement_
Field< vector > vectorField
Specialisation of Field<T> for vector.
tmp< tensorField > dxdbFace(const label patchI, const label cpI, bool useChainRule=true) const
dxdb tensor for a Bezier parameterized patch
List< label > labelList
A List of labels.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
boolList confineZmovement_
const boolList & confineZmovement() const
Confine z movement.
PtrList< pointTensorField > & dxidXj()
dx/db tensor for all control points
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
static constexpr const zero Zero
Global zero (0)