Skip to content

Commit

Permalink
Merge pull request #411 from akva2/no_serialization_fluidsystem
Browse files Browse the repository at this point in the history
Get rid of deck usage in BlackoilFluidSystem
  • Loading branch information
bska authored Mar 4, 2020
2 parents 335d42a + bbf6171 commit 268beae
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 122 deletions.
64 changes: 4 additions & 60 deletions opm/material/fluidsystems/BlackOilFluidSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S
/*!
* \brief Initialize the fluid system using an ECL deck object
*/
static void initFromDeck(const Deck& deck, const EclipseState& eclState)
static void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
const auto& densityTable = eclState.getTableManager().getDensityTable();
size_t numRegions = densityTable.size();
Expand Down Expand Up @@ -230,17 +230,17 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S

if (phaseIsActive(gasPhaseIdx)) {
gasPvt_ = std::make_shared<GasPvt>();
gasPvt_->initFromDeck(deck, eclState);
gasPvt_->initFromState(eclState, schedule);
}

if (phaseIsActive(oilPhaseIdx)) {
oilPvt_ = std::make_shared<OilPvt>();
oilPvt_->initFromDeck(deck, eclState);
oilPvt_->initFromState(eclState, schedule);
}

if (phaseIsActive(waterPhaseIdx)) {
waterPvt_ = std::make_shared<WaterPvt>();
waterPvt_->initFromDeck(deck, eclState);
waterPvt_->initFromState(eclState, schedule);
}

initEnd();
Expand Down Expand Up @@ -1270,62 +1270,6 @@ class BlackOilFluidSystem : public BaseFluidSystem<Scalar, BlackOilFluidSystem<S
return canonicalToActivePhaseIdx_[phaseIdx];
}

template<class Serializer>
static std::size_t packSize(Serializer& serializer)
{
return serializer.packSize(numActivePhases_) +
serializer.packSize(phaseIsActive_) +
serializer.packSize(reservoirTemperature_) +
serializer.packSize(gasPvt_) +
serializer.packSize(oilPvt_) +
serializer.packSize(waterPvt_) +
serializer.packSize(enableDissolvedGas_) +
serializer.packSize(enableVaporizedOil_) +
serializer.packSize(referenceDensity_) +
serializer.packSize(molarMass_) +
serializer.packSize(activeToCanonicalPhaseIdx_) +
serializer.packSize(canonicalToActivePhaseIdx_) +
serializer.packSize(isInitialized_);
}

template<class Serializer>
static void pack(std::vector<char>& buffer, int& position,
Serializer& serializer)
{
serializer.pack(numActivePhases_, buffer, position);
serializer.pack(phaseIsActive_, buffer, position);
serializer.pack(reservoirTemperature_, buffer, position);
serializer.pack(gasPvt_, buffer, position);
serializer.pack(oilPvt_, buffer, position);
serializer.pack(waterPvt_, buffer, position);
serializer.pack(enableDissolvedGas_, buffer, position);
serializer.pack(enableVaporizedOil_, buffer, position);
serializer.pack(referenceDensity_, buffer, position);
serializer.pack(molarMass_, buffer, position);
serializer.pack(activeToCanonicalPhaseIdx_, buffer, position);
serializer.pack(canonicalToActivePhaseIdx_, buffer, position);
serializer.pack(isInitialized_, buffer, position);
}

template<class Serializer>
static void unpack(std::vector<char>& buffer, int& position,
Serializer& serializer)
{
serializer.unpack(numActivePhases_, buffer, position);
serializer.unpack(phaseIsActive_, buffer, position);
serializer.unpack(reservoirTemperature_, buffer, position);
serializer.unpack(gasPvt_, buffer, position);
serializer.unpack(oilPvt_, buffer, position);
serializer.unpack(waterPvt_, buffer, position);
serializer.unpack(enableDissolvedGas_, buffer, position);
serializer.unpack(enableVaporizedOil_, buffer, position);
serializer.unpack(referenceDensity_, buffer, position);
serializer.unpack(molarMass_, buffer, position);
serializer.unpack(activeToCanonicalPhaseIdx_, buffer, position);
serializer.unpack(canonicalToActivePhaseIdx_, buffer, position);
serializer.unpack(isInitialized_, buffer, position);
}

