FV3 Bundle
GomQG.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/GomQG.h"
12 
13 #include "eckit/config/Configuration.h"
14 #include "model/LocationsQG.h"
15 #include "model/QgFortran.h"
16 #include "model/VariablesQG.h"
17 #include "oops/base/Variables.h"
18 #include "oops/util/Logger.h"
19 
20 namespace qg {
21 
22 // -----------------------------------------------------------------------------
23 GomQG::GomQG(const LocationsQG & locs, const oops::Variables & var) {
24  const VariablesQG varqg(var);
25 
26  // gom_setup just creates and allocates the GeoVaLs object without filling
27  // in values
28  qg_gom_setup_f90(keyGom_, locs.toFortran(), varqg.toFortran());
29 }
30 // -----------------------------------------------------------------------------
31 /*! QG GeoVaLs Constructor with Config */
32 
33  GomQG::GomQG(const eckit::Configuration & config, const oops::Variables &)
34 {
36 
37  const eckit::Configuration * conp = &config;
39 }
40 // -----------------------------------------------------------------------------
41 // Copy constructor
42 GomQG::GomQG(const GomQG & other) {
45 }
46 // -----------------------------------------------------------------------------
49 }
50 // -----------------------------------------------------------------------------
51 void GomQG::abs() {
53 }
54 // -----------------------------------------------------------------------------
55 double GomQG::norm() const {
56  double zz;
58  return zz;
59 }
60 // -----------------------------------------------------------------------------
61 void GomQG::zero() {
63 }
64 // -----------------------------------------------------------------------------
65 void GomQG::random() {
67 }
68 // -----------------------------------------------------------------------------
69 GomQG & GomQG::operator=(const GomQG & rhs) {
70  const int keyGomRhs = rhs.keyGom_;
71  qg_gom_assign_f90(keyGom_, keyGomRhs);
72  return *this;
73 }
74 // -----------------------------------------------------------------------------
75 GomQG & GomQG::operator*=(const double & zz) {
77  return *this;
78 }
79 // -----------------------------------------------------------------------------
80 GomQG & GomQG::operator+=(const GomQG & other) {
82  return *this;
83 }
84 // -----------------------------------------------------------------------------
85 GomQG & GomQG::operator-=(const GomQG & other) {
87  return *this;
88 }
89 // -----------------------------------------------------------------------------
90 GomQG & GomQG::operator/=(const GomQG & other) {
92  return *this;
93 }
94 // -----------------------------------------------------------------------------
95 double GomQG::dot_product_with(const GomQG & other) const {
96  double zz;
98  return zz;
99 }
100 // -----------------------------------------------------------------------------
101 void GomQG::read(const eckit::Configuration & config) {
102  const eckit::Configuration * conf = &config;
104 }
105 // -----------------------------------------------------------------------------
106 void GomQG::write(const eckit::Configuration & config) const {
107  const eckit::Configuration * conf = &config;
109 }
110 // -----------------------------------------------------------------------------
111 /*! \brief GomQG Analytic Initialization
112  *
113  * \details This qg::GomQG constructor was introduced in May, 2018 for use with
114  * the interpolation test.
115  *
116  */
118  const eckit::Configuration & config) {
119  // Optionally replace values with analytic init
120  const eckit::Configuration * conp = &config;
121  if (config.has("analytic_init"))
123 }
124 // -----------------------------------------------------------------------------
125 void GomQG::print(std::ostream & os) const {
126  int nn;
127  double zmin, zmax, zavg;
128  qg_gom_minmaxavg_f90(keyGom_, nn, zmin, zmax, zavg);
129  os << " nobs= " << nn << " Min=" << zmin << ", Max=" << zmax << ", RMS="
130  << zavg << std::endl;
131 
132  // If the min value across all variables is positive, then this may be an
133  // error measurement. If so, print the location and variable where the
134  // maximum occurs to the debug stream, for use in debugging
135 
136  if (zmin >= 0.0) {
137  double mxval;
138  int iloc, ivar;
139 
140  qg_gom_maxloc_f90(keyGom_, mxval, iloc, ivar);
141 
142  oops::Log::debug() << "GomQG: Maximum Value = " << std::setprecision(4)
143  << mxval << " at location = " << iloc
144  << " and variable = " << ivar << std::endl;
145  }
146 }
147 // -----------------------------------------------------------------------------
148 } // namespace qg
void zero()
Definition: GomQG.cc:61
void qg_gom_read_file_f90(const F90goms &, const eckit::Configuration *const *)
void qg_gom_divide_f90(const F90goms &, const F90goms &)
GomQG class to handle local model values for QG model.
Definition: GomQG.h:31
void qg_gom_analytic_init_f90(const F90goms &, const F90locs &, const eckit::Configuration *const *)
void qg_gom_diff_f90(const F90goms &, const F90goms &)
void qg_gom_dotprod_f90(const F90goms &, const F90goms &, double &)
Definition: conf.py:1
void abs()
Definition: GomQG.cc:51
void random()
Definition: GomQG.cc:65
double dot_product_with(const GomQG &) const
Definition: GomQG.cc:95
GomQG()
Definition: GomQG.h:40
F90goms keyGom_
Definition: GomQG.h:64
void read(const eckit::Configuration &)
Definition: GomQG.cc:101
void qg_gom_delete_f90(F90goms &)
logical debug
Definition: mpp.F90:1297
void qg_gom_minmaxavg_f90(const F90goms &, int &, double &, double &, double &)
void print(std::ostream &) const
Definition: GomQG.cc:125
void analytic_init(const LocationsQG &, const eckit::Configuration &)
GomQG Analytic Initialization.
Definition: GomQG.cc:117
void qg_gom_write_file_f90(const F90goms &, const eckit::Configuration *const *)
GomQG & operator/=(const GomQG &)
Definition: GomQG.cc:90
const int * toFortran() const
Definition: VariablesQG.h:43
GomQG & operator=(const GomQG &)
Definition: GomQG.cc:69
int toFortran() const
Definition: LocationsQG.h:43
~GomQG()
Definition: GomQG.cc:47
void qg_gom_abs_f90(const F90goms &)
void qg_gom_assign_f90(const F90goms &, const F90goms &)
void qg_gom_maxloc_f90(const F90goms &, double &, int &, int &)
void qg_gom_mult_f90(const F90goms &, const double &)
double norm() const
Definition: GomQG.cc:55
GomQG & operator+=(const GomQG &)
Definition: GomQG.cc:80
void qg_gom_random_f90(const F90goms &)
void qg_gom_rms_f90(const F90goms &, double &)
LocationsQG class to handle locations for QG model.
Definition: LocationsQG.h:26
void qg_gom_zero_f90(const F90goms &)
GomQG & operator-=(const GomQG &)
Definition: GomQG.cc:85
void qg_gom_create_f90(F90goms &)
GomQG & operator*=(const double &)
Definition: GomQG.cc:75
void write(const eckit::Configuration &) const
Definition: GomQG.cc:106
void qg_gom_add_f90(const F90goms &, const F90goms &)
The namespace for the qg model.
void qg_gom_setup_f90(F90goms &, const F90locs &, const F90vars *)