11 #ifndef OOPS_ASSIMILATION_PRIMALMINIMIZER_H_ 12 #define OOPS_ASSIMILATION_PRIMALMINIMIZER_H_ 16 #include "eckit/config/Configuration.h" 21 #include "oops/util/Logger.h" 43 const std::string
classname()
const override = 0;
49 const int,
const double) = 0;
56 template<
typename MODEL>
58 int ninner = config.getInt(
"ninner");
59 double gnreduc = config.getDouble(
"gradient_norm_reduction");
61 bool runOnlineAdjTest =
false;
62 if (config.has(
"onlineDiagnostics")) {
63 const eckit::LocalConfiguration onlineDiag(config,
"onlineDiagnostics");
64 runOnlineAdjTest = onlineDiag.getBool(
"onlineAdjTest");
67 Log::info() << classname() <<
": max iter = " << ninner
68 <<
", requested norm reduction = " << gnreduc << std::endl;
71 Hessian_ hessian(J_, runOnlineAdjTest);
76 J_.computeGradientFG(rhs);
77 J_.jb().addGradientFG(rhs);
79 Log::info() << classname() <<
" rhs" << rhs << std::endl;
85 double reduc = this->solve(*dx, rhs, hessian, B, ninner, gnreduc);
87 Log::test() << classname() <<
": reduction in residual norm = " << reduc << std::endl;
88 Log::info() << classname() <<
" output" << *dx << std::endl;
97 #endif // OOPS_ASSIMILATION_PRIMALMINIMIZER_H_
ControlIncrement< MODEL > CtrlInc_
CostFunction< MODEL > CostFct_
CtrlInc_ * doMinimize(const eckit::Configuration &) override
PrimalMinimizer(const CostFct_ &J)
The namespace for the main oops code.
const std::string classname() const override=0
subroutine, public info(self)
Minimizer< MODEL > Minimizer_
HessianMatrix< MODEL > Hessian_
virtual double solve(CtrlInc_ &, const CtrlInc_ &, const Hessian_ &, const Bmat_ &, const int, const double)=0
A Minimizer knows how to minimize a cost function.