Make use of EclipseState for EQLNUM and SWATINIT.

This commit is contained in:
osae 2014-06-26 14:46:57 +02:00
parent 7c667a2bd7
commit c1732b0b32
4 changed files with 16 additions and 12 deletions

View File

@ -95,7 +95,7 @@ try
// Initialisation. // Initialisation.
BlackoilState state; BlackoilState state;
initStateEquil(grid, props, deck, grav, state); initStateEquil(grid, props, deck, eclipseState, grav, state);
// Output. // Output.
const std::string output_dir = param.getDefault<std::string>("output_dir", "output"); const std::string output_dir = param.getDefault<std::string>("output_dir", "output");

View File

@ -28,6 +28,7 @@
#include <opm/core/utility/Units.hpp> #include <opm/core/utility/Units.hpp>
#include <opm/parser/eclipse/Utility/EquilWrapper.hpp> #include <opm/parser/eclipse/Utility/EquilWrapper.hpp>
#include <opm/parser/eclipse/Utility/SingleRecordTable.hpp> #include <opm/parser/eclipse/Utility/SingleRecordTable.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <array> #include <array>
#include <cassert> #include <cassert>
@ -62,6 +63,7 @@ namespace Opm
void initStateEquil(const UnstructuredGrid& grid, void initStateEquil(const UnstructuredGrid& grid,
const BlackoilPropertiesInterface& props, const BlackoilPropertiesInterface& props,
const Opm::DeckConstPtr deck, const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const double gravity, const double gravity,
BlackoilState& state); BlackoilState& state);
@ -230,13 +232,14 @@ namespace Opm
inline inline
std::vector<int> std::vector<int>
equilnum(const Opm::DeckConstPtr deck, equilnum(const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const UnstructuredGrid& G ) const UnstructuredGrid& G )
{ {
std::vector<int> eqlnum; std::vector<int> eqlnum;
if (deck->hasKeyword("EQLNUM")) { if (deck->hasKeyword("EQLNUM")) {
eqlnum.resize(G.number_of_cells); eqlnum.resize(G.number_of_cells);
const std::vector<int>& e = const std::vector<int>& e =
deck->getKeyword("EQLNUM")->getIntData(); eclipseState->getIntGridProperty("EQLNUM")->getData();
const int* gc = G.global_cell; const int* gc = G.global_cell;
for (int cell = 0; cell < G.number_of_cells; ++cell) { for (int cell = 0; cell < G.number_of_cells; ++cell) {
const int deck_pos = (gc == NULL) ? cell : gc[cell]; const int deck_pos = (gc == NULL) ? cell : gc[cell];
@ -257,6 +260,7 @@ namespace Opm
public: public:
InitialStateComputer(BlackoilPropertiesInterface& props, InitialStateComputer(BlackoilPropertiesInterface& props,
const Opm::DeckConstPtr deck, const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const UnstructuredGrid& G , const UnstructuredGrid& G ,
const double grav = unit::gravity) const double grav = unit::gravity)
: pp_(props.numPhases(), : pp_(props.numPhases(),
@ -270,7 +274,7 @@ namespace Opm
const std::vector<EquilRecord> rec = getEquil(deck); const std::vector<EquilRecord> rec = getEquil(deck);
// Create (inverse) region mapping. // Create (inverse) region mapping.
const RegionMapping<> eqlmap(equilnum(deck, G)); const RegionMapping<> eqlmap(equilnum(deck, eclipseState, G));
// Create Rs functions. // Create Rs functions.
rs_func_.reserve(rec.size()); rs_func_.reserve(rec.size());
@ -338,14 +342,13 @@ namespace Opm
// Check for presence of kw SWATINIT // Check for presence of kw SWATINIT
if (deck->hasKeyword("SWATINIT")) { if (deck->hasKeyword("SWATINIT")) {
const std::vector<double>& swat_init = deck->getKeyword("SWATINIT")->getSIDoubleData(); const std::vector<double>& swat_init = eclipseState->getDoubleGridProperty("SWATINIT")->getData();
swat_init_.resize(G.number_of_cells); swat_init_.resize(G.number_of_cells);
const int* gc = G.global_cell; const int* gc = G.global_cell;
for (int c = 0; c < G.number_of_cells; ++c) { for (int c = 0; c < G.number_of_cells; ++c) {
const int deck_pos = (gc == NULL) ? c : gc[c]; const int deck_pos = (gc == NULL) ? c : gc[c];
swat_init_[c] = swat_init[deck_pos]; swat_init_[c] = swat_init[deck_pos];
} }
} }
// Compute pressures, saturations, rs and rv factors. // Compute pressures, saturations, rs and rv factors.

View File

@ -755,11 +755,12 @@ namespace Opm
void initStateEquil(const UnstructuredGrid& grid, void initStateEquil(const UnstructuredGrid& grid,
BlackoilPropertiesInterface& props, BlackoilPropertiesInterface& props,
const Opm::DeckConstPtr deck, const Opm::DeckConstPtr deck,
const Opm::EclipseStateConstPtr eclipseState,
const double gravity, const double gravity,
BlackoilState& state) BlackoilState& state)
{ {
typedef Equil::DeckDependent::InitialStateComputer ISC; typedef Equil::DeckDependent::InitialStateComputer ISC;
ISC isc(props, deck, grid, gravity); ISC isc(props, deck, eclipseState, grid, gravity);
const auto pu = props.phaseUsage(); const auto pu = props.phaseUsage();
const int ref_phase = pu.phase_used[BlackoilPhases::Liquid] const int ref_phase = pu.phase_used[BlackoilPhases::Liquid]
? pu.phase_pos[BlackoilPhases::Liquid] ? pu.phase_pos[BlackoilPhases::Liquid]

View File

@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE (DeckAllDead)
Opm::DeckConstPtr deck = parser->parseFile("deadfluids.DATA"); Opm::DeckConstPtr deck = parser->parseFile("deadfluids.DATA");
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, *grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, *grid, 10.0); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, *grid, 10.0);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid->number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid->number_of_cells);
@ -419,7 +419,7 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillary)
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, grid, 10.0); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 10.0);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
@ -459,7 +459,7 @@ BOOST_AUTO_TEST_CASE (DeckWithCapillaryOverlap)
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, grid, 9.80665); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
@ -521,7 +521,7 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveOil)
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, grid, 9.80665); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
@ -600,7 +600,7 @@ BOOST_AUTO_TEST_CASE (DeckWithLiveGas)
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, grid, 9.80665); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);
@ -682,7 +682,7 @@ BOOST_AUTO_TEST_CASE (DeckWithRSVDAndRVVD)
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false); Opm::BlackoilPropertiesFromDeck props(deck, eclipseState, grid, false);
Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, grid, 9.80665); Opm::Equil::DeckDependent::InitialStateComputer comp(props, deck, eclipseState, grid, 9.80665);
const auto& pressures = comp.press(); const auto& pressures = comp.press();
BOOST_REQUIRE(pressures.size() == 3); BOOST_REQUIRE(pressures.size() == 3);
BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells); BOOST_REQUIRE(int(pressures[0].size()) == grid.number_of_cells);