Go to the documentation of this file.
39 namespace incompressible
48 sensitivityVolBSplines,
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
172 derivativesFolder_(
"optimisation"/
type() +
"Derivatives")
175 const label nCPs(volBSplinesBase_.getTotalControlPointsNumber());
184 mkDir(derivativesFolder_);
206 boxes[iNURB].computeControlPointSensitivities
209 sensitivityPatchIDs_.toc()
216 passedCPs += sens.size();
270 Info<<
"Writing control point sensitivities to file" <<
endl;
281 unsigned int widthDV =
285 <<
setw(widthDV) <<
"#cp" <<
" "
286 <<
setw(width) <<
"total::x"<<
" "
287 <<
setw(width) <<
"total::y"<<
" "
288 <<
setw(width) <<
"total::z"<<
" "
289 <<
setw(width) <<
"flow::x" <<
" "
290 <<
setw(width) <<
"flow::y" <<
" "
291 <<
setw(width) <<
"flow::z" <<
" "
292 <<
setw(width) <<
"dSdb::x" <<
" "
293 <<
setw(width) <<
"dSdb::y" <<
" "
294 <<
setw(width) <<
"dSdb::z" <<
" "
295 <<
setw(width) <<
"dndb::x" <<
" "
296 <<
setw(width) <<
"dndb::y" <<
" "
297 <<
setw(width) <<
"dndb::z" <<
" "
298 <<
setw(width) <<
"dxdbDirect::x" <<
" "
299 <<
setw(width) <<
"dxdbDirect::y" <<
" "
300 <<
setw(width) <<
"dxdbDirect::z" <<
" "
301 <<
setw(width) <<
"dvdb::x" <<
" "
302 <<
setw(width) <<
"dvdb::y" <<
" "
303 <<
setw(width) <<
"dvdb::z" <<
endl;
306 label lastActive(-1);
310 label nb = boxes[iNURB].getControlPoints().size();
311 const boolList& activeCPs = boxes[iNURB].getActiveCPs();
312 for (label iCP = 0; iCP < nb; iCP++)
316 label globalCP = passedCPs + iCP;
317 if (globalCP!=lastActive + 1)
321 lastActive = globalCP;
324 <<
setw(widthDV) << globalCP <<
" "
virtual void assembleSensitivities()
Assemble sensitivities.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
class for managing incompressible objective functions.
virtual void assembleSensitivities()
Assemble sensitivities.
void computeBCContributions()
const word & solverName() const
Return solver name.
autoPtr< boundaryVectorField > bcDxDbMult_
A class for handling words, derived from Foam::string.
virtual void write(const word &baseName=word::null)
Write sensitivities to file.
defineTypeNameAndDebug(adjointEikonalSolver, 0)
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict....
static constexpr const zero Zero
Global zero (0)
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
volBSplinesBase & volBSplinesBase_
Reference to underlaying volumetric B-Splines morpher.
static const volBSplinesBase & New(const fvMesh &mesh, Args &&... args)
Get existing or create a new MeshObject.
static word timeName(const scalar t, const int precision=precision_)
Base class for Surface Integral-based sensitivity derivatives.
Ostream & endl(Ostream &os)
Add newline and flush stream.
sensitivitySurface surfaceSensitivity_
Surface sensitivities.
Type gSum(const FieldField< Field, Type > &f)
void computeObjectiveContributions()
Class including all adjoint fields for incompressible flows.
vectorField flowSens_
Flow related term.
#define forAll(list, i)
Loop across all elements in list.
fileName derivativesFolder_
Field< vector > vectorField
Specialisation of Field<T> for vector.
vectorField bcSens_
Term dependng on the differentiation of boundary conditions.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
vectorField dxdbDirectSens_
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
addToRunTimeSelectionTable(adjointSensitivity, sensitivityBezier, dictionary)
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
virtual void write(const word &baseName=word::null)
Write sensitivity map.
void boundControlPointMovement(vectorField &controlPointsMovement)
Bound control points movement.
Istream and Ostream manipulators taking arguments.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
vectorField dndbSens_
Term depending on delta (n)/delta b.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
autoPtr< boundaryVectorField > dxdbDirectMult_
Macros for easy insertion into run-time selection tables.
incompressibleAdjointVars & adjointVars_
Mesh data needed to do the Finite Volume discretisation.
Omanip< int > setw(const int i)
Output to file stream, using an OSstream.
static bool master(const label communicator=0)
Am I the master process.
bool includeObjective_
Whether to include direct sensitivities or not.
vectorField dSdbSens_
Term depending on delta(n dS)/delta b.
static unsigned int defaultPrecision()
Return the default precision.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const Time & time() const
Return the top-level database.
static const Vector< scalar > zero
autoPtr< boundaryVectorField > dnfdbMult_
fv::IOoptionListAdjoint fvOptionsAdjoint(mesh)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Base class for solution control classes.