-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added JFUNC in TableManager and getJFuncColumn()
* Fully internalized JFUNC * Added JFunc.cpp, throw on wrong FLAG/DIR in JFUNC kw * added tests for JFUNC in TableManagerTests * added protected member m_jfunc to SimpleTable * Added getJFuncColumn to accompany getPcowColumn * Throws if pressure or jfunc is accessed inappropriately * ... meaning if getPcowColumn is called when JFUNC is in deck, or * getJFuncColumn is called when JFUNC is not in deck * added tests for throwing and for getJFuncColumn * SimpleTable.getColumn("PCOW/PCOG") throws if JFUNC * In the event that one tries to get "PCOW" or "PCOG" via getColumn * ... this will throw if JFUNC is present in the deck. * Added tests.
- Loading branch information
Pål Grønås Drange
committed
Dec 28, 2016
1 parent
848d701
commit 172725a
Showing
18 changed files
with
475 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
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/>. | ||
*/ | ||
|
||
#include <opm/parser/eclipse/Deck/Deck.hpp> | ||
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp> | ||
#include <opm/parser/eclipse/Parser/ParserKeywords/J.hpp> | ||
|
||
namespace Opm { | ||
|
||
JFunc::JFunc(const Deck& deck) : | ||
m_exists(deck.hasKeyword("JFUNC")) | ||
{ | ||
if (!m_exists) | ||
return; | ||
const auto& kw = *deck.getKeywordList<ParserKeywords::JFUNC>()[0]; | ||
const auto& rec = kw.getRecord(0); | ||
const auto& kw_flag = rec.getItem("FLAG").get<std::string>(0); | ||
if (kw_flag == "BOTH") | ||
flag = Flag::BOTH; | ||
else if (kw_flag == "WATER") | ||
flag = Flag::WATER; | ||
else if (kw_flag == "GAS") | ||
flag = Flag::GAS; | ||
else | ||
throw std::invalid_argument("Illegal JFUNC FLAG, must be BOTH, WATER, or GAS. Was \"" + kw_flag + "\"."); | ||
|
||
if (flag != Flag::WATER) | ||
goSurfaceTension = rec.getItem("GO_SURFACE_TENSION").get<double>(0); | ||
|
||
if (flag != Flag::GAS) | ||
owSurfaceTension = rec.getItem("OW_SURFACE_TENSION").get<double>(0); | ||
|
||
alphaFactor = rec.getItem("ALPHA_FACTOR").get<double>(0); | ||
betaFactor = rec.getItem("BETA_FACTOR").get<double>(0); | ||
|
||
const auto kw_dir = rec.getItem("DIRECTION").get<std::string>(0); | ||
if (kw_dir == "XY") | ||
direction = Direction::XY; | ||
else if (kw_dir == "X") | ||
direction = Direction::X; | ||
else if (kw_dir == "Y") | ||
direction = Direction::Y; | ||
else if (kw_dir == "Z") | ||
direction = Direction::Z; | ||
else | ||
throw std::invalid_argument("Illegal JFUNC DIRECTION, must be XY, X, Y, or Z. Was \"" + kw_dir + "\"."); | ||
} | ||
|
||
double JFunc::getAlphaFactor() const { | ||
return alphaFactor; | ||
} | ||
|
||
double JFunc::getBetaFactor() const { | ||
return betaFactor; | ||
} | ||
|
||
double JFunc::getgoSurfaceTension() const { | ||
if (flag == JFunc::Flag::WATER) | ||
throw std::invalid_argument("Cannot get gas-oil with WATER JFUNC"); | ||
return goSurfaceTension; | ||
} | ||
|
||
double JFunc::getowSurfaceTension() const { | ||
if (flag == JFunc::Flag::GAS) | ||
throw std::invalid_argument("Cannot get oil-water with GAS JFUNC"); | ||
return owSurfaceTension; | ||
} | ||
|
||
const JFunc::Flag& JFunc::getJFuncFlag() const { | ||
return flag; | ||
} | ||
|
||
const JFunc::Direction& JFunc::getDirection() const { | ||
return direction; | ||
} | ||
} // Opm:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
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_JFUNC_HPP_ | ||
#define OPM_JFUNC_HPP_ | ||
|
||
#include <opm/parser/eclipse/Deck/Deck.hpp> | ||
|
||
|
||
namespace Opm { | ||
|
||
class JFunc | ||
{ | ||
public: | ||
|
||
enum class Flag { BOTH, WATER, GAS }; | ||
enum class Direction { XY, X, Y, Z }; | ||
|
||
JFunc(const Deck& deck); | ||
double getAlphaFactor() const; | ||
double getBetaFactor() const; | ||
double getgoSurfaceTension() const; | ||
double getowSurfaceTension() const; | ||
const Flag& getJFuncFlag() const; | ||
const Direction& getDirection() const; | ||
operator bool() const { return m_exists; } | ||
|
||
private: | ||
Flag flag; // JFUNC flag: WATER, GAS, or BOTH. Default BOTH | ||
double owSurfaceTension; // oil-wat surface tension. Required if flag is BOTH or WATER | ||
double goSurfaceTension; // gas-oil surface tension. Required if flag is BOTH or GAS | ||
double alphaFactor; // alternative porosity term. Default 0.5 | ||
double betaFactor; // alternative permeability term. Default 0.5 | ||
Direction direction; // XY, X, Y, Z. Default XY | ||
const bool m_exists; // will be true if JFunc is specified in the deck | ||
}; | ||
} // Opm:: | ||
|
||
#endif /* OPM_JFUNC_HPP_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.