From 0101b210434e154135eb9aa3237ba51bed039dee Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 10 Nov 2023 15:57:29 +0100 Subject: [PATCH] Add CO2SOL and H2SOL --- opm/input/eclipse/EclipseState/Runspec.hpp | 6 +++ .../input/eclipse/EclipseState/Runspec.cpp | 42 +++++++++++++++++++ .../share/keywords/001_Eclipse300/C/CO2SOL | 6 +++ .../eclipse/share/keywords/900_OPM/H/H2SOL | 6 +++ .../eclipse/share/keywords/keyword_list.cmake | 2 + .../fluidsystems/BlackOilFluidSystem.cpp | 6 ++- .../fluidsystems/blackoilpvt/BrineCo2Pvt.cpp | 7 +++- .../fluidsystems/blackoilpvt/BrineH2Pvt.cpp | 7 +++- 8 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 src/opm/input/eclipse/share/keywords/001_Eclipse300/C/CO2SOL create mode 100644 src/opm/input/eclipse/share/keywords/900_OPM/H/H2SOL diff --git a/opm/input/eclipse/EclipseState/Runspec.hpp b/opm/input/eclipse/EclipseState/Runspec.hpp index c15d54a82..0d0e2a56a 100644 --- a/opm/input/eclipse/EclipseState/Runspec.hpp +++ b/opm/input/eclipse/EclipseState/Runspec.hpp @@ -470,6 +470,8 @@ public: const Nupcol& nupcol() const noexcept; const Tracers& tracers() const; bool co2Storage() const noexcept; + bool co2Sol() const noexcept; + bool h2Sol() const noexcept; bool h2Storage() const noexcept; bool micp() const noexcept; bool mech() const noexcept; @@ -495,6 +497,8 @@ public: serializer(m_sfuncctrl); serializer(m_nupcol); serializer(m_co2storage); + serializer(m_co2sol); + serializer(m_h2sol); serializer(m_h2storage); serializer(m_micp); serializer(m_mech); @@ -517,6 +521,8 @@ private: Nupcol m_nupcol; Tracers m_tracers; bool m_co2storage; + bool m_co2sol; + bool m_h2sol; bool m_h2storage; bool m_micp; bool m_mech; diff --git a/src/opm/input/eclipse/EclipseState/Runspec.cpp b/src/opm/input/eclipse/EclipseState/Runspec.cpp index 1455517f3..d5bfb08ac 100644 --- a/src/opm/input/eclipse/EclipseState/Runspec.cpp +++ b/src/opm/input/eclipse/EclipseState/Runspec.cpp @@ -624,6 +624,8 @@ Runspec::Runspec( const Deck& deck ) , m_nupcol( ) , m_tracers( deck ) , m_co2storage (false) + , m_co2sol (false) + , m_h2sol (false) , m_h2storage (false) , m_micp (false) , m_mech (false) @@ -660,6 +662,30 @@ Runspec::Runspec( const Deck& deck ) } + if (runspecSection.hasKeyword()) { + m_co2sol = true; + if (phases().active(Phase::SOLVENT)) { + std::string msg = "The CO2SOL option is given together with SOLVENT. PVT properties from the CO2-Brine system is used \n" + "See the OPM manual for details on the used models."; + OpmLog::note(msg); + } else { + throw std::runtime_error("The CO2SOL option is given. Activate SOLVENT."); + } + + } + + if (runspecSection.hasKeyword()) { + m_h2sol = true; + if (phases().active(Phase::SOLVENT)) { + std::string msg = "The H2SOL option is given together with SOLVENT. PVT properties from the H2-Brine system is used \n" + "See the OPM manual for details on the used models."; + OpmLog::note(msg); + } else { + throw std::runtime_error("The H2SOL option is given. Activate SOLVENT."); + } + + } + if (runspecSection.hasKeyword()) { m_h2storage = true; std::string msg = "The H2 storage option is given. PVT properties from the Brine-H2 system is used \n" @@ -699,6 +725,8 @@ Runspec Runspec::serializationTestObject() result.m_sfuncctrl = SatFuncControls::serializationTestObject(); result.m_nupcol = Nupcol::serializationTestObject(); result.m_co2storage = true; + result.m_co2sol = true; + result.m_h2sol = true; result.m_h2storage = true; result.m_micp = true; result.m_mech = true; @@ -766,6 +794,16 @@ bool Runspec::co2Storage() const noexcept return this->m_co2storage; } +bool Runspec::co2Sol() const noexcept +{ + return this->m_co2sol; +} + +bool Runspec::h2Sol() const noexcept +{ + return this->m_h2sol; +} + bool Runspec::h2Storage() const noexcept { return this->m_h2storage; @@ -818,6 +856,8 @@ bool Runspec::rst_cmp(const Runspec& full_spec, const Runspec& rst_spec) { full_spec.saturationFunctionControls() == rst_spec.saturationFunctionControls() && full_spec.m_nupcol == rst_spec.m_nupcol && full_spec.m_co2storage == rst_spec.m_co2storage && + full_spec.m_co2sol == rst_spec.m_co2sol && + full_spec.m_h2sol == rst_spec.m_h2sol && full_spec.m_h2storage == rst_spec.m_h2storage && full_spec.m_micp == rst_spec.m_micp && full_spec.m_mech == rst_spec.m_mech && @@ -837,6 +877,8 @@ bool Runspec::operator==(const Runspec& data) const { this->saturationFunctionControls() == data.saturationFunctionControls() && this->m_nupcol == data.m_nupcol && this->m_co2storage == data.m_co2storage && + this->m_co2sol == data.m_co2sol && + this->m_h2sol == data.m_h2sol && this->m_h2storage == data.m_h2storage && this->m_micp == data.m_micp && this->m_mech == data.m_mech; diff --git a/src/opm/input/eclipse/share/keywords/001_Eclipse300/C/CO2SOL b/src/opm/input/eclipse/share/keywords/001_Eclipse300/C/CO2SOL new file mode 100644 index 000000000..80f9ab763 --- /dev/null +++ b/src/opm/input/eclipse/share/keywords/001_Eclipse300/C/CO2SOL @@ -0,0 +1,6 @@ +{ + "name": "CO2SOL", + "sections": [ + "RUNSPEC" + ] +} diff --git a/src/opm/input/eclipse/share/keywords/900_OPM/H/H2SOL b/src/opm/input/eclipse/share/keywords/900_OPM/H/H2SOL new file mode 100644 index 000000000..d58e0020f --- /dev/null +++ b/src/opm/input/eclipse/share/keywords/900_OPM/H/H2SOL @@ -0,0 +1,6 @@ +{ + "name": "H2SOL", + "sections": [ + "RUNSPEC" + ] +} diff --git a/src/opm/input/eclipse/share/keywords/keyword_list.cmake b/src/opm/input/eclipse/share/keywords/keyword_list.cmake index d4a3d1817..ea6c69199 100644 --- a/src/opm/input/eclipse/share/keywords/keyword_list.cmake +++ b/src/opm/input/eclipse/share/keywords/keyword_list.cmake @@ -1049,6 +1049,7 @@ set( keywords 001_Eclipse300/C/CIRCLE 001_Eclipse300/C/CNAMES 001_Eclipse300/C/COMPS + 001_Eclipse300/C/CO2SOL 001_Eclipse300/C/CO2STORE 001_Eclipse300/C/CREF 001_Eclipse300/C/CREFS @@ -1114,6 +1115,7 @@ set( keywords 900_OPM/G/GCOMPIDX 900_OPM/G/GASDENT 900_OPM/G/GASJT + 900_OPM/H/H2SOL 900_OPM/H/H2STORE 900_OPM/M/MECH 900_OPM/M/MICP diff --git a/src/opm/material/fluidsystems/BlackOilFluidSystem.cpp b/src/opm/material/fluidsystems/BlackOilFluidSystem.cpp index 3db5f4aed..f7c54ce80 100644 --- a/src/opm/material/fluidsystems/BlackOilFluidSystem.cpp +++ b/src/opm/material/fluidsystems/BlackOilFluidSystem.cpp @@ -84,9 +84,11 @@ initFromState(const EclipseState& eclState, const Schedule& schedule) if (eclState.getSimulationConfig().hasDISGASW()) { if (eclState.runspec().co2Storage() || eclState.runspec().h2Storage()) setEnableDissolvedGasInWater(eclState.getSimulationConfig().hasDISGASW()); - else + else if (eclState.runspec().co2Sol() || eclState.runspec().h2Sol()) { + + } else OPM_THROW(std::runtime_error, - "DISGASW only supported in combination with CO2STORE or H2STORE"); + "DISGASW only supported in combination with CO2STORE/H2STORE or CO2SOL/H2SOL"); } if (phaseIsActive(gasPhaseIdx)) { diff --git a/src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp b/src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp index 2b6923df4..6ff87e55f 100644 --- a/src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp +++ b/src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp @@ -48,8 +48,11 @@ initFromState(const EclipseState& eclState, const Schedule&) "BRINE PVT properties are computed based on the Hu et al. " "pvt model and PVDO/PVTO input is ignored."); } - - setEnableDissolvedGas(eclState.getSimulationConfig().hasDISGASW() || eclState.getSimulationConfig().hasDISGAS()); + // enable co2 dissolution into brine for co2sol case with DISGASW + // or co2store case with DISGASW or DISGAS + bool co2sol_dis = eclState.runspec().co2Sol() && eclState.getSimulationConfig().hasDISGASW(); + bool co2storage_dis = eclState.runspec().co2Storage() && (eclState.getSimulationConfig().hasDISGASW() || eclState.getSimulationConfig().hasDISGAS()); + setEnableDissolvedGas(co2sol_dis || co2storage_dis); setEnableSaltConcentration(eclState.runspec().phases().active(Phase::BRINE)); // We only supported single pvt region for the co2-brine module size_t numRegions = 1; diff --git a/src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp b/src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp index 27efc14de..7ca613aeb 100644 --- a/src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp +++ b/src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp @@ -47,8 +47,11 @@ initFromState(const EclipseState& eclState, const Schedule&) "H2 PVT properties are calculated internally, " "and PVDO/PVTO input is ignored."); } - // Check if DISGAS has been activated (enables H2 dissolved in brine) - setEnableDissolvedGas(eclState.getSimulationConfig().hasDISGASW() || eclState.getSimulationConfig().hasDISGAS()); + // enable h2 dissolution into brine for h2sol case with DISGASW + // or h2store case with DISGASW or DISGAS + bool h2sol_dis = eclState.runspec().h2Sol() && eclState.getSimulationConfig().hasDISGASW(); + bool h2storage_dis = eclState.runspec().h2Storage() && (eclState.getSimulationConfig().hasDISGASW() || eclState.getSimulationConfig().hasDISGAS()); + setEnableDissolvedGas(h2sol_dis || h2storage_dis); // Check if BRINE has been activated (varying salt concentration in brine) setEnableSaltConcentration(eclState.runspec().phases().active(Phase::BRINE));