Go to the documentation of this file.
68 directionalDeriv_(
Zero),
74 lineSearchDict_.getOrDefault<scalar>(
"prevMeritDeriv",
Zero)
76 initialStep_(
dict.getOrDefault<scalar>(
"initialStep", 1.)),
77 minStep_(
dict.getOrDefault<scalar>(
"minStep", 0.3)),
79 iter_(lineSearchDict_.getOrDefault<label>(
"iter", 0)),
80 maxIters_(
dict.getOrDefault<label>(
"maxIters", 4)),
81 extrapolateInitialStep_
85 "extrapolateInitialStep",
105 Info<<
"lineSearch type : " << modelType <<
endl;
107 if (modelType !=
"none")
109 auto* ctorPtr = dictionaryConstructorTable(modelType);
118 *dictionaryConstructorTablePtr_
122 lineSrch.
reset((ctorPtr(
dict, time)).ptr());
126 Info<<
"No line search method specified. "
127 <<
"Proceeding with constant step" <<
endl;
138 directionalDeriv_ = deriv;
139 stepUpdate_->setDeriv(deriv);
151 newMeritValue_ = value;
152 stepUpdate_->setNewMeritValue(value);
158 oldMeritValue_ = value;
159 stepUpdate_->setOldMeritValue(value);
165 if (extrapolateInitialStep_ && iter_ != 0)
170 step_ =
max(
min(step_*prevMeritDeriv_/directionalDeriv_, 1.), minStep_);
171 Info<<
"\n------- Computing initial step-------" <<
endl;
172 Info<<
"old dphi(0) " << prevMeritDeriv_ <<
endl;
173 Info<<
"dphi(0) " << directionalDeriv_ <<
endl;
174 Info<<
"Setting initial step value " << step_ <<
endl <<
endl;
178 step_ = initialStep_;
204 prevMeritDeriv_ = directionalDeriv_;
205 lineSearchDict_.add<scalar>(
"prevMeritDeriv", prevMeritDeriv_,
true);
206 lineSearchDict_.add<label>(
"iter", iter_,
true);
207 lineSearchDict_.regIOobject::writeObject
virtual void reset()
Reset step to initial value.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void setOldMeritValue(const scalar value)
Set old objective value.
void setNewMeritValue(const scalar value)
Set new objective value.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
static constexpr const zero Zero
Global zero (0)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
scalar step() const
Get current step.
virtual void setDeriv(const scalar deriv)
Set objective derivative.
virtual lineSearch & operator++()
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dictionary dict_
Subdict within updateMethod.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
label maxIters() const
Get max number of iterations.
void setDirection(const scalarField &direction)
Set direction.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static autoPtr< lineSearch > New(const dictionary &dict, const Time &time)
Return a reference to the selected turbulence model.
The IOstreamOption is a simple container for options an IOstream can normally have.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & coeffsDict()
Optional coeffs dict.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
virtual void updateStep()=0
Abstract base class for step update methods used in line search.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Abstract base class for line search methods.
defineTypeNameAndDebug(combustionModel, 0)