Go to the documentation of this file.
49 void Foam::steadyOptimisation::updateOptTypeSource()
58 PtrList<adjointSolver>& adjointSolvers =
63 adjointSolvers[aI].updateOptTypeSource(
optType_->sourcePtr());
76 optType_->storeDesignVariables();
79 scalar meritFunction = optType_->computeMeritFunction();
83 const scalar dirDerivative =
84 optType_->meritFunctionDirectionalDerivative();
95 Info<<
"\n- - - - - - - - - - - - - - -" <<
endl;
96 Info<<
"Line search iteration " << iter <<
endl;
97 Info<<
"- - - - - - - - - - - - - - -\n" <<
endl;
104 solvePrimalEquations();
107 meritFunction = optType_->computeMeritFunction();
113 Info<<
"Line search converged in " << iter + 1
114 <<
" iterations." <<
endl;
116 optType_->updateOldCorrection(scaledCorrection);
126 Info<<
"Line search reached max. number of iterations.\n"
127 <<
"Proceeding to the next optimisation cycle" <<
endl;
129 optType_->updateOldCorrection(scaledCorrection);
136 optType_->resetDesignVariables();
151 optType_->updateOldCorrection(
direction);
155 solvePrimalEquations();
177 updateOptTypeSource();
188 Info<<
"\n* * * * * * * * * * * * * * * * *" <<
endl;
189 Info<<
"Optimisation cycle " << time_.value() <<
endl;
190 Info<<
"* * * * * * * * * * * * * * * * *\n" <<
endl;
220 return (time_.timeIndex() != 1 && !
end());
233 if (lineSrch.
valid())
245 adjSolverManager.clearSensitivities();
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual void reset()
Reset step to initial value.
void setOldMeritValue(const scalar value)
Set old objective value.
void setNewMeritValue(const scalar value)
Set new objective value.
A class for managing temporary objects.
PtrList< adjointSolverManager > adjointSolverManagers_
scalar step() const
Get current step.
virtual void setDeriv(const scalar deriv)
Set objective derivative.
virtual bool update()
Whether to update the design variables.
virtual optimisationManager & operator++()
Prefix increment.
bool valid() const noexcept
True if the managed pointer is non-null.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool end()
Return true if end of optimisation run.
void lineSearchUpdate(scalarField &direction)
Update design variables using a line-search.
autoPtr< incompressible::optimisationType > optType_
#define forAll(list, i)
Loop across all elements in list.
label maxIters() const
Get max number of iterations.
void setDirection(const scalarField &direction)
Set direction.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
PtrList< primalSolver > primalSolvers_
messageStream Info
Information stream (uses stdout - output is on the master only)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
virtual bool converged()=0
Return the correction of the design variables.
Class for managing adjoint solvers, which may be more than one per operating point.
Macros for easy insertion into run-time selection tables.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Mesh data needed to do the Finite Volume discretisation.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual bool checkEndOfLoopAndUpdate()
Return true if end of optimisation run.
void fixedStepUpdate(scalarField &direction)
Update design variables using a fixed step.
virtual void updateStep()=0
virtual void updateDesignVariables()
static autoPtr< optimisationType > New(fvMesh &mesh, const dictionary &dict, PtrList< adjointSolverManager > &adjointSolverManagers)
Return a reference to the selected turbulence model.
Abstract base class for optimisation methods.
defineTypeNameAndDebug(combustionModel, 0)