Merge pull request #2353 from joakim-hove/aquifer-config

Add serialization for AquiferConfig
This commit is contained in:
Joakim Hove 2020-02-20 08:25:20 +01:00 committed by GitHub
commit c239529565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 0 deletions

View File

@ -139,6 +139,19 @@ template <typename TypeTag>
void
BlackoilAquiferModel<TypeTag>::init()
{
/*
const auto& comm = this->simulator_.vanguard().gridView().comm();
const auto& aquifer = this->simulator_.vanguard().eclState().aquifer();
const auto& connections = aquifer.connections();
for (const auto& aq : aquifer.fetp())
aquifers_Fetkovich.push_back(AquiferFetkovich<TypeTag>(connections[aq.aquiferID], cartesian_to_compressed_, this->simulator_, aq));
for (const auto& aq : aquifer.ct())
aquifers_CarterTracy.push_back(AquiferCarterTracy<TypeTag>(connections[aq.aquiferID], cartesian_to_compressed_, this->simulator_, aq));
*/
const auto& deck = this->simulator_.vanguard().deck();
const auto& comm = this->simulator_.vanguard().gridView().comm();

View File

@ -562,6 +562,13 @@ std::size_t packSize(const AquiferCT& data, Dune::MPIHelper::MPICommunicator com
return packSize(data.data(), comm);
}
std::size_t packSize(const AquiferConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.fetp(), comm) +
packSize(data.ct(), comm) +
packSize(data.connections(), comm);
}
std::size_t packSize(const Aquancon::AquancCell& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.aquiferID, comm) +
@ -2354,6 +2361,13 @@ void pack(const Aquifetp& data, std::vector<char>& buffer, int& position,
pack(data.data(), buffer, position, comm);
}
void pack(const AquiferConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.fetp(), buffer, position, comm);
pack(data.ct(), buffer, position, comm);
pack(data.connections(), buffer, position, comm);
}
void pack(const Aquancon::AquancCell& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.aquiferID, buffer, position, comm);
@ -4370,6 +4384,17 @@ void unpack(Aquancon::AquancCell& data, std::vector<char>& buffer, int& position
}
void unpack(AquiferConfig& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) {
Aquifetp fetp;
AquiferCT ct;
Aquancon conn;
unpack(fetp, buffer, position, comm);
unpack(ct, buffer, position, comm);
unpack(conn, buffer, position, comm);
data = AquiferConfig(fetp, ct, conn);
}
void unpack(Aquancon& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{

View File

@ -40,6 +40,7 @@
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
@ -672,6 +673,7 @@ ADD_PACK_PROTOTYPES(Action::ASTNode)
ADD_PACK_PROTOTYPES(Action::Condition)
ADD_PACK_PROTOTYPES(Action::Quantity)
ADD_PACK_PROTOTYPES(Aqudims)
ADD_PACK_PROTOTYPES(AquiferConfig)
ADD_PACK_PROTOTYPES(Aquancon)
ADD_PACK_PROTOTYPES(Aquancon::AquancCell)
ADD_PACK_PROTOTYPES(AquiferCT)

View File

@ -1936,6 +1936,19 @@ BOOST_AUTO_TEST_CASE(Aquancon)
#endif
}
BOOST_AUTO_TEST_CASE(AquferConfig)
{
#ifdef HAVE_MPI
Opm::Aquifetp fetp = getAquifetp();
Opm::AquiferCT ct = getAquiferCT();
Opm::Aquancon conn = getAquancon();
Opm::AquiferConfig val1(fetp, ct, conn);
auto val2 = PackUnpack(val1);
DO_CHECKS(AquiferConfig);
#endif
}
BOOST_AUTO_TEST_CASE(GuideRateModel)