Merge pull request #3256 from akva2/co2gaspvt_encapsulate
Co2GasPvt: encapsulate EclipseState w/ friends
This commit is contained in:
@@ -239,6 +239,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/material/fluidmatrixinteractions/EclHysteresisConfig.cpp
|
||||
src/opm/material/fluidmatrixinteractions/EclMaterialLawManager.cpp
|
||||
src/opm/material/fluidsystems/blackoilpvt/BrineCo2Pvt.cpp
|
||||
src/opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@
|
||||
#include <opm/material/binarycoefficients/Brine_CO2.hpp>
|
||||
#include <opm/material/components/co2tables.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 CO2
|
||||
@@ -60,10 +60,6 @@ public:
|
||||
using BinaryCoeffBrineCO2 = BinaryCoeff::Brine_CO2<Scalar, H2O, CO2>;
|
||||
|
||||
explicit Co2GasPvt() = default;
|
||||
Co2GasPvt(const std::vector<Scalar>& gasReferenceDensity)
|
||||
: gasReferenceDensity_(gasReferenceDensity)
|
||||
{
|
||||
}
|
||||
|
||||
Co2GasPvt(size_t numRegions,
|
||||
Scalar T_ref = 288.71, //(273.15 + 15.56)
|
||||
@@ -78,27 +74,7 @@ public:
|
||||
/*!
|
||||
* \brief Initialize the parameters for co2 gas using an ECL deck.
|
||||
*/
|
||||
void initFromState(const EclipseState& eclState, const Schedule&)
|
||||
{
|
||||
if( !eclState.getTableManager().getDensityTable().empty()) {
|
||||
std::cerr << "WARNING: CO2STOR is enabled but DENSITY is in the deck. \n" <<
|
||||
"The surface density is computed based on CO2-BRINE PVT at standard conditions (STCOND) and DENSITY is ignored " << std::endl;
|
||||
}
|
||||
|
||||
if( eclState.getTableManager().hasTables("PVDG") || !eclState.getTableManager().getPvtgTables().empty()) {
|
||||
std::cerr << "WARNING: CO2STOR is enabled but PVDG or PVTG is in the deck. \n" <<
|
||||
"CO2 PVT properties are computed based on the Span-Wagner pvt model and PVDG/PVTG input is ignored. " << std::endl;
|
||||
}
|
||||
|
||||
// We only supported single pvt region for the co2-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] = CO2::gasDensity(T_ref, P_ref, extrapolate);
|
||||
initEnd();
|
||||
}
|
||||
void initFromState(const EclipseState& eclState, const Schedule&);
|
||||
#endif
|
||||
|
||||
void setNumRegions(size_t numRegions)
|
||||
@@ -247,14 +223,9 @@ public:
|
||||
return BinaryCoeffBrineCO2::gasDiffCoeff(temperature, pressure, extrapolate);
|
||||
}
|
||||
|
||||
const Scalar gasReferenceDensity(unsigned regionIdx) const
|
||||
Scalar gasReferenceDensity(unsigned regionIdx) const
|
||||
{ return gasReferenceDensity_[regionIdx]; }
|
||||
|
||||
bool operator==(const Co2GasPvt<Scalar>& data) const
|
||||
{
|
||||
return gasReferenceDensity_ == data.gasReferenceDensity_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<Scalar> gasReferenceDensity_;
|
||||
};
|
||||
|
||||
64
src/opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
Normal file
64
src/opm/material/fluidsystems/blackoilpvt/Co2GasPvt.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
// -*- 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/Co2GasPvt.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 Co2GasPvt<Scalar>::
|
||||
initFromState(const EclipseState& eclState, const Schedule&)
|
||||
{
|
||||
if (!eclState.getTableManager().getDensityTable().empty()) {
|
||||
OpmLog::warning("CO2STOR is enabled but DENSITY is in the deck. \n"
|
||||
"The surface density is computed based on CO2-BRINE "
|
||||
"PVT at standard conditions (STCOND) and DENSITY is ignored");
|
||||
}
|
||||
|
||||
if (eclState.getTableManager().hasTables("PVDG") ||
|
||||
!eclState.getTableManager().getPvtgTables().empty()) {
|
||||
OpmLog::warning("CO2STOR is enabled but PVDG or PVTG is in the deck. \n"
|
||||
"CO2 PVT properties are computed based on the Span-Wagner "
|
||||
"pvt model and PVDG/PVTG input is ignored.");
|
||||
}
|
||||
|
||||
// We only supported single pvt region for the co2-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] = CO2::gasDensity(T_ref, P_ref, extrapolate);
|
||||
initEnd();
|
||||
}
|
||||
|
||||
template class Co2GasPvt<double>;
|
||||
template class Co2GasPvt<float>;
|
||||
|
||||
} // namespace Opm
|
||||
Reference in New Issue
Block a user