Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
updateMethod Class Referenceabstract

Abstract base class for optimisation methods. More...

Inheritance diagram for updateMethod:
Inheritance graph
[legend]
Collaboration diagram for updateMethod:
Collaboration graph
[legend]

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...
 
scalarFieldreturnCorrection ()
 Return the correction of the design variables. More...
 
void writeCorrection ()
 
virtual scalar computeMeritFunction ()
 Compute merit function. Could be different than the objective in the presence of constraints. More...
 
virtual scalar meritFunctionDirectionalDerivative ()
 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. More...
 
bool & initialEtaSet ()
 Return whether initial eta was set. More...
 
virtual void updateOldCorrection (const scalarField &oldCorrection)
 Update old correction. useful for quasi-newton methods coupled with line search. More...
 
virtual void write ()
 Write useful quantities to files. More...
 

Static Public Member Functions

static autoPtr< updateMethodNew (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 fvMeshmesh_
 
const dictionary dict_
 
IOdictionary optMethodIODict_
 Used to output values useful for continuation runs. More...
 
scalarField objectiveDerivatives_
 Derivatives of the objective functions. More...
 
PtrList< scalarFieldconstraintDerivatives_
 Derivatives of the constraints. More...
 
scalar objectiveValue_
 Objective value. More...
 
scalarField cValues_
 Constraint values. More...
 
scalarField correction_
 Design variables correction. More...
 
scalarField cumulativeCorrection_
 Cumulative design variables correction throughout the optimisation loop. More...
 
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...
 

Detailed Description

Abstract base class for optimisation methods.

Source files

Definition at line 50 of file updateMethod.H.

Constructor & Destructor Documentation

◆ updateMethod()

updateMethod ( const fvMesh mesh,
const dictionary dict 
)

Construct from components.

Definition at line 194 of file updateMethod.C.

References dict, UPstream::master(), Foam::mkDir(), and dictionary::readIfPresent().

Here is the call graph for this function:

◆ ~updateMethod()

virtual ~updateMethod ( )
virtualdefault

Destructor.

Member Function Documentation

◆ leftMult()

const Foam::scalarField leftMult ( const scalarField s,
const SquareMatrix< scalar > &  m 
)
protected

Definition at line 38 of file updateMethod.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Matrix< Form, Type >::n(), s, and Foam::Zero.

Here is the call graph for this function:

◆ rightMult()

const Foam::scalarField rightMult ( const SquareMatrix< scalar > &  m,
const scalarField s 
)
protected

Definition at line 65 of file updateMethod.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, Matrix< Form, Type >::n(), s, and Foam::Zero.

Here is the call graph for this function:

◆ outerProd()

Foam::SquareMatrix< Foam::scalar > outerProd ( const scalarField a,
const scalarField b 
)
protected

Definition at line 92 of file updateMethod.C.

References Foam::abort(), Foam::constant::physicoChemical::b, Foam::FatalError, FatalErrorInFunction, forAll, UList< T >::size(), and Foam::Zero.

Here is the call graph for this function:

◆ inv()

Foam::SquareMatrix< Foam::scalar > inv ( SquareMatrix< scalar >  A)
protected

Definition at line 118 of file updateMethod.C.

References A, DebugInfo, Foam::endl(), invA(), Foam::LUBacksubstitute(), Foam::LUDecompose(), n, and Foam::Zero.

Referenced by constraintProjection::computeCorrection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalSum() [1/2]

Foam::scalar globalSum ( const scalarField field)
protected

Compute either global or local sum, based on globalSum flag.

Definition at line 168 of file updateMethod.C.

References field(), Foam::gSum(), and Foam::sum().

Referenced by constraintProjection::computeCorrection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ globalSum() [2/2]

Foam::scalar globalSum ( tmp< scalarField > &  tfield)
protected

Compute either global or local sum, based on globalSum flag.

Definition at line 183 of file updateMethod.C.

References tmp< T >::clear().

Here is the call graph for this function:

◆ coeffsDict()

Foam::dictionary coeffsDict ( )
protected

Return optional dictionary with parameters specific to each method.

Definition at line 247 of file updateMethod.C.

References dictionary::subOrEmptyDict(), and Foam::type().

Referenced by SQP::SQP(), and SR1::SR1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeName()

TypeName ( "updateMethod"  )

Runtime type information.

◆ declareRunTimeSelectionTable()

declareRunTimeSelectionTable ( autoPtr  ,
updateMethod  ,
dictionary  ,
(const fvMesh &mesh, const dictionary &dict ,
(mesh, dict  
)

◆ New()

Foam::autoPtr< Foam::updateMethod > New ( const fvMesh mesh,
const dictionary dict 
)
static

Return a reference to the selected turbulence model.

Definition at line 256 of file updateMethod.C.

References dict, Foam::endl(), Foam::exit(), Foam::FatalIOError, FatalIOErrorInLookup, dictionary::get(), Foam::Info, and mesh.

Here is the call graph for this function:

◆ setObjectiveDeriv()

void setObjectiveDeriv ( const scalarField derivs)

Set objective derivative.

Definition at line 284 of file updateMethod.C.

◆ setConstraintDeriv()

void setConstraintDeriv ( const PtrList< scalarField > &  derivs)

Set constraints derivative.

Definition at line 291 of file updateMethod.C.

◆ setObjectiveValue()

void setObjectiveValue ( const scalar  value)

Set constraints derivative.

Definition at line 299 of file updateMethod.C.

◆ setConstraintValues()

void setConstraintValues ( const scalarField values)

Set constraints derivative.

Definition at line 305 of file updateMethod.C.

References Foam::HashTableOps::values().

Here is the call graph for this function:

◆ setStep()

void setStep ( const scalar  eta)

Set step for optimisation methods.

Definition at line 311 of file updateMethod.C.

◆ setGlobalSum()

void setGlobalSum ( const bool  useGlobalSum)

Set globalSum variable.

Should be set by the optimisationType owining the updateMethod

Definition at line 317 of file updateMethod.C.

◆ computeCorrection()

virtual void computeCorrection ( )
pure virtual

Return the correction of the design variables.

Implemented in SQP, LBFGS, DBFGS, BFGS, SR1, conjugateGradient, constrainedOptimisationMethod, constraintProjection, and steepestDescent.

◆ returnCorrection()

Foam::scalarField & returnCorrection ( )

Return the correction of the design variables.

const scalarField& returnCorrection() const;

Return the correction of the design variables

Definition at line 323 of file updateMethod.C.

◆ writeCorrection()

void writeCorrection ( )

Definition at line 330 of file updateMethod.C.

References Foam::endl(), forAll, UPstream::master(), and Foam::Zero.

Here is the call graph for this function:

◆ computeMeritFunction()

Foam::scalar computeMeritFunction ( )
virtual

Compute merit function. Could be different than the objective in the presence of constraints.

Reimplemented in SQP.

Definition at line 364 of file updateMethod.C.

◆ meritFunctionDirectionalDerivative()

Foam::scalar meritFunctionDirectionalDerivative ( )
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 370 of file updateMethod.C.

◆ initialEtaSet()

bool & initialEtaSet ( )

Return whether initial eta was set.

Definition at line 376 of file updateMethod.C.

◆ updateOldCorrection()

void updateOldCorrection ( const scalarField oldCorrection)
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 383 of file updateMethod.C.

Referenced by SR1::updateOldCorrection(), BFGS::updateOldCorrection(), DBFGS::updateOldCorrection(), LBFGS::updateOldCorrection(), and SQP::updateOldCorrection().

Here is the caller graph for this function:

◆ write()

void write ( )
virtual

Write useful quantities to files.

Reimplemented in SQP, LBFGS, DBFGS, BFGS, SR1, and conjugateGradient.

Definition at line 391 of file updateMethod.C.

References IOstreamOption::ASCII.

Referenced by conjugateGradient::write(), SR1::write(), BFGS::write(), DBFGS::write(), LBFGS::write(), and SQP::write().

Here is the caller graph for this function:

Member Data Documentation

◆ mesh_

const fvMesh& mesh_
protected

Definition at line 56 of file updateMethod.H.

◆ dict_

const dictionary dict_
protected

Definition at line 58 of file updateMethod.H.

◆ optMethodIODict_

IOdictionary optMethodIODict_
protected

Used to output values useful for continuation runs.

Definition at line 63 of file updateMethod.H.

◆ objectiveDerivatives_

scalarField objectiveDerivatives_
protected

◆ constraintDerivatives_

PtrList<scalarField> constraintDerivatives_
protected

Derivatives of the constraints.

Definition at line 73 of file updateMethod.H.

Referenced by constraintProjection::computeCorrection().

◆ objectiveValue_

scalar objectiveValue_
protected

Objective value.

Definition at line 78 of file updateMethod.H.

◆ cValues_

scalarField cValues_
protected

Constraint values.

Definition at line 83 of file updateMethod.H.

Referenced by constraintProjection::computeCorrection().

◆ correction_

scalarField correction_
protected

Design variables correction.

Definition at line 88 of file updateMethod.H.

Referenced by steepestDescent::computeCorrection(), and constraintProjection::computeCorrection().

◆ cumulativeCorrection_

scalarField cumulativeCorrection_
protected

Cumulative design variables correction throughout the optimisation loop.

Definition at line 94 of file updateMethod.H.

◆ eta_

scalar eta_
protected

Step multiplying the correction.

Definition at line 99 of file updateMethod.H.

Referenced by steepestDescent::computeCorrection(), and constraintProjection::computeCorrection().

◆ initialEtaSet_

bool initialEtaSet_
protected

Is initially set?

Definition at line 104 of file updateMethod.H.

◆ correctionFolder_

word correctionFolder_
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 115 of file updateMethod.H.

◆ globalSum_

bool globalSum_
protected

Whether to use gSum or sum in the inner products.

Definition at line 120 of file updateMethod.H.


The documentation for this class was generated from the following files: