change order of directiona and type and support default ijk

This commit is contained in:
Tor Harald Sandve 2022-10-26 15:49:42 +02:00
parent 120ef99510
commit e90ee06e74
4 changed files with 42 additions and 14 deletions

View File

@ -24,6 +24,7 @@
#include <cstddef>
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
namespace Opm {
@ -59,7 +60,7 @@ public:
double rate;
BCFace() = default;
explicit BCFace(const DeckRecord& record);
explicit BCFace(const DeckRecord& record, const GridDims& grid);
static BCFace serializationTestObject();

View File

@ -64,18 +64,37 @@ BCComponent component(const std::string& s) {
}
}
BCConfig::BCFace::BCFace(const DeckRecord& record) :
i1(record.getItem("I1").get<int>(0) - 1),
i2(record.getItem("I2").get<int>(0) - 1),
j1(record.getItem("J1").get<int>(0) - 1),
j2(record.getItem("J2").get<int>(0) - 1),
k1(record.getItem("K1").get<int>(0) - 1),
k2(record.getItem("K2").get<int>(0) - 1),
BCConfig::BCFace::BCFace(const DeckRecord& record, const GridDims& grid) :
i1(0),
i2(grid.getNX() - 1),
j1(0),
j2(grid.getNY() - 1),
k1(0),
k2(grid.getNZ() - 1),
bctype(fromstring::bctype(record.getItem("TYPE").get<std::string>(0))),
dir(FaceDir::FromString(record.getItem("DIRECTION").get<std::string>(0))),
component(fromstring::component(record.getItem("COMPONENT").get<std::string>(0))),
rate(record.getItem("RATE").getSIDouble(0))
{
using BC = ParserKeywords::BC;
if (const auto& I1 = record.getItem<BC::I1>(); ! I1.defaultApplied(0)) {
this->i1 = I1.get<int>(0) - 1;
}
if (const auto& I2 = record.getItem<BC::I2>(); ! I2.defaultApplied(0)) {
this->i2 = I2.get<int>(0) - 1;
}
if (const auto& J1 = record.getItem<BC::J1>(); ! J1.defaultApplied(0)) {
this->j1 = J1.get<int>(0) - 1;
}
if (const auto& J2 = record.getItem<BC::J2>(); ! J2.defaultApplied(0)) {
this->j2 = J2.get<int>(0) - 1;
}
if (const auto& K1 = record.getItem<BC::K1>(); ! K1.defaultApplied(0)) {
this->k1 = K1.get<int>(0) - 1;
}
if (const auto& K2 = record.getItem<BC::K2>(); ! K2.defaultApplied(0)) {
this->k2 = K2.get<int>(0) - 1;
}
}
BCConfig::BCFace BCConfig::BCFace::serializationTestObject()
@ -112,9 +131,10 @@ bool BCConfig::BCFace::operator==(const BCConfig::BCFace& other) const {
BCConfig::BCConfig(const Deck& deck) {
GridDims grid( deck );
for (const auto& kw: deck.getKeywordList<ParserKeywords::BC>()) {
for (const auto& record : *kw)
this->m_faces.emplace_back( record );
this->m_faces.emplace_back( record, grid );
}
}

View File

@ -29,11 +29,11 @@
"value_type": "INT"
},
{
"name": "TYPE",
"name": "DIRECTION",
"value_type": "STRING"
},
{
"name": "DIRECTION",
"name": "TYPE",
"value_type": "STRING"
},
{

View File

@ -51,7 +51,6 @@ const std::string& inputStr = "RUNSPEC\n"
"EQLNUM\n"
"10*1 10*2 100*3 /\n "
"\n"
"SOLUTION\n"
"THPRES\n"
"1 2 12.0/\n"
@ -62,7 +61,6 @@ const std::string& inputStr = "RUNSPEC\n"
const std::string& inputStr_noTHPRES = "RUNSPEC\n"
"EQLOPTS\n"
"DIMENS\n"
"10 3 4 /\n"
"\n"
@ -75,12 +73,16 @@ const std::string& inputStr_noTHPRES = "RUNSPEC\n"
"\n";
const std::string& inputStr_cpr = "RUNSPEC\n"
"DIMENS\n"
"10 3 4 /\n"
"CPR\n"
"/\n"
"SUMMARY\n";
const std::string& inputStr_INVALID = "RUNSPEC\n"
"DIMENS\n"
"10 3 4 /\n"
"CPR\n"
"WEll 10 10 17/"
"/\n"
@ -88,11 +90,16 @@ const std::string& inputStr_INVALID = "RUNSPEC\n"
const std::string& inputStr_cpr_in_SUMMARY = "SUMMARY\n"
const std::string& inputStr_cpr_in_SUMMARY = "RUNSPEC\n"
"DIMENS\n"
"10 3 4 /\n"
"SUMMARY\n"
"CPR\n"
"well1 10 27 10/\n/\n";
const std::string& inputStr_cpr_BOTH = "RUNSPEC\n"
"DIMENS\n"
"10 3 4 /\n"
"CPR\n"
"/\n"
"SUMMARY\n"