Go to the documentation of this file.
49 void Foam::steadyOptimisation::updateOptTypeSource()
58 PtrList<adjointSolver>& adjointSolvers =
63 adjointSolvers[aI].updateOptTypeSource(
optType_->sourcePtr());
81 optType_->storeDesignVariables();
84 scalar meritFunction = optType_->computeMeritFunction();
88 const scalar dirDerivative =
89 optType_->meritFunctionDirectionalDerivative();
98 for (label iter = 0; iter < lineSrch->
maxIters(); ++iter)
100 Info<<
"\n- - - - - - - - - - - - - - -" <<
endl;
101 Info<<
"Line search iteration " << iter <<
endl;
102 Info<<
"- - - - - - - - - - - - - - -\n" <<
endl;
109 solvePrimalEquations();
112 meritFunction = optType_->computeMeritFunction();
118 Info<<
"Line search converged in " << iter + 1
119 <<
" iterations." <<
endl;
121 optType_->updateOldCorrection(scaledCorrection);
129 if (iter == lineSrch->
maxIters() - 1)
131 Info<<
"Line search reached max. number of iterations.\n"
132 <<
"Proceeding to the next optimisation cycle" <<
endl;
134 optType_->updateOldCorrection(scaledCorrection);
141 optType_->resetDesignVariables();
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());
228 if (optType_->getLineSearch())
240 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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool end()
Return true if end of optimisation run.
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.
PtrList< primalSolver > primalSolvers_
messageStream Info
Information stream (stdout output on master, null elsewhere)
void fixedStepUpdate()
Update design variables using a fixed step.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
void lineSearchUpdate()
Update design variables using a line-search.
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.
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)