64 (isA<symmetryFvPatch>(
pp) || isA<symmetryPlaneFvPatch>(
pp));
65 if (!isA<coupledFvPatch>(
pp) && !isA<emptyFvPatch>(
pp) && !isSymmetry)
67 extendedPatchIDs[pI++] = patchI;
70 extendedPatchIDs.setSize(pI);
118 const label patchStartIndex =
patch.start();
124 const labelList& pointFaces = patchPointFaces[ppI];
127 label localFaceIndex = pointFaces[pfI];
128 label globalFaceIndex = patchStartIndex + localFaceIndex;
129 const face& faceI = faces[globalFaceIndex];
136 if (faceI[facePointI] == meshPoints[ppI])
142 dBoundary.makeFaceCentresAndAreas_d(
p, p_d);
154 const tensor& deltaCf = deltaNormals[0];
155 pointPatchSens[ppI] += facePatchSens[localFaceIndex] & deltaCf;
163 const tensor& deltaSf = deltaNormals[1];
164 pointPatchSens[ppI] +=
165 dSfdbMult_()[patchI][localFaceIndex] & deltaSf;
171 const tensor& deltaNf = deltaNormals[2];
172 pointPatchSens[ppI] +=
173 dnfdbMult_()[patchI][localFaceIndex] & deltaNf;
203 const labelList& pointFaces = patchPointFaces[ppI];
206 const label localFaceIndex = pointFaces[pfI];
209 pointNormals[meshPoints[ppI]] += nf[localFaceIndex];
210 pointMagSf[meshPoints[ppI]] += magSf[localFaceIndex];
259 Nf.primitiveFieldRef() = pointNormals;
270 label nTotalPoints(0);
283 sensitivitySurfacePoints::sensitivitySurfacePoints
291 writeGeometricInfo_(false),
292 includeSurfaceArea_(false),
295 extendedPatchIDs_(populateExtendedIDs())
299 Info<<
"Extended sensitivity patches " <<
nl;
312 createZeroBoundaryPointFieldPtr<scalar>(
mesh_)
316 createZeroBoundaryPointFieldPtr<vector>(
mesh_)
326 (isA<symmetryFvPatch>(
pp) || isA<symmetryPlaneFvPatch>(
pp));
329 const labelList& meshPoints =
pp.patch().meshPoints();
333 const label pointi = meshPoints[pI];
369 return extendedPatchIDs_;
404 const label globaPointI = meshPoints[ppI];
462 vectorField patchPointNormals(pointNormals, meshPoints);
463 patchPointNormals.normalise();
476 const label gpi = nPassedDVs +
pi;
478 derivatives_[3*gpi ] = scalar(sd[0] == -1 ? 0 : pSens.x());
479 derivatives_[3*gpi + 1] = scalar(sd[1] == -1 ? 0 : pSens.y());
480 derivatives_[3*gpi + 2] = scalar(sd[2] == -1 ? 0 : pSens.z());
482 nPassedDVs +=
patch.nPoints();
548 nfOnPatch.boundaryFieldRef()[patchI] =
patch.nf();
549 SfOnPatch.boundaryFieldRef()[patchI] =
patch.Sf();
550 CfOnPatch.boundaryFieldRef()[patchI] =
patch.Cf();
autoPtr< boundaryVectorField > dSfdbMult_
Multiplier of dSf/db.
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
bool includeSurfaceArea_
Include surface area in sens computation.
void computeDxDbMult()
Compute dxdbMult from its various components.
autoPtr< pointBoundaryVectorField > wallPointSensVecPtr_
Wall point sens w.r.t. (x,y.z)
adjointSolver & adjointSolver_
Reference to the underlaying adjoint solver.
label nPoints() const noexcept
Number of mesh points.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
labelHashSet sensitivityPatchIDs_
Patches on which to compute shape sensitivities.
Abstract base class for adjoint-based sensitivities.
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
const Vector< label > & solutionD() const
Return the vector of solved-for directions in mesh.
void constructGlobalPointNormalsAndAreas(vectorField &pointNormals, scalarField &pointMagSf)
Construct globally correct point normals and point areas.
constexpr char nl
The newline '\n' character (0x0a)
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Differentiation of the mesh data structure.
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
Base class for adjoint solvers.
virtual bool readDict(const dictionary &dict)
Read dict if changed.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
GeometricField< vector, fvPatchField, volMesh > volVectorField
List< labelList > labelListList
List of labelList.
Macros for easy insertion into run-time selection tables.
autoPtr< pointBoundaryScalarField > wallPointSensNormalPtr_
Wall point sens projected to normal.
void finalisePointSensitivities()
Converts face sensitivities to point sensitivities and adds the ones directly computed in points (i...
boolList isSymmetryPoint_
Is point belonging to a symmetry{Plane}.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
labelHashSet populateExtendedIDs() const
Set suffix name for sensitivity fields.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
vectorField pointField
pointField is a vectorField.
void setSuffixName()
Set suffix name for sensitivity fields.
static const Identity< scalar > I
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
autoPtr< adjointMeshMovementSolver > adjointMeshMovementSolver_
Adjoint grid displacement solver.
static const word null
An empty word.
constexpr scalar pi(M_PI)
void setSuffix(const word &suffix)
Set suffix.
virtual const faceList & faces() const
Return raw faces.
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
autoPtr< boundaryVectorField > dxdbDirectMult_
Multiplier of dCf/db, found in the objective function.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
int debug
Static debugging option.
virtual void assembleSensitivities(autoPtr< designVariables > &designVars)
Assemble sensitivities.
autoPtr< pointBoundaryVectorField > wallPointSensNormalVecPtr_
Normal sens as vectors.
vectorField symmPointNormal_
Local point normal per symmetry point.
defineTypeNameAndDebug(combustionModel, 0)
autoPtr< boundaryVectorField > bcDxDbMult_
Multiplier of dx/db, coming from boundary conditions that depend on the geometry, like rotatingWallVe...
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
const dictionary & dict() const
Return the construction dictionary.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
bool writeGeometricInfo_
Write geometric info for use by external programs.
virtual void write(const word &baseName=word::null)
Write sensitivity fields.
virtual void assembleSensitivities(autoPtr< designVariables > &designVars)
Assemble sensitivities.
labelHashSet extendedPatchIDs_
Extended patchIDs.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
scalarField derivatives_
The sensitivity derivative values.
const word & solverName() const
Return the solver name.
Mesh data needed to do the Finite Volume discretisation.
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
virtual bool readDict(const dictionary &dict)
Read dict if changed.
void read()
Read controls and update solver pointers if necessary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< label > labelList
A List of labels.
void normalise()
Inplace normalise this field. Generally a no-op except for vector fields.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
void computePointDerivativesSize()
Allocate the proper size for the point-based sensitivities.
virtual const labelHashSet & geometryVariationIntegrationPatches() const
Return set of patches on which to compute direct sensitivities.
Calculation of adjoint-based sensitivities at wall points using the E-SI formulation.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
autoPtr< boundaryVectorField > dxdbMult_
Multiplier of face dx/db.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
Class for computing sensitivity derivatives using the Enhanced Surface Integral (E-SI) formulation...
autoPtr< boundaryVectorField > dnfdbMult_
Multiplier of dnf/db.
static constexpr const zero Zero
Global zero (0)