private:
static void resizeArrays_(size_t numRegions)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
#include <opm/material/common/Tabulated1DFunction.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtwsaltTable.hpp>
#endif

Expand Down Expand Up @@ -72,7 +69,7 @@ class ConstantCompressibilityBrinePvt
* \brief Sets the pressure-dependent water viscosity and density
* using a table stemming from the Eclipse PVTWSALT keyword.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& tableManager = eclState.getTableManager();
size_t numRegions = tableManager.getTabdims().getNumPVTTables();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@
#include <opm/material/common/Spline.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#endif

namespace Opm {
Expand Down Expand Up @@ -76,7 +73,7 @@ class ConstantCompressibilityOilPvt
/*!
* \brief Initialize the oil parameters via the data specified by the PVTO ECL keyword.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& pvcdoTable = eclState.getTableManager().getPvcdoTable();
const auto& densityTable = eclState.getTableManager().getDensityTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#include <opm/material/common/Tabulated1DFunction.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#endif

Expand Down Expand Up @@ -70,7 +66,7 @@ class ConstantCompressibilityWaterPvt
* \brief Sets the pressure-dependent water viscosity and density
* using a table stemming from the Eclipse PVTW keyword.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& pvtwTable = eclState.getTableManager().getPvtwTable();
const auto& densityTable = eclState.getTableManager().getDensityTable();
Expand Down
2 changes: 1 addition & 1 deletion opm/material/fluidsystems/blackoilpvt/DeadOilPvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DeadOilPvt
/*!
* \brief Initialize the oil parameters via the data specified by the PVDO ECL keyword.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& pvdoTables = eclState.getTableManager().getPvdoTables();
const auto& densityTable = eclState.getTableManager().getDensityTable();
Expand Down
6 changes: 2 additions & 4 deletions opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
#include <opm/material/common/Tabulated1DFunction.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#endif

#include <vector>
Expand Down Expand Up @@ -72,7 +70,7 @@ class DryGasPvt
*
* This method assumes that the deck features valid DENSITY and PVDG keywords.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& pvdgTables = eclState.getTableManager().getPvdgTables();
const auto& densityTable = eclState.getTableManager().getDensityTable();
Expand Down
7 changes: 2 additions & 5 deletions opm/material/fluidsystems/blackoilpvt/GasPvtMultiplexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@
#include "GasPvtThermal.hpp"

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#endif

namespace Opm {
Expand Down Expand Up @@ -126,7 +123,7 @@ class GasPvtMultiplexer
*
* This method assumes that the deck features valid DENSITY and PVDG keywords.
*/
void initFromDeck(const Deck& deck, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
if (!eclState.runspec().phases().active(Phase::GAS))
return;
Expand All @@ -138,7 +135,7 @@ class GasPvtMultiplexer
else if (eclState.getTableManager().hasTables("PVDG"))
setApproach(DryGasPvt);

OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.initFromDeck(deck, eclState));
OPM_GAS_PVT_MULTIPLEXER_CALL(pvtImpl.initFromState(eclState, schedule));
}
#endif // HAVE_ECL_INPUT

