FV3 Bundle
ModelQG.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2009-2016 ECMWF.
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  * In applying this licence, ECMWF does not waive the privileges and immunities
7  * granted to it by virtue of its status as an intergovernmental organisation nor
8  * does it submit to any jurisdiction.
9  */
10 
11 #include "model/ModelQG.h"
12 
13 #include <vector>
14 
15 #include "eckit/config/Configuration.h"
16 
17 #include "model/FieldsQG.h"
18 #include "model/GeometryQG.h"
19 #include "model/ModelBias.h"
20 #include "model/QgFortran.h"
21 #include "model/StateQG.h"
22 
23 #include "oops/util/DateTime.h"
24 #include "oops/util/Logger.h"
25 
26 namespace qg {
27 // -----------------------------------------------------------------------------
29 // -----------------------------------------------------------------------------
30 ModelQG::ModelQG(const GeometryQG & resol, const eckit::Configuration & model)
31  : keyConfig_(0), tstep_(0), geom_(resol),
32  vars_(std::vector<std::string>{"x", "q", "u", "v", "bc"})
33 {
34  oops::Log::trace() << "ModelQG::ModelQG" << std::endl;
35  tstep_ = util::Duration(model.getString("tstep"));
36  const eckit::Configuration * configc = &model;
37  qg_setup_f90(&configc, geom_.toFortran(), keyConfig_);
38  oops::Log::trace() << "ModelQG created" << std::endl;
39 }
40 // -----------------------------------------------------------------------------
43  oops::Log::trace() << "ModelQG destructed" << std::endl;
44 }
45 // -----------------------------------------------------------------------------
46 void ModelQG::initialize(StateQG & xx) const {
47  ASSERT(xx.fields().isForModel(true));
49  oops::Log::debug() << "ModelQG::initialize" << xx.fields() << std::endl;
50 }
51 // -----------------------------------------------------------------------------
52 void ModelQG::step(StateQG & xx, const ModelBias &) const {
53  ASSERT(xx.fields().isForModel(true));
54  oops::Log::debug() << "ModelQG::step fields in" << xx.fields() << std::endl;
56  xx.validTime() += tstep_;
57  oops::Log::debug() << "ModelQG::step fields out" << xx.fields() << std::endl;
58 }
59 // -----------------------------------------------------------------------------
60 void ModelQG::finalize(StateQG & xx) const {
61  ASSERT(xx.fields().isForModel(true));
62  oops::Log::debug() << "ModelQG::finalize" << xx.fields() << std::endl;
63 }
64 // -----------------------------------------------------------------------------
65 int ModelQG::saveTrajectory(StateQG & xx, const ModelBias &) const {
66  ASSERT(xx.fields().isForModel(true));
67  int ftraj = 0;
68  oops::Log::debug() << "ModelQG::saveTrajectory fields in" << xx.fields() << std::endl;
70  ASSERT(ftraj != 0);
71  oops::Log::debug() << "ModelQG::saveTrajectory fields out" << xx.fields() << std::endl;
72  return ftraj;
73 }
74 // -----------------------------------------------------------------------------
75 void ModelQG::print(std::ostream & os) const {
76  os << "ModelQG::print not implemented";
77 }
78 // -----------------------------------------------------------------------------
79 } // namespace qg
int & toFortran()
Definition: FieldsQG.h:96
Model error for the QG model.
void qg_prepare_integration_f90(const F90model &, const F90flds &)
int saveTrajectory(StateQG &, const ModelBias &) const
Definition: ModelQG.cc:65
subroutine std(a, mean, stdv, area)
void print(std::ostream &) const
Definition: ModelQG.cc:75
void step(StateQG &, const ModelBias &) const
Model integration.
Definition: ModelQG.cc:52
void finalize(StateQG &) const
Finish model integration.
Definition: ModelQG.cc:60
bool isForModel(const bool &) const
Definition: FieldsQG.cc:213
const util::DateTime & validTime() const
Definition: StateQG.h:77
logical debug
Definition: mpp.F90:1297
void qg_setup_f90(const eckit::Configuration *const *, const F90geom &, F90model &)
util::Duration tstep_
Definition: ModelQG.h:70
static oops::ModelMaker< QgTraits, ModelQG > makermodel_("QG")
F90model keyConfig_
Definition: ModelQG.h:69
QG model state.
Definition: StateQG.h:50
FieldsQG & fields()
Access to fields.
Definition: StateQG.h:81
GeometryQG handles geometry for QG model.
Definition: GeometryQG.h:33
void qg_delete_f90(F90model &)
void initialize(StateQG &) const
Prepare model integration.
Definition: ModelQG.cc:46
ModelQG(const GeometryQG &, const eckit::Configuration &)
Definition: ModelQG.cc:30
The namespace for the qg model.
void qg_prop_traj_f90(const F90model &, const F90flds &, F90traj &)
void qg_propagate_f90(const F90model &, const F90flds &)