Update to restructure and latest developments.

This commit is contained in:
Svenn Tveit
2023-01-11 12:57:34 +01:00
parent 423141eb30
commit fb70d31ba0
13 changed files with 314 additions and 129 deletions

View File

@@ -51,6 +51,7 @@ list (APPEND MAIN_SOURCE_FILES
src/opm/material/common/TridiagonalMatrix.cpp
src/opm/material/common/UniformXTabulated2DFunction.cpp
src/opm/material/components/CO2.cpp
src/opm/material/components/H2.cpp
src/opm/material/densead/Evaluation.cpp
src/opm/material/fluidmatrixinteractions/EclEpsScalingPoints.cpp
src/opm/material/fluidsystems/BlackOilFluidSystem.cpp
@@ -290,6 +291,8 @@ if(ENABLE_ECL_INPUT)
src/opm/material/fluidmatrixinteractions/EclMaterialLawManagerHystParams.cpp
src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp
src/opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.cpp
src/opm/material/fluidsystems/blackoilpvt/H2GasPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityBrinePvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.cpp
src/opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityWaterPvt.cpp
@@ -814,6 +817,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/binarycoefficients/H2O_CO2.hpp
opm/material/binarycoefficients/Air_Xylene.hpp
opm/material/binarycoefficients/Brine_CO2.hpp
opm/material/binarycoefficients/Brine_H2.hpp
opm/material/binarycoefficients/HenryIapws.hpp
opm/material/Constants.hpp
opm/material/fluidsystems/NullParameterCache.hpp
@@ -837,6 +841,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidsystems/blackoilpvt/WaterPvtThermal.hpp
opm/material/fluidsystems/blackoilpvt/WaterPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.hpp
opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.hpp
opm/material/fluidsystems/blackoilpvt/OilPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/GasPvtMultiplexer.hpp
opm/material/fluidsystems/blackoilpvt/DryHumidGasPvt.hpp
@@ -849,6 +854,7 @@ list( APPEND PUBLIC_HEADER_FILES
opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityBrinePvt.hpp
opm/material/fluidsystems/blackoilpvt/GasPvtThermal.hpp
opm/material/fluidsystems/blackoilpvt/Co2GasPvt.hpp
opm/material/fluidsystems/blackoilpvt/H2GasPvt.hpp
opm/material/fluidsystems/blackoilpvt/ConstantCompressibilityOilPvt.hpp
opm/material/fluidsystems/H2OAirFluidSystem.hpp
opm/material/fluidsystems/H2ON2FluidSystem.hpp

View File

@@ -33,7 +33,7 @@
#include <opm/material/IdealGas.hpp>
#include <opm/material/components/Component.hpp>
#include <opm/material/common/UniformTabulated2DFunction.hpp>
#include <opm/material/densead/Math.hpp>
#include <cmath>
@@ -53,11 +53,13 @@ namespace Opm {
*
* \tparam Scalar The type used for scalar values
*/
template <class Scalar, class H2Tables>
class H2 : public Component<Scalar, H2<Scalar, H2Tables> >
template <class Scalar>
class H2 : public Component<Scalar, H2<Scalar> >
{
using IdealGas = Opm::IdealGas<Scalar>;
static const UniformTabulated2DFunction<double>& tabulatedDensity;
public:
/*!
* \brief A human readable name for the \f$H_2\f$.
@@ -160,7 +162,7 @@ public:
template <class Evaluation>
static Evaluation gasDensity(Evaluation temperature, Evaluation pressure, bool extrapolate = false)
{
return H2Tables::tabulatedDensity.eval(temperature, pressure, extrapolate);
return tabulatedDensity.eval(temperature, pressure, extrapolate);
}
/*!

View File

@@ -27,22 +27,23 @@ copyright holders.
#ifndef OPM_BRINE_H2_PVT_HPP
#define OPM_BRINE_H2_PVT_HPP
#include <opm/common/Exceptions.hpp>
#include <opm/material/binarycoefficients/Brine_H2.hpp>
#include <opm/material/components/SimpleHuDuanH2O.hpp>
#include <opm/material/components/Brine.hpp>
#include <opm/material/components/H2.hpp>
#include <opm/material/common/UniformTabulated2DFunction.hpp>
#include <opm/material/components/h2tables.inc>
#include <vector>
namespace Opm {
#if HAVE_ECL_INPUT
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
class EclipseState;
class Schedule;
#endif
namespace Opm {
/*!
* \brief This class represents the Pressure-Volume-Temperature relations of the liquid phase for a H2-Brine system
*/
@@ -51,62 +52,36 @@ class BrineH2Pvt
{
static const bool extrapolate = true;
public:
typedef SimpleHuDuanH2O<Scalar> H2O;
typedef ::Opm::Brine<Scalar, H2O> Brine;
typedef ::Opm::H2<Scalar, H2Tables> H2;
using H2O = SimpleHuDuanH2O<Scalar>;
using Brine = ::Opm::Brine<Scalar, H2O>;
using H2 = ::Opm::H2<Scalar>;
// The binary coefficients for brine and H2 used by this fluid system
typedef BinaryCoeff::Brine_H2<Scalar, H2O, H2> BinaryCoeffBrineH2;
using BinaryCoeffBrineH2 = BinaryCoeff::Brine_H2<Scalar, H2O, H2>;
explicit BrineH2Pvt() = default;
BrineH2Pvt( const std::vector<Scalar>& brineReferenceDensity,
const std::vector<Scalar>& h2ReferenceDensity,
const std::vector<Scalar>& salinity)
: brineReferenceDensity_(brineReferenceDensity),
h2ReferenceDensity_(h2ReferenceDensity),
salinity_(salinity)
BrineH2Pvt(const std::vector<Scalar>& salinity,
Scalar T_ref = 288.71, //(273.15 + 15.56)
Scalar P_ref = 101325)
: salinity_(salinity)
{
int num_regions = salinity_.size();
h2ReferenceDensity_.resize(num_regions);
brineReferenceDensity_.resize(num_regions);
Brine::salinity = salinity[0];
for (int i = 0; i < num_regions; ++i) {
h2ReferenceDensity_[i] = H2::gasDensity(T_ref, P_ref, true);
brineReferenceDensity_[i] = Brine::liquidDensity(T_ref, P_ref, true);
}
}
#if HAVE_ECL_INPUT
/*!
* \brief Initialize the parameters for Brine-H2 system using an ECL deck.
*
*/
void initFromState(const EclipseState& eclState, const Schedule&)
{
// Error message for DENSITY keyword
if (!eclState.getTableManager().getDensityTable().empty()) {
std::cerr << "WARNING: H2STORE is enabled but DENSITY is in the deck. \n" <<
"The surface density is computed based on H2-BRINE PVT at standard conditions (STCOND)" <<
" and DENSITY is ignored " << std::endl;
}
// Error message for entering PVDO/PVTO in deck
if (eclState.getTableManager().hasTables("PVDO") || !eclState.getTableManager().getPvtoTables().empty()) {
std::cerr << "WARNING: H2STORE is enabled but PVDO or PVTO is in the deck. \n" <<
"BRINE PVT properties are computed based on the Li et al. (2018) and PVDO/PVTO input" <<
" is ignored. " << std::endl;
}
// Check if DISGAS has been activated (enables H2 dissolved in brine)
setEnableDissolvedGas(eclState.getSimulationConfig().hasDISGAS());
// We only supported single pvt region for the H2-brine module
size_t numRegions = 1;
setNumRegions(numRegions);
size_t regionIdx = 0;
// Currently we only support constant salinity
const Scalar molality = eclState.getTableManager().salinity(); // mol/kg
const Scalar MmNaCl = 58e-3; // molar mass of NaCl [kg/mol]
Brine::salinity = 1 / ( 1 + 1 / (molality*MmNaCl)); // convert to mass fraction
salinity_[regionIdx] = molality; // molality used in functions
// set the surface conditions using the STCOND keyword
Scalar T_ref = eclState.getTableManager().stCond().temperature;
Scalar P_ref = eclState.getTableManager().stCond().pressure;
brineReferenceDensity_[regionIdx] = Brine::liquidDensity(T_ref, P_ref, extrapolate);
h2ReferenceDensity_[regionIdx] = H2::gasDensity(T_ref, P_ref, extrapolate);
}
* \brief Initialize the parameters for Brine-H2 system using an ECL deck.
*
*/
void initFromState(const EclipseState& eclState, const Schedule&);
#endif
void setNumRegions(size_t numRegions)
@@ -259,12 +234,6 @@ public:
const Scalar salinity(unsigned regionIdx) const
{ return salinity_[regionIdx]; }
bool operator==(const BrineH2Pvt<Scalar>& data) const
{
return h2ReferenceDensity_ == data.h2ReferenceDensity_ &&
brineReferenceDensity_ == data.brineReferenceDensity_;
}
/*!
* \brief Diffusion coefficient of H2 in water
*/
@@ -345,16 +314,18 @@ private:
// check if pressure and temperature is valid
if(!extrapolate && T < 273.15) {
std::ostringstream oss;
oss << "Liquid density for Brine and H2 is only "
"defined above 273.15K (is "<<T<<"K)";
throw NumericalIssue(oss.str());
const std::string msg =
"Liquid density for Brine and H2 is only "
"defined above 273.15K (is " +
std::to_string(getValue(T)) + "K)";
throw NumericalProblem(msg);
}
if(!extrapolate && pl >= 2.5e8) {
std::ostringstream oss;
oss << "Liquid density for Brine and H2 is only "
"defined below 250MPa (is "<<pl<<"Pa)";
throw NumericalIssue(oss.str());
const std::string msg =
"Liquid density for Brine and CO2 is only "
"defined below 250MPa (is " +
std::to_string(getValue(pl)) + "Pa)";
throw NumericalProblem(msg);
}
// calculate individual contribution to density

View File

@@ -73,9 +73,9 @@ class Schedule;
auto& pvtImpl = getRealPvt<GasPvtApproach::Co2Gas>(); \
codeToCall; \
break; \
}
case GasPvtApproach::H2GasPvt: { \
auto& pvtImpl = getRealPvt<GasPvtApproach::H2GasPvt>(); \
} \
case GasPvtApproach::H2Gas: { \
auto& pvtImpl = getRealPvt<GasPvtApproach::H2Gas>(); \
codeToCall; \
break; \
} \
@@ -90,8 +90,8 @@ enum class GasPvtApproach {
WetHumidGas,
WetGas,
ThermalGas,
Co2Gas
H2GasPvt
Co2Gas,
H2Gas
};
/*!
@@ -151,8 +151,8 @@ public:
delete &getRealPvt<GasPvtApproach::Co2Gas>();
break;
}
case GasPvtApproach::H2GasPvt: {
delete &getRealPvt<GasPvtApproach::H2GasPvt>();
case GasPvtApproach::H2Gas: {
delete &getRealPvt<GasPvtApproach::H2Gas>();
break;
}
case GasPvtApproach::NoGas:
@@ -196,7 +196,7 @@ public:
realGasPvt_ = new Co2GasPvt<Scalar>;
break;
case GasPvtApproach::H2GasPvt:
case GasPvtApproach::H2Gas:
realGasPvt_ = new H2GasPvt<Scalar>;
break;
@@ -432,7 +432,14 @@ public:
}
template <GasPvtApproach approachV>
typename std::enable_if<approachV == GasPvtApproach::H2GasPvt, const H2GasPvt<Scalar> >::type& getRealPvt() const
typename std::enable_if<approachV == GasPvtApproach::H2Gas, H2GasPvt<Scalar> >::type& getRealPvt()
{
assert(gasPvtApproach() == approachV);
return *static_cast<H2GasPvt<Scalar>* >(realGasPvt_);
}
template <GasPvtApproach approachV>
typename std::enable_if<approachV == GasPvtApproach::H2Gas, const H2GasPvt<Scalar> >::type& getRealPvt() const
{
assert(gasPvtApproach() == approachV);
return *static_cast<const H2GasPvt<Scalar>* >(realGasPvt_);
@@ -462,7 +469,7 @@ public:
case GasPvtApproach::Co2Gas:
realGasPvt_ = new Co2GasPvt<Scalar>(*static_cast<const Co2GasPvt<Scalar>*>(data.realGasPvt_));
break;
case GasPvtApproach::H2GasPvt:
case GasPvtApproach::H2Gas:
realGasPvt_ = new H2GasPvt<Scalar>(*static_cast<const H2GasPvt<Scalar>*>(data.realGasPvt_));
break;
default:

View File

@@ -31,65 +31,47 @@
#include <opm/material/components/H2.hpp>
#include <opm/material/binarycoefficients/Brine_H2.hpp>
#include <opm/material/common/UniformTabulated2DFunction.hpp>
#include <opm/material/components/h2tables.inc>
#if HAVE_ECL_INPUT
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
#endif
#include <vector>
namespace Opm {
#if HAVE_ECL_INPUT
class EclipseState;
class Schedule;
#endif
/*!
* \brief This class represents the Pressure-Volume-Temperature relations of the gas phase for H2
*/
template <class Scalar>
class H2GasPvt
{
typedef SimpleHuDuanH2O<Scalar> H2O;
typedef ::Opm::H2<Scalar, H2Tables> H2;
using H2O = SimpleHuDuanH2O<Scalar>;
using H2 = ::Opm::H2<Scalar>;
static const bool extrapolate = true;
public:
// The binary coefficients for brine and H2 used by this fluid system
typedef BinaryCoeff::Brine_H2<Scalar, H2O, H2> BinaryCoeffBrineH2;
using BinaryCoeffBrineH2 = BinaryCoeff::Brine_H2<Scalar, H2O, H2>;
explicit H2GasPvt() = default;
H2GasPvt(const std::vector<Scalar>& gasReferenceDensity)
: gasReferenceDensity_(gasReferenceDensity)
H2GasPvt(size_t numRegions,
Scalar T_ref = 288.71, //(273.15 + 15.56)
Scalar P_ref = 101325)
{
setNumRegions(numRegions);
for (size_t i = 0; i < numRegions; ++i) {
gasReferenceDensity_[i] = H2::gasDensity(T_ref, P_ref, extrapolate);
}
}
#if HAVE_ECL_INPUT
/*!
* \brief Initialize the parameters for H2 gas using an ECL deck.
*/
void initFromState(const EclipseState& eclState, const Schedule&)
{
if( !eclState.getTableManager().getDensityTable().empty()) {
std::cerr << "WARNING: H2STORE is enabled but DENSITY is in the deck. \n" <<
"The surface density is computed based on H2-BRINE PVT at standard conditions (STCOND)" <<
" and DENSITY is ignored " << std::endl;
}
if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
std::cerr << "WARNING: H2STORE is enabled but PVDG or PVTG is in the deck. \n" <<
"H2 pvt properties are calculated based on ideal gas relations, and PVDG/PVTG input" <<
" is ignored. " << std::endl;
}
// We only supported single pvt region for the H2-brine module
size_t numRegions = 1;
setNumRegions(numRegions);
size_t regionIdx = 0;
Scalar T_ref = eclState.getTableManager().stCond().temperature;
Scalar P_ref = eclState.getTableManager().stCond().pressure;
gasReferenceDensity_[regionIdx] = H2::gasDensity(T_ref, P_ref, extrapolate);
initEnd();
}
void initFromState(const EclipseState& eclState, const Schedule&);
#endif
void setNumRegions(size_t numRegions)
@@ -114,7 +96,6 @@ public:
*/
void initEnd()
{
}
/*!
@@ -199,6 +180,16 @@ public:
const Evaluation& /*pressure*/) const
{ return 0.0; /* this is non-humid gas! */ }
/*!
* \brief Returns the water vaporization factor \f$R_vw\f$ [m^3/m^3] of water saturated gas.
*/
template <class Evaluation = Scalar>
Evaluation saturatedWaterVaporizationFactor(unsigned /*regionIdx*/,
const Evaluation& /*temperature*/,
const Evaluation& /*pressure*/,
const Evaluation& /*saltConcentration*/) const
{ return 0.0; }
/*!
* \brief Returns the oil vaporization factor \f$R_v\f$ [m^3/m^3] of the oil phase.
*/

View File

@@ -67,12 +67,12 @@ class Schedule;
auto& pvtImpl = getRealPvt<OilPvtApproach::BrineCo2>(); \
codeToCall; \
break; \
}
case OilPvtApproach::BrineH2Pvt: { \
auto& pvtImpl = getRealPvt<OilPvtApproach::BrineH2Pvt>(); \
codeToCall; \
break; \
} \
} \
case OilPvtApproach::BrineH2: { \
auto& pvtImpl = getRealPvt<OilPvtApproach::BrineH2>(); \
codeToCall; \
break; \
} \
case OilPvtApproach::NoOil: \
throw std::logic_error("Not implemented: Oil PVT of this deck!"); \
}
@@ -83,8 +83,8 @@ enum class OilPvtApproach {
DeadOil,
ConstantCompressibilityOil,
ThermalOil,
BrineCo2
BrineH2Pvt
BrineCo2,
BrineH2
};
/*!
@@ -142,8 +142,8 @@ public:
delete &getRealPvt<OilPvtApproach::BrineCo2>();
break;
}
case OilPvtApproach::BrineH2Pvt: {
delete &getRealPvt<OilPvtApproach::BrineH2Pvt>();
case OilPvtApproach::BrineH2: {
delete &getRealPvt<OilPvtApproach::BrineH2>();
break;
}
case OilPvtApproach::NoOil:
@@ -291,7 +291,7 @@ public:
realOilPvt_ = new BrineCo2Pvt<Scalar>;
break;
case OilPvtApproach::BrineH2Pvt:
case OilPvtApproach::BrineH2:
realOilPvt_ = new BrineH2Pvt<Scalar>;
break;
@@ -383,6 +383,20 @@ public:
const void* realOilPvt() const { return realOilPvt_; }
template <OilPvtApproach approachV>
typename std::enable_if<approachV == OilPvtApproach::BrineH2, BrineH2Pvt<Scalar> >::type& getRealPvt()
{
assert(approach() == approachV);
return *static_cast<BrineH2Pvt<Scalar>* >(realOilPvt_);
}
template <OilPvtApproach approachV>
typename std::enable_if<approachV == OilPvtApproach::BrineH2, const BrineH2Pvt<Scalar> >::type& getRealPvt() const
{
assert(approach() == approachV);
return *static_cast<const BrineH2Pvt<Scalar>* >(realOilPvt_);
}
OilPvtMultiplexer<Scalar,enableThermal>& operator=(const OilPvtMultiplexer<Scalar,enableThermal>& data)
{
approach_ = data.approach_;
@@ -402,7 +416,7 @@ public:
case OilPvtApproach::BrineCo2:
realOilPvt_ = new BrineCo2Pvt<Scalar>(*static_cast<const BrineCo2Pvt<Scalar>*>(data.realOilPvt_));
break;
case OilPvtApproach::BrineH2Pvt:
case OilPvtApproach::BrineH2:
realOilPvt_ = new BrineH2Pvt<Scalar>(*static_cast<const BrineH2Pvt<Scalar>*>(data.realOilPvt_));
break;
default:

View File

@@ -0,0 +1,39 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include <config.h>
#include <opm/material/components/H2.hpp>
#include "h2tables.inc"
namespace Opm {
template<>
const UniformTabulated2DFunction<double>&
H2<double>::tabulatedDensity = H2Tables::tabulatedDensity;
template<>
const UniformTabulated2DFunction<double>&
H2<float>::tabulatedDensity = H2Tables::tabulatedDensity;
} // namespace Opm

View File

@@ -131,6 +131,20 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
}
}
// use molarMass of CO2 and Brine as default
// when we are using the the CO2STORE option
if (eclState.runspec().co2Storage()) {
for (unsigned regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
if (phaseIsActive(oilPhaseIdx)) // The oil component is used for the brine if OIL is active
molarMass_[regionIdx][oilCompIdx] = BrineH2Pvt<Scalar>::Brine::molarMass();
if (!phaseIsActive(gasPhaseIdx)) {
OPM_THROW(std::runtime_error,
"H2STORE requires gas phase\n");
}
molarMass_[regionIdx][gasCompIdx] = BrineH2Pvt<Scalar>::H2::molarMass();
}
}
setEnableDiffusion(eclState.getSimulationConfig().isDiffusive());
if (enableDiffusion()) {
const auto& diffCoeffTables = eclState.getTableManager().getDiffusionCoefficientTable();

View File

@@ -0,0 +1,74 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include <config.h>
#include <opm/material/fluidsystems/blackoilpvt/BrineH2Pvt.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
namespace Opm {
template<class Scalar>
void BrineH2Pvt<Scalar>::
initFromState(const EclipseState& eclState, const Schedule&)
{
if( !eclState.getTableManager().getDensityTable().empty()) {
OpmLog::warning("WARNING: H2STORE is enabled but DENSITY is in the deck. \n"
"The surface density is computed based on H2-BRINE PVT "
"at standard conditions (STCOND) and DENSITY is ignored ");
}
if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
OpmLog::warning("WARNING: H2STORE is enabled but PVDG or PVTG is in the deck. \n"
"H2 pvt properties are calculated based on ideal gas relations, "
"and PVDG/PVTG input is ignored.");
}
// Check if DISGAS has been activated (enables H2 dissolved in brine)
setEnableDissolvedGas(eclState.getSimulationConfig().hasDISGAS());
// We only supported single pvt region for the H2-brine module
size_t numRegions = 1;
setNumRegions(numRegions);
size_t regionIdx = 0;
// Currently we only support constant salinity
const Scalar molality = eclState.getTableManager().salinity(); // mol/kg
const Scalar MmNaCl = 58e-3; // molar mass of NaCl [kg/mol]
Brine::salinity = 1 / ( 1 + 1 / (molality*MmNaCl)); // convert to mass fraction
salinity_[regionIdx] = molality; // molality used in functions
// set the surface conditions using the STCOND keyword
Scalar T_ref = eclState.getTableManager().stCond().temperature;
Scalar P_ref = eclState.getTableManager().stCond().pressure;
brineReferenceDensity_[regionIdx] = Brine::liquidDensity(T_ref, P_ref, extrapolate);
h2ReferenceDensity_[regionIdx] = H2::gasDensity(T_ref, P_ref, extrapolate);
}
template class BrineH2Pvt<double>;
template class BrineH2Pvt<float>;
} // namespace Opm

View File

@@ -36,6 +36,8 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
if (eclState.runspec().co2Storage())
setApproach(GasPvtApproach::Co2Gas);
else if (eclState.runspec().h2Storage())
setApproach(GasPvtApproach::H2Gas);
else if (enableThermal && eclState.getSimulationConfig().isThermal())
setApproach(GasPvtApproach::ThermalGas);
else if (!eclState.getTableManager().getPvtgwTables().empty() &&

View File

@@ -0,0 +1,63 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#include <config.h>
#include <opm/material/fluidsystems/blackoilpvt/H2GasPvt.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
namespace Opm {
template<class Scalar>
void H2GasPvt<Scalar>::
initFromState(const EclipseState& eclState, const Schedule&)
{
if( !eclState.getTableManager().getDensityTable().empty()) {
OpmLog::warning("WARNING: H2STORE is enabled but DENSITY is in the deck. \n"
"The surface density is computed based on H2-BRINE PVT "
"at standard conditions (STCOND) and DENSITY is ignored ");
}
if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
OpmLog::warning("WARNING: H2STORE is enabled but PVDG or PVTG is in the deck. \n"
"H2 pvt properties are calculated based on ideal gas relations, "
"and PVDG/PVTG input is ignored.");
}
// We only supported single pvt region for the H2-brine module
size_t numRegions = 1;
setNumRegions(numRegions);
size_t regionIdx = 0;
Scalar T_ref = eclState.getTableManager().stCond().temperature;
Scalar P_ref = eclState.getTableManager().stCond().pressure;
gasReferenceDensity_[regionIdx] = H2::gasDensity(T_ref, P_ref, extrapolate);
initEnd();
}
template class H2GasPvt<double>;
template class H2GasPvt<float>;
}

View File

@@ -40,6 +40,8 @@ initFromState(const EclipseState& eclState, const Schedule& schedule)
// and water/brine + gas
if (eclState.runspec().co2Storage())
setApproach(OilPvtApproach::BrineCo2);
else if (eclState.runspec().h2Storage())
setApproach(OilPvtApproach::BrineH2);
else if (enableThermal && eclState.getSimulationConfig().isThermal())
setApproach(OilPvtApproach::ThermalOil);
else if (!eclState.getTableManager().getPvcdoTable().empty())