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>
126 volZone_[zI] =
gSum(VZone);
127 UMean_[zI] =
gSum(UZone*VZone)/volZone_[zI];
128 UVar_[zI] =
gSum(
magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];
144 for (
const label cellI : cz)
146 dJdvPtr_()[cellI] = (
U[cellI] - UMean_[zI])/volZone_[zI];
160 for (
const label cellI : cz)
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.
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.
const expr V(m.psi().mesh().V())
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.
Type gSum(const FieldField< Field, Type > &f)
constexpr T & get(FixedList< T, N > &list) noexcept
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.
void setSize(label n)
Alias for resize()
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static constexpr const zero Zero
Global zero (0)