60Foam::quasiNewton::quasiNewton
65 const label nConstraints,
70 etaHessian_(coeffsDict(
type).getOrDefault<scalar>(
"etaHessian", 1)),
73 coeffsDict(
type).getOrDefault<label>(
"nSteepestDescent", 1)
77 coeffsDict(
type).getOrDefault<bool>(
"scaleFirstHessian", false)
82 readOrZeroField(
"derivativesOld", objectiveDerivatives_.size())
116 forAll(designVars_().activeDesignVariables(), iDV)
122 derivativesOld_.writeEntry(
"derivativesOld",
os);
123 correctionOld_.writeEntry(
"correctionOld",
os);
Macros for easy insertion into run-time selection tables.
label size() const noexcept
The number of elements in list.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
void size(const label n)
Older name for setAddressableSize.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
void writeEntry(Ostream &os) const
Write sub-dictionary with its dictName as its header.
Mesh data needed to do the Finite Volume discretisation.
Base class for quasi-Newton methods.
void computeCorrection()
Compute design variables correction.
scalarField correctionOld_
The previous correction.
autoPtr< SquareMatrix< scalar > > Hessian_
The Hessian or its inverse, depending on the deriving class.
virtual bool writeData(Ostream &os) const
Write useful quantities to files.
label nSteepestDescent_
Number of first steepest descent steps.
virtual void updateHessian()=0
Update approximation of the inverse Hessian.
scalar etaHessian_
Step for the Newton method.
bool scaleFirstHessian_
Scale the initial unitary Hessian approximation.
scalarField derivativesOld_
The previous derivatives.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-Newton methods coupled with line search.
void allocateHessian()
Allocate the Hessian matrix.
Abstract base class for optimisation methods.
scalarField objectiveDerivatives_
Derivatives of the objective functions.
scalarField correction_
Design variables correction.
dictionary coeffsDict(const word &type) const
Return optional dictionary with parameters specific to each method.
virtual bool writeData(Ostream &os) const
Write continuation data under uniform.
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...
const labelList & activeDesignVars_
Map to active design variables.
label counter_
Optimisation cycle count.
label nConstraints() const
Get the number of constraints.
virtual void updateOldCorrection(const scalarField &oldCorrection)
Update old correction. Useful for quasi-newton methods coupled with line search.
autoPtr< designVariables > & designVars_
Design variables.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
static const Identity< scalar > I
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
#define forAll(list, i)
Loop across all elements in list.