11 #ifndef OOPS_ASSIMILATION_DRMINIMIZER_H_ 12 #define OOPS_ASSIMILATION_DRMINIMIZER_H_ 17 #include <boost/scoped_ptr.hpp> 19 #include "eckit/config/Configuration.h" 26 #include "oops/util/dot_product.h" 27 #include "oops/util/formats.h" 28 #include "oops/util/Logger.h" 54 const std::string
classname()
const override = 0;
60 const double,
const double,
61 const int,
const double) = 0;
65 std::vector<CtrlInc_>
dxh_;
71 template<
typename MODEL>
73 int ninner = config.getInt(
"ninner");
74 double gnreduc = config.getDouble(
"gradient_norm_reduction");
76 bool runOnlineAdjTest =
false;
77 if (config.has(
"onlineDiagnostics")) {
78 const eckit::LocalConfiguration onlineDiag(config,
"onlineDiagnostics");
79 runOnlineAdjTest = onlineDiag.getBool(
"onlineAdjTest");
83 gradJb_.reset(
new CtrlInc_(J_.jb()));
85 gradJb_.reset(
new CtrlInc_(J_.jb().resolution(), *gradJb_));
89 Log::info() << classname() <<
": max iter = " << ninner
90 <<
", requested norm reduction = " << gnreduc << std::endl;
94 const HtRinvH_ HtRinvH(J_, runOnlineAdjTest);
99 J_.computeGradientFG(rhs);
100 J_.jb().addGradientFG(rhs, *gradJb_);
102 Log::info() << classname() <<
" rhs" << rhs << std::endl;
111 const double costJ0Jb = costJ0Jb_;
112 const double costJ0JoJc = J_.getCostJoJc();
115 double reduc = this->solve(*dx, dxh, rhs, B, HtRinvH, costJ0Jb, costJ0JoJc, ninner, gnreduc);
117 Log::test() << classname() <<
": reduction in residual norm = " << reduc << std::endl;
118 Log::info() << classname() <<
" output increment:" << *dx << std::endl;
125 costJ0Jb_ += 0.5 * dot_product(*dx, dxh);
126 for (
unsigned int jouter = 1; jouter < dxh_.size(); ++jouter) {
128 costJ0Jb_ += dot_product(*dx, dxhtmp);
138 #endif // OOPS_ASSIMILATION_DRMINIMIZER_H_
HtRinvHMatrix< MODEL > HtRinvH_
Geometry_ geometry() const
Get geometry.
const std::string classname() const override=0
std::vector< CtrlInc_ > dxh_
ControlIncrement< MODEL > CtrlInc_
The namespace for the main oops code.
subroutine, public info(self)
Minimizer< MODEL > Minimizer_
DRMinimizer(const CostFct_ &J)
virtual double solve(CtrlInc_ &, CtrlInc_ &, CtrlInc_ &, const Bmat_ &, const HtRinvH_ &, const double, const double, const int, const double)=0
CtrlInc_ * doMinimize(const eckit::Configuration &) override
A Minimizer knows how to minimize a cost function.
CostFunction< MODEL > CostFct_
DR (Derber and Rosati) Minimizers.
boost::scoped_ptr< CtrlInc_ > gradJb_