60 const word& adjointSolverName,
61 const word& primalSolverName
64 objectiveGeometric(
mesh,
dict, adjointSolverName, primalSolverName),
78 && !
dict.readIfPresent(
"initialVolume", initVol_)
81 const scalar oneThird(1.0/3.0);
82 for (const label patchi : objectivePatches_)
84 const fvPatch& patch = mesh_.boundary()[patchi];
85 initVol_ -= oneThird*gSum(patch.Sf() & patch.Cf());
101 for (
const label patchi : objectivePatches_)
103 const fvPatch& patch = mesh_.boundary()[patchi];
112void objectivePartialVolume::update_dxdbDirectMultiplier()
115 for (
const label patchi : objectivePatches_)
117 const fvPatch& patch = mesh_.boundary()[patchi];
125void objectivePartialVolume::update_dSdbMultiplier()
128 for (
const label patchi : objectivePatches_)
138 os.writeEntry(
"initialVolume", initVol_);
145 objFunctionFilePtr_()
146 <<
setw(4) <<
"#" <<
" "
147 <<
setw(width_) <<
"VInit" <<
" "
148 <<
setw(width_) << initVol_ <<
endl;
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
wordList sortedToc() const
Return the sorted table of contents.
Mesh data needed to do the Finite Volume discretisation.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Abstract base class for objective functions that contain only geometric quantities.
autoPtr< boundaryVectorField > bdSdbMultPtr_
Term multiplying delta(n dS)/delta b.
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
virtual bool writeData(Ostream &os) const
Write averaged objective for continuation.
autoPtr< boundaryVectorField > bdxdbDirectMultPtr_
Term multiplying delta(x)/delta b at the boundary for objectives that directly depend on x,...
unsigned int width_
Default width of entries when writing in the objective files.
scalar J_
Objective function value and weight.
const dictionary & dict() const
Return objective dictionary.
virtual bool writeData(Ostream &os) const
Write initial volume for continuation.
virtual void update_dxdbDirectMultiplier()
Update d (x) / db multiplier. Surface and volume-based sensitivity term.
objectivePartialVolume(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName)
from components
virtual scalar J()
Return the objective function value.
virtual void addHeaderInfo() const
Write headers for additional columns.
virtual void update_dSdbMultiplier()
Update d (normal dS) / db multiplier. Surface and volume-based sensitivity term.
A class for managing temporary objects.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
Type gSum(const FieldField< Field, Type > &f)
static constexpr scalar oneThird
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
autoPtr< typename GeometricField< Type, fvPatchField, volMesh >::Boundary > createZeroBoundaryPtr(const fvMesh &mesh, bool printAllocation=false)