39#ifndef designVariables_H
40#define designVariables_H
105 designVariables(
const designVariables&) =
delete;
108 void operator=(
const designVariables&) =
delete;
214 inline virtual bool resetEta()
const;
233 const wordList& adjointSolversNames,
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Abstract base class for adjoint-based sensitivities.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
autoPtr< scalarField > oldDesignVariables_
Copy of old design variables. Useful when performing line-search.
virtual void evolveNumber()
For design variables with a dynamic character (i.e. changing number), perform the evolution.
static autoPtr< designVariables > New(fvMesh &mesh, const dictionary &dict)
Return a reference to the selected design variables.
autoPtr< scalarField > upperBounds_
Upper bounds of the design variables.
autoPtr< scalar > maxInitChange_
Maximum design variables' change in the first optimisation cycle.
const autoPtr< scalarField > & upperBounds() const
Get max bounds for the design variables.
void setMaxInitChange(const scalar maxInitChange)
Set maxInitChange.
TypeName("designVariables")
Runtime type information.
virtual void resetDesignVariables()
Reset to the starting point of line search.
virtual bool globalSum() const =0
Whether to use global sum when computing matrix-vector products in update methods.
virtual PtrList< scalarField > constraintDerivatives()
scalarField & upperBoundsRef()
Get max bounds for the design variables.
bool isMaxInitChangeSet() const
Check whether the max. initial change of the design variables has been set.
virtual void addFvOptions(const PtrList< primalSolver > &primalSolver, const PtrList< adjointSolverManager > &adjointSolverManagers)
Add fvOptions depending on the design variables.
void readBounds(autoPtr< scalar > lowerBoundPtr=nullptr, autoPtr< scalar > upperBoundPtr=nullptr)
Read bounds for design variables, if present.
virtual const scalarField & getVars() const
Get the design variables.
scalarField & lowerBoundsRef()
Get min bounds for the design variables.
virtual tmp< scalarField > constraintValues()
Design variables might add constraints related to themselves (e.g. linear combinations of the design ...
autoPtr< scalarField > lowerBounds_
Lower bounds of the design variables.
virtual bool readDict(const dictionary &dict)
Read dictionary if changed.
declareRunTimeNewSelectionTable(autoPtr, designVariables, designVariables,(fvMesh &mesh, const dictionary &dict),(mesh, dict))
virtual bool resetEta() const
Trigger the recomputation of eta by updateMethod.
virtual void setInitialValues()
Set initial values of the design variables.
const labelList & activeDesignVariables() const
Return list of active design variables.
const autoPtr< scalarField > & lowerBounds() const
Get min bounds for the design variables.
labelList activeDesignVariables_
Which of the design variables will be updated.
virtual void update(scalarField &correction)=0
Update design variables based on a given correction.
virtual tmp< scalarField > assembleSensitivities(adjointSensitivity &sens)=0
Assemble sensitivity derivatives, by combining the part related to the primal and adjoint solution wi...
virtual void storeDesignVariables()
Store design variables, as the starting point for line search.
virtual ~designVariables()=default
Destructor.
virtual void postProcessSens(scalarField &objectiveSens, PtrList< scalarField > &constraintSens, const wordList &adjointSolversNames, bool isMaster)
Post process sensitivities if needed.
const autoPtr< scalar > & getMaxInitChange()
Get maxInitChange.
virtual void writeDesignVars()
Write useful quantities to files.
virtual scalar computeEta(scalarField &correction)=0
Compute eta if not set in the first step.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
Base class for primal solvers.
A class for managing temporary objects.
List< word > wordList
List of word.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< fvMatrix< Type > > correction(const fvMatrix< Type > &)
Return the correction form of the given matrix by subtracting the matrix multiplied by the current fi...
Macros to ease declaration of run-time selection tables.
#define declareRunTimeNewSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection for derived classes.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
PtrList< adjointSolverManager > & adjointSolverManagers
Forwards and collection of common volume field types.