Merge pull request #563 from osae/testEPS

New parser; proper handling of ENPTVD/ENKRVD.
This commit is contained in:
Atgeirr Flø Rasmussen 2014-04-08 13:51:43 +02:00
commit bbe5a0f776

View File

@ -888,8 +888,9 @@ namespace Opm
bool hasENPTVD = newParserDeck->hasKeyword("ENPTVD"); bool hasENPTVD = newParserDeck->hasKeyword("ENPTVD");
bool hasENKRVD = newParserDeck->hasKeyword("ENKRVD"); bool hasENKRVD = newParserDeck->hasKeyword("ENKRVD");
int itab = 0; int itab = 0;
std::vector<std::vector<std::vector<double> > > table_dummy; std::vector<std::vector<double> > param_col;
std::vector<std::vector<std::vector<double> > >& table = table_dummy; std::vector<std::vector<double> > depth_col;
std::vector<std::string> col_names;
// Active keyword assigned default values for each cell (in case of possible box-wise assignment) // Active keyword assigned default values for each cell (in case of possible box-wise assignment)
int phase_pos_aqua = phase_usage_.phase_pos[BlackoilPhases::Aqua]; int phase_pos_aqua = phase_usage_.phase_pos[BlackoilPhases::Aqua];
@ -955,22 +956,14 @@ namespace Opm
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'"); OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
} }
if (!useKeyword && itab > 0) { if (!useKeyword && itab > 0) {
Opm::EnptvdTable enptvd(newParserDeck->getKeyword("ENPTVD")); int num_tables = newParserDeck->getKeyword("ENPTVD")->size();
table.resize(1); // only one region supported so far param_col.resize(num_tables);
for (unsigned i = 0; i < table.size(); ++i) { depth_col.resize(num_tables);
table[i].resize(9); col_names.resize(9);
for (int table_num=0; table_num<num_tables; ++table_num) {
for (int k = 0; k < enptvd.numRows(); ++k) { Opm::SimpleTable enptvd(newParserDeck->getKeyword("ENPTVD"), col_names, table_num);
table[i][0] = enptvd.getDepthColumn(); depth_col[table_num] = enptvd.getColumn(0); // depth
table[i][1] = enptvd.getSwcoColumn(); param_col[table_num] = enptvd.getColumn(itab); // itab=[1-8]: swl swcr swu sgl sgcr sgu sowcr sogcr
table[i][2] = enptvd.getSwcritColumn();
table[i][3] = enptvd.getSwmaxColumn();
table[i][4] = enptvd.getSgcoColumn();
table[i][5] = enptvd.getSgcritColumn();
table[i][6] = enptvd.getSgmaxColumn();
table[i][7] = enptvd.getSowcritColumn();
table[i][8] = enptvd.getSogcritColumn();
}
} }
} }
} else if ((keyword[0] == 'K' && (useKeyword || hasENKRVD)) || (keyword[1] == 'K' && useKeyword) ) { } else if ((keyword[0] == 'K' && (useKeyword || hasENKRVD)) || (keyword[1] == 'K' && useKeyword) ) {
@ -1026,21 +1019,14 @@ namespace Opm
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'"); OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
} }
if (!useKeyword && itab > 0) { if (!useKeyword && itab > 0) {
Opm::EnkrvdTable enkrvd(newParserDeck->getKeyword("ENKRVD")); int num_tables = newParserDeck->getKeyword("ENKRVD")->size();
table.resize(1); // only one region supported so far param_col.resize(num_tables);
for (unsigned i = 0; i < table.size(); ++i) { depth_col.resize(num_tables);
table[i].resize(8); col_names.resize(8);
for (int table_num=0; table_num<num_tables; ++table_num) {
for (int k = 0; k < enkrvd.numRows(); ++k) { Opm::SimpleTable enkrvd(newParserDeck->getKeyword("ENKRVD"), col_names, table_num);
table[i][0] = enkrvd.getDepthColumn(); depth_col[table_num] = enkrvd.getColumn(0); // depth
table[i][1] = enkrvd.getKrwmaxColumn(); param_col[table_num] = enkrvd.getColumn(itab); // itab=[1-7]: krw krg kro krwr krgr krorw krorg
table[i][2] = enkrvd.getKrgmaxColumn();
table[i][3] = enkrvd.getKromaxColumn();
table[i][4] = enkrvd.getKrwcritColumn();
table[i][5] = enkrvd.getKrgcritColumn();
table[i][6] = enkrvd.getKrocritgColumn();
table[i][7] = enkrvd.getKrocritwColumn();
}
} }
} }
} }
@ -1057,24 +1043,14 @@ namespace Opm
scaleparam[c] = val[deck_pos]; scaleparam[c] = val[deck_pos];
} }
} else { } else {
// TODO for new parser
/*
std::cout << "--- Scaling parameter '" << keyword << "' assigned via ";
if (keyword[0] == 'S')
newParserDeck.getENPTVD().write(std::cout);
else
newParserDeck.getENKRVD().write(std::cout);
*/
const double* cc = grid.cell_centroids; const double* cc = grid.cell_centroids;
const int dim = grid.dimensions; const int dim = grid.dimensions;
for (int cell = 0; cell < grid.number_of_cells; ++cell) { for (int cell = 0; cell < grid.number_of_cells; ++cell) {
int jtab = cell_to_func_.empty() ? 0 : cell_to_func_[cell]; int jtab = cell_to_func_.empty() ? 0 : cell_to_func_[cell];
if (table[itab][jtab][0] != -1.0) { if (param_col[jtab][0] >= 0.0) {
std::vector<double>& depth = table[0][jtab];
std::vector<double>& val = table[itab][jtab];
double zc = cc[dim*cell+dim-1]; double zc = cc[dim*cell+dim-1];
if (zc >= depth.front() && zc <= depth.back()) { //don't want extrap outside depth interval if (zc >= depth_col[jtab].front() && zc <= depth_col[jtab].back()) { //don't want extrap outside depth interval
scaleparam[cell] = linearInterpolation(depth, val, zc); scaleparam[cell] = linearInterpolation(depth_col[jtab], param_col[jtab], zc);
} }
} }
} }