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
89 boxes[iNURB].boundControlPointMovement(
dSdbSens_);
90 boxes[iNURB].boundControlPointMovement(
dndbSens_);
98 boxes[iNURB].computeControlPointSensitivities
101 sensitivityPatchIDs_.toc()
105 forAll(sensDxDbDirect, cpI)
110 passedCPs += sensDxDbDirect.size();
118 sensitivityVolBSplines::sensitivityVolBSplines
147 derivativesFolder_(
"optimisation"/
type() +
"Derivatives")
150 label nCPs = volBSplinesBase_.getTotalControlPointsNumber();
158 mkDir(derivativesFolder_);
180 boxes[iNURB].computeControlPointSensitivities
183 sensitivityPatchIDs_.toc()
190 passedCPs += sens.size();
192 boxes[iNURB].boundControlPointMovement(
flowSens_);
239 Info<<
"Writing control point sensitivities to file" <<
endl;
247 unsigned int widthDV =
251 <<
setw(widthDV) <<
"#cp" <<
" "
252 <<
setw(width) <<
"total::x"<<
" "
253 <<
setw(width) <<
"total::y"<<
" "
254 <<
setw(width) <<
"total::z"<<
" "
255 <<
setw(width) <<
"flow::x" <<
" "
256 <<
setw(width) <<
"flow::y" <<
" "
257 <<
setw(width) <<
"flow::z" <<
" "
258 <<
setw(width) <<
"dSdb::x" <<
" "
259 <<
setw(width) <<
"dSdb::y" <<
" "
260 <<
setw(width) <<
"dSdb::z" <<
" "
261 <<
setw(width) <<
"dndb::x" <<
" "
262 <<
setw(width) <<
"dndb::y" <<
" "
263 <<
setw(width) <<
"dndb::z" <<
" "
264 <<
setw(width) <<
"dxdbDirect::x" <<
" "
265 <<
setw(width) <<
"dxdbDirect::y" <<
" "
266 <<
setw(width) <<
"dxdbDirect::z" <<
endl;
269 label lastActive(-1);
273 label nb = boxes[iNURB].getControlPoints().size();
274 const boolList& activeCPs = boxes[iNURB].getActiveCPs();
275 for (
label iCP = 0; iCP < nb; iCP++)
279 label globalCP = passedCPs + iCP;
280 if (globalCP!=lastActive + 1)
284 lastActive = globalCP;
287 <<
setw(widthDV) << globalCP <<
" "
autoPtr< boundaryVectorField > dxdbDirectMult_
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.
const word & solverName() const
Return solver name.
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.
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.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
vectorField dxdbDirectSens_
addToRunTimeSelectionTable(adjointSensitivity, sensitivityBezier, dictionary)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
messageStream Info
Information stream (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
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,...
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.
vectorField dSdbSens_
Term depending on delta(n dS)/delta b.
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
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.
autoPtr< boundaryVectorField > dnfdbMult_
const Time & time() const
Return the top-level database.
static const Vector< scalar > zero
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.