11 #ifndef OOPS_ASSIMILATION_COSTJCDFI_H_ 12 #define OOPS_ASSIMILATION_COSTJCDFI_H_ 14 #include <boost/pointer_cast.hpp> 15 #include <boost/scoped_ptr.hpp> 16 #include <boost/shared_ptr.hpp> 18 #include "eckit/config/LocalConfiguration.h" 32 #include "oops/util/DateTime.h" 33 #include "oops/util/Duration.h" 34 #include "oops/util/Logger.h" 56 const util::Duration &,
const util::Duration & tstep = util::Duration(0));
65 const eckit::Configuration &)
override;
68 double finalize(
const eckit::Configuration &)
const override;
72 boost::shared_ptr<PostBaseTLAD_>
setupTL(
const CtrlInc_ &)
const override;
75 boost::shared_ptr<PostBaseTLAD_>
setupAD(
76 boost::shared_ptr<const GeneralizedDepartures>,
CtrlInc_ &)
const override;
92 const eckit::LocalConfiguration
conf_;
96 boost::scoped_ptr<WeightingFct>
wfct_;
102 mutable boost::shared_ptr<WeightedDiff<MODEL, Increment_, State_> >
filter_;
103 mutable boost::shared_ptr<WeightedDiffTLAD<MODEL> >
ftlad_;
108 template<
typename MODEL>
110 const util::DateTime &
vt,
const util::Duration & span,
111 const util::Duration & tstep)
112 : conf_(
conf), vt_(
vt), span_(span), alpha_(0), wfct_(), gradFG_(),
113 resol_(resol), tstep_(tstep), tlres_(), tlstep_(), filter_()
116 if (
conf.has(
"ftime"))
vt_ = util::DateTime(
conf.getString(
"ftime"));
117 if (
conf.has(
"span"))
span_ = util::Duration(
conf.getString(
"span"));
120 Log::debug() <<
"CostJcDFI created vt = " <<
vt_ <<
", span = " <<
span_ << std::endl;
121 Log::trace() <<
"CostJcDFI created" << std::endl;
126 template<
typename MODEL>
127 boost::shared_ptr<PostBase<State<MODEL> > >
130 tstep_, resol_, *wfct_));
136 template<
typename MODEL>
138 double zz = 0.5 * alpha_;
139 boost::scoped_ptr<Increment_> dx(filter_->releaseDiff());
140 zz *= dot_product(*dx, *dx);
141 Log::test() <<
"CostJcDFI: Nonlinear Jc = " << zz << std::endl;
147 template<
typename MODEL>
148 boost::shared_ptr<PostBaseTLAD<MODEL> >
150 const eckit::Configuration & innerConf) {
152 tlstep_ = util::Duration(innerConf.getString(
"linearmodel.tstep"));
159 template<
typename MODEL>
161 gradFG_.reset(ftlad_->releaseDiff());
167 template<
typename MODEL>
176 template<
typename MODEL>
177 boost::shared_ptr<PostBaseTLAD<MODEL> >
179 ftlad_->setupTL(*tlres_);
185 template<
typename MODEL>
186 boost::shared_ptr<PostBaseTLAD<MODEL> >
189 boost::shared_ptr<const Increment_>
197 template<
typename MODEL>
201 const double za = 1.0/alpha_;
208 template<
typename MODEL>
218 template<
typename MODEL>
228 #endif // OOPS_ASSIMILATION_COSTJCDFI_H_ PostBaseTLAD< MODEL > PostBaseTLAD_
boost::shared_ptr< PostBase< State_ > > initialize(const CtrlVar_ &) const override
Initialize before nonlinear model integration.
boost::shared_ptr< WeightedDiffTLAD< MODEL > > ftlad_
double finalize(const eckit::Configuration &) const override
Finalize computation after nonlinear model integration.
Compute time average of states or increments during model run.
Increment_ * multiplyCoInv(const GeneralizedDepartures &) const override
Handles post-processing of model fields related to cost function.
Increment_ * multiplyCovar(const GeneralizedDepartures &) const override
Multiply by and .
Encapsulates the model state.
Increment< MODEL > Increment_
CostJcDFI(const eckit::Configuration &, const Geometry_ &, const util::DateTime &, const util::Duration &, const util::Duration &tstep=util::Duration(0))
Construct .
The namespace for the main oops code.
boost::scoped_ptr< Geometry_ > tlres_
real, dimension(:,:,:), allocatable vt
boost::shared_ptr< WeightedDiff< MODEL, Increment_, State_ > > filter_
virtual ~CostJcDFI()
Destructor.
boost::shared_ptr< PostBaseTLAD_ > setupAD(boost::shared_ptr< const GeneralizedDepartures >, CtrlInc_ &) const override
Initialize before starting the AD run.
const util::Duration tstep_
Increment Class: Difference between two states.
boost::scoped_ptr< WeightingFct > wfct_
Increment_ * newGradientFG() const override
Gradient of at first guess.
Base Class for Cost Function Terms.
boost::scoped_ptr< Increment_ > gradFG_
boost::shared_ptr< PostBaseTLAD_ > setupTL(const CtrlInc_ &) const override
Initialize before starting the TL run.
Geometry< MODEL > Geometry_
ControlIncrement< MODEL > CtrlInc_
Increment_ * newDualVector() const override
Provide new increment.
Compute time average of states or increments during linear model run.
const eckit::LocalConfiguration conf_
Abstract base class for quantities.
void finalizeTraj() override
boost::shared_ptr< PostBaseTLAD< MODEL > > initializeTraj(const CtrlVar_ &, const Geometry_ &, const eckit::Configuration &) override
ControlVariable< MODEL > CtrlVar_
void resetLinearization() override
Reset trajectory.