11 #ifndef OOPS_ASSIMILATION_COSTFCT4DVAR_H_ 12 #define OOPS_ASSIMILATION_COSTFCT4DVAR_H_ 14 #include "eckit/config/LocalConfiguration.h" 29 #include "oops/util/DateTime.h" 30 #include "oops/util/Duration.h" 31 #include "oops/util/Logger.h" 60 const bool idModel =
false)
const override;
63 const bool idModel =
false)
const override;
87 template<
typename MODEL>
92 Log::trace() <<
"CostFct4DVar:CostFct4DVar" << std::endl;
93 windowLength_ = util::Duration(config.getString(
"window_length"));
94 windowBegin_ = util::DateTime(config.getString(
"window_begin"));
97 Log::trace() <<
"CostFct4DVar constructed" << std::endl;
102 template <
typename MODEL>
106 ASSERT(
xb.state().checkStatesNumber(1));
107 return new CostJb3D<MODEL>(jbConf, resol, ctlvars_, windowLength_,
xb.state()[0]);
112 template <
typename MODEL>
114 return new CostJo<MODEL>(joConf, windowBegin_, windowEnd_, util::Duration(0));
119 template <
typename MODEL>
122 const eckit::LocalConfiguration jcdfi(jcConf,
"jcdfi");
123 const util::DateTime
vt(windowBegin_ + windowLength_/2);
129 template <
typename MODEL>
133 ASSERT(xx.
state()[0].validTime() == windowBegin_);
134 State_ xm(xx.
state()[0].geometry(), CostFct_::getModel().variables(), windowBegin_);
136 CostFct_::getModel().forecast(xm, xx.
modVar(), windowLength_, post);
138 ASSERT(xx.
state()[0].validTime() == windowEnd_);
143 template<
typename MODEL>
145 const eckit::Configuration & innerConf,
147 Log::trace() <<
"CostFct4DVar::doLinearize start" << std::endl;
148 eckit::LocalConfiguration
conf(innerConf,
"linearmodel");
151 an2model_->setInputVariables(ctlvars_);
152 an2model_->setOutputVariables(CostFct_::getTLM().variables());
153 Log::trace() <<
"CostFct4DVar::doLinearize done" << std::endl;
158 template <
typename MODEL>
162 const bool idModel)
const {
163 ASSERT(dx.
state()[0].validTime() == windowBegin_);
165 an2model_->multiply(dx.
state()[0], dxmodel);
166 CostFct_::getTLM().forecastTL(dxmodel, dx.
modVar(), windowLength_, post, cost, idModel);
167 an2model_->multiplyInverse(dxmodel, dx.
state()[0]);
168 ASSERT(dx.
state()[0].validTime() == windowEnd_);
173 template <
typename MODEL>
182 template <
typename MODEL>
186 const bool idModel)
const {
187 ASSERT(dx.
state()[0].validTime() == windowEnd_);
189 an2model_->multiplyInverseAD(dx.
state()[0], dxmodel);
190 CostFct_::getTLM().forecastAD(dxmodel, dx.
modVar(), windowLength_, post, cost, idModel);
191 an2model_->multiplyAD(dxmodel, dx.
state()[0]);
192 ASSERT(dx.
state()[0].validTime() == windowBegin_);
197 template<
typename MODEL>
208 #endif // OOPS_ASSIMILATION_COSTFCT4DVAR_H_
ControlVariable< MODEL > CtrlVar_
State4D_ & state()
Get state control variable.
Strong Constraint 4D-Var Cost Function.
ObsAuxIncr_ & obsVar()
Get augmented observation control variable.
ModelAuxIncr_ & modVar()
Get augmented model control variable.
LinearVariableChangeBase< MODEL > ChangeVar_
CostFct4DVar(const eckit::Configuration &, const Geometry_ &, const Model_ &)
void doLinearize(const Geometry_ &, const eckit::Configuration &, const CtrlVar_ &, const CtrlVar_ &) override
CostFunction< MODEL > CostFct_
Encapsulates the model state.
void zeroAD(CtrlInc_ &) const override
Geometry< MODEL > Geometry_
ControlIncrement< MODEL > CtrlInc_
void runADJ(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
The namespace for the main oops code.
void runTLM(CtrlInc_ &, PostProcessorTLAD< MODEL > &, PostProcessor< Increment_ >, const bool idModel=false) const override
CostTermBase< MODEL > * newJc(const eckit::Configuration &, const Geometry_ &) const override
ModelAux_ & modVar()
Get augmented model control variable.
util::DateTime windowEnd_
real, dimension(:,:,:), allocatable vt
void runNL(CtrlVar_ &, PostProcessor< State_ > &) const override
CostJo< MODEL > * newJo(const eckit::Configuration &) const override
util::Duration windowLength_
Increment4D_ & state()
Get state control variable.
Increment< MODEL > Increment_
LinearVariableChangeFactory Factory.
Control model post processing.
Base class for generic variable transform.
Encapsulates the nonlinear forecast model.
void addIncr(CtrlVar_ &, const CtrlInc_ &, PostProcessor< Increment_ > &) const override
util::DateTime windowBegin_
Increment Class: Difference between two states.
Base Class for Cost Function Terms.
Geometry_ geometry() const
Get geometry.
boost::scoped_ptr< ChangeVar_ > an2model_
bool checkStatesNumber(const unsigned int nn) const
Get model space control variable.
CostJb3D< MODEL > * newJb(const eckit::Configuration &, const Geometry_ &, const CtrlVar_ &) const override
Control model post processing.
void setupTerms(const eckit::Configuration &)