47 objectiveIncompressible,
48 objectiveUniformityCellZone,
59 const word& adjointSolverName,
60 const word& primalSolverName
65 UMean_(zones_.size(),
Zero),
66 UVar_(zones_.size(),
Zero),
67 volZone_(zones_.size(),
Zero)
74 extendedVariableName(
"Ua")
83 createZeroFieldPtr<vector>
121 for (
const label zI : zones_)
126 volZone_[zI] =
gSum(VZone);
127 UMean_[zI] =
gSum(UZone*VZone)/volZone_[zI];
128 UVar_[zI] =
gSum(
magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];
141 for (
const label zI : zones_)
144 for (
const label cellI : zoneI)
146 dJdvPtr_()[cellI] = (
U[cellI] - UMean_[zI])/volZone_[zI];
157 for (
const label zI : zones_)
160 for (
const label cellI : zoneI)
163 0.5*(
magSqr(
U[cellI] - UMean_[zI]) - UVar_[zI])/volZone_[zI];
166 divDxDbMult.correctBoundaryConditions();
173 for (
const label zI : zones_)
176 file<<
setw(
width_) << word(zoneName +
"-" +
"UMean") <<
" ";
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
const word adjointSolverName_
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const word & name() const noexcept
Return the object name.
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Output to file stream as an OSstream, normally using std::ofstream for the actual output...
dimensionedScalar sqrt(const dimensionedScalar &ds)
void checkCellZonesSize(const labelList &zoneIDs) const
Check if cellZones provided include at least one cell.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Macros for easy insertion into run-time selection tables.
const word objectiveName_
#define forAll(list, i)
Loop across all elements in list.
wordList fieldNames_
List of adjoint fields for which this objective will contribute sources to their equations.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
void setSize(const label n)
Alias for resize()
Type gSum(const FieldField< Field, Type > &f)
A class for handling words, derived from Foam::string.
autoPtr< volVectorField > dJdvPtr_
defineTypeNameAndDebug(objectivePartialVolume, 1)
A List of wordRe with additional matching capabilities.
scalar J_
Objective function value and weight.
const volVectorField & U() const
Return const reference to velocity.
Istream and Ostream manipulators taking arguments.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
addToRunTimeSelectionTable(objectiveGeometric, objectivePartialVolume, dictionary)
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
const incompressibleVars & vars_
unsigned int width_
Default width of entries when writing in the objective files.
dimensionedScalar pow3(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Omanip< int > setw(const int i)
const volVectorField & UInst() const
Return const reference to velocity.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Abstract base class for objective functions in incompressible flows.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)