allow constructing JFunc from variables

also add equality operator
This commit is contained in:
Arne Morten Kvarving
2019-11-29 09:57:25 +01:00
parent 73be14b7b8
commit 39ab36819e
2 changed files with 32 additions and 0 deletions

View File

@@ -32,7 +32,11 @@ public:
enum class Flag { BOTH, WATER, GAS };
enum class Direction { XY, X, Y, Z };
JFunc();
explicit JFunc(const Deck& deck);
JFunc(Flag flag, double ow, double go,
double alpha, double beta, Direction dir);
double alphaFactor() const;
double betaFactor() const;
double goSurfaceTension() const;
@@ -40,6 +44,8 @@ public:
const Flag& flag() const;
const Direction& direction() const;
bool operator==(const JFunc& data) const;
private:
Flag m_flag; // JFUNC flag: WATER, GAS, or BOTH. Default BOTH
double m_owSurfaceTension; // oil-wat surface tension. Required if flag is BOTH or WATER

View File

@@ -23,6 +23,11 @@
namespace Opm {
JFunc::JFunc()
: JFunc(Flag::BOTH, 0.0, 0.0, 0.0, 0.0, Direction::XY)
{
}
JFunc::JFunc(const Deck& deck)
{
const auto& kw = *deck.getKeywordList<ParserKeywords::JFUNC>()[0];
@@ -59,6 +64,17 @@ namespace Opm {
throw std::invalid_argument("Illegal JFUNC DIRECTION, must be XY, X, Y, or Z. Was \"" + kw_dir + "\".");
}
JFunc::JFunc(Flag flag, double ow, double go,
double alpha, double beta, Direction dir)
: m_flag(flag)
, m_owSurfaceTension(ow)
, m_goSurfaceTension(go)
, m_alphaFactor(alpha)
, m_betaFactor(beta)
, m_direction(dir)
{
}
double JFunc::alphaFactor() const {
return m_alphaFactor;
}
@@ -86,4 +102,14 @@ namespace Opm {
const JFunc::Direction& JFunc::direction() const {
return m_direction;
}
bool JFunc::operator==(const JFunc& data) const {
return this->flag() == data.flag() &&
this->owSurfaceTension() == data.owSurfaceTension() &&
this->goSurfaceTension() == data.goSurfaceTension() &&
this->alphaFactor() == data.alphaFactor() &&
this->betaFactor() == data.betaFactor() &&
this->direction() == data.direction();
}
} // Opm::