11 #ifndef OOPS_ASSIMILATION_DRIPCGMINIMIZER_H_ 12 #define OOPS_ASSIMILATION_DRIPCGMINIMIZER_H_ 24 #include "oops/util/dot_product.h" 25 #include "oops/util/formats.h" 26 #include "oops/util/Logger.h" 80 const std::string
classname()
const override {
return "DRIPCGMinimizer";}
86 const double,
const double,
const int,
const double)
override;
93 template<
typename MODEL>
100 template<
typename MODEL>
103 const double costJ0Jb,
const double costJ0JoJc,
104 const int maxiter,
const double tolerance) {
113 std::vector<CtrlInc_> vvecs;
114 std::vector<CtrlInc_> zvecs;
115 std::vector<double> scals;
117 lmp_.multiply(rr, sh);
120 double dotRr0 = dot_product(rr, rr);
121 double dotSr0 = dot_product(rr, ss);
122 double normReduction = 1.0;
123 double rdots = dotSr0;
124 double rdots_old = dotSr0;
128 scals.push_back(1.0/dotSr0);
131 for (
int jiter = 0; jiter < maxiter; ++jiter) {
132 Log::info() <<
" DRIPCG Starting Iteration " << jiter+1 << std::endl;
139 double beta = -dot_product(ss, dr)/rdots_old;
153 double rho = dot_product(pp, ap);
161 for (
int jj = 0; jj < jiter; ++jj) {
162 double proj = scals[jj] * dot_product(rr, zvecs[jj]);
163 rr.
axpy(-proj, vvecs[jj]);
166 lmp_.multiply(rr, sh);
170 rdots = dot_product(rr, ss);
171 normReduction = sqrt(dot_product(rr, rr)/dotRr0);
173 Log::info() <<
"DRIPCG end of iteration " << jiter+1 <<
". Norm reduction= " 174 << util::full_precision(normReduction) << std::endl << std::endl;
177 lmp_.push(pp, ph, ap,
rho);
180 Log::info() <<
"DRIPCG: Achieved required reduction in residual norm." << std::endl;
186 scals.push_back(1.0/rdots);
192 return normReduction;
199 #endif // OOPS_ASSIMILATION_DRIPCGMINIMIZER_H_
const std::string classname() const override
QNewtonLMP< CtrlInc_, Bmat_ > lmp_
ControlIncrement< MODEL > CtrlInc_
Derber-Rosati IPCG Minimizer.
The namespace for the main oops code.
HtRinvHMatrix< MODEL > HtRinvH_
void multiply(const CtrlInc_ &dx, CtrlInc_ &dz) const
subroutine, public info(self)
DRIPCGMinimizer(const eckit::Configuration &, const CostFct_ &)
real(fp), parameter, public tolerance
CostFunction< MODEL > CostFct_
DR (Derber and Rosati) Minimizers.
void axpy(const double, const ControlIncrement &)
void multiply(const CtrlInc_ &x, CtrlInc_ &bx) const
double solve(CtrlInc_ &, CtrlInc_ &, CtrlInc_ &, const Bmat_ &, const HtRinvH_ &, const double, const double, const int, const double) override