mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
AquiferConstantFlux: add restart serialization support
This commit is contained in:
parent
9418110d3e
commit
da4784b314
@ -52,6 +52,14 @@ public:
|
||||
connection_flux_.resize(this->connections_.size(), {0});
|
||||
}
|
||||
|
||||
static AquiferConstantFlux serializationTestObject(const Simulator& ebos_simulator)
|
||||
{
|
||||
AquiferConstantFlux<TypeTag> result({}, {}, ebos_simulator);
|
||||
result.cumulative_flux_ = 1.0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual ~AquiferConstantFlux() = default;
|
||||
|
||||
void updateAquifer(const SingleAquiferFlux& aquifer) {
|
||||
@ -113,6 +121,17 @@ public:
|
||||
+= this->connection_flux_[idx] / model.dofTotalVolume(cellIdx);
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(cumulative_flux_);
|
||||
}
|
||||
|
||||
bool operator==(const AquiferConstantFlux& rhs) const
|
||||
{
|
||||
return this->cumulative_flux_ == rhs.cumulative_flux_;
|
||||
}
|
||||
|
||||
private:
|
||||
const std::vector<Aquancon::AquancCell>& connections_;
|
||||
SingleAquiferFlux aquifer_data_;
|
||||
|
@ -244,12 +244,15 @@ serializeOp(Serializer& serializer)
|
||||
auto* ct = dynamic_cast<AquiferCarterTracy<TypeTag>*>(aiPtr.get());
|
||||
auto* fetp = dynamic_cast<AquiferFetkovich<TypeTag>*>(aiPtr.get());
|
||||
auto* num = dynamic_cast<AquiferNumerical<TypeTag>*>(aiPtr.get());
|
||||
auto* flux = dynamic_cast<AquiferConstantFlux<TypeTag>*>(aiPtr.get());
|
||||
if (ct) {
|
||||
serializer(*ct);
|
||||
} else if (fetp) {
|
||||
serializer(*fetp);
|
||||
} else if (num) {
|
||||
serializer(*num);
|
||||
} else if (flux) {
|
||||
serializer(*flux);
|
||||
} else {
|
||||
OPM_THROW(std::logic_error, "Error serializing BlackoilAquiferModel: unknown aquifer type");
|
||||
}
|
||||
|
@ -459,6 +459,24 @@ BOOST_AUTO_TEST_CASE(AquiferNumerical)
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized AquiferNumerical differ");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AquiferConstantFlux)
|
||||
{
|
||||
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::AquiferConstantFlux<TT>::serializationTestObject(sim);
|
||||
Opm::Serialization::MemPacker packer;
|
||||
Opm::Serializer ser(packer);
|
||||
ser.pack(data_out);
|
||||
const size_t pos1 = ser.position();
|
||||
decltype(data_out) data_in({}, {}, sim);
|
||||
ser.unpack(data_in);
|
||||
const size_t pos2 = ser.position();
|
||||
BOOST_CHECK_MESSAGE(pos1 == pos2, "Packed size differ from unpack size for AquiferConstantFlux");
|
||||
BOOST_CHECK_MESSAGE(data_out == data_in, "Deserialized AquiferConstantFlux differ");
|
||||
}
|
||||
|
||||
bool init_unit_test_func()
|
||||
{
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user