FV3 Bundle
test/lorenz95/ModelL95.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 <iostream>
12 
13 #include <boost/scoped_ptr.hpp>
14 #include <boost/test/unit_test.hpp>
15 
16 #include "./TestConfig.h"
17 #include "eckit/config/LocalConfiguration.h"
18 #include "lorenz95/FieldL95.h"
19 #include "lorenz95/ModelBias.h"
20 #include "lorenz95/ModelL95.h"
22 #include "lorenz95/Resolution.h"
23 #include "oops/util/DateTime.h"
24 #include "oops/util/Duration.h"
25 #include "test/TestFixture.h"
26 
27 namespace test {
28 
29 // -----------------------------------------------------------------------------
31  public:
33  eckit::LocalConfiguration res(TestConfig::config(), "resolution");
34  resol_.reset(new lorenz95::Resolution(res));
35  nlconf_.reset(new eckit::LocalConfiguration(TestConfig::config(), "model"));
36  }
38  boost::scoped_ptr<lorenz95::Resolution> resol_;
39  boost::scoped_ptr<const eckit::LocalConfiguration> nlconf_;
40 };
41 // -----------------------------------------------------------------------------
42 
43 // -----------------------------------------------------------------------------
44 BOOST_FIXTURE_TEST_SUITE(test_modelL95, ModelTestFixture)
45 // -----------------------------------------------------------------------------
46  BOOST_AUTO_TEST_CASE(test_modelL95_constructor) {
47  boost::scoped_ptr<lorenz95::ModelL95> model(new lorenz95::ModelL95(*resol_, *nlconf_));
48  BOOST_CHECK(model != NULL);
49  }
50 // -----------------------------------------------------------------------------
51  BOOST_AUTO_TEST_CASE(test_modelL95_get_classname) {
52  lorenz95::ModelL95 model(*resol_, *nlconf_);
53  BOOST_CHECK_EQUAL(model.classname(), "lorenz95::ModelL95");
54  }
55 // -----------------------------------------------------------------------------
56  BOOST_AUTO_TEST_CASE(test_modelL95_get_timestep) {
57  lorenz95::ModelL95 model(*resol_, *nlconf_);
58  util::Duration dt(nlconf_->getString("tstep"));
59  BOOST_CHECK_EQUAL(model.timeResolution().toSeconds(), dt.toSeconds());
60  }
61 // -----------------------------------------------------------------------------
62  BOOST_AUTO_TEST_CASE(test_modelL95_stepRk) {
63  lorenz95::ModelL95 model(*resol_, *nlconf_);
64 
65  // construct a FieldL95 object
66  lorenz95::FieldL95 fieldL95(*resol_);
67 
68  // construct a ModelBias object
69  eckit::LocalConfiguration biasCfg(TestConfig::config(), "ModelBias");
70  lorenz95::ModelBias modelBias(*resol_, biasCfg);
71 
72  // construct a ModelTrajectory object
73  lorenz95::ModelTrajectory modelTraj(true);
74  modelTraj.set(fieldL95);
75 
76 // for(int i = 0; i < fieldL95.resol(); ++i) {
77 // std::cout << "PMC: pre stepRK " << fieldL95[i] << std::endl;
78 // }
79 
80  model.stepRK(fieldL95, modelBias, modelTraj);
81 
82 // for(int i = 0; i < fieldL95.resol(); ++i) {
83 // std::cout << "PMC: post stepRK " << fieldL95[i] << std::endl;
84 // }
85  }
86 // -----------------------------------------------------------------------------
87 BOOST_AUTO_TEST_SUITE_END()
88 } // namespace test
boost::scoped_ptr< lorenz95::Resolution > resol_
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************! this routine is used to retrieve scalar boundary data for symmetric domain. subroutine MPP_GET_BOUNDARY_2D_(field, domain, ebuffer, sbuffer, wbuffer, nbuffer, flags, &position, complete, tile_count) type(domain2D), intent(in) ::domain MPP_TYPE_, intent(in) ::field(:,:) MPP_TYPE_, intent(inout), optional ::ebuffer(:), sbuffer(:), wbuffer(:), nbuffer(:) integer, intent(in), optional ::flags, position, tile_count logical, intent(in), optional ::complete MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_, allocatable, dimension(:,:) ::ebuffer2D, sbuffer2D, wbuffer2D, nbuffer2D integer ::xcount, ycount integer ::ntile logical ::need_ebuffer, need_sbuffer, need_wbuffer, need_nbuffer integer(LONG_KIND), dimension(MAX_DOMAIN_FIELDS, MAX_TILES), save ::f_addrs=-9999 integer(LONG_KIND), dimension(4, MAX_DOMAIN_FIELDS, MAX_TILES), save ::b_addrs=-9999 integer, save ::bsize(4)=0, isize=0, jsize=0, ksize=0, pos, list=0, l_size=0, upflags integer ::buffer_size(4) integer ::max_ntile, tile, update_position, ishift, jshift logical ::do_update, is_complete, set_mismatch character(len=3) ::text MPP_TYPE_ ::d_type type(overlapSpec), pointer ::bound=> NULL() ntile
Lorenz 95 model configuration and computations.
Definition: ModelL95.h:38
Handles resolution.
Definition: Resolution.h:25
boost::scoped_ptr< const eckit::LocalConfiguration > nlconf_
Model error for Lorenz 95 model.
L95 model trajectory.
BOOST_AUTO_TEST_CASE(test_GomL95_constructor)
static const eckit::Configuration & config()
Definition: TestConfig.h:30
void set(const FieldL95 &)
Save trajectory.
Class to represent fields for the L95 model.
Definition: FieldL95.h:36