72 <<
"Denominator of update too small. Keeping old Hessian" <<
endl;
81 if (counter_ < nSteepestDescent_)
83 Info<<
"Using steepest descent to update design variables" <<
endl;
84 for (
const label varI : activeDesignVars_)
86 correction_[varI] = -eta_*objectiveDerivatives_[varI];
92 activeDerivs.
map(objectiveDerivatives_, activeDesignVars_);
95 -etaHessian_*rightMult(Hessian_(), activeDerivs)
100 forAll(activeDesignVars_, varI)
102 correction_[activeDesignVars_[varI]] = activeCorrection[varI];
107 derivativesOld_ = objectiveDerivatives_;
108 correctionOld_ = correction_;
119 const label nConstraints,
126 coeffsDict(
type).getOrDefault<scalar>(
"ratioThreshold", 1
e-08)
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
dimensionedSymmTensor sqr(const dimensionedVector &dv)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const scalarField rightMult(const SquareMatrix< scalar > &, const scalarField &)
scalar ratioThreshold_
For stability check.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
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.
const dimensionedScalar e
Elementary charge.
Base class for quasi-Newton methods.
A class for handling words, derived from Foam::string.
autoPtr< SquareMatrix< scalar > > Hessian_
The Hessian or its inverse, depending on the deriving class.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
scalarField derivativesOld_
The previous derivatives.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
virtual void update()
Update design variables.
scalar globalSum(const scalarField &field)
Compute either global or local sum, based on globalSum flag.
void allocateHessian()
Allocate the Hessian matrix.
defineTypeNameAndDebug(combustionModel, 0)
scalarField objectiveDerivatives_
Derivatives of the objective functions.
#define WarningInFunction
Report a warning using Foam::Warning.
Mesh data needed to do the Finite Volume discretisation.
SquareMatrix< scalar > outerProd(const scalarField &, const scalarField &)
virtual void updateHessian()
Update approximation of the inverse Hessian.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)
scalarField correctionOld_
The previous correction.