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)
85 createZeroFieldPtr<vector>
95 createZeroFieldPtr<scalar>
98 (
"divDxdbMult" +
type()) ,
117 for (
const label zI : zones_)
122 volZone_[zI] =
gSum(VZone);
123 UMean_[zI] =
gSum(UZone*VZone)/volZone_[zI];
124 UVar_[zI] =
gSum(
magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];
137 for (
const label zI : zones_)
140 for (
const label cellI : zoneI)
142 dJdvPtr_()[cellI] = (
U[cellI] - UMean_[zI])/volZone_[zI];
153 for (
const label zI : zones_)
156 for (
const label cellI : zoneI)
159 0.5*(
magSqr(
U[cellI] - UMean_[zI]) - UVar_[zI])/volZone_[zI];
162 divDxDbMult.correctBoundaryConditions();
169 for (
const label zI : zones_)
172 file<<
setw(
width_) << word(zoneName +
"-" +
"UMean") <<
" ";
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
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, using an OSstream.
dimensionedScalar sqrt(const dimensionedScalar &ds)
void checkCellZonesSize(const labelList &zoneIDs) const
Check if cellZones provided include at least one cell.
defineTypeNameAndDebug(objectiveFlowRate, 0)
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
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)
A class for handling words, derived from Foam::string.
autoPtr< volVectorField > dJdvPtr_
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.
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)
addToRunTimeSelectionTable(objectiveIncompressible, objectiveFlowRate, dictionary)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
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.
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)