Updated with changes from opm-core master
This commit is contained in:
parent
68b5c38f3a
commit
e4df4dd48d
@ -33,7 +33,7 @@ struct MultiWriter : public OutputWriter {
|
||||
}
|
||||
|
||||
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
const SimulatorState& reservoirState,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const WellState& wellState,
|
||||
bool isSubstep) {
|
||||
for (it_t it = writers_->begin (); it != writers_->end(); ++it) {
|
||||
|
@ -30,7 +30,7 @@ namespace Opm {
|
||||
// forward declaration
|
||||
class EclipseState;
|
||||
namespace parameter { class ParameterGroup; }
|
||||
class SimulatorState;
|
||||
class SimulationDataContainer;
|
||||
class WellState;
|
||||
struct PhaseUsage;
|
||||
|
||||
@ -87,7 +87,7 @@ public:
|
||||
* i.e. timer.currentStepNum () > 0.
|
||||
*/
|
||||
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
const SimulatorState& reservoirState,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const WellState& wellState,
|
||||
bool isSubstep) = 0;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseMode.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -43,9 +43,9 @@ namespace Opm
|
||||
public:
|
||||
CornerPointChopper(const std::string& file)
|
||||
{
|
||||
Opm::ParseMode parseMode;
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
deck_ = parser->parseFile(file , parseMode);
|
||||
deck_ = parser->parseFile(file , parseContext);
|
||||
|
||||
metricUnits_.reset(Opm::UnitSystem::newMETRIC());
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
#define ECLIPSEREADER_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
///
|
||||
@ -23,10 +25,12 @@ namespace Opm
|
||||
/// An instance of a WellState object, with correct size for each of the 5 contained std::vector<double> objects
|
||||
///
|
||||
|
||||
class SimulationDataContainer;
|
||||
|
||||
void init_from_restart_file(EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
const PhaseUsage& pu,
|
||||
SimulatorState& simulator_state,
|
||||
SimulationDataContainer& simulator_state,
|
||||
WellState& wellstate);
|
||||
|
||||
|
||||
|
@ -21,8 +21,6 @@
|
||||
#define OPM_ECLIPSE_WRITE_RFT_HANDLER_HPP
|
||||
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace EclipseWriterDetails {
|
||||
class Summary;
|
||||
}
|
||||
|
||||
class SimulatorState;
|
||||
class SimulationDataContainer;
|
||||
class WellState;
|
||||
|
||||
namespace parameter { class ParameterGroup; }
|
||||
@ -101,7 +101,7 @@ public:
|
||||
* \param[in] wellState The production/injection data for all wells
|
||||
*/
|
||||
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
const SimulatorState& reservoirState,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const WellState& wellState,
|
||||
bool isSubstep);
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "EclipseReader.hpp"
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
@ -38,10 +37,10 @@
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
void restoreTemperatureData(const ecl_file_type* file,
|
||||
static void restoreTemperatureData(const ecl_file_type* file,
|
||||
EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
SimulatorState& simulator_state) {
|
||||
SimulationDataContainer& simulator_state) {
|
||||
const char* temperature = "TEMP";
|
||||
|
||||
if (ecl_file_has_kw(file , temperature)) {
|
||||
@ -69,7 +68,7 @@ namespace Opm
|
||||
void restorePressureData(const ecl_file_type* file,
|
||||
EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
SimulatorState& simulator_state) {
|
||||
SimulationDataContainer& simulator_state) {
|
||||
const char* pressure = "PRESSURE";
|
||||
|
||||
if (ecl_file_has_kw(file , pressure)) {
|
||||
@ -91,10 +90,10 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
void restoreSaturation(const ecl_file_type* file_type,
|
||||
static void restoreSaturation(const ecl_file_type* file_type,
|
||||
const PhaseUsage& phaseUsage,
|
||||
int numcells,
|
||||
SimulatorState& simulator_state) {
|
||||
SimulationDataContainer& simulator_state) {
|
||||
|
||||
float* sgas_data = NULL;
|
||||
float* swat_data = NULL;
|
||||
@ -127,19 +126,20 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
void restoreRSandRV(const ecl_file_type* file_type,
|
||||
static void restoreRSandRV(const ecl_file_type* file_type,
|
||||
SimulationConfigConstPtr sim_config,
|
||||
int numcells,
|
||||
BlackoilState* blackoil_state) {
|
||||
SimulationDataContainer& simulator_state) {
|
||||
|
||||
if (sim_config->hasDISGAS()) {
|
||||
const char* RS = "RS";
|
||||
if (ecl_file_has_kw(file_type, RS)) {
|
||||
ecl_kw_type* rs_kw = ecl_file_iget_named_kw(file_type, RS, 0);
|
||||
float* rs_data = ecl_kw_get_float_ptr(rs_kw);
|
||||
std::vector<double> rs_datavec(&rs_data[0], &rs_data[numcells]);
|
||||
blackoil_state->gasoilratio().clear();
|
||||
blackoil_state->gasoilratio().insert(blackoil_state->gasoilratio().begin(), rs_datavec.begin(), rs_datavec.end());
|
||||
auto& rs = simulator_state.getCellData( BlackoilState::GASOILRATIO );
|
||||
for (int i = 0; i < ecl_kw_get_size( rs_kw ); i++) {
|
||||
rs[i] = rs_data[i];
|
||||
}
|
||||
} else {
|
||||
throw std::runtime_error("Restart file is missing RS data!\n");
|
||||
}
|
||||
@ -150,9 +150,10 @@ namespace Opm
|
||||
if (ecl_file_has_kw(file_type, RV)) {
|
||||
ecl_kw_type* rv_kw = ecl_file_iget_named_kw(file_type, RV, 0);
|
||||
float* rv_data = ecl_kw_get_float_ptr(rv_kw);
|
||||
std::vector<double> rv_datavec(&rv_data[0], &rv_data[numcells]);
|
||||
blackoil_state->rv().clear();
|
||||
blackoil_state->rv().insert(blackoil_state->rv().begin(), rv_datavec.begin(), rv_datavec.end());
|
||||
auto& rv = simulator_state.getCellData( BlackoilState::RV );
|
||||
for (int i = 0; i < ecl_kw_get_size( rv_kw ); i++) {
|
||||
rv[i] = rv_data[i];
|
||||
}
|
||||
} else {
|
||||
throw std::runtime_error("Restart file is missing RV data!\n");
|
||||
}
|
||||
@ -160,13 +161,13 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
void restoreSOLUTION(const std::string& restart_filename,
|
||||
static void restoreSOLUTION(const std::string& restart_filename,
|
||||
int reportstep,
|
||||
bool unified,
|
||||
EclipseStateConstPtr eclipseState,
|
||||
int numcells,
|
||||
const PhaseUsage& phaseUsage,
|
||||
SimulatorState& simulator_state)
|
||||
SimulationDataContainer& simulator_state)
|
||||
{
|
||||
const char* filename = restart_filename.c_str();
|
||||
ecl_file_type* file_type = ecl_file_open(filename, 0);
|
||||
@ -178,10 +179,9 @@ namespace Opm
|
||||
restorePressureData(file_type, eclipseState, numcells, simulator_state);
|
||||
restoreTemperatureData(file_type, eclipseState, numcells, simulator_state);
|
||||
restoreSaturation(file_type, phaseUsage, numcells, simulator_state);
|
||||
BlackoilState* blackoilState = dynamic_cast<BlackoilState*>(&simulator_state);
|
||||
if (blackoilState) {
|
||||
if (simulator_state.hasCellData( BlackoilState::RV )) {
|
||||
SimulationConfigConstPtr sim_config = eclipseState->getSimulationConfig();
|
||||
restoreRSandRV(file_type, sim_config, numcells, blackoilState);
|
||||
restoreRSandRV(file_type, sim_config, numcells, simulator_state );
|
||||
}
|
||||
} else {
|
||||
std::string error_str = "Restart file " + restart_filename + " does not contain data for report step " + std::to_string(reportstep) + "!\n";
|
||||
@ -195,7 +195,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
void restoreOPM_XWELKeyword(const std::string& restart_filename, int reportstep, bool unified, WellState& wellstate)
|
||||
static void restoreOPM_XWELKeyword(const std::string& restart_filename, int reportstep, bool unified, WellState& wellstate)
|
||||
{
|
||||
const char * keyword = "OPM_XWEL";
|
||||
const char* filename = restart_filename.c_str();
|
||||
@ -229,7 +229,7 @@ namespace Opm
|
||||
void init_from_restart_file(EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
const PhaseUsage& phase_usage,
|
||||
SimulatorState& simulator_state,
|
||||
SimulationDataContainer& simulator_state,
|
||||
WellState& wellstate) {
|
||||
|
||||
InitConfigConstPtr initConfig = eclipse_state->getInitConfig();
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/output/eclipse/EclipseWriteRFTHandler.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
|
@ -23,13 +23,16 @@
|
||||
|
||||
#include "EclipseWriter.hpp"
|
||||
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/cpgpreprocess/preprocess.h>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/output/eclipse/EclipseWriteRFTHandler.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/parameters/Parameter.hpp>
|
||||
@ -1184,16 +1187,19 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMX")) {
|
||||
auto data = eclipseState_->getDoubleGridProperty("PERMX")->getData();
|
||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||
fortio.writeKeyword("PERMX", data);
|
||||
}
|
||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMY")) {
|
||||
auto data = eclipseState_->getDoubleGridProperty("PERMY")->getData();
|
||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||
fortio.writeKeyword("PERMY", data);
|
||||
}
|
||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMZ")) {
|
||||
auto data = eclipseState_->getDoubleGridProperty("PERMZ")->getData();
|
||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||
fortio.writeKeyword("PERMZ", data);
|
||||
}
|
||||
}
|
||||
@ -1221,7 +1227,7 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
||||
|
||||
// implementation of the writeTimeStep method
|
||||
void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
const SimulatorState& reservoirState,
|
||||
const SimulationDataContainer& reservoirState,
|
||||
const WellState& wellState,
|
||||
bool isSubstep)
|
||||
{
|
||||
@ -1342,14 +1348,15 @@ void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
||||
}
|
||||
|
||||
|
||||
const BlackoilState* blackoilState = dynamic_cast<const BlackoilState*>(&reservoirState);
|
||||
if (blackoilState) {
|
||||
// Write RS - Dissolved GOR
|
||||
const std::vector<double>& rs = blackoilState->gasoilratio();
|
||||
if (reservoirState.hasCellData( BlackoilState::GASOILRATIO )) {
|
||||
const std::vector<double>& rs = reservoirState.getCellData( BlackoilState::GASOILRATIO );
|
||||
sol.add(EclipseWriterDetails::Keyword<float>("RS", rs));
|
||||
}
|
||||
|
||||
// Write RV - Volatilized oil/gas ratio
|
||||
const std::vector<double>& rv = blackoilState->rv();
|
||||
if (reservoirState.hasCellData( BlackoilState::RV )) {
|
||||
const std::vector<double>& rv = reservoirState.getCellData( BlackoilState::RV );
|
||||
sol.add(EclipseWriterDetails::Keyword<float>("RV", rv));
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
void verifyRFTFile(const std::string& rft_filename) {
|
||||
void verifyRFTFile(const std::string& rft_filename) {
|
||||
|
||||
ecl_rft_file_type * new_rft_file = ecl_rft_file_alloc(rft_filename.c_str());
|
||||
std::shared_ptr<ecl_rft_file_type> rft_file;
|
||||
@ -85,50 +85,48 @@ namespace {
|
||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_depth(ecl_rft_cell1), (0.250 + (0.250/2)));
|
||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_depth(ecl_rft_cell2), (2*0.250 + (0.250/2)));
|
||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_depth(ecl_rft_cell3), (3*0.250 + (0.250/2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Opm::DeckConstPtr createDeck(const std::string& input_str) {
|
||||
Opm::DeckConstPtr createDeck(const std::string& input_str) {
|
||||
Opm::ParserPtr parser = std::make_shared<Opm::Parser>();
|
||||
Opm::DeckConstPtr deck = parser->parseString(input_str , Opm::ParseContext());
|
||||
return deck;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<Opm::WellState> createWellState(std::shared_ptr<Opm::BlackoilState> blackoilState)
|
||||
{
|
||||
std::shared_ptr<Opm::WellState> createWellState(std::shared_ptr<Opm::BlackoilState> blackoilState)
|
||||
{
|
||||
std::shared_ptr<Opm::WellState> wellState = std::make_shared<Opm::WellState>();
|
||||
wellState->init(0, *blackoilState);
|
||||
return wellState;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackoilState(int timeStepIdx, std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr)
|
||||
{
|
||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackoilState(int timeStepIdx, std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr)
|
||||
{
|
||||
const UnstructuredGrid &ug_grid = *ourFineGridManagerPtr->c_grid();
|
||||
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState = std::make_shared<Opm::BlackoilState>();
|
||||
blackoilState->init(ourFinerUnstructuredGrid, 3);
|
||||
|
||||
size_t numCells = ourFinerUnstructuredGrid.number_of_cells;
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState = std::make_shared<Opm::BlackoilState>(Opm::UgGridHelpers::numCells( ug_grid ) , Opm::UgGridHelpers::numFaces( ug_grid ), 3);
|
||||
size_t numCells = Opm::UgGridHelpers::numCells( ug_grid );
|
||||
|
||||
auto &pressure = blackoilState->pressure();
|
||||
for (size_t cellIdx = 0; cellIdx < numCells; ++cellIdx) {
|
||||
pressure[cellIdx] = timeStepIdx*1e5 + 1e4 + cellIdx;
|
||||
}
|
||||
return blackoilState;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<Opm::EclipseWriter> createEclipseWriter(std::shared_ptr<const Opm::Deck> deck,
|
||||
std::shared_ptr<Opm::EclipseWriter> createEclipseWriter(std::shared_ptr<const Opm::Deck> deck,
|
||||
std::shared_ptr<Opm::EclipseState> eclipseState,
|
||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr,
|
||||
const int * compressedToCartesianCellIdx)
|
||||
{
|
||||
{
|
||||
Opm::parameter::ParameterGroup params;
|
||||
params.insertParameter("deck_filename", "testcase.data");
|
||||
|
||||
@ -143,12 +141,12 @@ namespace {
|
||||
compressedToCartesianCellIdx);
|
||||
|
||||
return eclipseWriter;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_EclipseWriterRFTHandler)
|
||||
{
|
||||
{
|
||||
const std::string& deckString =
|
||||
"RUNSPEC\n"
|
||||
"OIL\n"
|
||||
@ -228,7 +226,7 @@ BOOST_AUTO_TEST_CASE(test_EclipseWriterRFTHandler)
|
||||
std::string rft_filename = cwd + "/TESTCASE.RFT";
|
||||
verifyRFTFile(rft_filename);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
@ -109,8 +110,7 @@ void createBlackoilState(int timeStepIdx)
|
||||
{
|
||||
// allocate a new BlackoilState object
|
||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||
blackoilState.reset(new Opm::BlackoilState);
|
||||
blackoilState->init(ourFinerUnstructuredGrid, 3);
|
||||
blackoilState.reset(new Opm::BlackoilState( Opm::UgGridHelpers::numCells( ourFinerUnstructuredGrid ) , Opm::UgGridHelpers::numFaces( ourFinerUnstructuredGrid ), 3));
|
||||
|
||||
size_t numCells = ourFinerUnstructuredGrid.number_of_cells;
|
||||
size_t numFaces = ourFinerUnstructuredGrid.number_of_faces;
|
||||
@ -367,7 +367,7 @@ void checkSummaryFile(int /*timeStepIdx*/)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseWriterIntegration)
|
||||
{
|
||||
{
|
||||
const char *deckString =
|
||||
"RUNSPEC\n"
|
||||
"INIT\n"
|
||||
@ -418,4 +418,4 @@ BOOST_AUTO_TEST_CASE(EclipseWriterIntegration)
|
||||
checkRestartFile(simTimer->currentStepNum());
|
||||
checkSummaryFile(simTimer->currentStepNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <opm/output/eclipse/EclipseReader.hpp>
|
||||
#include <opm/output/eclipse/EclipseIOUtil.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
@ -185,11 +186,12 @@ std::string input =
|
||||
"10 /"
|
||||
"/\n";
|
||||
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr eclGrid) {
|
||||
|
||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr(new Opm::GridManager(eclGrid));
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState);
|
||||
blackoilState->init(*ourFineGridManagerPtr->c_grid(), 3);
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr eclGrid , const Opm::PhaseUsage& phaseUsage) {
|
||||
|
||||
std::shared_ptr<Opm::GridManager> grid(new Opm::GridManager(eclGrid));
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState( Opm::UgGridHelpers::numCells(ug_grid) , Opm::UgGridHelpers::numFaces(ug_grid) , phaseUsage.num_phases) );
|
||||
|
||||
return blackoilState;
|
||||
}
|
||||
@ -247,7 +249,7 @@ void setValuesInWellState(std::shared_ptr<Opm::WellState> wellState){
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||
{
|
||||
{
|
||||
std::string eclipse_data_filename = "TestWellState.DATA";
|
||||
test_work_area_type * test_area = test_work_area_alloc("EclipseReadWriteWellStateData");
|
||||
|
||||
@ -266,7 +268,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||
Opm::GridManager gridManager(deck);
|
||||
Opm::WellsManager wellsManager(eclipseState, 1, *gridManager.c_grid(), NULL);
|
||||
const Wells* wells = wellsManager.c_wells();
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState = createBlackOilState(eclipseState->getEclipseGrid());
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState = createBlackOilState(eclipseState->getEclipseGrid(), phaseUsage);
|
||||
wellState->init(wells, *blackoilState);
|
||||
|
||||
//Set test data for pressure
|
||||
@ -313,7 +315,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||
wellStateRestored->init(wells, *blackoilState);
|
||||
|
||||
//Read and verify OPM XWEL data, and solution data: pressure, temperature, saturation data, rs and rv
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilStateRestored = createBlackOilState(eclipseState->getEclipseGrid());
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilStateRestored = createBlackOilState(eclipseState->getEclipseGrid(), phaseUsage);
|
||||
Opm::init_from_restart_file(eclipseState, Opm::UgGridHelpers::numCells(*gridManager.c_grid()), phaseUsage, *blackoilStateRestored, *wellStateRestored);
|
||||
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->bhp().begin(), wellState->bhp().end(), wellStateRestored->bhp().begin(), wellStateRestored->bhp().end());
|
||||
@ -331,7 +333,7 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||
Opm::EclipseIOUtil::extractFromStripedData(blackoilStateRestored->saturation(), sgas_restored, phaseUsage.phase_pos[Opm::BlackoilPhases::Vapour], phaseUsage.num_phases);
|
||||
Opm::EclipseIOUtil::extractFromStripedData(blackoilState->saturation(), sgas, phaseUsage.phase_pos[Opm::BlackoilPhases::Vapour], phaseUsage.num_phases);
|
||||
|
||||
for (size_t cellindex = 0; cellindex < 1000; ++cellindex) {
|
||||
for (size_t cellindex = 0; cellindex < 10; ++cellindex) {
|
||||
BOOST_CHECK_CLOSE(blackoilState->pressure()[cellindex], blackoilStateRestored->pressure()[cellindex], 0.00001);
|
||||
BOOST_CHECK_CLOSE(blackoilState->temperature()[cellindex], blackoilStateRestored->temperature()[cellindex], 0.00001);
|
||||
BOOST_CHECK_CLOSE(swat[cellindex], swat_restored[cellindex], 0.00001);
|
||||
@ -339,10 +341,10 @@ BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||
}
|
||||
|
||||
|
||||
for (size_t cellindex = 0; cellindex < 1000; ++cellindex) {
|
||||
for (size_t cellindex = 0; cellindex < 10; ++cellindex) {
|
||||
BOOST_CHECK_CLOSE(blackoilState->gasoilratio()[cellindex], blackoilStateRestored->gasoilratio()[cellindex], 0.0000001);
|
||||
BOOST_CHECK_CLOSE(blackoilState->rv()[cellindex], blackoilStateRestored->rv()[cellindex], 0.0000001);
|
||||
}
|
||||
|
||||
test_work_area_free(test_area);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
@ -127,9 +128,9 @@ void verifyWellState(const std::string& rst_filename,
|
||||
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr eclGrid) {
|
||||
|
||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr(new Opm::GridManager(eclGrid));
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState);
|
||||
blackoilState->init(*ourFineGridManagerPtr->c_grid(), 3);
|
||||
std::shared_ptr<Opm::GridManager> grid(new Opm::GridManager(eclGrid));
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState( Opm::UgGridHelpers::numCells(ug_grid) , Opm::UgGridHelpers::numFaces(ug_grid) , 3 ));
|
||||
|
||||
return blackoilState;
|
||||
}
|
||||
@ -162,7 +163,7 @@ Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
|
||||
{
|
||||
{
|
||||
std::string eclipse_data_filename = "testBlackoilState3.DATA";
|
||||
std::string eclipse_restart_filename = "TESTBLACKOILSTATE3.X0004";
|
||||
|
||||
@ -194,4 +195,4 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
|
||||
verifyWellState(eclipse_restart_filename, eclipseState->getEclipseGrid(), eclipseState->getSchedule());
|
||||
|
||||
test_work_area_free(test_area);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user