39 #ifndef designVariables_H 40 #define designVariables_H 56 class adjointSensitivity;
214 inline virtual bool resetEta()
const;
233 const wordList& adjointSolversNames,
virtual PtrList< scalarField > constraintDerivatives()
labelList activeDesignVariables_
Which of the design variables will be updated.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
declareRunTimeNewSelectionTable(autoPtr, designVariables, designVariables,(fvMesh &mesh, const dictionary &dict),(mesh, dict))
scalarField & upperBoundsRef()
Get max bounds for the design variables.
virtual tmp< scalarField > assembleSensitivities(adjointSensitivity &sens)=0
Assemble sensitivity derivatives, by combining the part related to the primal and adjoint solution wi...
const autoPtr< scalar > & getMaxInitChange()
Get maxInitChange.
Forwards and collection of common volume field types.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Abstract base class for adjoint-based sensitivities.
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.
bool isMaxInitChangeSet() const
Check whether the max. initial change of the design variables has been set.
virtual void setInitialValues()
Set initial values of the design variables.
virtual ~designVariables()=default
Destructor.
virtual void update(scalarField &correction)=0
Update design variables based on a given correction.
virtual bool globalSum() const =0
Whether to use global sum when computing matrix-vector products in update methods.
autoPtr< scalarField > oldDesignVariables_
Copy of old design variables. Useful when performing line-search.
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
const labelList & activeDesignVariables() const
Return list of active design variables.
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.
void setMaxInitChange(const scalar maxInitChange)
Set maxInitChange.
virtual void resetDesignVariables()
Reset to the starting point of line search.
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.
scalarField & lowerBoundsRef()
Get min bounds for the design variables.
TypeName("designVariables")
Runtime type information.
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...
Mesh data needed to do the Finite Volume discretisation.
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.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
virtual scalar computeEta(scalarField &correction)=0
Compute eta if not set in the first step.
Macros to ease declaration of run-time selection tables.
virtual bool resetEta() const
Trigger the recomputation of eta by updateMethod.
const autoPtr< scalarField > & upperBounds() const
Get max bounds for the design variables.
A class for managing temporary objects.
PtrList< adjointSolverManager > & adjointSolverManagers