mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ECL problem: Use Opm::EclipseState instead of the raw deck where possible
this means that property modifiers are now automatically supported...
This commit is contained in:
parent
bec1b8ba96
commit
536370fc96
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||||
|
|
||||||
@ -109,11 +110,7 @@ public:
|
|||||||
Opm::ParserPtr parser(new Opm::Parser());
|
Opm::ParserPtr parser(new Opm::Parser());
|
||||||
deck_ = parser->parseFile(deckPath.string());
|
deck_ = parser->parseFile(deckPath.string());
|
||||||
|
|
||||||
schedule_.reset(new Opm::Schedule(deck_));
|
eclipseState_.reset(new Opm::EclipseState(deck_));
|
||||||
|
|
||||||
std::shared_ptr<Opm::RUNSPECSection> runspecSection(new Opm::RUNSPECSection(deck_) );
|
|
||||||
std::shared_ptr<Opm::GRIDSection> gridSection(new Opm::GRIDSection(deck_) );
|
|
||||||
eclipseGrid_.reset(new Opm::EclipseGrid(runspecSection, gridSection));
|
|
||||||
|
|
||||||
grid_ = GridPointer(new Grid());
|
grid_ = GridPointer(new Grid());
|
||||||
grid_->processEclipseFormat(deck_,
|
grid_->processEclipseFormat(deck_,
|
||||||
@ -143,12 +140,18 @@ public:
|
|||||||
Opm::DeckConstPtr deck() const
|
Opm::DeckConstPtr deck() const
|
||||||
{ return deck_; }
|
{ return deck_; }
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Return a pointer to the internalized Eclipse deck
|
||||||
|
*/
|
||||||
|
Opm::EclipseStateConstPtr eclipseState() const
|
||||||
|
{ return eclipseState_; }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return a pointer to the internalized schedule of the
|
* \brief Return a pointer to the internalized schedule of the
|
||||||
* Eclipse deck
|
* Eclipse deck
|
||||||
*/
|
*/
|
||||||
Opm::ScheduleConstPtr schedule() const
|
Opm::ScheduleConstPtr schedule() const
|
||||||
{ return schedule_; }
|
{ return eclipseState_->getSchedule(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return a pointer to the EclipseGrid object
|
* \brief Return a pointer to the EclipseGrid object
|
||||||
@ -159,7 +162,7 @@ public:
|
|||||||
* Dune::CpGrid)
|
* Dune::CpGrid)
|
||||||
*/
|
*/
|
||||||
Opm::EclipseGridConstPtr eclipseGrid() const
|
Opm::EclipseGridConstPtr eclipseGrid() const
|
||||||
{ return eclipseGrid_; }
|
{ return eclipseState_->getEclipseGrid(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Returns the name of the case.
|
* \brief Returns the name of the case.
|
||||||
@ -174,8 +177,7 @@ private:
|
|||||||
std::string caseName_;
|
std::string caseName_;
|
||||||
GridPointer grid_;
|
GridPointer grid_;
|
||||||
Opm::DeckConstPtr deck_;
|
Opm::DeckConstPtr deck_;
|
||||||
Opm::ScheduleConstPtr schedule_;
|
Opm::EclipseStateConstPtr eclipseState_;
|
||||||
Opm::EclipseGridConstPtr eclipseGrid_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Ewoms
|
} // namespace Ewoms
|
||||||
|
@ -212,11 +212,9 @@ public:
|
|||||||
// (z coodinates represent depth, not height.)
|
// (z coodinates represent depth, not height.)
|
||||||
this->gravity_[dim - 1] *= -1;
|
this->gravity_[dim - 1] *= -1;
|
||||||
|
|
||||||
const auto deck = this->simulator().gridManager().deck();
|
initFluidSystem_();
|
||||||
|
readMaterialParameters_();
|
||||||
initFluidSystem_(deck);
|
readInitialCondition_();
|
||||||
readMaterialParameters_(deck);
|
|
||||||
readInitialCondition_(deck);
|
|
||||||
|
|
||||||
// Start the first episode. For this, ask the Eclipse schedule.
|
// Start the first episode. For this, ask the Eclipse schedule.
|
||||||
Opm::TimeMapConstPtr timeMap = simulator.gridManager().schedule()->getTimeMap();
|
Opm::TimeMapConstPtr timeMap = simulator.gridManager().schedule()->getTimeMap();
|
||||||
@ -395,7 +393,7 @@ public:
|
|||||||
//! \}
|
//! \}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readMaterialParameters_(Opm::DeckConstPtr deck)
|
void readMaterialParameters_()
|
||||||
{
|
{
|
||||||
size_t numDof = this->model().numDof();
|
size_t numDof = this->model().numDof();
|
||||||
|
|
||||||
@ -403,28 +401,17 @@ private:
|
|||||||
porosity_.resize(numDof);
|
porosity_.resize(numDof);
|
||||||
materialParams_.resize(numDof);
|
materialParams_.resize(numDof);
|
||||||
|
|
||||||
// read the intrinsic permeabilities from the deck
|
// read the intrinsic permeabilities from the eclipseState
|
||||||
if (deck->hasKeyword("PERM")) {
|
auto eclipseState = this->simulator().gridManager().eclipseState();
|
||||||
// the PERM and PERM{X,Y,Z,{X,Y,Z}{X,Y,Z}} keywords are
|
if (eclipseState->hasDoubleGridProperty("PERMX")) {
|
||||||
// mutually exclusive, but if the deck does shit, it is
|
|
||||||
// not our fault!
|
|
||||||
const std::vector<double> &permData =
|
|
||||||
deck->getKeyword("PERM")->getSIDoubleData();
|
|
||||||
|
|
||||||
assert(permData.size() == numDof);
|
|
||||||
|
|
||||||
for (size_t dofIdx = 0; dofIdx < numDof; ++ dofIdx)
|
|
||||||
intrinsicPermeability_[dofIdx] = this->toDimMatrix_(permData[dofIdx]);
|
|
||||||
}
|
|
||||||
else if (deck->hasKeyword("PERMX")) {
|
|
||||||
const std::vector<double> &permxData =
|
const std::vector<double> &permxData =
|
||||||
deck->getKeyword("PERMX")->getSIDoubleData();
|
eclipseState->getDoubleGridProperty("PERMX")->getData();
|
||||||
std::vector<double> permyData(permxData);
|
std::vector<double> permyData(permxData);
|
||||||
if (deck->hasKeyword("PERMY"))
|
if (eclipseState->hasDoubleGridProperty("PERMY"))
|
||||||
permyData = deck->getKeyword("PERMY")->getSIDoubleData();
|
permyData = eclipseState->getDoubleGridProperty("PERMY")->getData();
|
||||||
std::vector<double> permzData(permxData);
|
std::vector<double> permzData(permxData);
|
||||||
if (deck->hasKeyword("PERMZ"))
|
if (eclipseState->hasDoubleGridProperty("PERMZ"))
|
||||||
permzData = deck->getKeyword("PERMZ")->getSIDoubleData();
|
permzData = eclipseState->getDoubleGridProperty("PERMZ")->getData();
|
||||||
|
|
||||||
assert(permxData.size() == numDof);
|
assert(permxData.size() == numDof);
|
||||||
assert(permyData.size() == numDof);
|
assert(permyData.size() == numDof);
|
||||||
@ -441,12 +428,12 @@ private:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
OPM_THROW(std::logic_error,
|
OPM_THROW(std::logic_error,
|
||||||
"Can't read the intrinsic permeability from the deck. "
|
"Can't read the intrinsic permeability from the eclipse state. "
|
||||||
"(The PERM* keywords are missing)");
|
"(The PERM{X,Y,Z} keywords are missing)");
|
||||||
|
|
||||||
if (deck->hasKeyword("PORO")) {
|
if (eclipseState->hasDoubleGridProperty("PORO")) {
|
||||||
const std::vector<double> &poroData =
|
const std::vector<double> &poroData =
|
||||||
deck->getKeyword("PORO")->getSIDoubleData();
|
eclipseState->getDoubleGridProperty("PORO")->getData();
|
||||||
|
|
||||||
assert(poroData.size() == numDof);
|
assert(poroData.size() == numDof);
|
||||||
|
|
||||||
@ -455,9 +442,10 @@ private:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
OPM_THROW(std::logic_error,
|
OPM_THROW(std::logic_error,
|
||||||
"Can't read the porosity from the deck. "
|
"Can't read the porosity from the eclipse state. "
|
||||||
"(The PORO keyword is missing)");
|
"(The PORO keyword is missing)");
|
||||||
|
|
||||||
|
auto deck = this->simulator().gridManager().deck();
|
||||||
Opm::DeckKeywordConstPtr swofKeyword = deck->getKeyword("SWOF");
|
Opm::DeckKeywordConstPtr swofKeyword = deck->getKeyword("SWOF");
|
||||||
Opm::DeckKeywordConstPtr sgofKeyword = deck->getKeyword("SGOF");
|
Opm::DeckKeywordConstPtr sgofKeyword = deck->getKeyword("SGOF");
|
||||||
|
|
||||||
@ -503,9 +491,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the index of the table to be used
|
// set the index of the table to be used
|
||||||
if (deck->hasKeyword("SATNUM")) {
|
if (eclipseState->hasIntGridProperty("SATNUM")) {
|
||||||
const std::vector<int> &satnumData =
|
const std::vector<int> &satnumData = eclipseState->getIntGridProperty("SATNUM")->getData();
|
||||||
deck->getKeyword("SATNUM")->getRecord(0)->getItem(0)->getIntData();
|
|
||||||
assert(satnumData.size() == numDof);
|
assert(satnumData.size() == numDof);
|
||||||
|
|
||||||
materialParamTableIdx_.resize(numDof);
|
materialParamTableIdx_.resize(numDof);
|
||||||
@ -523,8 +510,10 @@ private:
|
|||||||
materialParamTableIdx_.clear();
|
materialParamTableIdx_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initFluidSystem_(Opm::DeckConstPtr deck)
|
void initFluidSystem_()
|
||||||
{
|
{
|
||||||
|
const auto deck = this->simulator().gridManager().deck();
|
||||||
|
|
||||||
FluidSystem::initBegin();
|
FluidSystem::initBegin();
|
||||||
|
|
||||||
// so far, we require the presence of the PVTO, PVTW and PVDG
|
// so far, we require the presence of the PVTO, PVTW and PVDG
|
||||||
@ -549,9 +538,10 @@ private:
|
|||||||
FluidSystem::initEnd();
|
FluidSystem::initEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void readInitialCondition_(Opm::DeckConstPtr deck)
|
void readInitialCondition_()
|
||||||
{
|
{
|
||||||
size_t numDof = this->model().numDof();
|
size_t numDof = this->model().numDof();
|
||||||
|
const auto deck = this->simulator().gridManager().deck();
|
||||||
|
|
||||||
initialFluidStates_.resize(numDof);
|
initialFluidStates_.resize(numDof);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user