40namespace incompressible
76 derivativesFolder_(
"optimisation"/
type() +
"Derivatives")
120 distanceSensPtr.
reset
122 createZeroFieldPtr<tensor>
137 const label nb(boxes[iNURB].getControlPoints().size());
140 vectorField dxdbSens = boxes[iNURB].computeControlPointSensitivities
143 sensitivityPatchIDs_.toc()
146 vectorField bcSens = boxes[iNURB].computeControlPointSensitivities
149 sensitivityPatchIDs_.toc()
152 for (label cpI = 0; cpI < nb; cpI++)
154 label globalCP = passedCPs + cpI;
159 volPointInter.
interpolate(boxes[iNURB].getDxDb(cpI))
171 for (label idir = 0; idir < pTraits<vector>::nComponents; ++idir)
202 distanceSensPtr().primitiveField();
216 for (
const label patchI : sensitivityPatchIDs_)
220 boxes[iNURB].dndbBasedSensitivities(patchI, cpI)
225 boxes[iNURB].dndbBasedSensitivities(patchI, cpI,
false)
236 *
fvc::div(
T(volDxDbI))().primitiveField()
248 bcSens_[globalCP] = bcSens[cpI];
250 boxSensitivities[cpI] =
262 boxes[iNURB].boundControlPointMovement(boxSensitivities);
265 for (label cpI = 0; cpI < nb; cpI++)
267 label globalCP = passedCPs + cpI;
269 derivatives_[3*globalCP + 1] = boxSensitivities[cpI].y();
270 derivatives_[3*globalCP + 2] = boxSensitivities[cpI].z();
309 Info<<
"Writing control point sensitivities to file" <<
endl;
323 <<
setw(widthDV) <<
"#cp" <<
" "
324 <<
setw(width) <<
"total::x" <<
" "
325 <<
setw(width) <<
"total::y" <<
" "
326 <<
setw(width) <<
"total::z" <<
" "
327 <<
setw(width) <<
"flow::x" <<
" "
328 <<
setw(width) <<
"flow::y" <<
" "
329 <<
setw(width) <<
"flow::z" <<
" "
330 <<
setw(width) <<
"dSdb::x" <<
" "
331 <<
setw(width) <<
"dSdb::y" <<
" "
332 <<
setw(width) <<
"dSdb::z" <<
" "
333 <<
setw(width) <<
"dndb::x" <<
" "
334 <<
setw(width) <<
"dndb::y" <<
" "
335 <<
setw(width) <<
"dndb::z" <<
" "
336 <<
setw(width) <<
"dxdbDirect::x" <<
" "
337 <<
setw(width) <<
"dxdbDirect::y" <<
" "
338 <<
setw(width) <<
"dxdbDirect::z" <<
" "
339 <<
setw(width) <<
"dVdb::x" <<
" "
340 <<
setw(width) <<
"dVdb::y" <<
" "
341 <<
setw(width) <<
"dVdb::z" <<
" "
342 <<
setw(width) <<
"distance::x" <<
" "
343 <<
setw(width) <<
"distance::y" <<
" "
344 <<
setw(width) <<
"distance::z" <<
" "
345 <<
setw(width) <<
"options::x" <<
" "
346 <<
setw(width) <<
"options::y" <<
" "
347 <<
setw(width) <<
"options::z" <<
" "
348 <<
setw(width) <<
"dvdb::x" <<
" "
349 <<
setw(width) <<
"dvdb::y" <<
" "
350 <<
setw(width) <<
"dvdb::z" <<
endl;
353 label lastActive(-1);
357 label nb = boxes[iNURB].getControlPoints().
size();
358 const boolList& activeCPs = boxes[iNURB].getActiveCPs();
359 for (label iCP = 0; iCP < nb; iCP++)
363 label globalCP = passedCPs + iCP;
364 if (globalCP!=lastActive + 1) derivFile <<
"\n";
365 lastActive = globalCP;
368 <<
setw(widthDV) << globalCP <<
" "
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
tmp< Field< cmptType > > component(const direction) const
Return a component field of the field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
static unsigned int defaultPrecision() noexcept
Return the default precision.
Output to file stream, using an OSstream.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
components
Component labeling enumeration.
Base class for adjoint solvers.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
virtual bool write()
Write the output fields.
Mesh data needed to do the Finite Volume discretisation.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const Time & time() const
Return the top-level database.
Base class for incompressibleAdjoint solvers.
Base class for Field Integral-based sensitivity derivatives.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
bool includeDistance_
Include distance variation in sens computation.
volTensorField gradDxDbMult_
grad(dx/db) multiplier
autoPtr< adjointEikonalSolver > eikonalSolver_
Adjoint eikonal equation solver.
void read()
Read options and update solver pointers if necessary.
scalarField divDxDbMult_
div(dx/db) multiplier
vectorField optionsDxDbMult_
dx/db multiplier coming from fvOptions
Abstract base class for adjoint-based sensitivities in incompressible flows.
incompressibleAdjointVars & adjointVars_
Calculation of adjoint based sensitivities at vol B-Splines control points using the FI approach.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
vectorField dVdbSens_
Term depending on delta(V)/delta b.
vectorField dSdbSens_
Term depending on delta(n dS)/delta b.
vectorField flowSens_
Flow related term.
vectorField dxdbDirectSens_
virtual void assembleSensitivities()
Assemble sensitivities.
vectorField bcSens_
Term depending on the differentiation of boundary conditions.
fileName derivativesFolder_
vectorField optionsSens_
Term depending on fvOptions.
vectorField dndbSens_
Term depending on delta(n)/delta b.
vectorField distanceSens_
Term depending on distance differentiation.
volBSplinesBase & volBSplinesBase_
Reference to underlaying volumetric B-Splines morpher.
autoPtr< boundaryVectorField > dxdbDirectMult_
autoPtr< boundaryVectorField > bcDxDbMult_
autoPtr< boundaryVectorField > dnfdbMult_
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
void interpolate(const GeometricField< Type, pointPatchField, pointMesh > &, GeometricField< Type, fvPatchField, volMesh > &) const
Interpolate from pointField to volField.
splitCell * master() const
A class for managing temporary objects.
const word & solverName() const
Return solver name.
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict....
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
void boundControlPointMovement(vectorField &controlPointsMovement) const
Bound control points movement.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Type gSum(const FieldField< Field, Type > &f)
const dimensionSet dimless
Dimensionless.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void unzipCol(const FieldField< Field, SymmTensor< Cmpt > > &input, const direction idx, FieldField< Field, Vector< Cmpt > > &result)
Extract a symmTensor field field column (x,y,z) == (0,1,2)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
#define forAll(list, i)
Loop across all elements in list.
A non-counting (dummy) refCount.