39 namespace incompressible
62 label nb = boxes[iNURB].getControlPoints().
size();
63 for (label cpI = 0; cpI < nb; cpI++)
67 for (
const label patchI : sensitivityPatchIDs_)
71 boxes[iNURB].dndbBasedSensitivities(patchI, cpI)
77 boxes[iNURB].dndbBasedSensitivities
98 boxes[iNURB].computeControlPointSensitivities
101 sensitivityPatchIDs_.toc()
105 forAll(sensDxDbDirect, cpI)
109 passedCPs += sensDxDbDirect.
size();
123 boxes[iNURB].computeControlPointSensitivities
126 sensitivityPatchIDs_.toc()
132 bcSens_[passedCPs + cpI] = sensBcsDxDb[cpI];
134 passedCPs += sensBcsDxDb.
size();
142 sensitivityVolBSplines::sensitivityVolBSplines
161 derivativesFolder_(
"optimisation"/
type() +
"Derivatives")
195 boxes[iNURB].computeControlPointSensitivities
198 sensitivityPatchIDs_.toc()
205 passedCPs += sens.
size();
259 Info<<
"Writing control point sensitivities to file" <<
endl;
270 unsigned int widthDV =
274 <<
setw(widthDV) <<
"#cp" <<
" " 275 <<
setw(width) <<
"total::x"<<
" " 276 <<
setw(width) <<
"total::y"<<
" " 277 <<
setw(width) <<
"total::z"<<
" " 278 <<
setw(width) <<
"flow::x" <<
" " 279 <<
setw(width) <<
"flow::y" <<
" " 280 <<
setw(width) <<
"flow::z" <<
" " 281 <<
setw(width) <<
"dSdb::x" <<
" " 282 <<
setw(width) <<
"dSdb::y" <<
" " 283 <<
setw(width) <<
"dSdb::z" <<
" " 284 <<
setw(width) <<
"dndb::x" <<
" " 285 <<
setw(width) <<
"dndb::y" <<
" " 286 <<
setw(width) <<
"dndb::z" <<
" " 287 <<
setw(width) <<
"dxdbDirect::x" <<
" " 288 <<
setw(width) <<
"dxdbDirect::y" <<
" " 289 <<
setw(width) <<
"dxdbDirect::z" <<
" " 290 <<
setw(width) <<
"dvdb::x" <<
" " 291 <<
setw(width) <<
"dvdb::y" <<
" " 292 <<
setw(width) <<
"dvdb::z" <<
endl;
295 label lastActive(-1);
299 label nb = boxes[iNURB].getControlPoints().
size();
300 const boolList& activeCPs = boxes[iNURB].getActiveCPs();
301 for (label iCP = 0; iCP < nb; iCP++)
305 label globalCP = passedCPs + iCP;
306 if (globalCP!=lastActive + 1)
310 lastActive = globalCP;
313 <<
setw(widthDV) << globalCP <<
" "
autoPtr< boundaryVectorField > dxdbDirectMult_
void size(const label n)
Older name for setAddressableSize.
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
defineTypeNameAndDebug(adjointEikonalSolver, 0)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual void write(const word &baseName=word::null)
Write sensitivity map.
vectorField bcSens_
Term dependng on the differentiation of boundary conditions.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Output to file stream, using an OSstream.
bool includeObjective_
Whether to include direct sensitivities or not.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static unsigned int defaultPrecision() noexcept
Return the default precision.
Base class for adjoint solvers.
const Time & time() const
Return the top-level database.
volBSplinesBase & volBSplinesBase_
Reference to underlaying volumetric B-Splines morpher.
addToRunTimeSelectionTable(adjointSensitivity, sensitivityBezier, dictionary)
Macros for easy insertion into run-time selection tables.
virtual void assembleSensitivities()
Assemble sensitivities.
Base class for incompressibleAdjoint solvers.
#define forAll(list, i)
Loop across all elements in list.
void computeBCContributions()
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
vectorField dSdbSens_
Term depending on delta(n dS)/delta b.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Type gSum(const FieldField< Field, Type > &f)
autoPtr< boundaryVectorField > dnfdbMult_
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Base class for Surface Integral-based sensitivity derivatives.
A class for handling words, derived from Foam::string.
Abstract base class for adjoint-based sensitivities in incompressible flows.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label size() const noexcept
The number of entries in the list.
Calculation of adjoint based sensitivities at vol B-Splines control points using the SI or e-SI appro...
virtual void assembleSensitivities()
Assemble sensitivities.
const word & solverName() const
Return solver name.
vectorField flowSens_
Flow related term.
void boundControlPointMovement(vectorField &controlPointsMovement) const
Bound control points movement.
Istream and Ostream manipulators taking arguments.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
vectorField dxdbDirectSens_
Term depending on dxdb for objective functions directly depending on x.
fileName derivativesFolder_
autoPtr< BasicCompressibleTurbulenceModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &alphaRhoPhi, const surfaceScalarField &phi, const typename BasicCompressibleTurbulenceModel::transportModel &transport, const word &propertiesName)
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
vectorField dndbSens_
Term depending on delta (n)/delta b.
Mesh data needed to do the Finite Volume discretisation.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
autoPtr< boundaryVectorField > bcDxDbMult_
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual void write(const word &baseName=word::null)
Write sensitivities to file.
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
Omanip< int > setw(const int i)
incompressibleAdjointVars & adjointVars_
sensitivitySurface surfaceSensitivity_
Surface sensitivities.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
void computeObjectiveContributions()
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict. Useful for various sensitivities and optMeshMovement classes.
static constexpr const zero Zero
Global zero (0)