39 #ifndef updateMethod_H 40 #define updateMethod_H 251 void setStep(
const scalar eta);
autoPtr< designVariables > & designVars_
Design variables.
void setConstraintDeriv(const PtrList< scalarField > &derivs)
Set constraints derivative.
virtual scalar computeMeritFunction()
Compute merit function. Could be different than the objective in the presence of constraints.
void setConstaintsNumber(const label nConstraints)
Set the number of constraints.
virtual scalar meritFunctionDirectionalDerivative()
Directional derivative of the merit function, in the direction of the correction. Could be different ...
scalarField cValues_
Constraint values.
label nConstraints() const
Get the number of constraints.
TypeName("updateMethod")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static autoPtr< updateMethod > New(const fvMesh &mesh, const dictionary &dict, autoPtr< designVariables > &designVars, const label nConstraints)
Return a reference to the selected turbulence model.
Abstract base class for optimisation methods.
scalar getObjectiveValueOld() const
Get old objective value.
const scalarField rightMult(const SquareMatrix< scalar > &, const scalarField &)
bool & initialEtaSet()
Return whether initial eta was set.
scalar getObjectiveValue() const
Get objective value.
const scalarField leftMult(const scalarField &, const SquareMatrix< scalar > &)
void setConstraintValues(const scalarField &values)
Set values of constraints.
virtual void computeCorrection()=0
Return the correction of the design variables.
PtrList< scalarField > constraintDerivatives_
Derivatives of the constraints.
scalar objectiveValueOld_
Old objective value.
scalar eta_
Step multiplying the correction.
label nConstraints_
Number of constraints.
localIOdictionary is derived from IOdictionary but excludes parallel master reading.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
scalar objectiveValue_
Objective value.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const labelList & activeDesignVars_
Map to active design variables.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-newton methods coupled with line search.
void setStep(const scalar eta)
Set step for optimisation methods.
void modifyStep(const scalar multiplier)
Multiply step.
virtual bool writeAuxiliaryData()
Write non-continuation data, usually under the optimisation folder.
void setObjectiveValueOld(const scalar value)
Set old objective value.
A class for handling words, derived from Foam::string.
label counter_
Optimisation cycle count.
declareRunTimeSelectionTable(autoPtr, updateMethod, dictionary,(const fvMesh &mesh, const dictionary &dict, autoPtr< designVariables > &designVars, const label nConstraints, const word &type),(mesh, dict, designVars, nConstraints, type))
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
SquareMatrix< scalar > inv(SquareMatrix< scalar > A)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
void setObjectiveValue(const scalar value)
Set objective value.
void setObjectiveDeriv(const scalarField &derivs)
Set objective derivative.
scalar globalSum(const scalarField &field)
Compute either global or local sum, based on globalSum flag.
OBJstream os(runTime.globalPath()/outputName)
dictionary coeffsDict(const word &type) const
Return optional dictionary with parameters specific to each method.
void setGlobalSum(const bool useGlobalSum)
Set globalSum variable.
bool initialEtaSet_
Is initially set?
bool globalSum_
Whether to use gSum or sum in the inner products.
scalarField objectiveDerivatives_
Derivatives of the objective functions.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
const scalarField & getConstraintValues() const
Get values of constraints.
Mesh data needed to do the Finite Volume discretisation.
SquareMatrix< scalar > outerProd(const scalarField &, const scalarField &)
scalarField correction_
Design variables correction.
label getCycle() const
Get optimisation cycle.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
scalarField cumulativeCorrection_
Cumulative design variables correction throughout the optimisation loop.
Macros to ease declaration of run-time selection tables.
A class for managing temporary objects.
word correctionFolder_
Folder storing the corrections to file.
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
scalarField & returnCorrection()
Return the correction of the design variables.
virtual ~updateMethod()=default
Destructor.
tmp< scalarField > readOrZeroField(const word &name, const label size)
Helper function to either read a scalarField of certain size from a dictionary, or construct a zero f...
virtual bool writeData(Ostream &os) const
Write continuation data under uniform.