mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 13:25:34 -06:00
Merge pull request #994 from pgdr/use-eclipse3dproperties
@bska We're merging as-is for now, and we've made a note to replace `shared_ptr` and maintain (and document!) this property. Those changes will obviously be internal and you won't notice a difference.
This commit is contained in:
commit
8b71d81a14
@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
||||
|
||||
|
||||
namespace Opm
|
||||
@ -37,14 +38,15 @@ namespace Opm
|
||||
PhaseUsage pu;
|
||||
std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);
|
||||
|
||||
const auto& tm = eclipseState->getTableManager();
|
||||
// Discover phase usage.
|
||||
if (eclipseState->hasPhase(Phase::PhaseEnum::WATER)) {
|
||||
if (tm.hasPhase(Phase::PhaseEnum::WATER)) {
|
||||
pu.phase_used[BlackoilPhases::Aqua] = 1;
|
||||
}
|
||||
if (eclipseState->hasPhase(Phase::PhaseEnum::OIL)) {
|
||||
if (tm.hasPhase(Phase::PhaseEnum::OIL)) {
|
||||
pu.phase_used[BlackoilPhases::Liquid] = 1;
|
||||
}
|
||||
if (eclipseState->hasPhase(Phase::PhaseEnum::GAS)) {
|
||||
if (tm.hasPhase(Phase::PhaseEnum::GAS)) {
|
||||
pu.phase_used[BlackoilPhases::Vapour] = 1;
|
||||
}
|
||||
pu.num_phases = 0;
|
||||
|
@ -45,8 +45,8 @@ namespace Opm
|
||||
: pref_(0.0),
|
||||
rock_comp_(0.0)
|
||||
{
|
||||
const auto tables = eclipseState->getTableManager();
|
||||
const auto& rocktabTables = tables->getRocktabTables();
|
||||
const auto& tables = eclipseState->getTableManager();
|
||||
const auto& rocktabTables = tables.getRocktabTables();
|
||||
if (rocktabTables.size() > 0) {
|
||||
const auto& rocktabTable = rocktabTables.getTable<RocktabTable>(0);
|
||||
if (rocktabTables.size() != 1)
|
||||
|
@ -183,16 +183,17 @@ namespace Opm
|
||||
/// Invalid invalid set of components given.
|
||||
PermeabilityKind classifyPermeability(Opm::EclipseStateConstPtr eclState)
|
||||
{
|
||||
const bool xx = eclState->hasDeckDoubleGridProperty("PERMX" );
|
||||
const bool xy = eclState->hasDeckDoubleGridProperty("PERMXY");
|
||||
auto& props = eclState->get3DProperties();
|
||||
const bool xx = props.hasDeckDoubleGridProperty("PERMX" );
|
||||
const bool xy = props.hasDeckDoubleGridProperty("PERMXY");
|
||||
const bool yx = xy;
|
||||
|
||||
const bool yy = eclState->hasDeckDoubleGridProperty("PERMY" );
|
||||
const bool yz = eclState->hasDeckDoubleGridProperty("PERMYZ");
|
||||
const bool yy = props.hasDeckDoubleGridProperty("PERMY" );
|
||||
const bool yz = props.hasDeckDoubleGridProperty("PERMYZ");
|
||||
const bool zy = yz;
|
||||
|
||||
const bool zz = eclState->hasDeckDoubleGridProperty("PERMZ" );
|
||||
const bool zx = eclState->hasDeckDoubleGridProperty("PERMZX");
|
||||
const bool zz = props.hasDeckDoubleGridProperty("PERMZ" );
|
||||
const bool zx = props.hasDeckDoubleGridProperty("PERMZX");
|
||||
const bool xz = zx;
|
||||
|
||||
int num_cross_comp = xy + xz + yx + yz + zx + zy;
|
||||
@ -309,7 +310,7 @@ namespace Opm
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 1st row: [ kxx, kxy ], kxz handled in kzx
|
||||
if (eclState->hasDeckDoubleGridProperty("PERMX" )) {
|
||||
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMX" )) {
|
||||
kmap[xx] = tensor.size();
|
||||
tensor.push_back(extractPermComponent(eclState, "PERMX", global_cell));
|
||||
|
||||
@ -322,7 +323,7 @@ namespace Opm
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 2nd row: [ kyy, kyz ], kyx handled in kxy
|
||||
if (eclState->hasDeckDoubleGridProperty("PERMY" )) {
|
||||
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMY" )) {
|
||||
kmap[yy] = tensor.size();
|
||||
tensor.push_back(extractPermComponent(eclState, "PERMY", global_cell));
|
||||
|
||||
@ -339,7 +340,7 @@ namespace Opm
|
||||
kmap[zx] = kmap[xz] = tensor.size(); // Enforce symmetry.
|
||||
tensor.push_back(extractPermComponent(eclState, "PERMZX", global_cell));
|
||||
}
|
||||
if (eclState->hasDeckDoubleGridProperty("PERMZ" )) {
|
||||
if (eclState->get3DProperties().hasDeckDoubleGridProperty("PERMZ" )) {
|
||||
kmap[zz] = tensor.size();
|
||||
tensor.push_back(extractPermComponent(eclState, "PERMZ", global_cell));
|
||||
|
||||
|
@ -93,14 +93,14 @@ namespace Opm{
|
||||
void RelpermDiagnostics::satFamilyCheck_(Opm::EclipseStateConstPtr eclState)
|
||||
{
|
||||
const auto& tableManager = eclState->getTableManager();
|
||||
const TableContainer& swofTables = tableManager->getSwofTables();
|
||||
const TableContainer& slgofTables= tableManager->getSlgofTables();
|
||||
const TableContainer& sgofTables = tableManager->getSgofTables();
|
||||
const TableContainer& swfnTables = tableManager->getSwfnTables();
|
||||
const TableContainer& sgfnTables = tableManager->getSgfnTables();
|
||||
const TableContainer& sof3Tables = tableManager->getSof3Tables();
|
||||
const TableContainer& sof2Tables = tableManager->getSof2Tables();
|
||||
const TableContainer& sgwfnTables= tableManager->getSgwfnTables();
|
||||
const TableContainer& swofTables = tableManager.getSwofTables();
|
||||
const TableContainer& slgofTables= tableManager.getSlgofTables();
|
||||
const TableContainer& sgofTables = tableManager.getSgofTables();
|
||||
const TableContainer& swfnTables = tableManager.getSwfnTables();
|
||||
const TableContainer& sgfnTables = tableManager.getSgfnTables();
|
||||
const TableContainer& sof3Tables = tableManager.getSof3Tables();
|
||||
const TableContainer& sof2Tables = tableManager.getSof2Tables();
|
||||
const TableContainer& sgwfnTables= tableManager.getSgwfnTables();
|
||||
|
||||
|
||||
bool family1 = (!sgofTables.empty() || !slgofTables.empty()) && !swofTables.empty();
|
||||
@ -147,19 +147,19 @@ namespace Opm{
|
||||
std::cout << msg << std::endl;
|
||||
OpmLog::info(msg);
|
||||
const auto& tableManager = eclState->getTableManager();
|
||||
const TableContainer& swofTables = tableManager->getSwofTables();
|
||||
const TableContainer& slgofTables= tableManager->getSlgofTables();
|
||||
const TableContainer& sgofTables = tableManager->getSgofTables();
|
||||
const TableContainer& swfnTables = tableManager->getSwfnTables();
|
||||
const TableContainer& sgfnTables = tableManager->getSgfnTables();
|
||||
const TableContainer& sof3Tables = tableManager->getSof3Tables();
|
||||
const TableContainer& sof2Tables = tableManager->getSof2Tables();
|
||||
const TableContainer& sgwfnTables= tableManager->getSgwfnTables();
|
||||
const TableContainer& sgcwmisTables = tableManager->getSgcwmisTables();
|
||||
const TableContainer& sorwmisTables = tableManager->getSorwmisTables();
|
||||
const TableContainer& ssfnTables = tableManager->getSsfnTables();
|
||||
const TableContainer& miscTables = tableManager->getMiscTables();
|
||||
const TableContainer& msfnTables = tableManager->getMsfnTables();
|
||||
const TableContainer& swofTables = tableManager.getSwofTables();
|
||||
const TableContainer& slgofTables = tableManager.getSlgofTables();
|
||||
const TableContainer& sgofTables = tableManager.getSgofTables();
|
||||
const TableContainer& swfnTables = tableManager.getSwfnTables();
|
||||
const TableContainer& sgfnTables = tableManager.getSgfnTables();
|
||||
const TableContainer& sof3Tables = tableManager.getSof3Tables();
|
||||
const TableContainer& sof2Tables = tableManager.getSof2Tables();
|
||||
const TableContainer& sgwfnTables = tableManager.getSgwfnTables();
|
||||
const TableContainer& sgcwmisTables = tableManager.getSgcwmisTables();
|
||||
const TableContainer& sorwmisTables = tableManager.getSorwmisTables();
|
||||
const TableContainer& ssfnTables = tableManager.getSsfnTables();
|
||||
const TableContainer& miscTables = tableManager.getMiscTables();
|
||||
const TableContainer& msfnTables = tableManager.getMsfnTables();
|
||||
|
||||
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
|
||||
if (deck->hasKeyword("SWOF")) {
|
||||
@ -710,11 +710,11 @@ namespace Opm{
|
||||
const int numSatRegions = deck->getKeyword("TABDIMS").getRecord(0).getItem("NTSFUN").get< int >(0);
|
||||
unscaledEpsInfo_.resize(numSatRegions);
|
||||
|
||||
const auto tables = eclState->getTableManager();
|
||||
const TableContainer& swofTables = tables->getSwofTables();
|
||||
const TableContainer& sgofTables = tables->getSgofTables();
|
||||
const TableContainer& slgofTables = tables->getSlgofTables();
|
||||
const TableContainer& sof3Tables = tables->getSof3Tables();
|
||||
const auto& tables = eclState->getTableManager();
|
||||
const TableContainer& swofTables = tables.getSwofTables();
|
||||
const TableContainer& sgofTables = tables.getSgofTables();
|
||||
const TableContainer& slgofTables = tables.getSlgofTables();
|
||||
const TableContainer& sof3Tables = tables.getSof3Tables();
|
||||
|
||||
// std::cout << "***************\nEnd-Points In all the Tables\n";
|
||||
for (int satnumIdx = 0; satnumIdx < numSatRegions; ++satnumIdx) {
|
||||
|
@ -82,11 +82,11 @@ namespace Opm {
|
||||
scaledEpsInfo_.resize(nc);
|
||||
EclEpsGridProperties epsGridProperties;
|
||||
epsGridProperties.initFromDeck(deck, eclState, /*imbibition=*/false);
|
||||
const auto satnum = eclState->getIntGridProperty("SATNUM");
|
||||
const auto& satnum = eclState->get3DProperties().getIntGridProperty("SATNUM");
|
||||
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
const int cartIdx = compressedToCartesianIdx[c];
|
||||
const std::string satnumIdx = std::to_string(satnum->iget(cartIdx));
|
||||
const std::string satnumIdx = std::to_string(satnum.iget(cartIdx));
|
||||
std::array<int, 3> ijk;
|
||||
ijk[0] = cartIdx % dims[0];
|
||||
ijk[1] = (cartIdx / dims[0]) % dims[1];
|
||||
|
@ -221,7 +221,7 @@ namespace Opm
|
||||
const int nc = UgGridHelpers::numCells(G);
|
||||
eqlnum.resize(nc);
|
||||
const std::vector<int>& e =
|
||||
eclipseState->getIntGridProperty("EQLNUM")->getData();
|
||||
eclipseState->get3DProperties().getIntGridProperty("EQLNUM").getData();
|
||||
const int* gc = UgGridHelpers::globalCell(G);
|
||||
for (int cell = 0; cell < nc; ++cell) {
|
||||
const int deck_pos = (gc == NULL) ? cell : gc[cell];
|
||||
@ -255,14 +255,14 @@ namespace Opm
|
||||
{
|
||||
// Get the equilibration records.
|
||||
const std::vector<EquilRecord> rec = getEquil(*eclipseState);
|
||||
std::shared_ptr<const TableManager> tables = eclipseState->getTableManager();
|
||||
const auto& tables = eclipseState->getTableManager();
|
||||
// Create (inverse) region mapping.
|
||||
const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
|
||||
|
||||
// Create Rs functions.
|
||||
rs_func_.reserve(rec.size());
|
||||
if (deck->hasKeyword("DISGAS")) {
|
||||
const TableContainer& rsvdTables = tables->getRsvdTables();
|
||||
const TableContainer& rsvdTables = tables.getRsvdTables();
|
||||
for (size_t i = 0; i < rec.size(); ++i) {
|
||||
const int cell = *(eqlmap.cells(i).begin());
|
||||
if (!rec[i].liveOilInitConstantRs()) {
|
||||
@ -295,7 +295,7 @@ namespace Opm
|
||||
|
||||
rv_func_.reserve(rec.size());
|
||||
if (deck->hasKeyword("VAPOIL")) {
|
||||
const TableContainer& rvvdTables = tables->getRvvdTables();
|
||||
const TableContainer& rvvdTables = tables.getRvvdTables();
|
||||
for (size_t i = 0; i < rec.size(); ++i) {
|
||||
const int cell = *(eqlmap.cells(i).begin());
|
||||
if (!rec[i].wetGasInitConstantRv()) {
|
||||
@ -332,7 +332,8 @@ namespace Opm
|
||||
|
||||
// Check for presence of kw SWATINIT
|
||||
if (deck->hasKeyword("SWATINIT")) {
|
||||
const std::vector<double>& swat_init = eclipseState->getDoubleGridProperty("SWATINIT")->getData();
|
||||
const std::vector<double>& swat_init = eclipseState->
|
||||
get3DProperties().getDoubleGridProperty("SWATINIT").getData();
|
||||
const int nc = UgGridHelpers::numCells(G);
|
||||
swat_init_.resize(nc);
|
||||
const int* gc = UgGridHelpers::globalCell(G);
|
||||
|
@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(Processing)
|
||||
Opm::ParseContext parseContext({{ ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE }});
|
||||
Opm::DeckConstPtr deck = parser->parseFile(filename, parseContext);
|
||||
std::shared_ptr<EclipseState> eclstate (new Opm::EclipseState(deck, parseContext));
|
||||
std::vector<double> porv = eclstate->getDoubleGridProperty("PORV")->getData();
|
||||
const auto& porv = eclstate->get3DProperties().getDoubleGridProperty("PORV").getData();
|
||||
EclipseGridConstPtr eclgrid = eclstate->getEclipseGrid();
|
||||
|
||||
BOOST_CHECK_EQUAL(eclgrid->getMinpvMode(), MinpvMode::EclSTD);
|
||||
|
Loading…
Reference in New Issue
Block a user