201 const word& adjointSolverName,
202 const word& primalSolverName
204 (
mesh,
dict, adjointSolverName, primalSolverName)
215 const word& adjointSolverName,
216 const word& primalSolverName
227 const word& objectiveType,
228 const word& adjointSolverName,
229 const word& primalSolverName
242 virtual scalar
J() = 0;
321 virtual void update() = 0;
364 virtual bool write(
const bool valid =
true)
const;
bool hasGradDxDbMult() const
void setInstantValueFilePtr() const
Set the output file ptr for the instantaneous value.
virtual void update_dSdbMultiplier()
Update d (normal dS) / db multiplier. Surface-based sensitivity term.
virtual void updateNormalizationFactor()
Update normalization factors, for objectives in which the factor is not known a priori.
autoPtr< boundaryVectorField > bdxdbMultPtr_
Term multiplying delta(x)/delta b at the boundary.
autoPtr< scalar > target_
Target value, in case the objective is used as a constraint.
A class for handling file names.
void incrementIntegrationTimes(const scalar timeSpan)
Increment integration times.
const word adjointSolverName_
const dictionary & dict() const
Return objective dictionary.
virtual void writeMeanValue() const
Write mean objective function history.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
virtual void update()=0
Update objective function derivatives.
autoPtr< OFstream > objFunctionFilePtr_
File to keep the objective values after the end of the primal solver.
autoPtr< scalar > normFactor_
Normalization factor.
virtual void update_dxdbMultiplier()
Update d (x) / db multiplier. Surface-based sensitivity term.
virtual void doNormalization()
Normalize all fields allocated by the objective.
virtual scalar J()=0
Return the instantaneous objective function value.
bool hasDivDxDbMult() const
void accumulateJMean()
Accumulate contribution for the mean objective value.
autoPtr< vectorField3 > bEdgeContribution_
Contribution located in specific parts of a patch. Mainly intended for patch boundary edges contribut...
autoPtr< boundaryVectorField > bdJdbPtr_
Term from material derivative.
const boundaryVectorField & dndbMultiplier()
Multiplier of delta(n dS)/delta b for all patches.
const volTensorField & gradDxDbMultiplier()
Multiplier of grad( delta(x)/delta b) for volume-based sensitivities.
const boundaryVectorField & dxdbDirectMultiplier()
Multiplier of delta(x)/delta b for all patches.
const boundaryVectorField & dxdbMultiplier()
Multiplier of delta(x)/delta b for all patches.
const word objectiveName_
virtual void update_gradDxDbMultiplier()
Update grad( dx/db multiplier). Volume-based sensitivity term.
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
bool hasBoundarydJdb() const
virtual void update_divDxDbMultiplier()
Update div( dx/db multiplier). Volume-based sensitivity term.
virtual bool write(const bool valid=true) const
Write objective function history.
static autoPtr< objective > New(const fvMesh &mesh, const dictionary &dict, const word &objectiveType, const word &adjointSolverName, const word &primalSolverName)
Return a reference to the selected turbulence model.
autoPtr< scalar > integrationEndTimePtr_
void setObjectiveFilePtr() const
Set the output file ptr.
A class for handling words, derived from Foam::string.
void setMeanValueFilePtr() const
Set the output file ptr for the mean value.
virtual void addHeaderColumns() const
Write headers for additional columns.
virtual void update_dndbMultiplier()
Update d (normal) / db multiplier. Surface-based sensitivity term.
virtual ~objective()=default
Destructor.
scalar JCycle() const
Return the mean objective function value, if it exists, otherwise the mean one.
Base class for solver control classes.
virtual void update_boundarydJdb()
Update objective function derivative term.
scalar JMean_
Average objective value.
scalar J_
Objective function value and weight.
const boundaryVectorField & dSdbMultiplier()
Multiplier of delta(n dS)/delta b for all patches.
TypeName("objective")
Runtime type information.
scalar weight() const
Return the objective function weight.
Abstract base class for objective functions. No point in making this runTime selectable since its chi...
autoPtr< boundaryVectorField > bdndbMultPtr_
Term multiplying delta(n)/delta b.
virtual bool writeData(Ostream &os) const
Write averaged objective for continuation.
virtual void writeInstantaneousValue() const
Write objective function history at each primal solver iteration.
const boundaryVectorField & boundarydJdb()
Contribution to surface sensitivities for all patches.
autoPtr< volScalarField > dJdbPtr_
Contribution to field sensitivity derivatives.
OBJstream os(runTime.globalPath()/outputName)
bool hasdxdbDirectMult() const
bool hasIntegrationEndTime() const
bool hasIntegrationStartTime() const
const word primalSolverName_
Useful typenames for fields defined only at the boundaries.
bool isWithinIntegrationTime() const
Check whether this is an objective integration time.
autoPtr< volScalarField > divDxDbMultPtr_
Multiplier of d(Volume)/db.
virtual void addColumnValues() const
Write information to additional columns.
autoPtr< OFstream > meanValueFilePtr_
File to keep the average objective values after the end of the primal solver.
const volScalarField & dJdb()
Contribution to field sensitivities.
unsigned int width_
Default width of entries when writing in the objective files.
const volScalarField & divDxDbMultiplier()
Multiplier of grad( delta(x)/delta b) for volume-based sensitivities.
virtual void update_boundaryEdgeContribution()
Update boundary edge contributions.
virtual void nullify()
Nullify adjoint contributions.
virtual void writeInstantaneousSeparator() const
Append a blank line after the end of optimisation cycle to the file holding the instantaneous objecti...
bool normalize() const
Is the objective normalized.
scalar weight_
Objective weight.
Mesh data needed to do the Finite Volume discretisation.
const vectorField3 & boundaryEdgeMultiplier()
Multiplier located at patch boundary edges.
virtual void addHeaderInfo() const
Write any information that needs to go the header of the file.
virtual bool readDict(const dictionary &dict)
autoPtr< volTensorField > gradDxDbMultPtr_
Emerging from volume objectives that include spatial derivatives.
autoPtr< scalar > integrationStartTimePtr_
Objective integration start and end times (for unsteady flows)
declareRunTimeNewSelectionTable(autoPtr, objective, objective,(const fvMesh &mesh, const dictionary &dict, const word &adjointSolverName, const word &primalSolverName),(mesh, dict, adjointSolverName, primalSolverName))
autoPtr< OFstream > instantValueFilePtr_
File to keep the objective values at each iteration of the primal solver.
Macros to ease declaration of run-time selection tables.
autoPtr< boundaryVectorField > bdxdbDirectMultPtr_
Term multiplying delta(x)/delta b at the boundary for objectives that directly depend on x...
virtual void update_dxdbDirectMultiplier()
Update d (x) / db multiplier. Surface and volume-based sensitivity term.
autoPtr< boundaryVectorField > bdSdbMultPtr_
Term multiplying delta(n dS)/delta b.
fileName objFunctionFolder_
Output file variables.
bool hasBoundaryEdgeContribution() const
const word & objectiveName() const
Return the objective name.