mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
AquiferCarterTracy: add serialization of dynamic state
This commit is contained in:
parent
6dc63b2da8
commit
51e5e61c39
@ -23,6 +23,8 @@
|
||||
|
||||
#include <opm/simulators/aquifers/AquiferAnalytical.hpp>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/Aquifer/AquiferCT.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <exception>
|
||||
@ -57,6 +59,22 @@ public:
|
||||
, aquct_data_(aquct_data)
|
||||
{}
|
||||
|
||||
static AquiferCarterTracy serializationTestObject(const Simulator& ebosSimulator)
|
||||
{
|
||||
AquiferCarterTracy result({}, ebosSimulator, {});
|
||||
|
||||
result.pressure_previous_ = {1.0, 2.0, 3.0};
|
||||
result.pressure_current_ = {4.0, 5.0};
|
||||
result.Qai_ = {{6.0}};
|
||||
result.rhow_ = 7.0;
|
||||
result.W_flux_ = 8.0;
|
||||
result.fluxValue_ = 9.0;
|
||||
result.dimensionless_time_ = 10.0;
|
||||
result.dimensionless_pressure_ = 11.0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void endTimeStep() override
|
||||
{
|
||||
for (const auto& q : this->Qai_) {
|
||||
@ -100,6 +118,23 @@ public:
|
||||
return data;
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(static_cast<Base&>(*this));
|
||||
serializer(fluxValue_);
|
||||
serializer(dimensionless_time_);
|
||||
serializer(dimensionless_pressure_);
|
||||
}
|
||||
|
||||
bool operator==(const AquiferCarterTracy& rhs) const
|
||||
{
|
||||
return static_cast<const AquiferAnalytical<TypeTag>&>(*this) == rhs &&
|
||||
this->fluxValue_ == rhs.fluxValue_ &&
|
||||
this->dimensionless_time_ == rhs.dimensionless_time_ &&
|
||||
this->dimensionless_pressure_ == rhs.dimensionless_pressure_;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Variables constants
|
||||
AquiferCT::AQUCT_data aquct_data_;
|
||||
|
@ -22,6 +22,9 @@
|
||||
#ifndef OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||
#define OPM_AQUIFERINTERFACE_HEADER_INCLUDED
|
||||
|
||||
#include <opm/models/common/multiphasebaseproperties.hh>
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
namespace Opm
|
||||
|
@ -134,6 +134,42 @@ BOOST_AUTO_TEST_CASE(EclGenericProblem)
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized EclGenericProblem differ");
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
struct AquiferFixture {
|
||||
AquiferFixture() {
|
||||
using TT = Opm::Properties::TTag::EbosTypeTag;
|
||||
const char* argv[] = {
|
||||
"test_RestartSerialization",
|
||||
"--ecl-deck-file-name=GLIFT1.DATA"
|
||||
};
|
||||
Opm::setupParameters_<TT>(2, argv, /*registerParams=*/true);
|
||||
Opm::EclGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
BOOST_GLOBAL_FIXTURE(AquiferFixture);
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AquiferCarterTracy)
|
||||
{
|
||||
using TT = Opm::Properties::TTag::EbosTypeTag;
|
||||
Opm::EclGenericVanguard::readDeck("GLIFT1.DATA");
|
||||
using Simulator = Opm::GetPropType<TT, Opm::Properties::Simulator>;
|
||||
Simulator sim;
|
||||
auto data_out = Opm::AquiferCarterTracy<TT>::serializationTestObject(sim);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
size_t pos1 = ser.position();
|
||||
decltype(data_out) data_in({}, sim, {});
|
||||
ser.unpack(data_in);
|
||||
size_t pos2 = ser.position();
|
||||
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for AquiferCarterTracy");
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized AquiferCarterTracy differ");
|
||||
}
|
||||
|
||||
bool init_unit_test_func()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user