Abstract base class for optimisation methods. More...
Public Member Functions | |
TypeName ("updateMethod") | |
Runtime type information. More... | |
declareRunTimeSelectionTable (autoPtr, updateMethod, dictionary,(const fvMesh &mesh, const dictionary &dict),(mesh, dict)) | |
updateMethod (const fvMesh &mesh, const dictionary &dict) | |
Construct from components. More... | |
virtual | ~updateMethod ()=default |
Destructor. More... | |
void | setObjectiveDeriv (const scalarField &derivs) |
Set objective derivative. More... | |
void | setConstraintDeriv (const PtrList< scalarField > &derivs) |
Set constraints derivative. More... | |
void | setObjectiveValue (const scalar value) |
Set constraints derivative. More... | |
void | setConstraintValues (const scalarField &values) |
Set constraints derivative. More... | |
void | setStep (const scalar eta) |
Set step for optimisation methods. More... | |
void | setGlobalSum (const bool useGlobalSum) |
Set globalSum variable. More... | |
virtual void | computeCorrection ()=0 |
Return the correction of the design variables. More... | |
scalarField & | returnCorrection () |
Return the correction of the design variables. More... | |
void | writeCorrection () |
virtual scalar | computeMeritFunction () |
virtual scalar | meritFunctionDirectionalDerivative () |
bool & | initialEtaSet () |
Return whether initial eta was set. More... | |
virtual void | updateOldCorrection (const scalarField &oldCorrection) |
virtual void | write () |
Write useful quantities to files. More... | |
Static Public Member Functions | |
static autoPtr< updateMethod > | New (const fvMesh &mesh, const dictionary &dict) |
Return a reference to the selected turbulence model. More... | |
Protected Member Functions | |
const scalarField | leftMult (const scalarField &, const SquareMatrix< scalar > &) |
const scalarField | rightMult (const SquareMatrix< scalar > &, const scalarField &) |
SquareMatrix< scalar > | outerProd (const scalarField &, const scalarField &) |
SquareMatrix< scalar > | inv (SquareMatrix< scalar > A) |
scalar | globalSum (const scalarField &field) |
Compute either global or local sum, based on globalSum flag. More... | |
scalar | globalSum (tmp< scalarField > &tfield) |
Compute either global or local sum, based on globalSum flag. More... | |
dictionary | coeffsDict () |
Return optional dictionary with parameters specific to each method. More... | |
Protected Attributes | |
const fvMesh & | mesh_ |
const dictionary | dict_ |
IOdictionary | optMethodIODict_ |
Used to output values useful for continuation runs. More... | |
scalarField | objectiveDerivatives_ |
Derivatives of the objective functions. More... | |
PtrList< scalarField > | constraintDerivatives_ |
Derivatives of the constraints. More... | |
scalar | objectiveValue_ |
Objective value. More... | |
scalarField | cValues_ |
Constraint values. More... | |
scalarField | correction_ |
Design variables correction. More... | |
scalarField | cumulativeCorrection_ |
scalar | eta_ |
Step multiplying the correction. More... | |
bool | initialEtaSet_ |
Is initially set? More... | |
word | correctionFolder_ |
Folder storing the corrections to file. More... | |
bool | globalSum_ |
Whether to use gSum or sum in the inner products. More... | |
Abstract base class for optimisation methods.
Definition at line 54 of file updateMethod.H.
updateMethod | ( | const fvMesh & | mesh, |
const dictionary & | dict | ||
) |
Construct from components.
Definition at line 201 of file updateMethod.C.
References dict, UPstream::master(), Foam::mkDir(), and dictionary::readIfPresent().
|
virtualdefault |
Destructor.
|
protected |
Definition at line 45 of file updateMethod.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Matrix< Form, Type >::n(), s, and Foam::Zero.
|
protected |
Definition at line 72 of file updateMethod.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Matrix< Form, Type >::n(), s, and Foam::Zero.
|
protected |
Definition at line 99 of file updateMethod.C.
References Foam::abort(), Foam::constant::physicoChemical::b, Foam::FatalError, FatalErrorInFunction, forAll, and Foam::Zero.
|
protected |
Definition at line 125 of file updateMethod.C.
References A, DebugInfo, Foam::endl(), invA(), Foam::LUBacksubstitute(), Foam::LUDecompose(), n, and Foam::Zero.
Referenced by constraintProjection::computeCorrection().
|
protected |
Compute either global or local sum, based on globalSum flag.
Definition at line 175 of file updateMethod.C.
References field(), Foam::gSum(), and Foam::sum().
Referenced by constraintProjection::computeCorrection().
|
protected |
Compute either global or local sum, based on globalSum flag.
Definition at line 190 of file updateMethod.C.
References tmp< T >::clear().
|
protected |
Return optional dictionary with parameters specific to each method.
Definition at line 254 of file updateMethod.C.
References dictionary::subOrEmptyDict(), and Foam::type().
Referenced by SQP::SQP(), and SR1::SR1().
TypeName | ( | "updateMethod" | ) |
Runtime type information.
declareRunTimeSelectionTable | ( | autoPtr | , |
updateMethod | , | ||
dictionary | , | ||
(const fvMesh &mesh, const dictionary &dict) | , | ||
(mesh, dict) | |||
) |
|
static |
Return a reference to the selected turbulence model.
Definition at line 263 of file updateMethod.C.
References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, dictionary::get(), Foam::Info, and mesh.
void setObjectiveDeriv | ( | const scalarField & | derivs | ) |
Set objective derivative.
Definition at line 291 of file updateMethod.C.
void setConstraintDeriv | ( | const PtrList< scalarField > & | derivs | ) |
Set constraints derivative.
Definition at line 298 of file updateMethod.C.
void setObjectiveValue | ( | const scalar | value | ) |
Set constraints derivative.
Definition at line 306 of file updateMethod.C.
void setConstraintValues | ( | const scalarField & | values | ) |
Set constraints derivative.
Definition at line 312 of file updateMethod.C.
References Foam::HashTableOps::values().
void setStep | ( | const scalar | eta | ) |
Set step for optimisation methods.
Definition at line 318 of file updateMethod.C.
void setGlobalSum | ( | const bool | useGlobalSum | ) |
Set globalSum variable.
Should be set by the optimisationType owining the updateMethod
Definition at line 324 of file updateMethod.C.
|
pure virtual |
Return the correction of the design variables.
Implemented in constrainedOptimisationMethod, SQP, LBFGS, DBFGS, BFGS, SR1, conjugateGradient, constraintProjection, and steepestDescent.
Foam::scalarField & returnCorrection | ( | ) |
Return the correction of the design variables.
const scalarField& returnCorrection() const; Return the correction of the design variables
Definition at line 330 of file updateMethod.C.
void writeCorrection | ( | ) |
Definition at line 337 of file updateMethod.C.
References Foam::endl(), forAll, UPstream::master(), and Foam::Zero.
|
virtual |
Compute merit function. Could be different than the objective in the presence of constraints
Reimplemented in SQP.
Definition at line 371 of file updateMethod.C.
|
virtual |
Directional derivative of the merit function, in the direction of the correction. Could be different than the objective directional derivative in the presence of constraints
Reimplemented in SQP.
Definition at line 377 of file updateMethod.C.
bool & initialEtaSet | ( | ) |
Return whether initial eta was set.
Definition at line 383 of file updateMethod.C.
|
virtual |
Update old correction. useful for quasi-newton methods coupled with line search
Reimplemented in SQP, LBFGS, DBFGS, BFGS, SR1, and conjugateGradient.
Definition at line 390 of file updateMethod.C.
Referenced by BFGS::updateOldCorrection(), SR1::updateOldCorrection(), DBFGS::updateOldCorrection(), LBFGS::updateOldCorrection(), and SQP::updateOldCorrection().
|
virtual |
Write useful quantities to files.
Reimplemented in SQP, LBFGS, DBFGS, BFGS, SR1, and conjugateGradient.
Definition at line 398 of file updateMethod.C.
References IOstreamOption::ASCII.
Referenced by conjugateGradient::write(), BFGS::write(), SR1::write(), DBFGS::write(), LBFGS::write(), and SQP::write().
|
protected |
Definition at line 60 of file updateMethod.H.
|
protected |
Definition at line 62 of file updateMethod.H.
|
protected |
Used to output values useful for continuation runs.
Definition at line 65 of file updateMethod.H.
|
protected |
Derivatives of the objective functions.
Definition at line 68 of file updateMethod.H.
Referenced by conjugateGradient::allocateFields(), SR1::allocateMatrices(), DBFGS::allocateMatrices(), LBFGS::allocateMatrices(), BFGS::allocateMatrices(), steepestDescent::computeCorrection(), and constraintProjection::computeCorrection().
|
protected |
Derivatives of the constraints.
Definition at line 71 of file updateMethod.H.
Referenced by constraintProjection::computeCorrection().
|
protected |
Objective value.
Definition at line 74 of file updateMethod.H.
|
protected |
Constraint values.
Definition at line 77 of file updateMethod.H.
Referenced by constraintProjection::computeCorrection().
|
protected |
Design variables correction.
Definition at line 80 of file updateMethod.H.
Referenced by steepestDescent::computeCorrection(), and constraintProjection::computeCorrection().
|
protected |
Cumulative design variables correction throughout the optimisation loop
Definition at line 84 of file updateMethod.H.
|
protected |
Step multiplying the correction.
Definition at line 87 of file updateMethod.H.
Referenced by steepestDescent::computeCorrection(), and constraintProjection::computeCorrection().
|
protected |
Is initially set?
Definition at line 90 of file updateMethod.H.
|
protected |
Folder storing the corrections to file.
For some optimisation methods with a very high number of design variables (e.g. topology), it doesn't make much sense to write all updates in the updateMethodDict. Hence, a separate file is used to write the corrections, in case they are needed for post-processing
Definition at line 98 of file updateMethod.H.
|
protected |
Whether to use gSum or sum in the inner products.
Definition at line 101 of file updateMethod.H.