mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2402 from akva2/update_foam_serialization
changed: update FoamConfig serialization
This commit is contained in:
commit
390c7b21d4
@ -681,7 +681,9 @@ std::size_t packSize(const Equil& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
|
||||
std::size_t packSize(const FoamConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.records(), comm);
|
||||
return packSize(data.records(), comm) +
|
||||
packSize(data.getTransportPhase(), comm) +
|
||||
packSize(data.getMobilityModel(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const InitConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
@ -2291,6 +2293,8 @@ void pack(const FoamConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.records(), buffer, position, comm);
|
||||
pack(data.getTransportPhase(), buffer, position, comm);
|
||||
pack(data.getMobilityModel(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const InitConfig& data, std::vector<char>& buffer, int& position,
|
||||
@ -4133,8 +4137,12 @@ void unpack(FoamConfig& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<FoamData> records;
|
||||
Phase transport_phase;
|
||||
FoamConfig::MobilityModel mobility_model;
|
||||
unpack(records, buffer, position, comm);
|
||||
data = FoamConfig(records);
|
||||
unpack(transport_phase, buffer, position, comm);
|
||||
unpack(mobility_model, buffer, position, comm);
|
||||
data = FoamConfig(records, transport_phase, mobility_model);
|
||||
}
|
||||
|
||||
void unpack(InitConfig& data, std::vector<char>& buffer, int& position,
|
||||
|
@ -197,18 +197,19 @@ Opm::ThresholdPressure getThresholdPressure()
|
||||
{{{1,2},{false,3.0}},{{2,3},{true,4.0}}});
|
||||
}
|
||||
|
||||
|
||||
Opm::RockConfig getRockConfig()
|
||||
{
|
||||
return Opm::RockConfig(true, {{100, 0.25}, {200, 0.30}}, "ROCKNUM", 10, false, Opm::RockConfig::Hysteresis::HYSTER);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Opm::BCConfig getBCConfig()
|
||||
{
|
||||
return Opm::BCConfig({{10,11,12,13,14,15,Opm::BCType::RATE,Opm::FaceDir::XPlus, Opm::BCComponent::GAS, 100.0}});
|
||||
}
|
||||
|
||||
|
||||
Opm::TableSchema getTableSchema()
|
||||
{
|
||||
Opm::OrderedMap<std::string, Opm::ColumnSchema> data;
|
||||
@ -227,7 +228,8 @@ Opm::TableColumn getTableColumn()
|
||||
}
|
||||
|
||||
|
||||
Opm::DenT getDenT() {
|
||||
Opm::DenT getDenT()
|
||||
{
|
||||
std::vector<Opm::DenT::entry> records;
|
||||
records.emplace_back(1,2,3);
|
||||
records.emplace_back(4,5,6);
|
||||
@ -254,6 +256,14 @@ Opm::FoamData getFoamData()
|
||||
}
|
||||
|
||||
|
||||
Opm::FoamConfig getFoamConfig()
|
||||
{
|
||||
return Opm::FoamConfig({getFoamData(), getFoamData()},
|
||||
Opm::Phase::GAS,
|
||||
Opm::FoamConfig::MobilityModel::TAB);
|
||||
}
|
||||
|
||||
|
||||
Opm::TimeMap getTimeMap()
|
||||
{
|
||||
return Opm::TimeMap({123});
|
||||
@ -789,7 +799,7 @@ BOOST_AUTO_TEST_CASE(FoamData)
|
||||
BOOST_AUTO_TEST_CASE(FoamConfig)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::FoamConfig val1({getFoamData(), getFoamData()});
|
||||
Opm::FoamConfig val1 = getFoamConfig();
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(FoamConfig)
|
||||
#endif
|
||||
@ -800,7 +810,7 @@ BOOST_AUTO_TEST_CASE(InitConfig)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::InitConfig val1(Opm::Equil({getEquilRecord(), getEquilRecord()}),
|
||||
Opm::FoamConfig({getFoamData(), getFoamData()}),
|
||||
getFoamConfig(),
|
||||
true, true, true, 20, "test1");
|
||||
auto val2 = PackUnpack(val1);
|
||||
DO_CHECKS(InitConfig)
|
||||
@ -2265,7 +2275,7 @@ BOOST_AUTO_TEST_CASE(EclipseConfig)
|
||||
Opm::IOConfig io(true, false, true, false, false, true, "test1", true,
|
||||
"test2", true, "test3", false);
|
||||
Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}),
|
||||
Opm::FoamConfig({getFoamData(), getFoamData()}),
|
||||
getFoamConfig(),
|
||||
true, true, true, 20, "test1");
|
||||
Opm::EclipseConfig val1{init, io};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user