39namespace incompressible
79 for (
const label patchI : sensitivityPatchIDs_)
91 Info<<
"Mesh Movement Propagation(direction, CP), ("
92 << idir <<
", " << iCP <<
"), Iteration : "<< iter <<
endl;
100 scalar residual =
mag(mEqn.
solve().initialResidual());
109 Info<<
"\n***Reached dxdb convergence limit, iteration " << iter
131 flowSens_(3*Bezier_.nBezier(),
Zero),
132 dSdbSens_(3*Bezier_.nBezier(),
Zero),
133 dndbSens_(3*Bezier_.nBezier(),
Zero),
134 dxdbDirectSens_(3*Bezier_.nBezier(),
Zero),
135 dVdbSens_(3*Bezier_.nBezier(),
Zero),
136 distanceSens_(3*Bezier_.nBezier(),
Zero),
137 optionsSens_(3*Bezier_.nBezier(),
Zero),
138 bcSens_(3*Bezier_.nBezier(),
Zero),
140 derivativesFolder_(
"optimisation"/
type() +
"Derivatives"),
142 meshMovementIters_(-1),
143 meshMovementResidualLimit_(1.e-7),
174 distanceSensPtr.
reset
176 createZeroFieldPtr<tensor>
187 const label nDVs = 3*nBezier;
188 for (label iDV = 0; iDV < nDVs; iDV++)
190 label iCP = iDV%nBezier;
191 label idir = iDV/nBezier;
217 for (
const label patchI : sensitivityPatchIDs_)
266 distanceSensPtr().primitiveField()
309 Info<<
"Writing control point sensitivities to file" <<
endl;
320 <<
setw(widthDV) <<
"#dv" <<
" "
321 <<
setw(width) <<
"total" <<
" "
322 <<
setw(width) <<
"flow" <<
" "
323 <<
setw(width) <<
"dSdb" <<
" "
324 <<
setw(width) <<
"dndb" <<
" "
325 <<
setw(width) <<
"dxdbDirect" <<
" "
326 <<
setw(width) <<
"dVdb" <<
" "
327 <<
setw(width) <<
"distance" <<
" "
328 <<
setw(width) <<
"options" <<
" "
333 label lastActive(-1);
335 for (label iDV = 0; iDV < nDVs; iDV++)
337 const label iCP(iDV%nBezier);
338 const label idir(iDV/nBezier);
339 if (!confineMovement[idir][iCP])
341 if (iDV!=lastActive + 1)
347 <<
setw(widthDV) << iDV <<
" "
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.
label nBezier() const
Number of Bezier control points.
const boolList & confineZmovement() const
Confine z movement.
const boolList & confineYmovement() const
Confine y movement.
const boolListList & confineMovement() const
Info about confining movement in all directions.
const boolList & confineXmovement() const
Confine x movement.
tmp< tensorField > dxdbFace(const label patchI, const label cpI, bool useChainRule=true) const
dxdb tensor for a Bezier parameterized patch
tmp< tensorField > dndbBasedSensitivities(const label patchI, const label cpI, bool returnDimensionedNormalSens=true) const
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static unsigned int defaultPrecision() noexcept
Return the default precision.
Output to file stream, using an OSstream.
static word timeName(const scalar t, const int precision=precision_)
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
void size(const label n)
Older name for setAddressableSize.
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,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
virtual bool write()
Write the output fields.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
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 for Bezier control points using the FI appoach.
virtual void clearSensitivities()
Zero sensitivity fields and their constituents.
scalarField dSdbSens_
Term depending on delta(n dS)/delta b.
scalarField flowSens_
Flow related term.
tmp< volVectorField > solveMeshMovementEqn(const label iCP, const label idir)
scalarField dVdbSens_
Term depending on delta(V)/delta b.
virtual void assembleSensitivities()
Assemble sensitivities.
scalarField optionsSens_
Term depending on fvOptions.
fileName derivativesFolder_
scalar meshMovementResidualLimit_
scalarField dxdbDirectSens_
scalarField distanceSens_
Term depending on distance differentiation.
scalarField bcSens_
Term depending on the differenation of boundary conditions.
scalarField dndbSens_
Term depending on delta(n)/delta b.
autoPtr< boundaryVectorField > dxdbDirectMult_
autoPtr< boundaryVectorField > bcDxDbMult_
autoPtr< boundaryVectorField > dnfdbMult_
autoPtr< boundaryVectorField > dSfdbMult_
Fields related to direct sensitivities.
splitCell * master() const
A class for managing temporary objects.
Base class for creating a set of variables.
const word & solverName() const
Return solver name.
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)
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
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)
GeometricField< vector, fvPatchField, volMesh > volVectorField
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Type gMax(const FieldField< Field, Type > &f)