mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-22 09:16:27 -06:00
AquiferFetkovich: add serialization of dynamic state
This commit is contained in:
parent
51e5e61c39
commit
03f6309ff7
@ -23,6 +23,8 @@ along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <opm/simulators/aquifers/AquiferAnalytical.hpp>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/Aquifer/Aquifetp.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <exception>
|
||||
@ -58,6 +60,20 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
static AquiferFetkovich serializationTestObject(const Simulator& ebosSimulator)
|
||||
{
|
||||
AquiferFetkovich 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.aquifer_pressure_ = 9.0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void endTimeStep() override
|
||||
{
|
||||
for (const auto& q : this->Qai_) {
|
||||
@ -89,6 +105,19 @@ public:
|
||||
return data;
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(static_cast<Base&>(*this));
|
||||
serializer(aquifer_pressure_);
|
||||
}
|
||||
|
||||
bool operator==(const AquiferFetkovich& rhs) const
|
||||
{
|
||||
return static_cast<const Base&>(*this) == rhs &&
|
||||
this->aquifer_pressure_ == rhs.aquifer_pressure_;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Aquifer Fetkovich Specific Variables
|
||||
Aquifetp::AQUFETP_data aqufetp_data_;
|
||||
|
@ -170,6 +170,24 @@ BOOST_AUTO_TEST_CASE(AquiferCarterTracy)
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized AquiferCarterTracy differ");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AquiferFetkovich)
|
||||
{
|
||||
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::AquiferFetkovich<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 AquiferFetkovich");
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized AquiferFetkovich differ");
|
||||
}
|
||||
|
||||
bool init_unit_test_func()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user