56 <<
"Inconsistent dimensions for lowerBounds (" 58 <<
") and design variables (" 66 scalar lowerBound(
dict_.
get<scalar>(
"lowerBound"));
69 else if (lowerBoundPtr)
81 <<
"Inconsistent dimensions for upperBounds (" 83 <<
") and design variables (" 91 scalar upperBound(
dict_.
get<scalar>(
"upperBound"));
94 else if (upperBoundPtr)
103 Foam::designVariables::designVariables
106 const dictionary&
dict 112 activeDesignVariables_(0),
113 oldDesignVariables_(nullptr),
114 maxInitChange_(nullptr),
115 lowerBounds_(nullptr),
116 upperBounds_(nullptr)
119 if (
dict.found(
"maxInitChange"))
126 Foam::designVariables::designVariables
129 const dictionary&
dict,
136 activeDesignVariables_(0),
137 oldDesignVariables_(nullptr),
138 maxInitChange_(nullptr),
139 lowerBounds_(nullptr),
140 upperBounds_(nullptr)
143 if (
dict.found(
"maxInitChange"))
155 const dictionary&
dict 160 return autoPtr<designVariables>(
nullptr);
163 const word modelType(
dict.
get<word>(
"type"));
165 Info<<
"designVariables type : " << modelType <<
endl;
167 auto* ctorPtr = designVariablesConstructorTable(modelType);
175 *designVariablesConstructorTablePtr_
191 maxInitChange_.reset(
new scalar(dict_.get<scalar>(
"maxInitChange")));
212 if (!oldDesignVariables_)
217 oldDesignVariables_.ref() = getVars();
224 <<
"Reseting design variables" <<
endl;
225 getVars() = (oldDesignVariables_());
233 const wordList& adjointSolversNames,
virtual PtrList< scalarField > constraintDerivatives()
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void evolveNumber()
For design variables with a dynamic character (i.e. changing number), perform the evolution...
Base class for primal solvers.
virtual tmp< scalarField > constraintValues()
Design variables might add constraints related to themselves (e.g. linear combinations of the design ...
const autoPtr< scalarField > & lowerBounds() const
Get min bounds for the design variables.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void setInitialValues()
Set initial values of the design variables.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
#define FatalErrorInLookup(lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalError.
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
autoPtr< scalar > maxInitChange_
Maximum design variables' change in the first optimisation cycle.
void readBounds(autoPtr< scalar > lowerBoundPtr=nullptr, autoPtr< scalar > upperBoundPtr=nullptr)
Read bounds for design variables, if present.
virtual void resetDesignVariables()
Reset to the starting point of line search.
#define DebugInfo
Report an information message using Foam::Info.
virtual void addFvOptions(const PtrList< primalSolver > &primalSolver, const PtrList< adjointSolverManager > &adjointSolverManagers)
Add fvOptions depending on the design variables.
virtual const scalarField & getVars() const
Get the design variables.
label size() const noexcept
The number of elements in the container.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
autoPtr< scalarField > lowerBounds_
Lower bounds of the design variables.
virtual void storeDesignVariables()
Store design variables, as the starting point for line search.
virtual void postProcessSens(scalarField &objectiveSens, PtrList< scalarField > &constraintSens, const wordList &adjointSolversNames, bool isMaster)
Post process sensitivities if needed.
Abstract base class for defining design variables.
virtual void writeDesignVars()
Write useful quantities to files.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
autoPtr< scalarField > upperBounds_
Upper bounds of the design variables.
static autoPtr< designVariables > New(fvMesh &mesh, const dictionary &dict)
Return a reference to the selected design variables.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const autoPtr< scalarField > & upperBounds() const
Get max bounds for the design variables.
A class for managing temporary objects.
PtrList< adjointSolverManager > & adjointSolverManagers
static constexpr const zero Zero
Global zero (0)