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,
|
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||||
const SimulatorState& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const WellState& wellState,
|
const WellState& wellState,
|
||||||
bool isSubstep) {
|
bool isSubstep) {
|
||||||
for (it_t it = writers_->begin (); it != writers_->end(); ++it) {
|
for (it_t it = writers_->begin (); it != writers_->end(); ++it) {
|
||||||
|
@ -30,7 +30,7 @@ namespace Opm {
|
|||||||
// forward declaration
|
// forward declaration
|
||||||
class EclipseState;
|
class EclipseState;
|
||||||
namespace parameter { class ParameterGroup; }
|
namespace parameter { class ParameterGroup; }
|
||||||
class SimulatorState;
|
class SimulationDataContainer;
|
||||||
class WellState;
|
class WellState;
|
||||||
struct PhaseUsage;
|
struct PhaseUsage;
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ public:
|
|||||||
* i.e. timer.currentStepNum () > 0.
|
* i.e. timer.currentStepNum () > 0.
|
||||||
*/
|
*/
|
||||||
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||||
const SimulatorState& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const WellState& wellState,
|
const WellState& wellState,
|
||||||
bool isSubstep) = 0;
|
bool isSubstep) = 0;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/parser/eclipse/Parser/Parser.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/Units/UnitSystem.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||||
@ -43,9 +43,9 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
CornerPointChopper(const std::string& file)
|
CornerPointChopper(const std::string& file)
|
||||||
{
|
{
|
||||||
Opm::ParseMode parseMode;
|
Opm::ParseContext parseContext;
|
||||||
Opm::ParserPtr parser(new Opm::Parser());
|
Opm::ParserPtr parser(new Opm::Parser());
|
||||||
deck_ = parser->parseFile(file , parseMode);
|
deck_ = parser->parseFile(file , parseContext);
|
||||||
|
|
||||||
metricUnits_.reset(Opm::UnitSystem::newMETRIC());
|
metricUnits_.reset(Opm::UnitSystem::newMETRIC());
|
||||||
|
|
||||||
|
@ -2,11 +2,13 @@
|
|||||||
#define ECLIPSEREADER_HPP
|
#define ECLIPSEREADER_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
#include <opm/core/simulator/SimulatorState.hpp>
|
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
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
|
/// 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,
|
void init_from_restart_file(EclipseStateConstPtr eclipse_state,
|
||||||
int numcells,
|
int numcells,
|
||||||
const PhaseUsage& pu,
|
const PhaseUsage& pu,
|
||||||
SimulatorState& simulator_state,
|
SimulationDataContainer& simulator_state,
|
||||||
WellState& wellstate);
|
WellState& wellstate);
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#define OPM_ECLIPSE_WRITE_RFT_HANDLER_HPP
|
#define OPM_ECLIPSE_WRITE_RFT_HANDLER_HPP
|
||||||
|
|
||||||
#include <opm/core/simulator/SimulatorTimer.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>
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace EclipseWriterDetails {
|
|||||||
class Summary;
|
class Summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SimulatorState;
|
class SimulationDataContainer;
|
||||||
class WellState;
|
class WellState;
|
||||||
|
|
||||||
namespace parameter { class ParameterGroup; }
|
namespace parameter { class ParameterGroup; }
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
* \param[in] wellState The production/injection data for all wells
|
* \param[in] wellState The production/injection data for all wells
|
||||||
*/
|
*/
|
||||||
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
virtual void writeTimeStep(const SimulatorTimerInterface& timer,
|
||||||
const SimulatorState& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const WellState& wellState,
|
const WellState& wellState,
|
||||||
bool isSubstep);
|
bool isSubstep);
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "EclipseReader.hpp"
|
#include "EclipseReader.hpp"
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
#include <opm/core/simulator/SimulatorState.hpp>
|
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
#include <opm/core/grid/GridHelpers.hpp>
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
@ -38,10 +37,10 @@
|
|||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
void restoreTemperatureData(const ecl_file_type* file,
|
static void restoreTemperatureData(const ecl_file_type* file,
|
||||||
EclipseStateConstPtr eclipse_state,
|
EclipseStateConstPtr eclipse_state,
|
||||||
int numcells,
|
int numcells,
|
||||||
SimulatorState& simulator_state) {
|
SimulationDataContainer& simulator_state) {
|
||||||
const char* temperature = "TEMP";
|
const char* temperature = "TEMP";
|
||||||
|
|
||||||
if (ecl_file_has_kw(file , temperature)) {
|
if (ecl_file_has_kw(file , temperature)) {
|
||||||
@ -69,7 +68,7 @@ namespace Opm
|
|||||||
void restorePressureData(const ecl_file_type* file,
|
void restorePressureData(const ecl_file_type* file,
|
||||||
EclipseStateConstPtr eclipse_state,
|
EclipseStateConstPtr eclipse_state,
|
||||||
int numcells,
|
int numcells,
|
||||||
SimulatorState& simulator_state) {
|
SimulationDataContainer& simulator_state) {
|
||||||
const char* pressure = "PRESSURE";
|
const char* pressure = "PRESSURE";
|
||||||
|
|
||||||
if (ecl_file_has_kw(file , 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,
|
const PhaseUsage& phaseUsage,
|
||||||
int numcells,
|
int numcells,
|
||||||
SimulatorState& simulator_state) {
|
SimulationDataContainer& simulator_state) {
|
||||||
|
|
||||||
float* sgas_data = NULL;
|
float* sgas_data = NULL;
|
||||||
float* swat_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,
|
SimulationConfigConstPtr sim_config,
|
||||||
int numcells,
|
int numcells,
|
||||||
BlackoilState* blackoil_state) {
|
SimulationDataContainer& simulator_state) {
|
||||||
|
|
||||||
if (sim_config->hasDISGAS()) {
|
if (sim_config->hasDISGAS()) {
|
||||||
const char* RS = "RS";
|
const char* RS = "RS";
|
||||||
if (ecl_file_has_kw(file_type, RS)) {
|
if (ecl_file_has_kw(file_type, RS)) {
|
||||||
ecl_kw_type* rs_kw = ecl_file_iget_named_kw(file_type, RS, 0);
|
ecl_kw_type* rs_kw = ecl_file_iget_named_kw(file_type, RS, 0);
|
||||||
float* rs_data = ecl_kw_get_float_ptr(rs_kw);
|
float* rs_data = ecl_kw_get_float_ptr(rs_kw);
|
||||||
std::vector<double> rs_datavec(&rs_data[0], &rs_data[numcells]);
|
auto& rs = simulator_state.getCellData( BlackoilState::GASOILRATIO );
|
||||||
blackoil_state->gasoilratio().clear();
|
for (int i = 0; i < ecl_kw_get_size( rs_kw ); i++) {
|
||||||
blackoil_state->gasoilratio().insert(blackoil_state->gasoilratio().begin(), rs_datavec.begin(), rs_datavec.end());
|
rs[i] = rs_data[i];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Restart file is missing RS data!\n");
|
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)) {
|
if (ecl_file_has_kw(file_type, RV)) {
|
||||||
ecl_kw_type* rv_kw = ecl_file_iget_named_kw(file_type, RV, 0);
|
ecl_kw_type* rv_kw = ecl_file_iget_named_kw(file_type, RV, 0);
|
||||||
float* rv_data = ecl_kw_get_float_ptr(rv_kw);
|
float* rv_data = ecl_kw_get_float_ptr(rv_kw);
|
||||||
std::vector<double> rv_datavec(&rv_data[0], &rv_data[numcells]);
|
auto& rv = simulator_state.getCellData( BlackoilState::RV );
|
||||||
blackoil_state->rv().clear();
|
for (int i = 0; i < ecl_kw_get_size( rv_kw ); i++) {
|
||||||
blackoil_state->rv().insert(blackoil_state->rv().begin(), rv_datavec.begin(), rv_datavec.end());
|
rv[i] = rv_data[i];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("Restart file is missing RV data!\n");
|
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,
|
int reportstep,
|
||||||
bool unified,
|
bool unified,
|
||||||
EclipseStateConstPtr eclipseState,
|
EclipseStateConstPtr eclipseState,
|
||||||
int numcells,
|
int numcells,
|
||||||
const PhaseUsage& phaseUsage,
|
const PhaseUsage& phaseUsage,
|
||||||
SimulatorState& simulator_state)
|
SimulationDataContainer& simulator_state)
|
||||||
{
|
{
|
||||||
const char* filename = restart_filename.c_str();
|
const char* filename = restart_filename.c_str();
|
||||||
ecl_file_type* file_type = ecl_file_open(filename, 0);
|
ecl_file_type* file_type = ecl_file_open(filename, 0);
|
||||||
@ -178,11 +179,10 @@ namespace Opm
|
|||||||
restorePressureData(file_type, eclipseState, numcells, simulator_state);
|
restorePressureData(file_type, eclipseState, numcells, simulator_state);
|
||||||
restoreTemperatureData(file_type, eclipseState, numcells, simulator_state);
|
restoreTemperatureData(file_type, eclipseState, numcells, simulator_state);
|
||||||
restoreSaturation(file_type, phaseUsage, numcells, simulator_state);
|
restoreSaturation(file_type, phaseUsage, numcells, simulator_state);
|
||||||
BlackoilState* blackoilState = dynamic_cast<BlackoilState*>(&simulator_state);
|
if (simulator_state.hasCellData( BlackoilState::RV )) {
|
||||||
if (blackoilState) {
|
|
||||||
SimulationConfigConstPtr sim_config = eclipseState->getSimulationConfig();
|
SimulationConfigConstPtr sim_config = eclipseState->getSimulationConfig();
|
||||||
restoreRSandRV(file_type, sim_config, numcells, blackoilState);
|
restoreRSandRV(file_type, sim_config, numcells, simulator_state );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::string error_str = "Restart file " + restart_filename + " does not contain data for report step " + std::to_string(reportstep) + "!\n";
|
std::string error_str = "Restart file " + restart_filename + " does not contain data for report step " + std::to_string(reportstep) + "!\n";
|
||||||
throw std::runtime_error(error_str);
|
throw std::runtime_error(error_str);
|
||||||
@ -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 * keyword = "OPM_XWEL";
|
||||||
const char* filename = restart_filename.c_str();
|
const char* filename = restart_filename.c_str();
|
||||||
@ -229,7 +229,7 @@ namespace Opm
|
|||||||
void init_from_restart_file(EclipseStateConstPtr eclipse_state,
|
void init_from_restart_file(EclipseStateConstPtr eclipse_state,
|
||||||
int numcells,
|
int numcells,
|
||||||
const PhaseUsage& phase_usage,
|
const PhaseUsage& phase_usage,
|
||||||
SimulatorState& simulator_state,
|
SimulationDataContainer& simulator_state,
|
||||||
WellState& wellstate) {
|
WellState& wellstate) {
|
||||||
|
|
||||||
InitConfigConstPtr initConfig = eclipse_state->getInitConfig();
|
InitConfigConstPtr initConfig = eclipse_state->getInitConfig();
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <opm/output/eclipse/EclipseWriteRFTHandler.hpp>
|
#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/simulator/SimulatorTimer.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/utility/Units.hpp>
|
#include <opm/core/utility/Units.hpp>
|
||||||
|
@ -23,13 +23,16 @@
|
|||||||
|
|
||||||
#include "EclipseWriter.hpp"
|
#include "EclipseWriter.hpp"
|
||||||
|
|
||||||
|
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||||
|
|
||||||
|
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/grid/cpgpreprocess/preprocess.h>
|
#include <opm/core/grid/cpgpreprocess/preprocess.h>
|
||||||
#include <opm/core/simulator/SimulatorState.hpp>
|
|
||||||
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
#include <opm/core/simulator/SimulatorTimerInterface.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/output/eclipse/EclipseWriteRFTHandler.hpp>
|
#include <opm/output/eclipse/EclipseWriteRFTHandler.hpp>
|
||||||
#include <opm/common/ErrorMacros.hpp>
|
#include <opm/common/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/parameters/Parameter.hpp>
|
#include <opm/core/utility/parameters/Parameter.hpp>
|
||||||
@ -1184,16 +1187,19 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
|||||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMX")) {
|
if (eclipseState_->hasDeckDoubleGridProperty("PERMX")) {
|
||||||
auto data = eclipseState_->getDoubleGridProperty("PERMX")->getData();
|
auto data = eclipseState_->getDoubleGridProperty("PERMX")->getData();
|
||||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||||
|
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||||
fortio.writeKeyword("PERMX", data);
|
fortio.writeKeyword("PERMX", data);
|
||||||
}
|
}
|
||||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMY")) {
|
if (eclipseState_->hasDeckDoubleGridProperty("PERMY")) {
|
||||||
auto data = eclipseState_->getDoubleGridProperty("PERMY")->getData();
|
auto data = eclipseState_->getDoubleGridProperty("PERMY")->getData();
|
||||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||||
|
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||||
fortio.writeKeyword("PERMY", data);
|
fortio.writeKeyword("PERMY", data);
|
||||||
}
|
}
|
||||||
if (eclipseState_->hasDeckDoubleGridProperty("PERMZ")) {
|
if (eclipseState_->hasDeckDoubleGridProperty("PERMZ")) {
|
||||||
auto data = eclipseState_->getDoubleGridProperty("PERMZ")->getData();
|
auto data = eclipseState_->getDoubleGridProperty("PERMZ")->getData();
|
||||||
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
EclipseWriterDetails::convertFromSiTo(data, Opm::prefix::milli * Opm::unit::darcy);
|
||||||
|
EclipseWriterDetails::restrictAndReorderToActiveCells(data, gridToEclipseIdx_.size(), gridToEclipseIdx_.data());
|
||||||
fortio.writeKeyword("PERMZ", data);
|
fortio.writeKeyword("PERMZ", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1221,7 +1227,7 @@ void EclipseWriter::writeInit(const SimulatorTimerInterface &timer)
|
|||||||
|
|
||||||
// implementation of the writeTimeStep method
|
// implementation of the writeTimeStep method
|
||||||
void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
||||||
const SimulatorState& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const WellState& wellState,
|
const WellState& wellState,
|
||||||
bool isSubstep)
|
bool isSubstep)
|
||||||
{
|
{
|
||||||
@ -1342,14 +1348,15 @@ void EclipseWriter::writeTimeStep(const SimulatorTimerInterface& timer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BlackoilState* blackoilState = dynamic_cast<const BlackoilState*>(&reservoirState);
|
// Write RS - Dissolved GOR
|
||||||
if (blackoilState) {
|
if (reservoirState.hasCellData( BlackoilState::GASOILRATIO )) {
|
||||||
// Write RS - Dissolved GOR
|
const std::vector<double>& rs = reservoirState.getCellData( BlackoilState::GASOILRATIO );
|
||||||
const std::vector<double>& rs = blackoilState->gasoilratio();
|
|
||||||
sol.add(EclipseWriterDetails::Keyword<float>("RS", rs));
|
sol.add(EclipseWriterDetails::Keyword<float>("RS", rs));
|
||||||
|
}
|
||||||
|
|
||||||
// Write RV - Volatilized oil/gas ratio
|
// 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));
|
sol.add(EclipseWriterDetails::Keyword<float>("RV", rv));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,185 +50,183 @@
|
|||||||
|
|
||||||
namespace {
|
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());
|
ecl_rft_file_type * new_rft_file = ecl_rft_file_alloc(rft_filename.c_str());
|
||||||
std::shared_ptr<ecl_rft_file_type> rft_file;
|
std::shared_ptr<ecl_rft_file_type> rft_file;
|
||||||
rft_file.reset(new_rft_file, ecl_rft_file_free);
|
rft_file.reset(new_rft_file, ecl_rft_file_free);
|
||||||
|
|
||||||
//Get RFT node for well/time OP_1/10 OKT 2008
|
//Get RFT node for well/time OP_1/10 OKT 2008
|
||||||
time_t recording_time = util_make_datetime(0, 0, 0, 10, 10, 2008);
|
time_t recording_time = util_make_datetime(0, 0, 0, 10, 10, 2008);
|
||||||
ecl_rft_node_type * ecl_rft_node = ecl_rft_file_get_well_time_rft(rft_file.get() , "OP_1" , recording_time);
|
ecl_rft_node_type * ecl_rft_node = ecl_rft_file_get_well_time_rft(rft_file.get() , "OP_1" , recording_time);
|
||||||
BOOST_CHECK(ecl_rft_node_is_RFT(ecl_rft_node));
|
BOOST_CHECK(ecl_rft_node_is_RFT(ecl_rft_node));
|
||||||
|
|
||||||
//Verify RFT data for completions (ijk) 9 9 1, 9 9 2 and 9 9 3 for OP_1
|
//Verify RFT data for completions (ijk) 9 9 1, 9 9 2 and 9 9 3 for OP_1
|
||||||
const ecl_rft_cell_type * ecl_rft_cell1 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 0);
|
const ecl_rft_cell_type * ecl_rft_cell1 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 0);
|
||||||
const ecl_rft_cell_type * ecl_rft_cell2 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 1);
|
const ecl_rft_cell_type * ecl_rft_cell2 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 1);
|
||||||
const ecl_rft_cell_type * ecl_rft_cell3 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 2);
|
const ecl_rft_cell_type * ecl_rft_cell3 = ecl_rft_node_lookup_ijk(ecl_rft_node, 8, 8, 2);
|
||||||
|
|
||||||
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell1), 210088*0.00001, 0.00001);
|
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell1), 210088*0.00001, 0.00001);
|
||||||
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell2), 210188*0.00001, 0.00001);
|
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell2), 210188*0.00001, 0.00001);
|
||||||
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell3), 210288*0.00001, 0.00001);
|
BOOST_CHECK_CLOSE(ecl_rft_cell_get_pressure(ecl_rft_cell3), 210288*0.00001, 0.00001);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell1), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell1), 0.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell2), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell2), 0.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell3), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_sgas(ecl_rft_cell3), 0.0);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell1), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell1), 0.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell2), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell2), 0.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell3), 0.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_swat(ecl_rft_cell3), 0.0);
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell1), 1.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell1), 1.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell2), 1.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell2), 1.0);
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell3), 1.0);
|
BOOST_CHECK_EQUAL(ecl_rft_cell_get_soil(ecl_rft_cell3), 1.0);
|
||||||
|
|
||||||
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_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_cell2), (2*0.250 + (0.250/2)));
|
||||||
BOOST_CHECK_EQUAL(ecl_rft_cell_get_depth(ecl_rft_cell3), (3*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::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> 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 &ug_grid = *ourFineGridManagerPtr->c_grid();
|
||||||
|
|
||||||
|
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::EclipseState> eclipseState,
|
||||||
|
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr,
|
||||||
|
const int * compressedToCartesianCellIdx)
|
||||||
|
{
|
||||||
|
Opm::parameter::ParameterGroup params;
|
||||||
|
params.insertParameter("deck_filename", "testcase.data");
|
||||||
|
|
||||||
Opm::DeckConstPtr createDeck(const std::string& input_str) {
|
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
Opm::ParserPtr parser = std::make_shared<Opm::Parser>();
|
|
||||||
Opm::DeckConstPtr deck = parser->parseString(input_str , Opm::ParseContext());
|
|
||||||
return deck;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||||
|
|
||||||
std::shared_ptr<Opm::WellState> createWellState(std::shared_ptr<Opm::BlackoilState> blackoilState)
|
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = std::make_shared<Opm::EclipseWriter>(params,
|
||||||
{
|
eclipseState,
|
||||||
std::shared_ptr<Opm::WellState> wellState = std::make_shared<Opm::WellState>();
|
phaseUsage,
|
||||||
wellState->init(0, *blackoilState);
|
ourFinerUnstructuredGrid.number_of_cells,
|
||||||
return wellState;
|
compressedToCartesianCellIdx);
|
||||||
}
|
|
||||||
|
|
||||||
|
return eclipseWriter;
|
||||||
|
}
|
||||||
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> blackoilState = std::make_shared<Opm::BlackoilState>();
|
|
||||||
blackoilState->init(ourFinerUnstructuredGrid, 3);
|
|
||||||
|
|
||||||
size_t numCells = ourFinerUnstructuredGrid.number_of_cells;
|
|
||||||
|
|
||||||
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::EclipseState> eclipseState,
|
|
||||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr,
|
|
||||||
const int * compressedToCartesianCellIdx)
|
|
||||||
{
|
|
||||||
Opm::parameter::ParameterGroup params;
|
|
||||||
params.insertParameter("deck_filename", "testcase.data");
|
|
||||||
|
|
||||||
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
|
||||||
|
|
||||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
|
||||||
|
|
||||||
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = std::make_shared<Opm::EclipseWriter>(params,
|
|
||||||
eclipseState,
|
|
||||||
phaseUsage,
|
|
||||||
ourFinerUnstructuredGrid.number_of_cells,
|
|
||||||
compressedToCartesianCellIdx);
|
|
||||||
|
|
||||||
return eclipseWriter;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_EclipseWriterRFTHandler)
|
BOOST_AUTO_TEST_CASE(test_EclipseWriterRFTHandler)
|
||||||
{
|
{
|
||||||
const std::string& deckString =
|
const std::string& deckString =
|
||||||
"RUNSPEC\n"
|
"RUNSPEC\n"
|
||||||
"OIL\n"
|
"OIL\n"
|
||||||
"GAS\n"
|
"GAS\n"
|
||||||
"WATER\n"
|
"WATER\n"
|
||||||
"DIMENS\n"
|
"DIMENS\n"
|
||||||
" 10 10 10 /\n"
|
" 10 10 10 /\n"
|
||||||
"GRID\n"
|
"GRID\n"
|
||||||
"DXV\n"
|
"DXV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"DYV\n"
|
"DYV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"DZV\n"
|
"DZV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"TOPS\n"
|
"TOPS\n"
|
||||||
"100*0.25 /\n"
|
"100*0.25 /\n"
|
||||||
"\n"
|
"\n"
|
||||||
"START -- 0 \n"
|
"START -- 0 \n"
|
||||||
"1 NOV 1979 / \n"
|
"1 NOV 1979 / \n"
|
||||||
"SCHEDULE\n"
|
"SCHEDULE\n"
|
||||||
"DATES -- 1\n"
|
"DATES -- 1\n"
|
||||||
" 1 DES 1979/ \n"
|
" 1 DES 1979/ \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
" 'OP_2' 'OP' 4 4 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_2' 'OP' 4 4 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
" 'OP_1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
|
" 'OP_1' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
|
||||||
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
" 'OP_2' 4 4 4 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_2' 4 4 4 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"DATES -- 2\n"
|
"DATES -- 2\n"
|
||||||
" 10 OKT 2008 / \n"
|
" 10 OKT 2008 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WRFT \n"
|
"WRFT \n"
|
||||||
"/ \n"
|
"/ \n"
|
||||||
"WELOPEN\n"
|
"WELOPEN\n"
|
||||||
" 'OP_1' OPEN / \n"
|
" 'OP_1' OPEN / \n"
|
||||||
" 'OP_2' OPEN / \n"
|
" 'OP_2' OPEN / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"DATES -- 3\n"
|
"DATES -- 3\n"
|
||||||
" 10 NOV 2008 / \n"
|
" 10 NOV 2008 / \n"
|
||||||
"/\n";
|
"/\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_work_area_type * new_ptr = test_work_area_alloc("test_EclipseWriterRFTHandler");
|
test_work_area_type * new_ptr = test_work_area_alloc("test_EclipseWriterRFTHandler");
|
||||||
std::shared_ptr<test_work_area_type> test_area;
|
std::shared_ptr<test_work_area_type> test_area;
|
||||||
test_area.reset(new_ptr, test_work_area_free);
|
test_area.reset(new_ptr, test_work_area_free);
|
||||||
|
|
||||||
std::shared_ptr<const Opm::Deck> deck = createDeck(deckString);
|
std::shared_ptr<const Opm::Deck> deck = createDeck(deckString);
|
||||||
std::shared_ptr<Opm::EclipseState> eclipseState = std::make_shared<Opm::EclipseState>(deck , Opm::ParseContext());
|
std::shared_ptr<Opm::EclipseState> eclipseState = std::make_shared<Opm::EclipseState>(deck , Opm::ParseContext());
|
||||||
|
|
||||||
std::shared_ptr<Opm::SimulatorTimer> simulatorTimer = std::make_shared<Opm::SimulatorTimer>();
|
std::shared_ptr<Opm::SimulatorTimer> simulatorTimer = std::make_shared<Opm::SimulatorTimer>();
|
||||||
simulatorTimer->init(eclipseState->getSchedule()->getTimeMap());
|
simulatorTimer->init(eclipseState->getSchedule()->getTimeMap());
|
||||||
|
|
||||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr = std::make_shared<Opm::GridManager>(eclipseState->getEclipseGrid());
|
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr = std::make_shared<Opm::GridManager>(eclipseState->getEclipseGrid());
|
||||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||||
const int* compressedToCartesianCellIdx = Opm::UgGridHelpers::globalCell(ourFinerUnstructuredGrid);
|
const int* compressedToCartesianCellIdx = Opm::UgGridHelpers::globalCell(ourFinerUnstructuredGrid);
|
||||||
|
|
||||||
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = createEclipseWriter(deck,
|
std::shared_ptr<Opm::EclipseWriter> eclipseWriter = createEclipseWriter(deck,
|
||||||
eclipseState,
|
eclipseState,
|
||||||
ourFineGridManagerPtr,
|
ourFineGridManagerPtr,
|
||||||
compressedToCartesianCellIdx);
|
compressedToCartesianCellIdx);
|
||||||
eclipseWriter->writeInit(*simulatorTimer);
|
eclipseWriter->writeInit(*simulatorTimer);
|
||||||
|
|
||||||
|
|
||||||
for (; simulatorTimer->currentStepNum() < simulatorTimer->numSteps(); ++ (*simulatorTimer)) {
|
for (; simulatorTimer->currentStepNum() < simulatorTimer->numSteps(); ++ (*simulatorTimer)) {
|
||||||
std::shared_ptr<Opm::BlackoilState> blackoilState2 = createBlackoilState(simulatorTimer->currentStepNum(),ourFineGridManagerPtr);
|
std::shared_ptr<Opm::BlackoilState> blackoilState2 = createBlackoilState(simulatorTimer->currentStepNum(),ourFineGridManagerPtr);
|
||||||
std::shared_ptr<Opm::WellState> wellState = createWellState(blackoilState2);
|
std::shared_ptr<Opm::WellState> wellState = createWellState(blackoilState2);
|
||||||
eclipseWriter->writeTimeStep(*simulatorTimer, *blackoilState2, *wellState, false);
|
eclipseWriter->writeTimeStep(*simulatorTimer, *blackoilState2, *wellState, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cwd(test_work_area_get_cwd(test_area.get()));
|
std::string cwd(test_work_area_get_cwd(test_area.get()));
|
||||||
std::string rft_filename = cwd + "/TESTCASE.RFT";
|
std::string rft_filename = cwd + "/TESTCASE.RFT";
|
||||||
verifyRFTFile(rft_filename);
|
verifyRFTFile(rft_filename);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
@ -109,8 +110,7 @@ void createBlackoilState(int timeStepIdx)
|
|||||||
{
|
{
|
||||||
// allocate a new BlackoilState object
|
// allocate a new BlackoilState object
|
||||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||||
blackoilState.reset(new Opm::BlackoilState);
|
blackoilState.reset(new Opm::BlackoilState( Opm::UgGridHelpers::numCells( ourFinerUnstructuredGrid ) , Opm::UgGridHelpers::numFaces( ourFinerUnstructuredGrid ), 3));
|
||||||
blackoilState->init(ourFinerUnstructuredGrid, 3);
|
|
||||||
|
|
||||||
size_t numCells = ourFinerUnstructuredGrid.number_of_cells;
|
size_t numCells = ourFinerUnstructuredGrid.number_of_cells;
|
||||||
size_t numFaces = ourFinerUnstructuredGrid.number_of_faces;
|
size_t numFaces = ourFinerUnstructuredGrid.number_of_faces;
|
||||||
@ -367,55 +367,55 @@ void checkSummaryFile(int /*timeStepIdx*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(EclipseWriterIntegration)
|
BOOST_AUTO_TEST_CASE(EclipseWriterIntegration)
|
||||||
{
|
{
|
||||||
const char *deckString =
|
const char *deckString =
|
||||||
"RUNSPEC\n"
|
"RUNSPEC\n"
|
||||||
"INIT\n"
|
"INIT\n"
|
||||||
"UNIFOUT\n"
|
"UNIFOUT\n"
|
||||||
"OIL\n"
|
"OIL\n"
|
||||||
"GAS\n"
|
"GAS\n"
|
||||||
"WATER\n"
|
"WATER\n"
|
||||||
"METRIC\n"
|
"METRIC\n"
|
||||||
"DIMENS\n"
|
"DIMENS\n"
|
||||||
"3 3 3/\n"
|
"3 3 3/\n"
|
||||||
"GRID\n"
|
"GRID\n"
|
||||||
"DXV\n"
|
"DXV\n"
|
||||||
"1.0 2.0 3.0 /\n"
|
"1.0 2.0 3.0 /\n"
|
||||||
"DYV\n"
|
"DYV\n"
|
||||||
"4.0 5.0 6.0 /\n"
|
"4.0 5.0 6.0 /\n"
|
||||||
"DZV\n"
|
"DZV\n"
|
||||||
"7.0 8.0 9.0 /\n"
|
"7.0 8.0 9.0 /\n"
|
||||||
"TOPS\n"
|
"TOPS\n"
|
||||||
"9*100 /\n"
|
"9*100 /\n"
|
||||||
"PROPS\n"
|
"PROPS\n"
|
||||||
"PORO\n"
|
"PORO\n"
|
||||||
"27*0.3 /\n"
|
"27*0.3 /\n"
|
||||||
"PERMX\n"
|
"PERMX\n"
|
||||||
"27*1 /\n"
|
"27*1 /\n"
|
||||||
"SOLUTION\n"
|
"SOLUTION\n"
|
||||||
"RPTRST\n"
|
"RPTRST\n"
|
||||||
"BASIC=2\n"
|
"BASIC=2\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"SCHEDULE\n"
|
"SCHEDULE\n"
|
||||||
"TSTEP\n"
|
"TSTEP\n"
|
||||||
"1.0 2.0 3.0 4.0 /\n"
|
"1.0 2.0 3.0 4.0 /\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
"'INJ' 'G' 1 1 2000 'GAS' /\n"
|
"'INJ' 'G' 1 1 2000 'GAS' /\n"
|
||||||
"'PROD' 'G' 3 3 1000 'OIL' /\n"
|
"'PROD' 'G' 3 3 1000 'OIL' /\n"
|
||||||
"/\n";
|
"/\n";
|
||||||
|
|
||||||
createEclipseWriter(deckString);
|
createEclipseWriter(deckString);
|
||||||
|
|
||||||
eclWriter->writeInit(*simTimer);
|
eclWriter->writeInit(*simTimer);
|
||||||
|
|
||||||
checkEgridFile();
|
checkEgridFile();
|
||||||
checkInitFile();
|
checkInitFile();
|
||||||
|
|
||||||
for (; simTimer->currentStepNum() < simTimer->numSteps(); ++ (*simTimer)) {
|
for (; simTimer->currentStepNum() < simTimer->numSteps(); ++ (*simTimer)) {
|
||||||
createBlackoilState(simTimer->currentStepNum());
|
createBlackoilState(simTimer->currentStepNum());
|
||||||
createWellState(simTimer->currentStepNum());
|
createWellState(simTimer->currentStepNum());
|
||||||
eclWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
|
eclWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
|
||||||
checkRestartFile(simTimer->currentStepNum());
|
checkRestartFile(simTimer->currentStepNum());
|
||||||
checkSummaryFile(simTimer->currentStepNum());
|
checkSummaryFile(simTimer->currentStepNum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <opm/output/eclipse/EclipseReader.hpp>
|
#include <opm/output/eclipse/EclipseReader.hpp>
|
||||||
#include <opm/output/eclipse/EclipseIOUtil.hpp>
|
#include <opm/output/eclipse/EclipseIOUtil.hpp>
|
||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
@ -60,155 +61,156 @@
|
|||||||
|
|
||||||
|
|
||||||
std::string input =
|
std::string input =
|
||||||
"RUNSPEC\n"
|
"RUNSPEC\n"
|
||||||
"OIL\n"
|
"OIL\n"
|
||||||
"GAS\n"
|
"GAS\n"
|
||||||
"WATER\n"
|
"WATER\n"
|
||||||
"DISGAS\n"
|
"DISGAS\n"
|
||||||
"VAPOIL\n"
|
"VAPOIL\n"
|
||||||
"UNIFOUT\n"
|
"UNIFOUT\n"
|
||||||
"UNIFIN\n"
|
"UNIFIN\n"
|
||||||
"DIMENS\n"
|
"DIMENS\n"
|
||||||
" 10 10 10 /\n"
|
" 10 10 10 /\n"
|
||||||
|
|
||||||
"GRID\n"
|
"GRID\n"
|
||||||
"DXV\n"
|
"DXV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"DYV\n"
|
"DYV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"DZV\n"
|
"DZV\n"
|
||||||
"10*0.25 /\n"
|
"10*0.25 /\n"
|
||||||
"TOPS\n"
|
"TOPS\n"
|
||||||
"100*0.25 /\n"
|
"100*0.25 /\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
"SOLUTION\n"
|
"SOLUTION\n"
|
||||||
"RESTART\n"
|
"RESTART\n"
|
||||||
"TESTWELLSTATE 1/\n"
|
"TESTWELLSTATE 1/\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
||||||
"START -- 0 \n"
|
"START -- 0 \n"
|
||||||
"1 NOV 1979 / \n"
|
"1 NOV 1979 / \n"
|
||||||
|
|
||||||
"SCHEDULE\n"
|
"SCHEDULE\n"
|
||||||
"SKIPREST\n"
|
"SKIPREST\n"
|
||||||
"RPTRST\n"
|
"RPTRST\n"
|
||||||
"BASIC=1\n"
|
"BASIC=1\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"DATES -- 1\n"
|
"DATES -- 1\n"
|
||||||
" 10 OKT 2008 / \n"
|
" 10 OKT 2008 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_1' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
" 'OP_2' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_2' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_1' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
" 'OP_2' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
|
" 'OP_2' 9 9 2 2 'OPEN' 1* 46.825 0.311 4332.346 1* 1* 'X' 22.123 / \n"
|
||||||
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_1' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_1' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONINJE\n"
|
"WCONINJE\n"
|
||||||
"'OP_2' 'GAS' 'OPEN' 'RATE' 100 200 400 /\n"
|
"'OP_2' 'GAS' 'OPEN' 'RATE' 100 200 400 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 2\n"
|
"DATES -- 2\n"
|
||||||
" 20 JAN 2011 / \n"
|
" 20 JAN 2011 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_3' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_3' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_3' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_3' 9 9 1 1 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_3' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_3' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 3\n"
|
"DATES -- 3\n"
|
||||||
" 15 JUN 2013 / \n"
|
" 15 JUN 2013 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_2' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_2' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
" 'OP_1' 9 9 7 7 'SHUT' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_1' 9 9 7 7 'SHUT' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 4\n"
|
"DATES -- 4\n"
|
||||||
" 22 APR 2014 / \n"
|
" 22 APR 2014 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_4' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_4' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_4' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_4' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
" 'OP_3' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_3' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_4' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_4' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 5\n"
|
"DATES -- 5\n"
|
||||||
" 30 AUG 2014 / \n"
|
" 30 AUG 2014 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_5' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_5' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_5' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_5' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_5' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_5' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 6\n"
|
"DATES -- 6\n"
|
||||||
" 15 SEP 2014 / \n"
|
" 15 SEP 2014 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_3' 'SHUT' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_3' 'SHUT' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
|
|
||||||
"DATES -- 7\n"
|
"DATES -- 7\n"
|
||||||
" 9 OCT 2014 / \n"
|
" 9 OCT 2014 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WELSPECS\n"
|
"WELSPECS\n"
|
||||||
" 'OP_6' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
" 'OP_6' 'OP' 9 9 1* 'OIL' 1* 1* 1* 1* 1* 1* 1* / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"COMPDAT\n"
|
"COMPDAT\n"
|
||||||
" 'OP_6' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
" 'OP_6' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"WCONPROD\n"
|
"WCONPROD\n"
|
||||||
"'OP_6' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
"'OP_6' 'OPEN' 'ORAT' 20000 4* 1000 /\n"
|
||||||
"/\n"
|
"/\n"
|
||||||
"TSTEP -- 8\n"
|
"TSTEP -- 8\n"
|
||||||
"10 /"
|
"10 /"
|
||||||
"/\n";
|
"/\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> createBlackOilState(Opm::EclipseGridConstPtr eclGrid , const Opm::PhaseUsage& phaseUsage) {
|
||||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState);
|
|
||||||
blackoilState->init(*ourFineGridManagerPtr->c_grid(), 3);
|
|
||||||
|
|
||||||
return blackoilState;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
|
Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
|
||||||
Opm::EclipseStatePtr eclipseState,
|
Opm::EclipseStatePtr eclipseState,
|
||||||
std::string& eclipse_data_filename) {
|
std::string& eclipse_data_filename) {
|
||||||
|
|
||||||
Opm::parameter::ParameterGroup params;
|
Opm::parameter::ParameterGroup params;
|
||||||
params.insertParameter("deck_filename", eclipse_data_filename);
|
params.insertParameter("deck_filename", eclipse_data_filename);
|
||||||
|
|
||||||
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
|
|
||||||
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
eclipseState->getEclipseGrid()->getCartesianSize(),
|
eclipseState->getEclipseGrid()->getCartesianSize(),
|
||||||
0));
|
0));
|
||||||
return eclWriter;
|
return eclWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValuesInWellState(std::shared_ptr<Opm::WellState> wellState){
|
void setValuesInWellState(std::shared_ptr<Opm::WellState> wellState){
|
||||||
@ -247,102 +249,102 @@ void setValuesInWellState(std::shared_ptr<Opm::WellState> wellState){
|
|||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
BOOST_AUTO_TEST_CASE(EclipseReadWriteWellStateData)
|
||||||
{
|
{
|
||||||
std::string eclipse_data_filename = "TestWellState.DATA";
|
std::string eclipse_data_filename = "TestWellState.DATA";
|
||||||
test_work_area_type * test_area = test_work_area_alloc("EclipseReadWriteWellStateData");
|
test_work_area_type * test_area = test_work_area_alloc("EclipseReadWriteWellStateData");
|
||||||
|
|
||||||
Opm::Parser parser;
|
Opm::Parser parser;
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = parser.parseString(input, parseContext);
|
Opm::DeckConstPtr deck = parser.parseString(input, parseContext);
|
||||||
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
|
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
|
||||||
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);
|
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);
|
||||||
|
|
||||||
std::shared_ptr<Opm::SimulatorTimer> simTimer( new Opm::SimulatorTimer() );
|
std::shared_ptr<Opm::SimulatorTimer> simTimer( new Opm::SimulatorTimer() );
|
||||||
simTimer->init(eclipseState->getSchedule()->getTimeMap());
|
simTimer->init(eclipseState->getSchedule()->getTimeMap());
|
||||||
eclipseWriter->writeInit(*simTimer);
|
eclipseWriter->writeInit(*simTimer);
|
||||||
std::shared_ptr<Opm::WellState> wellState(new Opm::WellState());
|
std::shared_ptr<Opm::WellState> wellState(new Opm::WellState());
|
||||||
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
|
|
||||||
Opm::GridManager gridManager(deck);
|
Opm::GridManager gridManager(deck);
|
||||||
Opm::WellsManager wellsManager(eclipseState, 1, *gridManager.c_grid(), NULL);
|
Opm::WellsManager wellsManager(eclipseState, 1, *gridManager.c_grid(), NULL);
|
||||||
const Wells* wells = wellsManager.c_wells();
|
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);
|
wellState->init(wells, *blackoilState);
|
||||||
|
|
||||||
//Set test data for pressure
|
//Set test data for pressure
|
||||||
std::vector<double>& pressure = blackoilState->pressure();
|
std::vector<double>& pressure = blackoilState->pressure();
|
||||||
for (std::vector<double>::iterator iter = pressure.begin(); iter != pressure.end(); ++iter) {
|
for (std::vector<double>::iterator iter = pressure.begin(); iter != pressure.end(); ++iter) {
|
||||||
*iter = 6.0;
|
*iter = 6.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set test data for temperature
|
//Set test data for temperature
|
||||||
std::vector<double>& temperature = blackoilState->temperature();
|
std::vector<double>& temperature = blackoilState->temperature();
|
||||||
for (std::vector<double>::iterator iter = temperature.begin(); iter != temperature.end(); ++iter) {
|
for (std::vector<double>::iterator iter = temperature.begin(); iter != temperature.end(); ++iter) {
|
||||||
*iter = 7.0;
|
*iter = 7.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set test data for saturation water
|
//Set test data for saturation water
|
||||||
std::vector<double> swatdata(1000, 8);
|
std::vector<double> swatdata(1000, 8);
|
||||||
Opm::EclipseIOUtil::addToStripedData(swatdata, blackoilState->saturation(), phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
Opm::EclipseIOUtil::addToStripedData(swatdata, blackoilState->saturation(), phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
||||||
|
|
||||||
//Set test data for saturation gas
|
//Set test data for saturation gas
|
||||||
std::vector<double> sgasdata(1000, 9);
|
std::vector<double> sgasdata(1000, 9);
|
||||||
Opm::EclipseIOUtil::addToStripedData(sgasdata, blackoilState->saturation(), phaseUsage.phase_pos[Opm::BlackoilPhases::Vapour], phaseUsage.num_phases);
|
Opm::EclipseIOUtil::addToStripedData(sgasdata, blackoilState->saturation(), phaseUsage.phase_pos[Opm::BlackoilPhases::Vapour], phaseUsage.num_phases);
|
||||||
|
|
||||||
// Set test data for rs
|
// Set test data for rs
|
||||||
double rs = 300.0;
|
double rs = 300.0;
|
||||||
std::vector<double>& rs_vec = blackoilState->gasoilratio();
|
std::vector<double>& rs_vec = blackoilState->gasoilratio();
|
||||||
for (std::vector<double>::iterator rs_iter = rs_vec.begin(); rs_iter != rs_vec.end(); ++ rs_iter) {
|
for (std::vector<double>::iterator rs_iter = rs_vec.begin(); rs_iter != rs_vec.end(); ++ rs_iter) {
|
||||||
*rs_iter = rs;
|
*rs_iter = rs;
|
||||||
rs = rs + 1.0;
|
rs = rs + 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set testdata for rv
|
// Set testdata for rv
|
||||||
double rv = 400.0;
|
double rv = 400.0;
|
||||||
std::vector<double>& rv_vec = blackoilState->rv();
|
std::vector<double>& rv_vec = blackoilState->rv();
|
||||||
for (std::vector<double>::iterator rv_iter = rv_vec.begin(); rv_iter != rv_vec.end(); ++rv_iter) {
|
for (std::vector<double>::iterator rv_iter = rv_vec.begin(); rv_iter != rv_vec.end(); ++rv_iter) {
|
||||||
*rv_iter = rv;
|
*rv_iter = rv;
|
||||||
rv = rv + 1.0;
|
rv = rv + 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setValuesInWellState(wellState);
|
setValuesInWellState(wellState);
|
||||||
simTimer->setCurrentStepNum(1);
|
simTimer->setCurrentStepNum(1);
|
||||||
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState , false);
|
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState , false);
|
||||||
|
|
||||||
std::shared_ptr<Opm::WellState> wellStateRestored(new Opm::WellState());
|
std::shared_ptr<Opm::WellState> wellStateRestored(new Opm::WellState());
|
||||||
wellStateRestored->init(wells, *blackoilState);
|
wellStateRestored->init(wells, *blackoilState);
|
||||||
|
|
||||||
//Read and verify OPM XWEL data, and solution data: pressure, temperature, saturation data, rs and rv
|
//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);
|
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());
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->temperature().begin(), wellState->temperature().end(), wellStateRestored->temperature().begin(), wellStateRestored->temperature().end());
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->wellRates().begin(), wellState->wellRates().end(), wellStateRestored->wellRates().begin(), wellStateRestored->wellRates().end());
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->perfRates().begin(), wellState->perfRates().end(), wellStateRestored->perfRates().begin(), wellStateRestored->perfRates().end());
|
||||||
|
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->perfPress().begin(), wellState->perfPress().end(), wellStateRestored->perfPress().begin(), wellStateRestored->perfPress().end());
|
||||||
|
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->bhp().begin(), wellState->bhp().end(), wellStateRestored->bhp().begin(), wellStateRestored->bhp().end());
|
std::vector<double> swat_restored;
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->temperature().begin(), wellState->temperature().end(), wellStateRestored->temperature().begin(), wellStateRestored->temperature().end());
|
std::vector<double> swat;
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->wellRates().begin(), wellState->wellRates().end(), wellStateRestored->wellRates().begin(), wellStateRestored->wellRates().end());
|
std::vector<double> sgas_restored;
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->perfRates().begin(), wellState->perfRates().end(), wellStateRestored->perfRates().begin(), wellStateRestored->perfRates().end());
|
std::vector<double> sgas;
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(wellState->perfPress().begin(), wellState->perfPress().end(), wellStateRestored->perfPress().begin(), wellStateRestored->perfPress().end());
|
Opm::EclipseIOUtil::extractFromStripedData(blackoilStateRestored->saturation(), swat_restored, phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
||||||
|
Opm::EclipseIOUtil::extractFromStripedData(blackoilState->saturation(), swat, phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
||||||
|
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);
|
||||||
|
|
||||||
std::vector<double> swat_restored;
|
for (size_t cellindex = 0; cellindex < 10; ++cellindex) {
|
||||||
std::vector<double> swat;
|
BOOST_CHECK_CLOSE(blackoilState->pressure()[cellindex], blackoilStateRestored->pressure()[cellindex], 0.00001);
|
||||||
std::vector<double> sgas_restored;
|
BOOST_CHECK_CLOSE(blackoilState->temperature()[cellindex], blackoilStateRestored->temperature()[cellindex], 0.00001);
|
||||||
std::vector<double> sgas;
|
BOOST_CHECK_CLOSE(swat[cellindex], swat_restored[cellindex], 0.00001);
|
||||||
Opm::EclipseIOUtil::extractFromStripedData(blackoilStateRestored->saturation(), swat_restored, phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
BOOST_CHECK_CLOSE(sgas[cellindex], sgas_restored[cellindex], 0.00001);
|
||||||
Opm::EclipseIOUtil::extractFromStripedData(blackoilState->saturation(), swat, phaseUsage.phase_pos[Opm::BlackoilPhases::Aqua], phaseUsage.num_phases);
|
}
|
||||||
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) {
|
|
||||||
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);
|
|
||||||
BOOST_CHECK_CLOSE(sgas[cellindex], sgas_restored[cellindex], 0.00001);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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->gasoilratio()[cellindex], blackoilStateRestored->gasoilratio()[cellindex], 0.0000001);
|
||||||
BOOST_CHECK_CLOSE(blackoilState->rv()[cellindex], blackoilStateRestored->rv()[cellindex], 0.0000001);
|
BOOST_CHECK_CLOSE(blackoilState->rv()[cellindex], blackoilStateRestored->rv()[cellindex], 0.0000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
test_work_area_free(test_area);
|
test_work_area_free(test_area);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <opm/output/eclipse/EclipseWriter.hpp>
|
#include <opm/output/eclipse/EclipseWriter.hpp>
|
||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
|
#include <opm/core/grid/GridHelpers.hpp>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
@ -57,89 +58,89 @@ void verifyWellState(const std::string& rst_filename,
|
|||||||
Opm::EclipseGridConstPtr ecl_grid,
|
Opm::EclipseGridConstPtr ecl_grid,
|
||||||
Opm::ScheduleConstPtr schedule) {
|
Opm::ScheduleConstPtr schedule) {
|
||||||
|
|
||||||
well_info_type * well_info = well_info_alloc(ecl_grid->c_ptr());
|
well_info_type * well_info = well_info_alloc(ecl_grid->c_ptr());
|
||||||
well_info_load_rstfile(well_info, rst_filename.c_str(), false);
|
well_info_load_rstfile(well_info, rst_filename.c_str(), false);
|
||||||
|
|
||||||
//Verify numwells
|
//Verify numwells
|
||||||
int numwells = well_info_get_num_wells(well_info);
|
int numwells = well_info_get_num_wells(well_info);
|
||||||
BOOST_CHECK(numwells == (int)schedule->numWells());
|
BOOST_CHECK(numwells == (int)schedule->numWells());
|
||||||
|
|
||||||
std::vector<Opm::WellConstPtr> wells = schedule->getWells();
|
std::vector<Opm::WellConstPtr> wells = schedule->getWells();
|
||||||
|
|
||||||
for (int i = 0; i < numwells; ++i) {
|
for (int i = 0; i < numwells; ++i) {
|
||||||
|
|
||||||
//Verify wellnames
|
//Verify wellnames
|
||||||
const char * wellname = well_info_iget_well_name(well_info, i);
|
const char * wellname = well_info_iget_well_name(well_info, i);
|
||||||
Opm::WellConstPtr well = wells.at(i);
|
Opm::WellConstPtr well = wells.at(i);
|
||||||
BOOST_CHECK(wellname == well->name());
|
BOOST_CHECK(wellname == well->name());
|
||||||
|
|
||||||
// Verify well-head position data
|
// Verify well-head position data
|
||||||
well_ts_type * well_ts = well_info_get_ts(well_info , wellname);
|
well_ts_type * well_ts = well_info_get_ts(well_info , wellname);
|
||||||
well_state_type * well_state = well_ts_iget_state(well_ts, 0);
|
well_state_type * well_state = well_ts_iget_state(well_ts, 0);
|
||||||
const well_conn_type * well_head = well_state_get_wellhead(well_state, ECL_GRID_GLOBAL_GRID);
|
const well_conn_type * well_head = well_state_get_wellhead(well_state, ECL_GRID_GLOBAL_GRID);
|
||||||
BOOST_CHECK(well_conn_get_i(well_head) == well->getHeadI());
|
BOOST_CHECK(well_conn_get_i(well_head) == well->getHeadI());
|
||||||
BOOST_CHECK(well_conn_get_j(well_head) == well->getHeadJ());
|
BOOST_CHECK(well_conn_get_j(well_head) == well->getHeadJ());
|
||||||
|
|
||||||
for (int j = 0; j < well_ts_get_size(well_ts); ++j) {
|
for (int j = 0; j < well_ts_get_size(well_ts); ++j) {
|
||||||
well_state = well_ts_iget_state(well_ts, j);
|
well_state = well_ts_iget_state(well_ts, j);
|
||||||
|
|
||||||
//Verify welltype
|
//Verify welltype
|
||||||
int ert_well_type = well_state_get_type(well_state);
|
int ert_well_type = well_state_get_type(well_state);
|
||||||
WellType welltype = well->isProducer(j) ? PRODUCER : INJECTOR;
|
WellType welltype = well->isProducer(j) ? PRODUCER : INJECTOR;
|
||||||
Opm::WellInjector::TypeEnum injectortype = well->getInjectionProperties(j).injectorType;
|
Opm::WellInjector::TypeEnum injectortype = well->getInjectionProperties(j).injectorType;
|
||||||
int ecl_converted_welltype = Opm::EclipseWriter::eclipseWellTypeMask(welltype, injectortype);
|
int ecl_converted_welltype = Opm::EclipseWriter::eclipseWellTypeMask(welltype, injectortype);
|
||||||
int ert_converted_welltype = well_state_translate_ecl_type_int(ecl_converted_welltype);
|
int ert_converted_welltype = well_state_translate_ecl_type_int(ecl_converted_welltype);
|
||||||
BOOST_CHECK(ert_well_type == ert_converted_welltype);
|
BOOST_CHECK(ert_well_type == ert_converted_welltype);
|
||||||
|
|
||||||
//Verify wellstatus
|
//Verify wellstatus
|
||||||
int ert_well_status = well_state_is_open(well_state) ? 1 : 0;
|
int ert_well_status = well_state_is_open(well_state) ? 1 : 0;
|
||||||
|
|
||||||
Opm::WellCommon::StatusEnum status = well->getStatus(j);
|
Opm::WellCommon::StatusEnum status = well->getStatus(j);
|
||||||
int wellstatus = Opm::EclipseWriter::eclipseWellStatusMask(status);
|
int wellstatus = Opm::EclipseWriter::eclipseWellStatusMask(status);
|
||||||
|
|
||||||
BOOST_CHECK(ert_well_status == wellstatus);
|
BOOST_CHECK(ert_well_status == wellstatus);
|
||||||
|
|
||||||
//Verify number of completion connections
|
//Verify number of completion connections
|
||||||
const well_conn_collection_type * well_connections = well_state_get_global_connections( well_state );
|
const well_conn_collection_type * well_connections = well_state_get_global_connections( well_state );
|
||||||
size_t num_wellconnections = well_conn_collection_get_size(well_connections);
|
size_t num_wellconnections = well_conn_collection_get_size(well_connections);
|
||||||
|
|
||||||
int report_nr = well_state_get_report_nr(well_state);
|
int report_nr = well_state_get_report_nr(well_state);
|
||||||
Opm::CompletionSetConstPtr completions_set = well->getCompletions((size_t)report_nr);
|
Opm::CompletionSetConstPtr completions_set = well->getCompletions((size_t)report_nr);
|
||||||
|
|
||||||
BOOST_CHECK(num_wellconnections == completions_set->size());
|
BOOST_CHECK(num_wellconnections == completions_set->size());
|
||||||
|
|
||||||
//Verify coordinates for each completion connection
|
//Verify coordinates for each completion connection
|
||||||
for (size_t k = 0; k < num_wellconnections; ++k) {
|
for (size_t k = 0; k < num_wellconnections; ++k) {
|
||||||
const well_conn_type * well_connection = well_conn_collection_iget_const(well_connections , k);
|
const well_conn_type * well_connection = well_conn_collection_iget_const(well_connections , k);
|
||||||
|
|
||||||
Opm::CompletionConstPtr completion = completions_set->get(k);
|
Opm::CompletionConstPtr completion = completions_set->get(k);
|
||||||
|
|
||||||
BOOST_CHECK(well_conn_get_i(well_connection) == completion->getI());
|
BOOST_CHECK(well_conn_get_i(well_connection) == completion->getI());
|
||||||
BOOST_CHECK(well_conn_get_j(well_connection) == completion->getJ());
|
BOOST_CHECK(well_conn_get_j(well_connection) == completion->getJ());
|
||||||
BOOST_CHECK(well_conn_get_k(well_connection) == completion->getK());
|
BOOST_CHECK(well_conn_get_k(well_connection) == completion->getK());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
well_info_free(well_info);
|
well_info_free(well_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr eclGrid) {
|
std::shared_ptr<Opm::BlackoilState> createBlackOilState(Opm::EclipseGridConstPtr eclGrid) {
|
||||||
|
|
||||||
std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr(new Opm::GridManager(eclGrid));
|
std::shared_ptr<Opm::GridManager> grid(new Opm::GridManager(eclGrid));
|
||||||
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState);
|
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||||
blackoilState->init(*ourFineGridManagerPtr->c_grid(), 3);
|
std::shared_ptr<Opm::BlackoilState> blackoilState(new Opm::BlackoilState( Opm::UgGridHelpers::numCells(ug_grid) , Opm::UgGridHelpers::numFaces(ug_grid) , 3 ));
|
||||||
|
|
||||||
return blackoilState;
|
return blackoilState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Opm::DeckConstPtr createDeck(const std::string& eclipse_data_filename) {
|
Opm::DeckConstPtr createDeck(const std::string& eclipse_data_filename) {
|
||||||
Opm::ParserPtr parser(new Opm::Parser());
|
Opm::ParserPtr parser(new Opm::Parser());
|
||||||
Opm::DeckConstPtr deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext());
|
Opm::DeckConstPtr deck = parser->parseFile(eclipse_data_filename , Opm::ParseContext());
|
||||||
|
|
||||||
return deck;
|
return deck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -147,51 +148,51 @@ Opm::EclipseWriterPtr createEclipseWriter(Opm::DeckConstPtr deck,
|
|||||||
Opm::EclipseStatePtr eclipseState,
|
Opm::EclipseStatePtr eclipseState,
|
||||||
std::string& eclipse_data_filename) {
|
std::string& eclipse_data_filename) {
|
||||||
|
|
||||||
Opm::parameter::ParameterGroup params;
|
Opm::parameter::ParameterGroup params;
|
||||||
params.insertParameter("deck_filename", eclipse_data_filename);
|
params.insertParameter("deck_filename", eclipse_data_filename);
|
||||||
|
|
||||||
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
const Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck);
|
||||||
|
|
||||||
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
Opm::EclipseWriterPtr eclWriter(new Opm::EclipseWriter(params,
|
||||||
eclipseState,
|
eclipseState,
|
||||||
phaseUsage,
|
phaseUsage,
|
||||||
eclipseState->getEclipseGrid()->getCartesianSize(),
|
eclipseState->getEclipseGrid()->getCartesianSize(),
|
||||||
0));
|
0));
|
||||||
return eclWriter;
|
return eclWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
|
BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo)
|
||||||
{
|
{
|
||||||
std::string eclipse_data_filename = "testBlackoilState3.DATA";
|
std::string eclipse_data_filename = "testBlackoilState3.DATA";
|
||||||
std::string eclipse_restart_filename = "TESTBLACKOILSTATE3.X0004";
|
std::string eclipse_restart_filename = "TESTBLACKOILSTATE3.X0004";
|
||||||
|
|
||||||
|
|
||||||
test_work_area_type * test_area = test_work_area_alloc("TEST_EclipseWriteNumWells");
|
test_work_area_type * test_area = test_work_area_alloc("TEST_EclipseWriteNumWells");
|
||||||
test_work_area_copy_file(test_area, eclipse_data_filename.c_str());
|
test_work_area_copy_file(test_area, eclipse_data_filename.c_str());
|
||||||
|
|
||||||
Opm::ParseContext parseContext;
|
Opm::ParseContext parseContext;
|
||||||
Opm::DeckConstPtr deck = createDeck(eclipse_data_filename);
|
Opm::DeckConstPtr deck = createDeck(eclipse_data_filename);
|
||||||
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
|
Opm::EclipseStatePtr eclipseState(new Opm::EclipseState(deck , parseContext));
|
||||||
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);
|
Opm::EclipseWriterPtr eclipseWriter = createEclipseWriter(deck, eclipseState, eclipse_data_filename);
|
||||||
|
|
||||||
std::shared_ptr<Opm::SimulatorTimer> simTimer( new Opm::SimulatorTimer() );
|
std::shared_ptr<Opm::SimulatorTimer> simTimer( new Opm::SimulatorTimer() );
|
||||||
simTimer->init(eclipseState->getSchedule()->getTimeMap());
|
simTimer->init(eclipseState->getSchedule()->getTimeMap());
|
||||||
|
|
||||||
eclipseWriter->writeInit(*simTimer);
|
eclipseWriter->writeInit(*simTimer);
|
||||||
|
|
||||||
std::shared_ptr<Opm::WellState> wellState(new Opm::WellState());
|
std::shared_ptr<Opm::WellState> wellState(new Opm::WellState());
|
||||||
std::shared_ptr<Opm::BlackoilState> blackoilState = createBlackOilState(eclipseState->getEclipseGrid());
|
std::shared_ptr<Opm::BlackoilState> blackoilState = createBlackOilState(eclipseState->getEclipseGrid());
|
||||||
wellState->init(0, *blackoilState);
|
wellState->init(0, *blackoilState);
|
||||||
|
|
||||||
int countTimeStep = eclipseState->getSchedule()->getTimeMap()->numTimesteps();
|
int countTimeStep = eclipseState->getSchedule()->getTimeMap()->numTimesteps();
|
||||||
|
|
||||||
for(int timestep=0; timestep <= countTimeStep; ++timestep){
|
for(int timestep=0; timestep <= countTimeStep; ++timestep){
|
||||||
simTimer->setCurrentStepNum(timestep);
|
simTimer->setCurrentStepNum(timestep);
|
||||||
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
|
eclipseWriter->writeTimeStep(*simTimer, *blackoilState, *wellState, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyWellState(eclipse_restart_filename, eclipseState->getEclipseGrid(), eclipseState->getSchedule());
|
verifyWellState(eclipse_restart_filename, eclipseState->getEclipseGrid(), eclipseState->getSchedule());
|
||||||
|
|
||||||
test_work_area_free(test_area);
|
test_work_area_free(test_area);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user