From e2f27af345f64f71011c3aeea6542c0bd0b7c9dd Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 1/6] BlackOilBrineModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilbrinemodules.hh | 72 ++------------------- 1 file changed, 4 insertions(+), 68 deletions(-) diff --git a/opm/models/blackoil/blackoilbrinemodules.hh b/opm/models/blackoil/blackoilbrinemodules.hh index b7e139f80a..4c2470776e 100644 --- a/opm/models/blackoil/blackoilbrinemodules.hh +++ b/opm/models/blackoil/blackoilbrinemodules.hh @@ -32,21 +32,13 @@ #include -#if HAVE_ECL_INPUT -#include -#include -#include -#include -#include -#include -#endif - #include #include #include namespace Opm { + /*! * \ingroup BlackOil * \brief Contains the high level supplements required to extend the black oil @@ -84,67 +76,11 @@ class BlackOilBrineModule static constexpr unsigned numPhases = FluidSystem::numPhases; public: - -#if HAVE_ECL_INPUT - /*! - * \brief Initialize all internal data structures needed by the brine module - */ - static void initFromState(const EclipseState& eclState) + //! \brief Set the parameters. + static void setParams(BlackOilBrineParams params) { - // some sanity checks: if brine are enabled, the BRINE keyword must be - // present, if brine are disabled the keyword must not be present. - if (enableBrine && !eclState.runspec().phases().active(Phase::BRINE)) { - throw std::runtime_error("Non-trivial brine treatment requested at compile time, but " - "the deck does not contain the BRINE keyword"); - } - else if (!enableBrine && eclState.runspec().phases().active(Phase::BRINE)) { - throw std::runtime_error("Brine treatment disabled at compile time, but the deck " - "contains the BRINE keyword"); - } - - if (!eclState.runspec().phases().active(Phase::BRINE)) - return; // brine treatment is supposed to be disabled - - const auto& tableManager = eclState.getTableManager(); - - unsigned numPvtRegions = tableManager.getTabdims().getNumPVTTables(); - params_.referencePressure_.resize(numPvtRegions); - - const auto& pvtwsaltTables = tableManager.getPvtwSaltTables(); - - // initialize the objects which deal with the BDENSITY keyword - const auto& bdensityTables = tableManager.getBrineDensityTables(); - if (!bdensityTables.empty()) { - params_.bdensityTable_.resize(numPvtRegions); - assert(numPvtRegions == bdensityTables.size()); - for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) { - const auto& bdensityTable = bdensityTables[pvtRegionIdx]; - const auto& pvtwsaltTable = pvtwsaltTables[pvtRegionIdx]; - const auto& c = pvtwsaltTable.getSaltConcentrationColumn(); - params_.bdensityTable_[pvtRegionIdx].setXYContainers(c, bdensityTable); - } - } - - if constexpr (enableSaltPrecipitation) { - const TableContainer& permfactTables = tableManager.getPermfactTables(); - params_.permfactTable_.resize(numPvtRegions); - for (size_t i = 0; i < permfactTables.size(); ++i) { - const PermfactTable& permfactTable = permfactTables.getTable(i); - params_.permfactTable_[i].setXYContainers(permfactTable.getPorosityChangeColumn(), permfactTable.getPermeabilityMultiplierColumn()); - } - - const TableContainer& saltsolTables = tableManager.getSaltsolTables(); - if (!saltsolTables.empty()) { - params_.saltsolTable_.resize(numPvtRegions); - assert(numPvtRegions == saltsolTables.size()); - for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) { - const SaltsolTable& saltsolTable = saltsolTables.getTable(pvtRegionIdx ); - params_.saltsolTable_[pvtRegionIdx] = saltsolTable.getSaltsolColumn().front(); - } - } - } + params_ = std::move(params); } -#endif /*! * \brief Register all run-time parameters for the black-oil brine module. From 65c4906a40a7aeb87e3a93a63232f97ab1349c6f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 2/6] BlackOilExtboModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilextbomodules.hh | 173 +------------------- 1 file changed, 3 insertions(+), 170 deletions(-) diff --git a/opm/models/blackoil/blackoilextbomodules.hh b/opm/models/blackoil/blackoilextbomodules.hh index baf3ad2e6f..3c9d6f7f92 100644 --- a/opm/models/blackoil/blackoilextbomodules.hh +++ b/opm/models/blackoil/blackoilextbomodules.hh @@ -36,20 +36,6 @@ #include -//#include //TODO: Missing ... - -#if HAVE_ECL_INPUT -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - #include #include @@ -96,164 +82,11 @@ class BlackOilExtboModule static constexpr bool blackoilConserveSurfaceVolume = getPropValue(); public: -#if HAVE_ECL_INPUT - /*! - * \brief Initialize all internal data structures needed by the solvent module - */ - static void initFromState(const EclipseState& eclState) + //! \brief Set the parameters. + static void setParams(BlackOilExtboParams params) { - // some sanity checks: if extended BO is enabled, the PVTSOL keyword must be - // present, if extended BO is disabled the keyword must not be present. - if (enableExtbo && !eclState.runspec().phases().active(Phase::ZFRACTION)) - throw std::runtime_error("Extended black oil treatment requested at compile " - "time, but the deck does not contain the PVTSOL keyword"); - else if (!enableExtbo && eclState.runspec().phases().active(Phase::ZFRACTION)) - throw std::runtime_error("Extended black oil treatment disabled at compile time, but the deck " - "contains the PVTSOL keyword"); - - if (!eclState.runspec().phases().active(Phase::ZFRACTION)) - return; // solvent treatment is supposed to be disabled - - // pvt properties from kw PVTSOL: - - const auto& tableManager = eclState.getTableManager(); - const auto& pvtsolTables = tableManager.getPvtsolTables(); - - size_t numPvtRegions = pvtsolTables.size(); - - params_.BO_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.BG_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.RS_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.RV_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.X_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.Y_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.VISCO_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.VISCG_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - - params_.PBUB_RS_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - params_.PBUB_RV_.resize(numPvtRegions, Tabulated2DFunction{Tabulated2DFunction::InterpolationPolicy::LeftExtreme}); - - params_.zLim_.resize(numPvtRegions); - - const bool extractCmpFromPvt = true; //: Default values used in [*] - params_.oilCmp_.resize(numPvtRegions); - params_.gasCmp_.resize(numPvtRegions); - - for (unsigned regionIdx = 0; regionIdx < numPvtRegions; ++ regionIdx) { - const auto& pvtsolTable = pvtsolTables[regionIdx]; - - const auto& saturatedTable = pvtsolTable.getSaturatedTable(); - assert(saturatedTable.numRows() > 1); - - std::vector oilCmp(saturatedTable.numRows(), -4.0e-9); //Default values used in [*] - std::vector gasCmp(saturatedTable.numRows(), -0.08); //-------------"------------- - params_.zLim_[regionIdx] = 0.7; //-------------"------------- - std::vector zArg(saturatedTable.numRows(), 0.0); - - for (unsigned outerIdx = 0; outerIdx < saturatedTable.numRows(); ++ outerIdx) { - Scalar ZCO2 = saturatedTable.get("ZCO2", outerIdx); - - zArg[outerIdx] = ZCO2; - - params_.BO_[regionIdx].appendXPos(ZCO2); - params_.BG_[regionIdx].appendXPos(ZCO2); - - params_.RS_[regionIdx].appendXPos(ZCO2); - params_.RV_[regionIdx].appendXPos(ZCO2); - - params_.X_[regionIdx].appendXPos(ZCO2); - params_.Y_[regionIdx].appendXPos(ZCO2); - - params_.VISCO_[regionIdx].appendXPos(ZCO2); - params_.VISCG_[regionIdx].appendXPos(ZCO2); - - params_.PBUB_RS_[regionIdx].appendXPos(ZCO2); - params_.PBUB_RV_[regionIdx].appendXPos(ZCO2); - - const auto& underSaturatedTable = pvtsolTable.getUnderSaturatedTable(outerIdx); - size_t numRows = underSaturatedTable.numRows(); - - Scalar bo0=0.0; - Scalar po0=0.0; - for (unsigned innerIdx = 0; innerIdx < numRows; ++ innerIdx) { - Scalar po = underSaturatedTable.get("P", innerIdx); - Scalar bo = underSaturatedTable.get("B_O", innerIdx); - Scalar bg = underSaturatedTable.get("B_G", innerIdx); - Scalar rs = underSaturatedTable.get("RS", innerIdx)+innerIdx*1.0e-10; - Scalar rv = underSaturatedTable.get("RV", innerIdx)+innerIdx*1.0e-10; - Scalar xv = underSaturatedTable.get("XVOL", innerIdx); - Scalar yv = underSaturatedTable.get("YVOL", innerIdx); - Scalar mo = underSaturatedTable.get("MU_O", innerIdx); - Scalar mg = underSaturatedTable.get("MU_G", innerIdx); - - if (bo0 > bo) { // This is undersaturated oil-phase for ZCO2 <= zLim ... - // Here we assume tabulated bo to decay beyond boiling point - if (extractCmpFromPvt) { - Scalar cmpFactor = (bo-bo0)/(po-po0); - oilCmp[outerIdx] = cmpFactor; - params_.zLim_[regionIdx] = ZCO2; - //std::cout << "### cmpFactorOil: " << cmpFactor << " zLim: " << zLim_[regionIdx] << std::endl; - } - break; - } else if (bo0 == bo) { // This is undersaturated gas-phase for ZCO2 > zLim ... - // Here we assume tabulated bo to be constant extrapolated beyond dew point - if (innerIdx+1 < numRows && ZCO2<1.0 && extractCmpFromPvt) { - Scalar rvNxt = underSaturatedTable.get("RV", innerIdx+1)+innerIdx*1.0e-10; - Scalar bgNxt = underSaturatedTable.get("B_G", innerIdx+1); - Scalar cmpFactor = (bgNxt-bg)/(rvNxt-rv); - gasCmp[outerIdx] = cmpFactor; - //std::cout << "### cmpFactorGas: " << cmpFactor << " zLim: " << zLim_[regionIdx] << std::endl; - } - - params_.BO_[regionIdx].appendSamplePoint(outerIdx,po,bo); - params_.BG_[regionIdx].appendSamplePoint(outerIdx,po,bg); - params_.RS_[regionIdx].appendSamplePoint(outerIdx,po,rs); - params_.RV_[regionIdx].appendSamplePoint(outerIdx,po,rv); - params_.X_[regionIdx].appendSamplePoint(outerIdx,po,xv); - params_.Y_[regionIdx].appendSamplePoint(outerIdx,po,yv); - params_.VISCO_[regionIdx].appendSamplePoint(outerIdx,po,mo); - params_.VISCG_[regionIdx].appendSamplePoint(outerIdx,po,mg); - break; - } - - bo0=bo; - po0=po; - - params_.BO_[regionIdx].appendSamplePoint(outerIdx,po,bo); - params_.BG_[regionIdx].appendSamplePoint(outerIdx,po,bg); - - params_.RS_[regionIdx].appendSamplePoint(outerIdx,po,rs); - params_.RV_[regionIdx].appendSamplePoint(outerIdx,po,rv); - - params_.X_[regionIdx].appendSamplePoint(outerIdx,po,xv); - params_.Y_[regionIdx].appendSamplePoint(outerIdx,po,yv); - - params_.VISCO_[regionIdx].appendSamplePoint(outerIdx,po,mo); - params_.VISCG_[regionIdx].appendSamplePoint(outerIdx,po,mg); - - // rs,rv -> pressure - params_.PBUB_RS_[regionIdx].appendSamplePoint(outerIdx, rs, po); - params_.PBUB_RV_[regionIdx].appendSamplePoint(outerIdx, rv, po); - - } - } - params_.oilCmp_[regionIdx].setXYContainers(zArg, oilCmp, /*sortInput=*/false); - params_.gasCmp_[regionIdx].setXYContainers(zArg, gasCmp, /*sortInput=*/false); - } - - // Reference density for pure z-component taken from kw SDENSITY - const auto& sdensityTables = eclState.getTableManager().getSolventDensityTables(); - if (sdensityTables.size() == numPvtRegions) { - params_.zReferenceDensity_.resize(numPvtRegions); - for (unsigned regionIdx = 0; regionIdx < numPvtRegions; ++ regionIdx) { - Scalar rhoRefS = sdensityTables[regionIdx].getSolventDensityColumn().front(); - params_.zReferenceDensity_[regionIdx]=rhoRefS; - } - } - else - throw std::runtime_error("Extbo: kw SDENSITY is missing or not aligned with NTPVT\n"); + params_ = std::move(params); } -#endif /*! * \brief Register all run-time parameters for the black-oil solvent module. From 25c2219da7608d945cb738ad71b3c565d365b76f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 3/6] BlackOilFoamModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilfoammodules.hh | 97 +--------------------- 1 file changed, 3 insertions(+), 94 deletions(-) diff --git a/opm/models/blackoil/blackoilfoammodules.hh b/opm/models/blackoil/blackoilfoammodules.hh index dd8b03c94e..08c575bb1b 100644 --- a/opm/models/blackoil/blackoilfoammodules.hh +++ b/opm/models/blackoil/blackoilfoammodules.hh @@ -34,12 +34,6 @@ #include -#if HAVE_ECL_INPUT -#include -#include -#include -#endif - #include #include @@ -83,96 +77,11 @@ class BlackOilFoamModule static constexpr unsigned numPhases = FluidSystem::numPhases; public: -#if HAVE_ECL_INPUT - /*! - * \brief Initialize all internal data structures needed by the foam module - */ - static void initFromState(const EclipseState& eclState) + //! \brief Set the parameters. + static void setParams(BlackOilFoamParams params) { - // some sanity checks: if foam is enabled, the FOAM keyword must be - // present, if foam is disabled the keyword must not be present. - if (enableFoam && !eclState.runspec().phases().active(Phase::FOAM)) { - throw std::runtime_error("Non-trivial foam treatment requested at compile time, but " - "the deck does not contain the FOAM keyword"); - } - else if (!enableFoam && eclState.runspec().phases().active(Phase::FOAM)) { - throw std::runtime_error("Foam treatment disabled at compile time, but the deck " - "contains the FOAM keyword"); - } - - if (!eclState.runspec().phases().active(Phase::FOAM)) { - return; // foam treatment is supposed to be disabled - } - - // Check that only implemented options are used. - // We only support the default values of FOAMOPTS (GAS, TAB). - if (eclState.getInitConfig().getFoamConfig().getTransportPhase() != Phase::GAS) { - throw std::runtime_error("In FOAMOPTS, only GAS is allowed for the transport phase."); - } - if (eclState.getInitConfig().getFoamConfig().getMobilityModel() != FoamConfig::MobilityModel::TAB) { - throw std::runtime_error("In FOAMOPTS, only TAB is allowed for the gas mobility factor reduction model."); - } - - const auto& tableManager = eclState.getTableManager(); - const unsigned int numSatRegions = tableManager.getTabdims().getNumSatTables(); - params_.setNumSatRegions(numSatRegions); - const unsigned int numPvtRegions = tableManager.getTabdims().getNumPVTTables(); - params_.gasMobilityMultiplierTable_.resize(numPvtRegions); - - // Get and check FOAMROCK data. - const FoamConfig& foamConf = eclState.getInitConfig().getFoamConfig(); - if (numSatRegions != foamConf.size()) { - throw std::runtime_error("Inconsistent sizes, number of saturation regions differ from the number of elements " - "in FoamConfig, which typically corresponds to the number of records in FOAMROCK."); - } - - // Get and check FOAMADS data. - const auto& foamadsTables = tableManager.getFoamadsTables(); - if (foamadsTables.empty()) { - throw std::runtime_error("FOAMADS must be specified in FOAM runs"); - } - if (numSatRegions != foamadsTables.size()) { - throw std::runtime_error("Inconsistent sizes, number of saturation regions differ from the " - "number of FOAMADS tables."); - } - - // Set data that vary with saturation region. - for (std::size_t satReg = 0; satReg < numSatRegions; ++satReg) { - const auto& rec = foamConf.getRecord(satReg); - params_.foamCoefficients_[satReg] = typename BlackOilFoamParams::FoamCoefficients(); - params_.foamCoefficients_[satReg].fm_min = rec.minimumSurfactantConcentration(); - params_.foamCoefficients_[satReg].fm_surf = rec.referenceSurfactantConcentration(); - params_.foamCoefficients_[satReg].ep_surf = rec.exponent(); - params_.foamRockDensity_[satReg] = rec.rockDensity(); - params_.foamAllowDesorption_[satReg] = rec.allowDesorption(); - const auto& foamadsTable = foamadsTables.template getTable(satReg); - const auto& conc = foamadsTable.getFoamConcentrationColumn(); - const auto& ads = foamadsTable.getAdsorbedFoamColumn(); - params_.adsorbedFoamTable_[satReg].setXYContainers(conc, ads); - } - - // Get and check FOAMMOB data. - const auto& foammobTables = tableManager.getFoammobTables(); - if (foammobTables.empty()) { - // When in the future adding support for the functional - // model, FOAMMOB will not be required anymore (functional - // family of keywords can be used instead, FOAMFSC etc.). - throw std::runtime_error("FOAMMOB must be specified in FOAM runs"); - } - if (numPvtRegions != foammobTables.size()) { - throw std::runtime_error("Inconsistent sizes, number of PVT regions differ from the " - "number of FOAMMOB tables."); - } - - // Set data that vary with PVT region. - for (std::size_t pvtReg = 0; pvtReg < numPvtRegions; ++pvtReg) { - const auto& foammobTable = foammobTables.template getTable(pvtReg); - const auto& conc = foammobTable.getFoamConcentrationColumn(); - const auto& mobMult = foammobTable.getMobilityMultiplierColumn(); - params_.gasMobilityMultiplierTable_[pvtReg].setXYContainers(conc, mobMult); - } + params_ = std::move(params); } -#endif /*! * \brief Register all run-time parameters for the black-oil foam module. From 563e195c0be1ffcc3e977ce82d25ffd7c8b10725 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 4/6] BlackOilMICPModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilmicpmodules.hh | 92 +--------------------- 1 file changed, 3 insertions(+), 89 deletions(-) diff --git a/opm/models/blackoil/blackoilmicpmodules.hh b/opm/models/blackoil/blackoilmicpmodules.hh index ac56397fa6..dadc57bfad 100644 --- a/opm/models/blackoil/blackoilmicpmodules.hh +++ b/opm/models/blackoil/blackoilmicpmodules.hh @@ -33,11 +33,6 @@ #include #include -#if HAVE_ECL_INPUT -#include -#include -#endif - #include #include @@ -86,50 +81,11 @@ class BlackOilMICPModule static constexpr unsigned numEq = getPropValue(); public: - -#if HAVE_ECL_INPUT - // - //* \brief Initialize all internal data structures needed by the MICP module - // - static void initFromState(const EclipseState& eclState) + //! \brief Set the parameters. + static void setParams(BlackOilMICPParams params) { - // some sanity checks: if MICP is enabled, the MICP keyword must be - // present, if MICP is disabled the keyword must not be present. - if (enableMICP && !eclState.runspec().micp()) { - throw std::runtime_error("Non-trivial MICP treatment requested at compile time, but " - "the deck does not contain the MICP keyword"); - } - else if (!enableMICP && eclState.runspec().micp()) { - throw std::runtime_error("MICP treatment disabled at compile time, but the deck " - "contains the MICP keyword"); - } - - if (!eclState.runspec().micp()) - return; // MICP treatment is supposed to be disabled*/ - - // initialize the objects which deal with the MICPpara keyword - const auto& MICPpara = eclState.getMICPpara(); - setMICPpara(MICPpara.getDensityBiofilm(), - MICPpara.getDensityCalcite(), - MICPpara.getDetachmentRate(), - MICPpara.getCriticalPorosity(), - MICPpara.getFittingFactor(), - MICPpara.getHalfVelocityOxygen(), - MICPpara.getHalfVelocityUrea(), - MICPpara.getMaximumGrowthRate(), - MICPpara.getMaximumUreaUtilization(), - MICPpara.getMicrobialAttachmentRate(), - MICPpara.getMicrobialDeathRate(), - MICPpara.getMinimumPermeability(), - MICPpara.getOxygenConsumptionFactor(), - MICPpara.getYieldGrowthCoefficient(), - MICPpara.getMaximumOxygenConcentration(), - MICPpara.getMaximumUreaConcentration(), - MICPpara.getToleranceBeforeClogging()); - // obtain the porosity for the clamp in the blackoilnewtonmethod - params_.phi_ = eclState.fieldProps().get_double("PORO"); + params_ = std::move(params); } -#endif /*! * \brief The simulator stops if "clogging" has been (almost) reached in any of the cells. @@ -145,48 +101,6 @@ public: throw std::logic_error("Clogging has been (almost) reached in at least one cell\n"); } - /*! - * \brief Specify the MICP properties a single region. - * - * The index of specified here must be in range [0, numSatRegions) - */ - static void setMICPpara(const Scalar& densityBiofilm, - const Scalar& densityCalcite, - const Scalar& detachmentRate, - const Scalar& criticalPorosity, - const Scalar& fittingFactor, - const Scalar& halfVelocityOxygen, - const Scalar& halfVelocityUrea, - const Scalar& maximumGrowthRate, - const Scalar& maximumUreaUtilization, - const Scalar& microbialAttachmentRate, - const Scalar& microbialDeathRate, - const Scalar& minimumPermeability, - const Scalar& oxygenConsumptionFactor, - const Scalar& yieldGrowthCoefficient, - const Scalar& maximumOxygenConcentration, - const Scalar& maximumUreaConcentration, - const Scalar& toleranceBeforeClogging) - { - params_.densityBiofilm_ = densityBiofilm; - params_.densityCalcite_ = densityCalcite; - params_.detachmentRate_ = detachmentRate; - params_.criticalPorosity_ = criticalPorosity; - params_.fittingFactor_ = fittingFactor; - params_.halfVelocityOxygen_ = halfVelocityOxygen; - params_.halfVelocityUrea_ = halfVelocityUrea; - params_.maximumGrowthRate_ = maximumGrowthRate; - params_.maximumUreaUtilization_ = maximumUreaUtilization; - params_.microbialAttachmentRate_ = microbialAttachmentRate; - params_.microbialDeathRate_ = microbialDeathRate; - params_.minimumPermeability_ = minimumPermeability; - params_.oxygenConsumptionFactor_ = oxygenConsumptionFactor; - params_.yieldGrowthCoefficient_ = yieldGrowthCoefficient; - params_.maximumOxygenConcentration_ = maximumOxygenConcentration; - params_.maximumUreaConcentration_ = maximumUreaConcentration; - params_.toleranceBeforeClogging_ = toleranceBeforeClogging; - } - /*! * \brief Register all run-time parameters for the black-oil MICP module. */ From 0cf2a792f4382772cec05d00210cef318c267a3a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 5/6] BlackOilPolymerModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilpolymermodules.hh | 264 +----------------- 1 file changed, 3 insertions(+), 261 deletions(-) diff --git a/opm/models/blackoil/blackoilpolymermodules.hh b/opm/models/blackoil/blackoilpolymermodules.hh index e5d6ef21e8..ae93777464 100644 --- a/opm/models/blackoil/blackoilpolymermodules.hh +++ b/opm/models/blackoil/blackoilpolymermodules.hh @@ -33,17 +33,6 @@ #include #include -#include - -#if HAVE_ECL_INPUT -#include -#include -#include -#include -#include -#include -#endif - #include #include @@ -91,258 +80,11 @@ class BlackOilPolymerModule static constexpr unsigned numPhases = FluidSystem::numPhases; public: -#if HAVE_ECL_INPUT - /*! - * \brief Initialize all internal data structures needed by the polymer module - */ - static void initFromState(const EclipseState& eclState) + //! \brief Set the parameters. + static void setParams(BlackOilPolymerParams params) { - // some sanity checks: if polymers are enabled, the POLYMER keyword must be - // present, if polymers are disabled the keyword must not be present. - if (enablePolymer && !eclState.runspec().phases().active(Phase::POLYMER)) { - throw std::runtime_error("Non-trivial polymer treatment requested at compile time, but " - "the deck does not contain the POLYMER keyword"); - } - else if (!enablePolymer && eclState.runspec().phases().active(Phase::POLYMER)) { - throw std::runtime_error("Polymer treatment disabled at compile time, but the deck " - "contains the POLYMER keyword"); - } - - if (enablePolymerMolarWeight && !eclState.runspec().phases().active(Phase::POLYMW)) { - throw std::runtime_error("Polymer molecular weight tracking is enabled at compile time, but " - "the deck does not contain the POLYMW keyword"); - } - else if (!enablePolymerMolarWeight && eclState.runspec().phases().active(Phase::POLYMW)) { - throw std::runtime_error("Polymer molecular weight tracking is disabled at compile time, but the deck " - "contains the POLYMW keyword"); - } - - if (enablePolymerMolarWeight && !enablePolymer) { - throw std::runtime_error("Polymer molecular weight tracking is enabled while polymer treatment " - "is disabled at compile time"); - } - - if (!eclState.runspec().phases().active(Phase::POLYMER)) - return; // polymer treatment is supposed to be disabled - - const auto& tableManager = eclState.getTableManager(); - - unsigned numSatRegions = tableManager.getTabdims().getNumSatTables(); - params_.setNumSatRegions(numSatRegions); - - // initialize the objects which deal with the PLYROCK keyword - const auto& plyrockTables = tableManager.getPlyrockTables(); - if (!plyrockTables.empty()) { - assert(numSatRegions == plyrockTables.size()); - for (unsigned satRegionIdx = 0; satRegionIdx < numSatRegions; ++ satRegionIdx) { - const auto& plyrockTable = plyrockTables.template getTable(satRegionIdx); - params_.setPlyrock(satRegionIdx, - plyrockTable.getDeadPoreVolumeColumn()[0], - plyrockTable.getResidualResistanceFactorColumn()[0], - plyrockTable.getRockDensityFactorColumn()[0], - static_cast::AdsorptionBehaviour>(plyrockTable.getAdsorbtionIndexColumn()[0]), - plyrockTable.getMaxAdsorbtionColumn()[0]); - } - } - else { - throw std::runtime_error("PLYROCK must be specified in POLYMER runs\n"); - } - - // initialize the objects which deal with the PLYADS keyword - const auto& plyadsTables = tableManager.getPlyadsTables(); - if (!plyadsTables.empty()) { - assert(numSatRegions == plyadsTables.size()); - for (unsigned satRegionIdx = 0; satRegionIdx < numSatRegions; ++ satRegionIdx) { - const auto& plyadsTable = plyadsTables.template getTable(satRegionIdx); - // Copy data - const auto& c = plyadsTable.getPolymerConcentrationColumn(); - const auto& ads = plyadsTable.getAdsorbedPolymerColumn(); - params_.plyadsAdsorbedPolymer_[satRegionIdx].setXYContainers(c, ads); - } - } - else { - throw std::runtime_error("PLYADS must be specified in POLYMER runs\n"); - } - - - unsigned numPvtRegions = tableManager.getTabdims().getNumPVTTables(); - params_.plyviscViscosityMultiplierTable_.resize(numPvtRegions); - - // initialize the objects which deal with the PLYVISC keyword - const auto& plyviscTables = tableManager.getPlyviscTables(); - if (!plyviscTables.empty()) { - // different viscosity model is used for POLYMW - if (enablePolymerMolarWeight) { - OpmLog::warning("PLYVISC should not be used in POLYMW runs, " - "it will have no effect. A viscosity model based on PLYVMH is used instead.\n"); - } - else { - assert(numPvtRegions == plyviscTables.size()); - for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) { - const auto& plyadsTable = plyviscTables.template getTable(pvtRegionIdx); - // Copy data - const auto& c = plyadsTable.getPolymerConcentrationColumn(); - const auto& visc = plyadsTable.getViscosityMultiplierColumn(); - params_.plyviscViscosityMultiplierTable_[pvtRegionIdx].setXYContainers(c, visc); - } - } - } - else if (!enablePolymerMolarWeight) { - throw std::runtime_error("PLYVISC must be specified in POLYMER runs\n"); - } - - // initialize the objects which deal with the PLYMAX keyword - const auto& plymaxTables = tableManager.getPlymaxTables(); - const unsigned numMixRegions = plymaxTables.size(); - params_.setNumMixRegions(numMixRegions, enablePolymerMolarWeight); - if (!plymaxTables.empty()) { - for (unsigned mixRegionIdx = 0; mixRegionIdx < numMixRegions; ++ mixRegionIdx) { - const auto& plymaxTable = plymaxTables.template getTable(mixRegionIdx); - params_.plymaxMaxConcentration_[mixRegionIdx] = plymaxTable.getPolymerConcentrationColumn()[0]; - } - } - else { - throw std::runtime_error("PLYMAX must be specified in POLYMER runs\n"); - } - - if (!eclState.getTableManager().getPlmixparTable().empty()) { - if (enablePolymerMolarWeight) { - OpmLog::warning("PLMIXPAR should not be used in POLYMW runs, it will have no effect.\n"); - } - else { - const auto& plmixparTable = eclState.getTableManager().getPlmixparTable(); - // initialize the objects which deal with the PLMIXPAR keyword - for (unsigned mixRegionIdx = 0; mixRegionIdx < numMixRegions; ++ mixRegionIdx) { - params_.plymixparToddLongstaff_[mixRegionIdx] = plmixparTable[mixRegionIdx].todd_langstaff; - } - } - } - else if (!enablePolymerMolarWeight) { - throw std::runtime_error("PLMIXPAR must be specified in POLYMER runs\n"); - } - - params_.hasPlyshlog_ = eclState.getTableManager().hasTables("PLYSHLOG"); - params_.hasShrate_ = eclState.getTableManager().useShrate(); - - if ((params_.hasPlyshlog_ || params_.hasShrate_) && enablePolymerMolarWeight) { - OpmLog::warning("PLYSHLOG and SHRATE should not be used in POLYMW runs, they will have no effect.\n"); - } - - if (params_.hasPlyshlog_ && !enablePolymerMolarWeight) { - const auto& plyshlogTables = tableManager.getPlyshlogTables(); - assert(numPvtRegions == plyshlogTables.size()); - params_.plyshlogShearEffectRefMultiplier_.resize(numPvtRegions); - params_.plyshlogShearEffectRefLogVelocity_.resize(numPvtRegions); - for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) { - const auto& plyshlogTable = plyshlogTables.template getTable(pvtRegionIdx); - - Scalar plyshlogRefPolymerConcentration = plyshlogTable.getRefPolymerConcentration(); - auto waterVelocity = plyshlogTable.getWaterVelocityColumn().vectorCopy(); - auto shearMultiplier = plyshlogTable.getShearMultiplierColumn().vectorCopy(); - - // do the unit version here for the waterVelocity - UnitSystem unitSystem = eclState.getDeckUnitSystem(); - double siFactor = params_.hasShrate_? unitSystem.parse("1/Time").getSIScaling() : unitSystem.parse("Length/Time").getSIScaling(); - for (size_t i = 0; i < waterVelocity.size(); ++i) { - waterVelocity[i] *= siFactor; - // for plyshlog the input must be stored as logarithms - // the interpolation is then done the log-space. - waterVelocity[i] = std::log(waterVelocity[i]); - } - - Scalar refViscMult = params_.plyviscViscosityMultiplierTable_[pvtRegionIdx].eval(plyshlogRefPolymerConcentration, /*extrapolate=*/true); - // convert the table using referece conditions - for (size_t i = 0; i < waterVelocity.size(); ++i) { - shearMultiplier[i] *= refViscMult; - shearMultiplier[i] -= 1; - shearMultiplier[i] /= (refViscMult - 1); - shearMultiplier[i] = shearMultiplier[i]; - } - params_.plyshlogShearEffectRefMultiplier_[pvtRegionIdx].resize(waterVelocity.size()); - params_.plyshlogShearEffectRefLogVelocity_[pvtRegionIdx].resize(waterVelocity.size()); - - for (size_t i = 0; i < waterVelocity.size(); ++i) { - params_.plyshlogShearEffectRefMultiplier_[pvtRegionIdx][i] = shearMultiplier[i]; - params_.plyshlogShearEffectRefLogVelocity_[pvtRegionIdx][i] = waterVelocity[i]; - } - } - } - - if (params_.hasShrate_ && !enablePolymerMolarWeight) { - if (!params_.hasPlyshlog_) { - throw std::runtime_error("PLYSHLOG must be specified if SHRATE is used in POLYMER runs\n"); - } - const auto& shrateTable = eclState.getTableManager().getShrateTable(); - params_.shrate_.resize(numPvtRegions); - for (unsigned pvtRegionIdx = 0; pvtRegionIdx < numPvtRegions; ++ pvtRegionIdx) { - if (shrateTable.empty()) { - params_.shrate_[pvtRegionIdx] = 4.8; //default; - } - else if (shrateTable.size() == numPvtRegions) { - params_.shrate_[pvtRegionIdx] = shrateTable[pvtRegionIdx].rate; - } - else { - throw std::runtime_error("SHRATE must either have 0 or number of NUMPVT entries\n"); - } - } - } - - if constexpr (enablePolymerMolarWeight) { - const auto& plyvmhTable = eclState.getTableManager().getPlyvmhTable(); - if (!plyvmhTable.empty()) { - assert(plyvmhTable.size() == numMixRegions); - for (size_t regionIdx = 0; regionIdx < numMixRegions; ++regionIdx) { - params_.plyvmhCoefficients_[regionIdx].k_mh = plyvmhTable[regionIdx].k_mh; - params_.plyvmhCoefficients_[regionIdx].a_mh = plyvmhTable[regionIdx].a_mh; - params_.plyvmhCoefficients_[regionIdx].gamma = plyvmhTable[regionIdx].gamma; - params_.plyvmhCoefficients_[regionIdx].kappa = plyvmhTable[regionIdx].kappa; - } - } - else { - throw std::runtime_error("PLYVMH keyword must be specified in POLYMW rus \n"); - } - - // handling PLYMWINJ keyword - const auto& plymwinjTables = tableManager.getPlymwinjTables(); - for (const auto& table : plymwinjTables) { - const int tableNumber = table.first; - const auto& plymwinjtable = table.second; - const std::vector& throughput = plymwinjtable.getThroughputs(); - const std::vector& watervelocity = plymwinjtable.getVelocities(); - const std::vector>& molecularweight = plymwinjtable.getMoleWeights(); - TabulatedTwoDFunction tablefunc(throughput, watervelocity, molecularweight, true, false); - params_.plymwinjTables_[tableNumber] = std::move(tablefunc); - } - - // handling SKPRWAT keyword - const auto& skprwatTables = tableManager.getSkprwatTables(); - for (const auto& table : skprwatTables) { - const int tableNumber = table.first; - const auto& skprwattable = table.second; - const std::vector& throughput = skprwattable.getThroughputs(); - const std::vector& watervelocity = skprwattable.getVelocities(); - const std::vector>& skinpressure = skprwattable.getSkinPressures(); - TabulatedTwoDFunction tablefunc(throughput, watervelocity, skinpressure, true, false); - params_.skprwatTables_[tableNumber] = std::move(tablefunc); - } - - // handling SKPRPOLY keyword - const auto& skprpolyTables = tableManager.getSkprpolyTables(); - for (const auto& table : skprpolyTables) { - const int tableNumber = table.first; - const auto& skprpolytable = table.second; - const std::vector& throughput = skprpolytable.getThroughputs(); - const std::vector& watervelocity = skprpolytable.getVelocities(); - const std::vector>& skinpressure = skprpolytable.getSkinPressures(); - const double refPolymerConcentration = skprpolytable.referenceConcentration(); - typename BlackOilPolymerParams::SkprpolyTable tablefunc = - {refPolymerConcentration, - TabulatedTwoDFunction(throughput, watervelocity, skinpressure, true, false)}; - params_.skprpolyTables_[tableNumber] = std::move(tablefunc); - } - } + params_ = std::move(params); } -#endif /*! * \brief get the PLYMWINJ table From 1bc8cb253b85c16026b81a0d71ccb863a047b173 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 20 Sep 2022 11:39:12 +0200 Subject: [PATCH 6/6] BlackOilSolventModule: remove member function for initing from EclipseState instead add a method to provide parameters externally. this decouples the class from the structures in opm-common, and at the same time adds the ability to use the classes without an EclipseState, making the code more reusable. --- opm/models/blackoil/blackoilsolventmodules.hh | 259 +----------------- 1 file changed, 3 insertions(+), 256 deletions(-) diff --git a/opm/models/blackoil/blackoilsolventmodules.hh b/opm/models/blackoil/blackoilsolventmodules.hh index bbd738825f..b3150c093a 100644 --- a/opm/models/blackoil/blackoilsolventmodules.hh +++ b/opm/models/blackoil/blackoilsolventmodules.hh @@ -34,20 +34,6 @@ #include #include -#include - -#if HAVE_ECL_INPUT -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - #include #include @@ -92,250 +78,11 @@ class BlackOilSolventModule public: -#if HAVE_ECL_INPUT - /*! - * \brief Initialize all internal data structures needed by the solvent module - */ - static void initFromState(const EclipseState& eclState, const Schedule& schedule) + //! \brief Set the parameters. + static void setParams(BlackOilSolventParams params) { - // some sanity checks: if solvents are enabled, the SOLVENT keyword must be - // present, if solvents are disabled the keyword must not be present. - if (enableSolvent && !eclState.runspec().phases().active(Phase::SOLVENT)) - throw std::runtime_error("Non-trivial solvent treatment requested at compile " - "time, but the deck does not contain the SOLVENT keyword"); - else if (!enableSolvent && eclState.runspec().phases().active(Phase::SOLVENT)) - throw std::runtime_error("Solvent treatment disabled at compile time, but the deck " - "contains the SOLVENT keyword"); - - if (!eclState.runspec().phases().active(Phase::SOLVENT)) - return; // solvent treatment is supposed to be disabled - - params_.solventPvt_.initFromState(eclState, schedule); - - const auto& tableManager = eclState.getTableManager(); - // initialize the objects which deal with the SSFN keyword - const auto& ssfnTables = tableManager.getSsfnTables(); - unsigned numSatRegions = tableManager.getTabdims().getNumSatTables(); - params_.setNumSatRegions(numSatRegions); - for (unsigned satRegionIdx = 0; satRegionIdx < numSatRegions; ++ satRegionIdx) { - const auto& ssfnTable = ssfnTables.template getTable(satRegionIdx); - params_.ssfnKrg_[satRegionIdx].setXYContainers(ssfnTable.getSolventFractionColumn(), - ssfnTable.getGasRelPermMultiplierColumn(), - /*sortInput=*/true); - params_.ssfnKrs_[satRegionIdx].setXYContainers(ssfnTable.getSolventFractionColumn(), - ssfnTable.getSolventRelPermMultiplierColumn(), - /*sortInput=*/true); - } - - // initialize the objects needed for miscible solvent and oil simulations - params_.isMiscible_ = false; - if (!eclState.getTableManager().getMiscTables().empty()) { - params_.isMiscible_ = true; - - unsigned numMiscRegions = 1; - - // misicible hydrocabon relative permeability wrt water - const auto& sof2Tables = tableManager.getSof2Tables(); - if (!sof2Tables.empty()) { - // resize the attributes of the object - params_.sof2Krn_.resize(numSatRegions); - for (unsigned satRegionIdx = 0; satRegionIdx < numSatRegions; ++ satRegionIdx) { - const auto& sof2Table = sof2Tables.template getTable(satRegionIdx); - params_.sof2Krn_[satRegionIdx].setXYContainers(sof2Table.getSoColumn(), - sof2Table.getKroColumn(), - /*sortInput=*/true); - } - } - else - throw std::runtime_error("SOF2 must be specified in MISCIBLE (SOLVENT) runs\n"); - - const auto& miscTables = tableManager.getMiscTables(); - if (!miscTables.empty()) { - assert(numMiscRegions == miscTables.size()); - - // resize the attributes of the object - params_.misc_.resize(numMiscRegions); - for (unsigned miscRegionIdx = 0; miscRegionIdx < numMiscRegions; ++miscRegionIdx) { - const auto& miscTable = miscTables.template getTable(miscRegionIdx); - - // solventFraction = Ss / (Ss + Sg); - const auto& solventFraction = miscTable.getSolventFractionColumn(); - const auto& misc = miscTable.getMiscibilityColumn(); - params_.misc_[miscRegionIdx].setXYContainers(solventFraction, misc); - } - } - else - throw std::runtime_error("MISC must be specified in MISCIBLE (SOLVENT) runs\n"); - - // resize the attributes of the object - params_.pmisc_.resize(numMiscRegions); - const auto& pmiscTables = tableManager.getPmiscTables(); - if (!pmiscTables.empty()) { - assert(numMiscRegions == pmiscTables.size()); - - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - const auto& pmiscTable = pmiscTables.template getTable(regionIdx); - - // Copy data - const auto& po = pmiscTable.getOilPhasePressureColumn(); - const auto& pmisc = pmiscTable.getMiscibilityColumn(); - - params_.pmisc_[regionIdx].setXYContainers(po, pmisc); - } - } - else { - std::vector x = {0.0,1.0e20}; - std::vector y = {1.0,1.0}; - TabulatedFunction constant = TabulatedFunction(2, x, y); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - params_.pmisc_[regionIdx] = constant; - } - } - - // miscible relative permeability multipleiers - params_.msfnKrsg_.resize(numSatRegions); - params_.msfnKro_.resize(numSatRegions); - const auto& msfnTables = tableManager.getMsfnTables(); - if (!msfnTables.empty()) { - assert(numSatRegions == msfnTables.size()); - - for (unsigned regionIdx = 0; regionIdx < numSatRegions; ++regionIdx) { - const MsfnTable& msfnTable = msfnTables.template getTable(regionIdx); - - // Copy data - // Ssg = Ss + Sg; - const auto& Ssg = msfnTable.getGasPhaseFractionColumn(); - const auto& krsg = msfnTable.getGasSolventRelpermMultiplierColumn(); - const auto& kro = msfnTable.getOilRelpermMultiplierColumn(); - - params_.msfnKrsg_[regionIdx].setXYContainers(Ssg, krsg); - params_.msfnKro_[regionIdx].setXYContainers(Ssg, kro); - } - } - else { - std::vector x = {0.0,1.0}; - std::vector y = {1.0,0.0}; - TabulatedFunction unit = TabulatedFunction(2, x, x); - TabulatedFunction invUnit = TabulatedFunction(2, x, y); - - for (unsigned regionIdx = 0; regionIdx < numSatRegions; ++regionIdx) { - params_.setMsfn(regionIdx, unit, invUnit); - } - } - // resize the attributes of the object - params_.sorwmis_.resize(numMiscRegions); - const auto& sorwmisTables = tableManager.getSorwmisTables(); - if (!sorwmisTables.empty()) { - assert(numMiscRegions == sorwmisTables.size()); - - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - const auto& sorwmisTable = sorwmisTables.template getTable(regionIdx); - - // Copy data - const auto& sw = sorwmisTable.getWaterSaturationColumn(); - const auto& sorwmis = sorwmisTable.getMiscibleResidualOilColumn(); - - params_.sorwmis_[regionIdx].setXYContainers(sw, sorwmis); - } - } - else { - // default - std::vector x = {0.0,1.0}; - std::vector y = {0.0,0.0}; - TabulatedFunction zero = TabulatedFunction(2, x, y); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - params_.sorwmis_[regionIdx] = zero; - } - } - - // resize the attributes of the object - params_.sgcwmis_.resize(numMiscRegions); - const auto& sgcwmisTables = tableManager.getSgcwmisTables(); - if (!sgcwmisTables.empty()) { - assert(numMiscRegions == sgcwmisTables.size()); - - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - const auto& sgcwmisTable = sgcwmisTables.template getTable(regionIdx); - - // Copy data - const auto& sw = sgcwmisTable.getWaterSaturationColumn(); - const auto& sgcwmis = sgcwmisTable.getMiscibleResidualGasColumn(); - - params_.sgcwmis_[regionIdx].setXYContainers(sw, sgcwmis); - } - } - else { - // default - std::vector x = {0.0,1.0}; - std::vector y = {0.0,0.0}; - TabulatedFunction zero = TabulatedFunction(2, x, y); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) - params_.sgcwmis_[regionIdx] = zero; - } - - const auto& tlmixpar = eclState.getTableManager().getTLMixpar(); - if (!tlmixpar.empty()) { - // resize the attributes of the object - params_.tlMixParamViscosity_.resize(numMiscRegions); - params_.tlMixParamDensity_.resize(numMiscRegions); - - assert(numMiscRegions == tlmixpar.size()); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - const auto& tlp = tlmixpar[regionIdx]; - params_.tlMixParamViscosity_[regionIdx] = tlp.viscosity_parameter; - params_.tlMixParamDensity_[regionIdx] = tlp.density_parameter; - } - } - else - throw std::runtime_error("TLMIXPAR must be specified in MISCIBLE (SOLVENT) runs\n"); - - // resize the attributes of the object - params_.tlPMixTable_.resize(numMiscRegions); - if (!eclState.getTableManager().getTlpmixpaTables().empty()) { - const auto& tlpmixparTables = tableManager.getTlpmixpaTables(); - if (!tlpmixparTables.empty()) { - assert(numMiscRegions == tlpmixparTables.size()); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) { - const auto& tlpmixparTable = tlpmixparTables.template getTable(regionIdx); - - // Copy data - const auto& po = tlpmixparTable.getOilPhasePressureColumn(); - const auto& tlpmixpa = tlpmixparTable.getMiscibilityColumn(); - - params_.tlPMixTable_[regionIdx].setXYContainers(po, tlpmixpa); - } - } - else { - // if empty keyword. Try to use the pmisc table as default. - if (params_.pmisc_.size() > 0) - params_.tlPMixTable_ = params_.pmisc_; - else - throw std::invalid_argument("If the pressure dependent TL values in " - "TLPMIXPA is defaulted (no entries), then " - "the PMISC tables must be specified."); - } - } - else { - // default - std::vector x = {0.0,1.0e20}; - std::vector y = {1.0,1.0}; - TabulatedFunction ones = TabulatedFunction(2, x, y); - for (unsigned regionIdx = 0; regionIdx < numMiscRegions; ++regionIdx) - params_.tlPMixTable_[regionIdx] = ones; - } - } + params_ = std::move(params); } -#endif - - /*! - * \brief Specify the solvent PVT of a all PVT regions. - */ - static void setSolventPvt(const SolventPvt& value) - { params_.solventPvt_ = value; } - - - static void setIsMiscible(const bool isMiscible) - { params_.isMiscible_ = isMiscible; } /*! * \brief Register all run-time parameters for the black-oil solvent module.