Merge pull request #2011 from joakim-hove/grid-msg

Grid msg
This commit is contained in:
Joakim Hove
2020-10-10 10:30:36 +02:00
committed by GitHub
5 changed files with 13 additions and 46 deletions

View File

@@ -26,6 +26,8 @@
#include <tuple>
#include <functional>
#include <fmt/format.h>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/utility/numeric/calculateCellVol.hpp>
@@ -209,17 +211,8 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
m_multzMode(PinchMode::ModeEnum::TOP),
m_pinchGapMode(PinchMode::ModeEnum::GAP)
{
OpmLog::info("Creating grid");
if (deck.hasKeyword("GDFILE")){
if (deck.hasKeyword("COORD")){
throw std::invalid_argument("COORD can't be used together with GDFILE");
}
if (deck.hasKeyword("ZCORN")){
throw std::invalid_argument("ZCORN can't be used together with GDFILE");
}
if (deck.hasKeyword("ACTNUM")){
if (keywInputBeforeGdfile(deck, "ACTNUM")) {
m_useActnumFromGdfile = true;
@@ -333,6 +326,7 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
}
void EclipseGrid::initGridFromEGridFile(Opm::EclIO::EclFile& egridfile, std::string fileName){
OpmLog::info(fmt::format("Creating grid from: {} ", fileName));
if (!egridfile.hasKey("GRIDHEAD")) {
throw std::invalid_argument("file: " + fileName + " is not a valid egrid file, GRIDHEAD not found");
@@ -517,7 +511,7 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
}
void EclipseGrid::initDVDEPTHZGrid(const Deck& deck) {
OpmLog::info("Creating grid from keywords DXV, DYV, DZV and DEPTHZ");
const std::vector<double>& DXV = deck.getKeyword<ParserKeywords::DXV>().getSIDoubleData();
const std::vector<double>& DYV = deck.getKeyword<ParserKeywords::DYV>().getSIDoubleData();
const std::vector<double>& DZV = deck.getKeyword<ParserKeywords::DZV>().getSIDoubleData();
@@ -539,6 +533,7 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
}
void EclipseGrid::initDTOPSGrid(const Deck& deck) {
OpmLog::info("Creating grid from keywords DX, DY, DZ and TOPS");
std::vector<double> DX = EclipseGrid::createDVector( this->getNXYZ(), 0 , "DX" , "DXV" , deck);
std::vector<double> DY = EclipseGrid::createDVector( this->getNXYZ(), 1 , "DY" , "DYV" , deck);
@@ -951,6 +946,7 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
const std::vector<double>& dthetav = deck.getKeyword<ParserKeywords::DTHETAV>().getSIDoubleData();
const std::vector<double>& dzv = deck.getKeyword<ParserKeywords::DZV>().getSIDoubleData();
const std::vector<double>& tops = deck.getKeyword<ParserKeywords::TOPS>().getSIDoubleData();
OpmLog::info("Creating cylindrical grid from keywords DRV, DTHETAV, DZV and TOPS");
if (drv.size() != this->getNX())
throw std::invalid_argument("DRV keyword should have exactly " + std::to_string( this->getNX() ) + " elements");
@@ -1087,7 +1083,9 @@ EclipseGrid::EclipseGrid(const Deck& deck, const int * actnum)
throw std::invalid_argument("ACTNUM vector has wrong size");
actnum = actnumVector.data();
}
OpmLog::info("Creating cornerpoint grid from keywords ZCORN, COORD and ACTNUM");
} else
OpmLog::info("Creating cornerpoint grid from keywords ZCORN and COORD");
initCornerPointGrid( coord , zcorn, actnum, nullptr );
}

View File

@@ -3,6 +3,7 @@
"sections": [
"GRID"
],
"prohibits" : ["GDFILE"],
"data": {
"value_type": "DOUBLE",
"dimension": "Length"

View File

@@ -3,6 +3,7 @@
"sections": [
"GRID"
],
"prohibits" : ["COORD", "ZCORN"],
"size": 1,
"items": [
{

View File

@@ -3,6 +3,7 @@
"sections": [
"GRID"
],
"prohibits" : ["GDFILE"],
"data": {
"value_type": "DOUBLE",
"dimension": "Length"

View File

@@ -28,6 +28,7 @@
#include <unistd.h>
#include <opm/common/utility/FileSystem.hpp>
#include <opm/common/utility/OpmInputError.hpp>
#define BOOST_TEST_MODULE EclipseGridTests
#include <boost/test/unit_test.hpp>
@@ -2451,44 +2452,9 @@ BOOST_AUTO_TEST_CASE(TEST_GDFILE_1) {
"PORO\n"
" 2*0.15 /\n";
const char* deckData2 =
"RUNSPEC\n"
"DIMENS\n"
"1 1 2 /\n"
"GRID\n"
"GDFILE\n"
" 'BAD_CP_M.EGRID' /\n"
"COORD\n"
"10.0000 10.0000 2000.0000 9.8255 10.0000 2014.9977\n"
"109.9848 10.0000 2001.7452 109.8102 10.0000 2016.7430\n"
"10.0000 110.0000 2000.0000 9.8255 110.0000 2014.9977\n"
"109.9848 110.0000 2001.7452 109.8102 110.0000 2016.7430 /\n"
"PORO\n"
" 2*0.15 /\n";
const char* deckData3 =
"RUNSPEC\n"
"DIMENS\n"
"1 1 2 /\n"
"GRID\n"
"GDFILE\n"
" 'BAD_CP_M.EGRID' /\n"
"ZCORN\n"
"2000.0000 2001.7452 2000.0000 2001.7452 2004.9992 2006.7445\n"
"2004.9992 2006.7445 2004.9992 2006.7445 2004.9992 2006.7445\n"
"2014.9977 2016.7430 2014.9977 2016.7430 /\n"
"PORO\n"
" 2*0.15 /\n";
Opm::Parser parser;
auto deck1 = parser.parseString( deckData1) ;
auto deck2 = parser.parseString( deckData2) ;
auto deck3 = parser.parseString( deckData3) ;
BOOST_CHECK_NO_THROW( Opm::EclipseGrid grid1(deck1) );
BOOST_CHECK_THROW(Opm::EclipseGrid grid2(deck2), std::invalid_argument);
BOOST_CHECK_THROW(Opm::EclipseGrid grid3(deck3), std::invalid_argument);
}