Expand Down
6 changes: 2 additions & 4 deletions opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <opm/material/common/Spline.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
Expand Down Expand Up @@ -96,14 +95,13 @@ class GasPvtThermal
/*!
* \brief Implement the temperature part of the gas PVT properties.
*/
void initFromDeck(const Deck& deck,
const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
//////
// initialize the isothermal part
//////
isothermalPvt_ = new IsothermalPvt;
isothermalPvt_->initFromDeck(deck, eclState);
isothermalPvt_->initFromState(eclState, schedule);

//////
// initialize the thermal part
Expand Down
11 changes: 5 additions & 6 deletions opm/material/fluidsystems/blackoilpvt/LiveOilPvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
#include <opm/material/common/Tabulated1DFunction.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#endif

Expand Down Expand Up @@ -91,7 +90,7 @@ class LiveOilPvt
/*!
* \brief Initialize the oil parameters via the data specified by the PVTO ECL keyword.
*/
void initFromDeck(const Deck& deck, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
const auto& pvtoTables = eclState.getTableManager().getPvtoTables();
const auto& densityTable = eclState.getTableManager().getDensityTable();
Expand Down Expand Up @@ -196,9 +195,9 @@ class LiveOilPvt
}

vapPar2_ = 0.0;
if (deck.hasKeyword("VAPPARS")) {
const auto& vapParsKeyword = deck.getKeyword("VAPPARS");
vapPar2_ = vapParsKeyword.getRecord(0).getItem("OIL_DENSITY_PROPENSITY").template get<double>(0);
const auto& oilVap = schedule.getOilVaporizationProperties(0);
if (oilVap.getType() == OilVaporizationProperties::OilVaporization::VAPPARS) {
vapPar2_ = oilVap.vap2();
}

initEnd();
Expand Down
6 changes: 3 additions & 3 deletions opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ class OilPvtMultiplexer

#if HAVE_ECL_INPUT
/*!
* \brief Initialize the parameters for water using an ECL deck.
* \brief Initialize the parameters for water using an ECL state.
*
* This method assumes that the deck features valid DENSITY and PVTO/PVDO/PVCDO keywords.
*/
void initFromDeck(const Deck& deck, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
if (!eclState.runspec().phases().active(Phase::OIL))
return;
Expand All @@ -151,7 +151,7 @@ class OilPvtMultiplexer
else if (!eclState.getTableManager().getPvtoTables().empty())
setApproach(LiveOilPvt);

OPM_OIL_PVT_MULTIPLEXER_CALL(pvtImpl.initFromDeck(deck, eclState));
OPM_OIL_PVT_MULTIPLEXER_CALL(pvtImpl.initFromState(eclState, schedule));
}
#endif // HAVE_ECL_INPUT

Expand Down
6 changes: 2 additions & 4 deletions opm/material/fluidsystems/blackoilpvt/OilPvtThermal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <opm/material/common/Spline.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
Expand Down Expand Up @@ -102,14 +101,13 @@ class OilPvtThermal
/*!
* \brief Implement the temperature part of the oil PVT properties.
*/
void initFromDeck(const Deck& deck,
const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
//////
// initialize the isothermal part
//////
isothermalPvt_ = new IsothermalPvt;
isothermalPvt_->initFromDeck(deck, eclState);
isothermalPvt_->initFromState(eclState, schedule);

//////
// initialize the thermal part
Expand Down
6 changes: 2 additions & 4 deletions opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
#include <opm/material/common/Tabulated1DFunction.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvdsTable.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#endif

#include <vector>
Expand Down Expand Up @@ -73,7 +71,7 @@ class SolventPvt
*
* This method assumes that the deck features valid SDENSITY and PVDS keywords.
*/
void initFromDeck(const Deck&, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule&)
{
const auto& pvdsTables = eclState.getTableManager().getPvdsTables();
const auto& sdensityTables = eclState.getTableManager().getSolventDensityTables();
Expand Down
4 changes: 2 additions & 2 deletions opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class WaterPvtMultiplexer
*
* This method assumes that the deck features valid DENSITY and PVDG keywords.
*/
void initFromDeck(const Deck& deck, const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
if (!eclState.runspec().phases().active(Phase::WATER))
return;
Expand All @@ -129,7 +129,7 @@ class WaterPvtMultiplexer
else if (enableBrine && !eclState.getTableManager().getPvtwSaltTables().empty())
setApproach(ConstantCompressibilityBrinePvt);

OPM_WATER_PVT_MULTIPLEXER_CALL(pvtImpl.initFromDeck(deck, eclState));
OPM_WATER_PVT_MULTIPLEXER_CALL(pvtImpl.initFromState(eclState, schedule));
}
#endif // HAVE_ECL_INPUT

Expand Down
6 changes: 2 additions & 4 deletions opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <opm/material/common/Spline.hpp>

#if HAVE_ECL_INPUT
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
Expand Down Expand Up @@ -108,14 +107,13 @@ class WaterPvtThermal
/*!
* \brief Implement the temperature part of the water PVT properties.
*/
void initFromDeck(const Deck& deck,
const EclipseState& eclState)
void initFromState(const EclipseState& eclState, const Schedule& schedule)
{
//////
// initialize the isothermal part
//////
isothermalPvt_ = new IsothermalPvt;
isothermalPvt_->initFromDeck(deck, eclState);
isothermalPvt_->initFromState(eclState, schedule);

//////
// initialize the thermal part
Expand Down
Loading

0 comments on commit 268beae

Please sign in to comment.