FV3-JEDI
VarChaVertRemap.cc
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2017-2020 UCAR.
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  */
7 
8 #include <ostream>
9 #include <string>
10 
11 #include "eckit/config/Configuration.h"
12 
13 #include "oops/interface/VariableChange.h"
14 #include "oops/util/Logger.h"
15 #include "oops/util/Timer.h"
16 
18 #include "fv3jedi/State/State.h"
22 
23 namespace fv3jedi {
24 // -------------------------------------------------------------------------------------------------
25 static oops::VariableChangeMaker<Traits, oops::VariableChange<Traits, VarChaVertRemap>>
26  makerVarChaVertRemap_("VertRemap");
27 // -------------------------------------------------------------------------------------------------
28 VarChaVertRemap::VarChaVertRemap(const Geometry & resol, const eckit::Configuration & conf):
29  geom_(new Geometry(resol))
30 {
31  util::Timer timer(classname(), "VarChaVertRemap");
32  oops::Log::trace() << classname() << " constructor starting" << std::endl;
33  const eckit::Configuration * configc = &conf;
34 
35  // Prepare input.nml file
36  stageFv3Files(conf, resol.getComm());
37  if ( !conf.has("nml_file") ) {
38  generateGeomFv3Conf(conf, resol.getComm());
39  }
40  fv3jedi_vc_vertremap_create_f90(keyFtn_, geom_->toFortran(), &configc);
41  // Remove input.nml
42  removeFv3Files(resol.getComm());
43  oops::Log::trace() << classname() << " constructor done" << std::endl;
44 }
45 // -------------------------------------------------------------------------------------------------
47  util::Timer timer(classname(), "~VarChaVertRemap");
48  oops::Log::trace() << classname() << " destructor starting" << std::endl;
50  oops::Log::trace() << classname() << " destructor done" << std::endl;
51 }
52 // -------------------------------------------------------------------------------------------------
53 void VarChaVertRemap::changeVar(const State & xin, State & xout) const {
54  util::Timer timer(classname(), "changeVar");
55  oops::Log::trace() << classname() << " changeVar starting" << std::endl;
57  xout.validTime() = xin.validTime();
58  oops::Log::trace() << classname() << " changeVar done" << std::endl;
59 }
60 // -------------------------------------------------------------------------------------------------
61 void VarChaVertRemap::changeVarInverse(const State & xin, State & xout) const {
62  util::Timer timer(classname(), "changeVarInverse");
63  oops::Log::trace() << classname() << " changeVarInverse starting" << std::endl;
64  xout = xin; // No inverse required
65  xout.validTime() = xin.validTime();
66  oops::Log::trace() << classname() << " changeVarInverse done" << std::endl;
67 }
68 // -------------------------------------------------------------------------------------------------
69 void VarChaVertRemap::print(std::ostream & os) const {
70  os << classname() << " variable change";
71 }
72 // -------------------------------------------------------------------------------------------------
73 } // namespace fv3jedi
Traits.h
fv3jedi::Geometry::getComm
const eckit::mpi::Comm & getComm() const
Definition: Geometry.h:55
fv3jedi::VarChaVertRemap::VarChaVertRemap
VarChaVertRemap(const Geometry &, const eckit::Configuration &)
Definition: VarChaVertRemap.cc:28
fv3jedi::VarChaVertRemap::print
void print(std::ostream &) const override
Definition: VarChaVertRemap.cc:69
Utilities.h
fv3jedi::makerVarChaVertRemap_
static oops::VariableChangeMaker< Traits, oops::VariableChange< Traits, VarChaVertRemap > > makerVarChaVertRemap_("VertRemap")
fv3jedi::VarChaVertRemap::geom_
std::shared_ptr< const Geometry > geom_
Definition: VarChaVertRemap.h:32
fv3jedi::fv3jedi_vc_vertremap_create_f90
void fv3jedi_vc_vertremap_create_f90(const F90vc_VR &, const F90geom &, const eckit::Configuration *const *)
Geometry.h
fv3jedi::VarChaVertRemap::changeVarInverse
void changeVarInverse(const State &, State &) const
Definition: VarChaVertRemap.cc:61
fv3jedi::State::toFortran
int & toFortran()
Definition: State.h:87
fv3jedi::State::validTime
const util::DateTime & validTime() const
Definition: State.h:83
fv3jedi::Geometry
Geometry handles geometry for FV3JEDI model.
Definition: Geometry.h:41
fv3jedi::VarChaVertRemap::classname
static const std::string classname()
Definition: VarChaVertRemap.h:25
fv3jedi::VarChaVertRemap::keyFtn_
F90vc_VR keyFtn_
Definition: VarChaVertRemap.h:33
fv3jedi::VarChaVertRemap::~VarChaVertRemap
~VarChaVertRemap()
Definition: VarChaVertRemap.cc:46
fv3jedi::State
Definition: State.h:45
fv3jedi::fv3jedi_vc_vertremap_changevar_f90
void fv3jedi_vc_vertremap_changevar_f90(const F90vc_VR &, const F90state &, const F90state &)
fv3jedi::stageFv3Files
void stageFv3Files(const eckit::Configuration &conf, const eckit::mpi::Comm &comm)
Definition: Utilities.cc:53
fv3jedi
Configuration files should be formatted as e.g.
Definition: ErrorCovariance.cc:20
fv3jedi::generateGeomFv3Conf
void generateGeomFv3Conf(const eckit::Configuration &conf, const eckit::mpi::Comm &comm)
Definition: Utilities.cc:160
fv3jedi::VarChaVertRemap::changeVar
void changeVar(const State &, State &) const
Definition: VarChaVertRemap.cc:53
fv3jedi::fv3jedi_vc_vertremap_delete_f90
void fv3jedi_vc_vertremap_delete_f90(F90vc_VR &)
fv3jedi::removeFv3Files
void removeFv3Files(const eckit::mpi::Comm &comm)
Definition: Utilities.cc:130
VarChaVertRemap.h
State.h