159 updateMethod(
const updateMethod&) =
delete;
162 void operator=(
const updateMethod&) =
delete;
251 void setStep(
const scalar eta);
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
label size() const noexcept
The number of elements in list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & name() const
Name function is needed to disambiguate those inherited from regIOobject and dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
localIOdictionary(const IOobject &io, const dictionary *fallback=nullptr)
Construct given an IOobject and optional fallback dictionary content.
A class for managing temporary objects.
declareRunTimeSelectionTable(autoPtr, updateMethod, dictionary,(const fvMesh &mesh, const dictionary &dict, autoPtr< designVariables > &designVars, const label nConstraints, const word &type),(mesh, dict, designVars, nConstraints, type))
void setConstraintValues(const scalarField &values)
Set values of constraints.
scalarField objectiveDerivatives_
Derivatives of the objective functions.
label nConstraints_
Number of constraints.
virtual scalar meritFunctionDirectionalDerivative()
Directional derivative of the merit function, in the direction of the correction. Could be different ...
scalarField correction_
Design variables correction.
bool globalSum_
Whether to use gSum or sum in the inner products.
dictionary coeffsDict(const word &type) const
Return optional dictionary with parameters specific to each method.
scalar globalSum(const scalarField &field)
Compute either global or local sum, based on globalSum flag.
scalarField cValues_
Constraint values.
scalar objectiveValue_
Objective value.
virtual bool writeAuxiliaryData()
Write non-continuation data, usually under the optimisation folder.
PtrList< scalarField > constraintDerivatives_
Derivatives of the constraints.
void setStep(const scalar eta)
Set step for optimisation methods.
virtual bool writeData(Ostream &os) const
Write continuation data under uniform.
const scalarField leftMult(const scalarField &, const SquareMatrix< scalar > &)
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...
scalarField & returnCorrection()
Return the correction of the design variables.
TypeName("updateMethod")
Runtime type information.
SquareMatrix< scalar > inv(SquareMatrix< scalar > A)
const labelList & activeDesignVars_
Map to active design variables.
scalar getObjectiveValue() const
Get objective value.
label getCycle() const
Get optimisation cycle.
bool initialEtaSet_
Is initially set?
const scalarField rightMult(const SquareMatrix< scalar > &, const scalarField &)
void setObjectiveValue(const scalar value)
Set objective value.
autoPtr< scalar > objectiveValueOld_
Old objective value.
static autoPtr< updateMethod > New(const fvMesh &mesh, const dictionary &dict, autoPtr< designVariables > &designVars, const label nConstraints)
Return a reference to the selected turbulence model.
const autoPtr< scalar > & getObjectiveValueOld() const
Get old objective value.
void setObjectiveValueOld(const scalar value)
Set old objective value.
label counter_
Optimisation cycle count.
void setConstaintsNumber(const label nConstraints)
Set the number of constraints.
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.
virtual ~updateMethod()=default
Destructor.
const scalarField & getConstraintValues() const
Get values of constraints.
label nConstraints() const
Get the number of constraints.
void modifyStep(const scalar multiplier)
Multiply step.
scalarField cumulativeCorrection_
Cumulative design variables correction throughout the optimisation loop.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-newton methods coupled with line search.
scalar eta_
Step multiplying the correction.
bool & initialEtaSet()
Return whether initial eta was set.
autoPtr< designVariables > & designVars_
Design variables.
word correctionFolder_
Folder storing the corrections to file.
SquareMatrix< scalar > outerProd(const scalarField &, const scalarField &)
void setObjectiveDeriv(const scalarField &derivs)
Set objective derivative.
virtual void computeCorrection()=0
Return the correction of the design variables.
void setGlobalSum(const bool useGlobalSum)
Set globalSum variable.
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.