Files
opm-common/opm/parser/eclipse/EclipseState/Runspec.hpp
T

345 lines
8.6 KiB
C++
Raw Normal View History

/*
Copyright 2016 Statoil ASA.
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 3 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/>.
*/
#ifndef OPM_RUNSPEC_HPP
#define OPM_RUNSPEC_HPP
#include <iosfwd>
#include <string>
2020-09-22 10:14:05 +02:00
#include <optional>
2020-09-22 10:14:05 +02:00
#include <opm/common/OpmLog/KeywordLocation.hpp>
2016-11-17 16:15:18 +01:00
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
2017-01-03 19:25:30 +01:00
#include <opm/parser/eclipse/EclipseState/EndpointScaling.hpp>
2019-02-18 08:32:17 +01:00
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actdims.hpp>
2016-11-17 16:15:18 +01:00
namespace Opm {
class Deck;
2017-01-03 19:25:30 +01:00
enum class Phase {
2016-12-20 12:51:44 +01:00
OIL = 0,
GAS = 1,
WATER = 2,
SOLVENT = 3,
2017-06-16 13:41:09 +02:00
POLYMER = 4,
2017-11-23 13:18:33 +01:00
ENERGY = 5,
2019-04-26 10:36:34 +02:00
POLYMW = 6,
FOAM = 7,
BRINE = 8,
ZFRACTION = 9
2019-06-25 13:34:19 +02:00
// If you add more entries to this enum, remember to update NUM_PHASES_IN_ENUM below.
};
constexpr int NUM_PHASES_IN_ENUM = static_cast<int>(Phase::ZFRACTION) + 1; // Used to get correct size of the bitset in class Phases.
2019-06-25 13:34:19 +02:00
Phase get_phase( const std::string& );
std::ostream& operator<<( std::ostream&, const Phase& );
class Phases {
public:
Phases() noexcept = default;
2018-03-08 22:15:47 +01:00
Phases( bool oil, bool gas, bool wat, bool solvent = false, bool polymer = false, bool energy = false,
bool polymw = false, bool foam = false, bool brine = false, bool zfraction = false ) noexcept;
static Phases serializeObject();
bool active( Phase ) const noexcept;
size_t size() const noexcept;
2019-11-29 09:57:25 +01:00
bool operator==(const Phases& data) const;
2020-03-13 12:19:37 +01:00
template<class Serializer>
void serializeOp(Serializer& serializer)
{
2020-03-13 12:37:17 +01:00
if (serializer.isSerializing())
serializer(bits.to_ulong());
else {
unsigned long Bits = 0;
2020-03-13 12:37:17 +01:00
serializer(Bits);
bits = std::bitset<NUM_PHASES_IN_ENUM>(Bits);
}
2020-03-13 12:19:37 +01:00
}
private:
2019-06-25 13:34:19 +02:00
std::bitset< NUM_PHASES_IN_ENUM > bits;
};
2017-01-03 15:42:41 +01:00
class Welldims {
public:
2019-11-29 09:57:25 +01:00
Welldims() = default;
explicit Welldims(const Deck& deck);
static Welldims serializeObject();
int maxConnPerWell() const
{
return this->nCWMax;
}
int maxWellsPerGroup() const
{
return this->nWGMax;
}
int maxGroupsInField() const
{
return this->nGMax;
}
2020-03-13 12:25:23 +01:00
int maxWellsInField() const
{
return this->nWMax;
}
2019-11-29 09:57:25 +01:00
2020-09-22 10:14:05 +02:00
const std::optional<KeywordLocation>& location() const {
return this->m_location;
}
2019-11-29 09:57:25 +01:00
bool operator==(const Welldims& data) const {
return this->maxConnPerWell() == data.maxConnPerWell() &&
this->maxWellsPerGroup() == data.maxWellsPerGroup() &&
this->maxGroupsInField() == data.maxGroupsInField() &&
2020-09-22 10:14:05 +02:00
this->maxWellsInField() == data.maxWellsInField() &&
this->location() == data.location();
2019-11-29 09:57:25 +01:00
}
2020-03-13 12:25:23 +01:00
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(nWMax);
serializer(nCWMax);
serializer(nWGMax);
serializer(nGMax);
2020-09-22 10:14:05 +02:00
serializer(m_location);
2020-03-13 12:25:23 +01:00
}
private:
int nWMax { 0 };
int nCWMax { 0 };
int nWGMax { 0 };
int nGMax { 0 };
2020-09-22 10:14:05 +02:00
std::optional<KeywordLocation> m_location;
};
class WellSegmentDims {
public:
WellSegmentDims();
explicit WellSegmentDims(const Deck& deck);
static WellSegmentDims serializeObject();
int maxSegmentedWells() const
{
return this->nSegWellMax;
}
int maxSegmentsPerWell() const
{
return this->nSegmentMax;
}
int maxLateralBranchesPerWell() const
{
return this->nLatBranchMax;
}
bool operator==(const WellSegmentDims& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(nSegWellMax);
serializer(nSegmentMax);
serializer(nLatBranchMax);
}
private:
int nSegWellMax;
int nSegmentMax;
int nLatBranchMax;
};
2019-01-18 08:52:11 +01:00
class EclHysterConfig
{
public:
EclHysterConfig() = default;
explicit EclHysterConfig(const Deck& deck);
static EclHysterConfig serializeObject();
/*!
* \brief Specify whether hysteresis is enabled or not.
*/
//void setActive(bool yesno);
/*!
* \brief Returns whether hysteresis is enabled (active).
*/
bool active() const;
/*!
* \brief Return the type of the hysteresis model which is used for capillary pressure.
*
* -1: capillary pressure hysteresis is disabled
* 0: use the Killough model for capillary pressure hysteresis
*/
int pcHysteresisModel() const;
/*!
* \brief Return the type of the hysteresis model which is used for relative permeability.
*
* -1: relperm hysteresis is disabled
* 0: use the Carlson model for relative permeability hysteresis
*/
int krHysteresisModel() const;
bool operator==(const EclHysterConfig& data) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(activeHyst);
serializer(pcHystMod);
serializer(krHystMod);
}
private:
// enable hysteresis at all
bool activeHyst { false };
// the capillary pressure and the relperm hysteresis models to be used
int pcHystMod { 0 };
int krHystMod { 0 };
};
2020-01-24 13:52:12 +01:00
class SatFuncControls {
public:
2020-03-10 10:38:43 +01:00
enum class ThreePhaseOilKrModel {
Default,
Stone1,
Stone2
};
enum class KeywordFamily {
Family_I, // SGOF, SWOF, SLGOF
Family_II, // SGFN, SOF{2,3}, SWFN
Undefined,
};
2020-01-24 13:52:12 +01:00
SatFuncControls();
explicit SatFuncControls(const Deck& deck);
explicit SatFuncControls(const double tolcritArg,
const ThreePhaseOilKrModel model,
const KeywordFamily family);
static SatFuncControls serializeObject();
2020-01-24 13:52:12 +01:00
double minimumRelpermMobilityThreshold() const
{
return this->tolcrit;
}
2020-03-10 10:38:43 +01:00
ThreePhaseOilKrModel krModel() const
{
return this->krmodel;
}
KeywordFamily family() const
{
return this->satfunc_family;
}
2020-01-24 13:52:12 +01:00
bool operator==(const SatFuncControls& rhs) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(tolcrit);
serializer(krmodel);
serializer(satfunc_family);
}
2020-01-24 13:52:12 +01:00
private:
double tolcrit;
2020-03-10 10:38:43 +01:00
ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default;
KeywordFamily satfunc_family = KeywordFamily::Undefined;
2020-01-24 13:52:12 +01:00
};
class Runspec {
2019-02-07 08:29:32 +01:00
public:
2019-11-29 09:57:25 +01:00
Runspec() = default;
2019-02-07 08:29:32 +01:00
explicit Runspec( const Deck& );
static Runspec serializeObject();
2019-02-07 08:29:32 +01:00
const UDQParams& udqParams() const noexcept;
const Phases& phases() const noexcept;
const Tabdims& tabdims() const noexcept;
const EndpointScaling& endpointScaling() const noexcept;
const Welldims& wellDimensions() const noexcept;
const WellSegmentDims& wellSegmentDimensions() const noexcept;
int eclPhaseMask( ) const noexcept;
const EclHysterConfig& hysterPar() const noexcept;
const Actdims& actdims() const noexcept;
2020-01-24 13:52:12 +01:00
const SatFuncControls& saturationFunctionControls() const noexcept;
2020-06-10 14:55:20 +02:00
int nupcol() const noexcept;
2020-09-14 11:26:04 +02:00
bool co2Storage() const noexcept;
2019-02-07 08:29:32 +01:00
2019-11-29 09:57:25 +01:00
bool operator==(const Runspec& data) const;
2020-03-13 12:37:17 +01:00
template<class Serializer>
void serializeOp(Serializer& serializer)
{
active_phases.serializeOp(serializer);
m_tabdims.serializeOp(serializer);
endscale.serializeOp(serializer);
welldims.serializeOp(serializer);
wsegdims.serializeOp(serializer);
udq_params.serializeOp(serializer);
hystpar.serializeOp(serializer);
m_actdims.serializeOp(serializer);
m_sfuncctrl.serializeOp(serializer);
2020-09-16 14:58:56 +02:00
serializer(m_nupcol);
2020-09-14 11:26:04 +02:00
serializer(m_co2storage);
2020-03-13 12:37:17 +01:00
}
2019-02-07 08:29:32 +01:00
private:
Phases active_phases;
Tabdims m_tabdims;
EndpointScaling endscale;
Welldims welldims;
WellSegmentDims wsegdims;
UDQParams udq_params;
EclHysterConfig hystpar;
Actdims m_actdims;
2020-01-24 13:52:12 +01:00
SatFuncControls m_sfuncctrl;
2020-06-10 14:55:20 +02:00
int m_nupcol;
2020-09-14 11:26:04 +02:00
bool m_co2storage;
};
}
#endif // OPM_RUNSPEC_HPP