10#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
11#include <doctest/doctest.h>
27TEST_SUITE_BEGIN(
"PrognosticData");
28TEST_CASE(
"PrognosticData call order test")
30 ModelArray::setDimensions(ModelArray::Type::H, { 1, 1 });
31 ModelArray::setDimensions(ModelArray::Type::Z, { 1, 1, 1 });
33 std::stringstream config;
34 config <<
"[Modules]" << std::endl;
35 config <<
"Nextsim::IAtmosphereBoundary = Nextsim::ConfiguredAtmosphere" << std::endl;
37 config <<
"[ConfiguredAtmosphere]" << std::endl;
38 config <<
"t_air = 3" << std::endl;
39 config <<
"t_dew = 2" << std::endl;
40 config <<
"pmsl = 100000" << std::endl;
41 config <<
"sw_in = 50" << std::endl;
42 config <<
"lw_in = 330" << std::endl;
43 config <<
"snow = 0" << std::endl;
44 config <<
"rainfall = 0" << std::endl;
45 config <<
"wind_speed = 5" << std::endl;
47 std::unique_ptr<std::istream> pcstream(
new std::stringstream(config.str()));
48 Configurator::addStream(std::move(pcstream));
50 ConfiguredModule::parseConfigurator();
52 class OceanData :
public IOceanBoundary {
58 void setData(
const ModelState::DataMap& state)
override { IOceanBoundary::setData(state); }
59 void updateBefore(
const TimestepTime& tst)
override
70 void updateAfter(
const TimestepTime& tst)
override { }
72 ocnBdy.setData(ModelState().data);
75 Module::newImpl<IOceanBoundary, OceanData>);
84 ModelState::DataMap initialData = {
87 {
"hsnow", zeroData },
88 {
"tice", zeroDataZ },
93 pData.setData(initialData);
94 TimestepTime tst = { TimePoint(
"2000-01-01T00:00:00Z"), Duration(
"P0-0T0:10:0") };
97 ModelArrayRef<ModelComponent::SharedArray::Q_OW, MARBackingStore> qow(
98 ModelComponent::getSharedArray());
102 REQUIRE(qow[0] == doctest::Approx(-109.923).
epsilon(prec));
104 REQUIRE(qow[0] != doctest::Approx(-92.1569).
epsilon(prec));
const double epsilon
Thermal emissivity of smooth ice [0..1].
const double rho
Density of fresh water at 4˚C. [kg m⁻³].
const double cp
Specific heat capacity at constant pressure of water [J kg⁻¹ K⁻¹].