Merge pull request #962 from joakim-hove/remove-simulator-state
Replaced SimulatorState -> SimulationDatacontainer
This commit is contained in:
commit
ce6cdb4a47
@ -103,11 +103,11 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
opm/core/props/satfunc/SaturationPropsFromDeck.cpp
|
||||
opm/core/simulator/AdaptiveSimulatorTimer.cpp
|
||||
opm/core/simulator/BlackoilState.cpp
|
||||
opm/core/simulator/TwophaseState.cpp
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.cpp
|
||||
opm/core/simulator/SimulatorIncompTwophase.cpp
|
||||
opm/core/simulator/SimulatorOutput.cpp
|
||||
opm/core/simulator/SimulatorReport.cpp
|
||||
opm/core/simulator/SimulatorState.cpp
|
||||
opm/core/simulator/SimulatorTimer.cpp
|
||||
opm/core/simulator/TimeStepControl.cpp
|
||||
opm/core/transport/TransportSolverTwophaseInterface.cpp
|
||||
@ -377,13 +377,11 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/core/simulator/SimulatorIncompTwophase.hpp
|
||||
opm/core/simulator/SimulatorOutput.hpp
|
||||
opm/core/simulator/SimulatorReport.hpp
|
||||
opm/core/simulator/SimulatorState.hpp
|
||||
opm/core/simulator/SimulatorTimer.hpp
|
||||
opm/core/simulator/SimulatorTimerInterface.hpp
|
||||
opm/core/simulator/TimeStepControl.hpp
|
||||
opm/core/simulator/TimeStepControlInterface.hpp
|
||||
opm/core/simulator/TwophaseState.hpp
|
||||
opm/core/simulator/TwophaseState_impl.hpp
|
||||
opm/core/simulator/WellState.hpp
|
||||
opm/core/simulator/initState.hpp
|
||||
opm/core/simulator/initStateEquil.hpp
|
||||
|
@ -96,7 +96,8 @@ try
|
||||
warnIfUnusedParams(param);
|
||||
|
||||
// Initialisation.
|
||||
BlackoilState state;
|
||||
//initBlackoilSurfvolUsingRSorRV(UgGridHelpers::numCells(grid), props, state);
|
||||
BlackoilState state( UgGridHelpers::numCells(grid) , UgGridHelpers::numFaces(grid), 3);
|
||||
initStateEquil(grid, props, deck, eclipseState, grav, state);
|
||||
|
||||
// Output.
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
@ -89,11 +90,12 @@ try
|
||||
std::unique_ptr<GridManager> grid;
|
||||
std::unique_ptr<BlackoilPropertiesInterface> props;
|
||||
std::unique_ptr<RockCompressibility> rock_comp;
|
||||
std::unique_ptr<BlackoilState> state;
|
||||
|
||||
|
||||
ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck;
|
||||
|
||||
BlackoilState state;
|
||||
// bool check_well_controls = false;
|
||||
// int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
@ -105,21 +107,25 @@ try
|
||||
|
||||
// Grid init
|
||||
grid.reset(new GridManager(deck));
|
||||
// Rock and fluid init
|
||||
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, *grid->c_grid(), param));
|
||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(deck, eclipseState));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
|
||||
{
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
state.reset( new BlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ) ,2));
|
||||
// Rock and fluid init
|
||||
props.reset(new BlackoilPropertiesFromDeck(deck, eclipseState, ug_grid, param));
|
||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(deck, eclipseState));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||
} else {
|
||||
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
|
||||
}
|
||||
initBlackoilSurfvol(ug_grid, *props, *state);
|
||||
}
|
||||
initBlackoilSurfvol(*grid->c_grid(), *props, state);
|
||||
} else {
|
||||
// Grid init.
|
||||
const int nx = param.getDefault("nx", 100);
|
||||
@ -129,15 +135,22 @@ try
|
||||
const double dy = param.getDefault("dy", 1.0);
|
||||
const double dz = param.getDefault("dz", 1.0);
|
||||
grid.reset(new GridManager(nx, ny, nz, dx, dy, dz));
|
||||
// Rock and fluid init.
|
||||
props.reset(new BlackoilPropertiesBasic(param, grid->c_grid()->dimensions, grid->c_grid()->number_of_cells));
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(param));
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
initBlackoilSurfvol(*grid->c_grid(), *props, state);
|
||||
{
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
// Rock and fluid init.
|
||||
props.reset(new BlackoilPropertiesBasic(param, ug_grid.dimensions, UgGridHelpers::numCells( ug_grid )));
|
||||
|
||||
// State init
|
||||
state.reset( new BlackoilState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid ), 3));
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(param));
|
||||
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||
initBlackoilSurfvol(ug_grid, *props, *state);
|
||||
}
|
||||
}
|
||||
|
||||
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
|
||||
@ -153,7 +166,7 @@ try
|
||||
// terms of total pore volume.
|
||||
std::vector<double> porevol;
|
||||
if (rock_comp->isActive()) {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state->pressure(), porevol);
|
||||
} else {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), porevol);
|
||||
}
|
||||
@ -219,8 +232,8 @@ try
|
||||
simtimer.init(param);
|
||||
warnIfUnusedParams(param);
|
||||
WellState well_state;
|
||||
well_state.init(0, state);
|
||||
rep = simulator.run(simtimer, state, well_state);
|
||||
well_state.init(0, *state);
|
||||
rep = simulator.run(simtimer, *state, well_state);
|
||||
} else {
|
||||
// With a deck, we may have more epochs etc.
|
||||
WellState well_state;
|
||||
@ -245,7 +258,7 @@ try
|
||||
// properly transfer old well state to it every report step,
|
||||
// since number of wells may change etc.
|
||||
if (reportStepIdx == 0) {
|
||||
well_state.init(wells.c_wells(), state);
|
||||
well_state.init(wells.c_wells(), *state);
|
||||
}
|
||||
|
||||
// Create and run simulator.
|
||||
@ -261,7 +274,7 @@ try
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, *state, well_state);
|
||||
if (output) {
|
||||
epoch_rep.reportParam(epoch_os);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ try
|
||||
std::unique_ptr<GridManager> grid;
|
||||
std::unique_ptr<IncompPropertiesInterface> props;
|
||||
std::unique_ptr<RockCompressibility> rock_comp;
|
||||
TwophaseState state;
|
||||
std::unique_ptr<TwophaseState> state;
|
||||
// bool check_well_controls = false;
|
||||
// int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
@ -118,19 +118,23 @@ try
|
||||
eclipseState.reset( new EclipseState(deck, parseContext));
|
||||
// Grid init
|
||||
grid.reset(new GridManager(deck));
|
||||
// Rock and fluid init
|
||||
props.reset(new IncompPropertiesFromDeck(deck, eclipseState, *grid->c_grid()));
|
||||
// check_well_controls = param.getDefault("check_well_controls", false);
|
||||
// max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(deck, eclipseState));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
|
||||
{
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
// Rock and fluid init
|
||||
props.reset(new IncompPropertiesFromDeck(deck, eclipseState, ug_grid));
|
||||
|
||||
state.reset( new TwophaseState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid )));
|
||||
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(deck, eclipseState));
|
||||
// Gravity.
|
||||
gravity[2] = deck->hasKeyword("NOGRAV") ? 0.0 : unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||
} else {
|
||||
initStateFromDeck(ug_grid, *props, deck, gravity[2], *state);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Grid init.
|
||||
@ -141,14 +145,20 @@ try
|
||||
const double dy = param.getDefault("dy", 1.0);
|
||||
const double dz = param.getDefault("dz", 1.0);
|
||||
grid.reset(new GridManager(nx, ny, nz, dx, dy, dz));
|
||||
// Rock and fluid init.
|
||||
props.reset(new IncompPropertiesBasic(param, grid->c_grid()->dimensions, grid->c_grid()->number_of_cells));
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(param));
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
{
|
||||
const UnstructuredGrid& ug_grid = *(grid->c_grid());
|
||||
|
||||
// Rock and fluid init.
|
||||
props.reset(new IncompPropertiesBasic(param, ug_grid.dimensions, UgGridHelpers::numCells( ug_grid )));
|
||||
|
||||
state.reset( new TwophaseState( UgGridHelpers::numCells( ug_grid ) , UgGridHelpers::numFaces( ug_grid )));
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new RockCompressibility(param));
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(ug_grid, *props, param, gravity[2], *state);
|
||||
}
|
||||
}
|
||||
|
||||
// Warn if gravity but no density difference.
|
||||
@ -170,7 +180,7 @@ try
|
||||
// terms of total pore volume.
|
||||
std::vector<double> porevol;
|
||||
if (rock_comp->isActive()) {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state->pressure(), porevol);
|
||||
} else {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), porevol);
|
||||
}
|
||||
@ -235,8 +245,8 @@ try
|
||||
simtimer.init(param);
|
||||
warnIfUnusedParams(param);
|
||||
WellState well_state;
|
||||
well_state.init(0, state);
|
||||
rep = simulator.run(simtimer, state, well_state);
|
||||
well_state.init(0, *state);
|
||||
rep = simulator.run(simtimer, *state, well_state);
|
||||
} else {
|
||||
// With a deck, we may have more epochs etc.
|
||||
Opm::TimeMapConstPtr timeMap = eclipseState->getSchedule()->getTimeMap();
|
||||
@ -268,7 +278,7 @@ try
|
||||
// properly transfer old well state to it every report step,
|
||||
// since number of wells may change etc.
|
||||
if (reportStepIdx == 0) {
|
||||
well_state.init(wells.c_wells(), state);
|
||||
well_state.init(wells.c_wells(), *state);
|
||||
}
|
||||
|
||||
// Create and run simulator.
|
||||
@ -284,7 +294,7 @@ try
|
||||
if (reportStepIdx == 0) {
|
||||
warnIfUnusedParams(param);
|
||||
}
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, state, well_state);
|
||||
SimulatorReport epoch_rep = simulator.run(simtimer, *state, well_state);
|
||||
if (output) {
|
||||
epoch_rep.reportParam(epoch_os);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ try
|
||||
all_cells.push_back(i);
|
||||
}
|
||||
|
||||
Opm::TwophaseState state;
|
||||
Opm::TwophaseState state( grid.c_grid()->number_of_cells , grid.c_grid()->number_of_faces );
|
||||
|
||||
initStateFromDeck(*grid.c_grid(), incomp_properties, deck, gravity[2], state);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
SimulatorState& simulator_state) {
|
||||
static void restoreTemperatureData(const ecl_file_type* file,
|
||||
EclipseStateConstPtr eclipse_state,
|
||||
int numcells,
|
||||
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,
|
||||
const PhaseUsage& phaseUsage,
|
||||
int numcells,
|
||||
SimulatorState& simulator_state) {
|
||||
static void restoreSaturation(const ecl_file_type* file_type,
|
||||
const PhaseUsage& phaseUsage,
|
||||
int numcells,
|
||||
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,
|
||||
SimulationConfigConstPtr sim_config,
|
||||
int numcells,
|
||||
BlackoilState* blackoil_state) {
|
||||
static void restoreRSandRV(const ecl_file_type* file_type,
|
||||
SimulationConfigConstPtr sim_config,
|
||||
int numcells,
|
||||
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,
|
||||
int reportstep,
|
||||
bool unified,
|
||||
EclipseStateConstPtr eclipseState,
|
||||
int numcells,
|
||||
const PhaseUsage& phaseUsage,
|
||||
SimulatorState& simulator_state)
|
||||
static void restoreSOLUTION(const std::string& restart_filename,
|
||||
int reportstep,
|
||||
bool unified,
|
||||
EclipseStateConstPtr eclipseState,
|
||||
int numcells,
|
||||
const PhaseUsage& phaseUsage,
|
||||
SimulationDataContainer& simulator_state)
|
||||
{
|
||||
const char* filename = restart_filename.c_str();
|
||||
ecl_file_type* file_type = ecl_file_open(filename, 0);
|
||||
@ -178,11 +179,10 @@ 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";
|
||||
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* 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();
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/core/io/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>
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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/core/io/eclipse/EclipseWriteRFTHandler.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/parameters/Parameter.hpp>
|
||||
@ -1224,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)
|
||||
{
|
||||
@ -1345,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();
|
||||
// Write RS - Dissolved GOR
|
||||
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();
|
||||
// Write RV - Volatilized oil/gas ratio
|
||||
if (reservoirState.hasCellData( BlackoilState::RV )) {
|
||||
const std::vector<double>& rv = reservoirState.getCellData( BlackoilState::RV );
|
||||
sol.add(EclipseWriterDetails::Keyword<float>("RV", rv));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -18,8 +18,10 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
|
||||
@ -28,7 +30,6 @@
|
||||
#include <opm/core/pressure/flow_bc.h>
|
||||
#include <opm/core/linalg/LinearSolverInterface.hpp>
|
||||
#include <opm/core/linalg/sparse_sys.h>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
@ -155,7 +156,7 @@ namespace Opm
|
||||
/// May throw an exception if the number of iterations
|
||||
/// exceed maxiter (set in constructor).
|
||||
void IncompTpfa::solve(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state)
|
||||
{
|
||||
if (rock_comp_props_ != 0 && rock_comp_props_->isActive()) {
|
||||
@ -169,7 +170,7 @@ namespace Opm
|
||||
|
||||
// Solve with no rock compressibility (linear eqn).
|
||||
void IncompTpfa::solveIncomp(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state)
|
||||
{
|
||||
// Set up properties.
|
||||
@ -207,7 +208,7 @@ namespace Opm
|
||||
|
||||
// Solve with rock compressibility (nonlinear eqn).
|
||||
void IncompTpfa::solveRockComp(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state)
|
||||
{
|
||||
// This function is identical to CompressibleTpfa::solve().
|
||||
@ -321,7 +322,7 @@ namespace Opm
|
||||
|
||||
/// Compute per-solve dynamic properties.
|
||||
void IncompTpfa::computePerSolveDynamicData(const double /*dt*/,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& /*well_state*/)
|
||||
{
|
||||
// Computed here:
|
||||
@ -369,7 +370,7 @@ namespace Opm
|
||||
|
||||
/// Compute per-iteration dynamic properties.
|
||||
void IncompTpfa::computePerIterationDynamicData(const double /*dt*/,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& well_state)
|
||||
{
|
||||
// These are the variables that get computed by this function:
|
||||
@ -396,7 +397,7 @@ namespace Opm
|
||||
|
||||
/// Compute the residual in h_->b and Jacobian in h_->A.
|
||||
void IncompTpfa::assemble(const double dt,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& /*well_state*/)
|
||||
{
|
||||
const double* pressures = wells_ ? &pressures_[0] : &state.pressure()[0];
|
||||
@ -462,7 +463,7 @@ namespace Opm
|
||||
|
||||
|
||||
/// Compute the output.
|
||||
void IncompTpfa::computeResults(SimulatorState& state,
|
||||
void IncompTpfa::computeResults(SimulationDataContainer& state,
|
||||
WellState& well_state) const
|
||||
{
|
||||
// Make sure h_ contains the direct-solution matrix
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef OPM_INCOMPTPFA_HEADER_INCLUDED
|
||||
#define OPM_INCOMPTPFA_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
|
||||
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
|
||||
#include <vector>
|
||||
|
||||
@ -36,7 +34,7 @@ namespace Opm
|
||||
class RockCompressibility;
|
||||
class LinearSolverInterface;
|
||||
class WellState;
|
||||
class SimulatoreState;
|
||||
class SimulationDataContainer;
|
||||
|
||||
|
||||
/// Encapsulating a tpfa pressure solver for the incompressible-fluid case.
|
||||
@ -114,7 +112,7 @@ namespace Opm
|
||||
/// May throw an exception if the number of iterations
|
||||
/// exceed maxiter (set in constructor).
|
||||
void solve(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state);
|
||||
|
||||
|
||||
@ -124,28 +122,28 @@ namespace Opm
|
||||
protected:
|
||||
// Solve with no rock compressibility (linear eqn).
|
||||
void solveIncomp(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state);
|
||||
// Solve with rock compressibility (nonlinear eqn).
|
||||
void solveRockComp(const double dt,
|
||||
SimulatorState& state,
|
||||
SimulationDataContainer& state,
|
||||
WellState& well_state);
|
||||
private:
|
||||
// Helper functions.
|
||||
void computeStaticData();
|
||||
virtual void computePerSolveDynamicData(const double dt,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& well_state);
|
||||
void computePerIterationDynamicData(const double dt,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& well_state);
|
||||
void assemble(const double dt,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& well_state);
|
||||
void solveIncrement();
|
||||
double residualNorm() const;
|
||||
double incrementNorm() const;
|
||||
void computeResults(SimulatorState& state,
|
||||
void computeResults(SimulationDataContainer& state,
|
||||
WellState& well_state) const;
|
||||
|
||||
protected:
|
||||
|
@ -5,44 +5,39 @@
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
void
|
||||
BlackoilState::init(int number_of_cells, int number_of_phases, int num_phases)
|
||||
|
||||
const std::string BlackoilState::GASOILRATIO = "GASOILRATIO";
|
||||
const std::string BlackoilState::RV = "RV";
|
||||
const std::string BlackoilState::SURFACEVOL = "SURFACEVOL";
|
||||
|
||||
|
||||
BlackoilState::BlackoilState( size_t num_cells , size_t num_faces , size_t num_phases)
|
||||
: SimulationDataContainer( num_cells , num_faces , num_phases)
|
||||
{
|
||||
SimulatorState::init(number_of_cells, number_of_phases, num_phases);
|
||||
|
||||
// register cell data in base class
|
||||
gorId_ = SimulatorState::registerCellData( "GASOILRATIO", 1 );
|
||||
rvId_ = SimulatorState::registerCellData( "RV", 1 );
|
||||
|
||||
// surfvolumes intentionally empty, left to initBlackoilSurfvol
|
||||
surfaceVolId_ = SimulatorState::registerCellData( "SURFACEVOL", 0 );
|
||||
registerCellData( GASOILRATIO , 1 );
|
||||
registerCellData( RV, 1 );
|
||||
registerCellData( SURFACEVOL, num_phases );
|
||||
setBlackoilStateReferencePointers();
|
||||
}
|
||||
|
||||
void
|
||||
BlackoilState::init(const UnstructuredGrid& g, int num_phases)
|
||||
BlackoilState::BlackoilState( const BlackoilState& other )
|
||||
: SimulationDataContainer(other)
|
||||
{
|
||||
init(g.number_of_cells, g.number_of_faces, num_phases);
|
||||
setBlackoilStateReferencePointers();
|
||||
}
|
||||
|
||||
bool
|
||||
BlackoilState::equals(const SimulatorState& other,
|
||||
double epsilon) const {
|
||||
const BlackoilState* that = dynamic_cast <const BlackoilState*> (&other);
|
||||
bool equal = that != 0;
|
||||
equal = equal && SimulatorState::equals (other, epsilon);
|
||||
equal = equal && cmp::vector_equal(this->surfacevol(),
|
||||
that->surfacevol(),
|
||||
cmp::default_abs_epsilon,
|
||||
epsilon);
|
||||
|
||||
equal = equal && cmp::vector_equal(this->gasoilratio(),
|
||||
that->gasoilratio(),
|
||||
cmp::default_abs_epsilon,
|
||||
epsilon);
|
||||
|
||||
equal = equal && cmp::vector_equal(this->rv(),
|
||||
that->rv(),
|
||||
cmp::default_abs_epsilon,
|
||||
epsilon);
|
||||
return equal;
|
||||
BlackoilState& BlackoilState::operator=( const BlackoilState& other )
|
||||
{
|
||||
SimulationDataContainer::operator=(other);
|
||||
setBlackoilStateReferencePointers();
|
||||
return *this;
|
||||
}
|
||||
|
||||
void BlackoilState::setBlackoilStateReferencePointers()
|
||||
{
|
||||
// This sets the reference pointers for the fast
|
||||
// accessors, the fields must have been created first.
|
||||
gasoilratio_ref_ = &getCellData(GASOILRATIO);
|
||||
rv_ref_ = &getCellData(RV);
|
||||
surfacevol_ref_ = &getCellData(SURFACEVOL);
|
||||
}
|
||||
|
@ -21,43 +21,59 @@
|
||||
#ifndef OPM_BLACKOILSTATE_HEADER_INCLUDED
|
||||
#define OPM_BLACKOILSTATE_HEADER_INCLUDED
|
||||
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Simulator state for a blackoil simulator.
|
||||
class BlackoilState : public SimulatorState
|
||||
class BlackoilState : public SimulationDataContainer
|
||||
{
|
||||
public:
|
||||
using SimulatorState :: cellData ;
|
||||
static const std::string GASOILRATIO;
|
||||
static const std::string RV;
|
||||
static const std::string SURFACEVOL;
|
||||
|
||||
virtual void init(const UnstructuredGrid& grid, int num_phases);
|
||||
/// Main constructor setting the sizes for the contained data
|
||||
/// types.
|
||||
/// \param num_cells number of elements in cell data vectors
|
||||
/// \param num_faces number of elements in face data vectors
|
||||
/// \param num_phases number of phases, the number of components
|
||||
/// in any data vector must equal 1 or this
|
||||
/// number (this behaviour and argument is deprecated).
|
||||
BlackoilState(size_t num_cells, size_t num_faces, size_t num_phases);
|
||||
|
||||
virtual void init(int number_of_cells, int number_of_faces, int num_phases);
|
||||
/// Copy constructor.
|
||||
/// Must be defined explicitly because class contains non-value objects
|
||||
/// (the reference pointers rv_ref_ etc.) that should not simply
|
||||
/// be copied.
|
||||
BlackoilState(const BlackoilState& other);
|
||||
|
||||
virtual bool equals(const SimulatorState& other,
|
||||
double epsilon = 1e-8) const;
|
||||
/// Copy assignment operator.
|
||||
/// Must be defined explicitly because class contains non-value objects
|
||||
/// (the reference pointers rv_ref_ etc.) that should not simply
|
||||
/// be copied.
|
||||
BlackoilState& operator=(const BlackoilState& other);
|
||||
|
||||
std::vector<double>& surfacevol () { return cellData()[ surfaceVolId_ ]; }
|
||||
std::vector<double>& gasoilratio () { return cellData()[ gorId_ ] ; }
|
||||
std::vector<double>& rv () {return cellData()[ rvId_ ] ; }
|
||||
std::vector<double>& surfacevol () { return *surfacevol_ref_; }
|
||||
std::vector<double>& gasoilratio () { return *gasoilratio_ref_; }
|
||||
std::vector<double>& rv () { return *rv_ref_; }
|
||||
|
||||
const std::vector<double>& surfacevol () const { return cellData()[ surfaceVolId_ ]; }
|
||||
const std::vector<double>& gasoilratio () const { return cellData()[ gorId_ ] ; }
|
||||
const std::vector<double>& rv () const { return cellData()[ rvId_ ] ; }
|
||||
const std::vector<double>& surfacevol () const { return *surfacevol_ref_; }
|
||||
const std::vector<double>& gasoilratio () const { return *gasoilratio_ref_; }
|
||||
const std::vector<double>& rv () const { return *rv_ref_; }
|
||||
|
||||
private:
|
||||
int gorId_ ; // no entries = no cells (gas oil ratio id)
|
||||
int rvId_ ; // no entries = no cells ( rv id )
|
||||
int surfaceVolId_ ; // no entries = no cells * no phases (surfaceVol id )
|
||||
void setBlackoilStateReferencePointers();
|
||||
std::vector<double>* surfacevol_ref_;
|
||||
std::vector<double>* gasoilratio_ref_;
|
||||
std::vector<double>* rv_ref_;
|
||||
|
||||
|
||||
//std::vector<double> surfvol_; // no entries = no cells * no phases
|
||||
//std::vector<double> gor_ ; // no entries = no cells
|
||||
//std::vector<double> rv_ ; // no entries = no cells
|
||||
};
|
||||
} // namespace Opm
|
||||
|
||||
|
@ -34,7 +34,7 @@ SimulatorOutputBase::SimulatorOutputBase (
|
||||
const Opm::PhaseUsage &phaseUsage,
|
||||
std::shared_ptr <const UnstructuredGrid> grid,
|
||||
std::shared_ptr <const SimulatorTimer> timer,
|
||||
std::shared_ptr <const SimulatorState> state,
|
||||
std::shared_ptr <const SimulationDataContainer> state,
|
||||
std::shared_ptr <const WellState> wellState)
|
||||
|
||||
// store all parameters passed into the object, making them curried
|
||||
|
@ -36,7 +36,7 @@ class Deck;
|
||||
class EclipseState;
|
||||
class OutputWriter;
|
||||
namespace parameter { class ParameterGroup; }
|
||||
class SimulatorState;
|
||||
class SimulationDataContainer;
|
||||
class SimulatorTimer;
|
||||
class TimeMap;
|
||||
class WellState;
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
const Opm::PhaseUsage &phaseUsage,
|
||||
std::shared_ptr <const UnstructuredGrid> grid,
|
||||
std::shared_ptr <const SimulatorTimer> timer,
|
||||
std::shared_ptr <const SimulatorState> state,
|
||||
std::shared_ptr <const SimulationDataContainer> state,
|
||||
std::shared_ptr <const WellState> wellState);
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ protected:
|
||||
/// Just hold a reference to these objects that are owned elsewhere.
|
||||
std::shared_ptr <const SimulatorTimer> timer_;
|
||||
std::shared_ptr <const TimeMap> timeMap_;
|
||||
std::shared_ptr <const SimulatorState> reservoirState_;
|
||||
std::shared_ptr <const SimulationDataContainer> reservoirState_;
|
||||
std::shared_ptr <const WellState> wellState_;
|
||||
|
||||
/// Created locally and destructed together with us
|
||||
@ -149,7 +149,7 @@ struct SimulatorOutput : public SimulatorOutputBase {
|
||||
const Opm::PhaseUsage &phaseUsage,
|
||||
std::shared_ptr <const UnstructuredGrid> grid,
|
||||
std::shared_ptr <const SimulatorTimer> timer,
|
||||
std::shared_ptr <const SimulatorState> state,
|
||||
std::shared_ptr <const SimulationDataContainer> state,
|
||||
std::shared_ptr <const WellState> wellState,
|
||||
std::shared_ptr <Simulator> sim)
|
||||
// send all other parameters to base class
|
||||
@ -173,7 +173,7 @@ struct SimulatorOutput : public SimulatorOutputBase {
|
||||
const Opm::PhaseUsage &phaseUsage,
|
||||
const UnstructuredGrid& grid,
|
||||
const SimulatorTimer& timer,
|
||||
const SimulatorState& state,
|
||||
const SimulationDataContainer& state,
|
||||
const WellState& wellState,
|
||||
Simulator& sim)
|
||||
// send all other parameters to base class
|
||||
|
@ -1,108 +0,0 @@
|
||||
// Copyright (C) 2013 Uni Research AS
|
||||
// Copyright (C) 2015 IRIS AS
|
||||
// This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
#ifndef OPM_SIMULATORSTATE_HEADER_INCLUDED
|
||||
#define OPM_SIMULATORSTATE_HEADER_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
class SimulatorState
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void init(int number_of_cells, int number_of_faces, int num_phases);
|
||||
|
||||
protected:
|
||||
/// \brief pressure per cell.
|
||||
static const int pressureId_ = 0;
|
||||
/// \brief temperature per cell.
|
||||
static const int temperatureId_ = 1;
|
||||
/// \brief The saturation of each phase per cell.
|
||||
static const int saturationId_ = 2;
|
||||
|
||||
/// \brief pressure per face.
|
||||
static const int facePressureId_ = 0;
|
||||
/// \brief The fluxes at the faces.
|
||||
static const int faceFluxId_ = 1;
|
||||
|
||||
public:
|
||||
/// Will set the values of component nr @component in the
|
||||
/// field @key. All the cells in @cells will be set to the
|
||||
/// values in @values.
|
||||
void setCellDataComponent( const std::string& key , size_t component , const std::vector<int>& cells , const std::vector<double>& values);
|
||||
|
||||
int numPhases() const { return num_phases_; }
|
||||
int numCells () const { return num_cells_; }
|
||||
int numFaces () const { return num_faces_; }
|
||||
|
||||
std::vector<double>& pressure () { return cellData_[ pressureId_ ]; }
|
||||
std::vector<double>& temperature () { return cellData_[ temperatureId_ ]; }
|
||||
std::vector<double>& facepressure() { return faceData_[ facePressureId_]; }
|
||||
std::vector<double>& faceflux () { return faceData_[ faceFluxId_ ]; }
|
||||
std::vector<double>& saturation () { return cellData_[ saturationId_ ]; }
|
||||
|
||||
const std::vector<double>& pressure () const { return cellData_[ pressureId_ ]; }
|
||||
const std::vector<double>& temperature () const { return cellData_[ temperatureId_ ]; }
|
||||
const std::vector<double>& facepressure() const { return faceData_[ facePressureId_]; }
|
||||
const std::vector<double>& faceflux () const { return faceData_[ faceFluxId_ ]; }
|
||||
const std::vector<double>& saturation () const { return cellData_[ saturationId_ ]; }
|
||||
|
||||
/**
|
||||
* Compare this state with another, to see if they are different
|
||||
* only within a small margin.
|
||||
*/
|
||||
virtual bool equals(const SimulatorState& other,
|
||||
double epsilon = 1e-8) const;
|
||||
|
||||
std::vector< std::vector<double> >& cellData() { return cellData_; }
|
||||
const std::vector< std::vector<double> >& cellData() const { return cellData_; }
|
||||
|
||||
std::vector< std::vector<double> >& faceData() { return faceData_; }
|
||||
const std::vector< std::vector<double> >& faceData() const { return faceData_; }
|
||||
|
||||
const std::vector< std::string >& cellDataNames() const { return cellDataNames_; }
|
||||
const std::vector< std::string >& faceDataNames() const { return faceDataNames_; }
|
||||
|
||||
size_t registerCellData( const std::string& name, const int components, const double initialValue = 0.0 );
|
||||
size_t registerFaceData( const std::string& name, const int components, const double initialValue = 0.0 );
|
||||
|
||||
std::vector<double>& getCellData( const std::string& name );
|
||||
const std::vector<double>& getCellData( const std::string& name ) const;
|
||||
private:
|
||||
int num_cells_;
|
||||
int num_faces_;
|
||||
int num_phases_;
|
||||
|
||||
/// \brief vector containing all registered cell data
|
||||
std::vector< std::vector< double > > cellData_;
|
||||
/// \brief vector containing all registered face data
|
||||
std::vector< std::vector< double > > faceData_;
|
||||
|
||||
/// \brief names for the cell data
|
||||
std::vector< std::string > cellDataNames_;
|
||||
/// \brief names for the face data
|
||||
std::vector< std::string > faceDataNames_;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Check if two vectors are equal within a margin.
|
||||
*
|
||||
* @param epsilon Relative difference that is tolerated for the
|
||||
* vectors to still be considered equal.
|
||||
*
|
||||
* @return True if every element is within the margin, false if
|
||||
* there is at least one that is not.
|
||||
*/
|
||||
static bool vectorApproxEqual(const std::vector<double>& v1,
|
||||
const std::vector<double>& v2,
|
||||
double epsilon);
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_SIMULATORSTATE_HEADER_INCLUDED
|
@ -19,7 +19,6 @@
|
||||
#ifndef OPM_TIMESTEPCONTROLINTERFACE_HEADER_INCLUDED
|
||||
#define OPM_TIMESTEPCONTROLINTERFACE_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
33
opm/core/simulator/TwophaseState.cpp
Normal file
33
opm/core/simulator/TwophaseState.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/core/simulator/TwophaseState.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
TwophaseState::TwophaseState(size_t num_cells , size_t num_faces) :
|
||||
SimulationDataContainer( num_cells , num_faces , 2 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,22 +20,16 @@
|
||||
#ifndef OPM_TWOPHASESTATE_HEADER_INCLUDED
|
||||
#define OPM_TWOPHASESTATE_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// Simulator state for a two-phase simulator.
|
||||
class TwophaseState : public SimulatorState
|
||||
class TwophaseState : public SimulationDataContainer
|
||||
{
|
||||
public:
|
||||
virtual bool equals (const SimulatorState& other,
|
||||
double epsilon = 1e-8) const;
|
||||
TwophaseState(size_t num_cells , size_t num_faces);
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
}
|
||||
|
||||
#include "TwophaseState_impl.hpp"
|
||||
|
||||
#endif // OPM_TWOPHASESTATE_HEADER_INCLUDED
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
#include <opm/core/simulator/SimulatorState.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
namespace Opm
|
||||
@ -31,6 +31,7 @@ namespace Opm
|
||||
namespace parameter { class ParameterGroup; }
|
||||
class IncompPropertiesInterface;
|
||||
class BlackoilPropertiesInterface;
|
||||
class SimulationDataContainer;
|
||||
|
||||
/// \file
|
||||
///
|
||||
@ -45,7 +46,7 @@ namespace Opm
|
||||
|
||||
enum ExtremalSat { MinSat, MaxSat };
|
||||
template <class Props>
|
||||
static void initSaturation(const std::vector<int>& cells , const Props& props , SimulatorState& state , ExtremalSat satType);
|
||||
static void initSaturation(const std::vector<int>& cells , const Props& props , SimulationDataContainer& state , ExtremalSat satType);
|
||||
|
||||
|
||||
/// Initialize a two-phase state from parameters.
|
||||
|
@ -20,11 +20,12 @@
|
||||
#ifndef OPM_INITSTATE_IMPL_HEADER_INCLUDED
|
||||
#define OPM_INITSTATE_IMPL_HEADER_INCLUDED
|
||||
|
||||
#include <opm/common/data/SimulationDataContainer.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/MonotCubicInterpolator.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
||||
@ -42,7 +43,7 @@ namespace Opm
|
||||
|
||||
|
||||
template <class Props>
|
||||
static void initSaturation(const std::vector<int>& cells , const Props& props , SimulatorState& state , ExtremalSat satType) {
|
||||
static void initSaturation(const std::vector<int>& cells , const Props& props , SimulationDataContainer& state , ExtremalSat satType) {
|
||||
const int num_phases = state.numPhases();
|
||||
std::vector<double> min_sat(num_phases * cells.size());
|
||||
std::vector<double> max_sat(num_phases * cells.size());
|
||||
@ -438,7 +439,6 @@ namespace Opm
|
||||
if (num_phases != 2) {
|
||||
OPM_THROW(std::runtime_error, "initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
}
|
||||
state.init(number_of_cells, number_of_faces, num_phases);
|
||||
const int num_cells = props.numCells();
|
||||
// By default: initialise water saturation to minimum everywhere.
|
||||
std::vector<int> all_cells(num_cells);
|
||||
@ -563,7 +563,6 @@ namespace Opm
|
||||
if (num_phases != 2) {
|
||||
OPM_THROW(std::runtime_error, "initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
}
|
||||
state.init(number_of_cells, number_of_faces, num_phases);
|
||||
const int num_cells = props.numCells();
|
||||
// By default: initialise water saturation to minimum everywhere.
|
||||
std::vector<int> all_cells(num_cells);
|
||||
@ -651,7 +650,6 @@ namespace Opm
|
||||
OPM_THROW(std::runtime_error, "initStateFromDeck(): user specified property object with " << num_phases << " phases, "
|
||||
"found " << pu.num_phases << " phases in deck.");
|
||||
}
|
||||
state.init(number_of_cells, number_of_faces, num_phases);
|
||||
if (deck->hasKeyword("EQUIL") && deck->hasKeyword("PRESSURE")) {
|
||||
OPM_THROW(std::runtime_error, "initStateFromDeck(): The deck must either specify the initial "
|
||||
"condition using the PRESSURE _or_ the EQUIL keyword (currently it has both)");
|
||||
|
@ -108,12 +108,10 @@ std::shared_ptr<Opm::WellState> createWellState(std::shared_ptr<Opm::BlackoilSta
|
||||
|
||||
std::shared_ptr<Opm::BlackoilState> createBlackoilState(int timeStepIdx, std::shared_ptr<Opm::GridManager> ourFineGridManagerPtr)
|
||||
{
|
||||
const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid();
|
||||
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) {
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <opm/core/io/eclipse/EclipseWriter.hpp>
|
||||
#include <opm/core/io/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;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/GridHelpers.hpp>
|
||||
#include <opm/core/props/BlackoilPhases.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
@ -38,41 +39,18 @@ BOOST_AUTO_TEST_CASE(EqualsDifferentDeckReturnFalse) {
|
||||
Opm::DeckConstPtr deck2(parser->parseFile(filename2, parseContext));
|
||||
|
||||
GridManager gridManager1(deck1);
|
||||
const UnstructuredGrid* grid1 = gridManager1.c_grid();
|
||||
const UnstructuredGrid& grid1 = *gridManager1.c_grid();
|
||||
GridManager gridManager2(deck2);
|
||||
const UnstructuredGrid* grid2 = gridManager2.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
state1.init(*grid1, 3);
|
||||
|
||||
BlackoilState state2;
|
||||
state2.init(*grid2, 3);
|
||||
const UnstructuredGrid& grid2 = *gridManager2.c_grid();
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
BlackoilState state1( UgGridHelpers::numCells( grid1 ) , UgGridHelpers::numFaces( grid1 ) , 3);
|
||||
BlackoilState state2( UgGridHelpers::numCells( grid2 ) , UgGridHelpers::numFaces( grid2 ) , 3);
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EqualsDifferentNumPhasesReturnFalse) {
|
||||
|
||||
const string filename = "testBlackoilState1.DATA";
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename, parseContext));
|
||||
|
||||
GridManager gridManager(deck);
|
||||
const UnstructuredGrid* grid = gridManager.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
state1.init(*grid, 3);
|
||||
|
||||
BlackoilState state2;
|
||||
state2.init(*grid, 2);
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
|
||||
@ -82,41 +60,39 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
Opm::DeckConstPtr deck(parser->parseFile(filename , parseContext));
|
||||
|
||||
GridManager gridManager(deck);
|
||||
const UnstructuredGrid* grid = gridManager.c_grid();
|
||||
|
||||
BlackoilState state1;
|
||||
state1.init(*grid, 3);
|
||||
|
||||
BlackoilState state2;
|
||||
state2.init(*grid, 3);
|
||||
const UnstructuredGrid& grid = *gridManager.c_grid();
|
||||
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BlackoilState state1( UgGridHelpers::numCells( grid ) , UgGridHelpers::numFaces( grid ) , 3);
|
||||
BlackoilState state2( UgGridHelpers::numCells( grid ) , UgGridHelpers::numFaces( grid ) , 3);
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
{
|
||||
std::vector<double>& p1 = state1.pressure();
|
||||
std::vector<double>& p2 = state2.pressure();
|
||||
p1[0] = p1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
p1[0] = p2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
{
|
||||
std::vector<double>& gor1 = state1.gasoilratio();
|
||||
std::vector<double>& gor2 = state2.gasoilratio();
|
||||
gor1[0] = gor1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
gor1[0] = gor2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
{
|
||||
std::vector<double>& p1 = state1.facepressure();
|
||||
std::vector<double>& p2 = state2.facepressure();
|
||||
p1[0] = p1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
p1[0] = p2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
|
||||
{
|
||||
@ -124,10 +100,10 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
std::vector<double>& f2 = state2.faceflux();
|
||||
if (f1.size() > 0 ) {
|
||||
f1[0] = f1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
f1[0] = f2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -135,19 +111,19 @@ BOOST_AUTO_TEST_CASE(EqualsNumericalDifferenceReturnFalse) {
|
||||
std::vector<double>& sv2 = state2.surfacevol();
|
||||
if (sv1.size() > 0) {
|
||||
sv1[0] = sv1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
sv1[0] = sv2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<double>& sat1 = state1.saturation();
|
||||
std::vector<double>& sat2 = state2.saturation();
|
||||
sat1[0] = sat1[0] * 2 + 1;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equals(state2) );
|
||||
|
||||
BOOST_CHECK_EQUAL( false , state1.equal(state2) );
|
||||
sat1[0] = sat2[0];
|
||||
BOOST_CHECK_EQUAL( true , state1.equals(state2) );
|
||||
BOOST_CHECK_EQUAL( true , state1.equal(state2) );
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ BOOST_AUTO_TEST_CASE(TestStoppedWells)
|
||||
double target_surfacerate_prod;
|
||||
|
||||
const std::vector<double> pressure = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
BlackoilState state;
|
||||
state.init(pressure.size(), 0, 3);
|
||||
BlackoilState state( pressure.size() , 0 , 3);
|
||||
state.pressure() = pressure;
|
||||
|
||||
// Both wells are open in the first schedule step
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <opm/core/io/eclipse/EclipseReader.hpp>
|
||||
#include <opm/core/io/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;
|
||||
}
|
||||
@ -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,9 +315,9 @@ 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());
|
||||
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());
|
||||
@ -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,7 +341,7 @@ 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);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <opm/core/io/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;
|
||||
}
|
||||
|
@ -163,10 +163,8 @@ try
|
||||
/// <CODE>Opm::IncompTPFA</CODE>.
|
||||
/// \snippet tutorial2.cpp state
|
||||
/// \internal [state]
|
||||
Opm::TwophaseState state;
|
||||
state.pressure().resize(num_cells, 0.0);
|
||||
state.faceflux().resize(num_faces, 0.0);
|
||||
state.saturation().resize(num_cells, 1.0);
|
||||
|
||||
Opm::TwophaseState state( num_cells , num_faces );
|
||||
Opm::WellState well_state;
|
||||
/// \internal [state]
|
||||
/// \endinternal
|
||||
|
@ -266,8 +266,7 @@ try
|
||||
/// initialize water saturation to minimum everywhere.
|
||||
/// \snippet tutorial3.cpp two-phase state
|
||||
/// \internal [two-phase state]
|
||||
TwophaseState state;
|
||||
state.init(grid.number_of_cells , grid.number_of_faces, 2);
|
||||
TwophaseState state( grid.number_of_cells , grid.number_of_faces );
|
||||
initSaturation( allcells , props , state , MinSat );
|
||||
|
||||
/// \internal [two-phase state]
|
||||
|
@ -213,8 +213,7 @@ try
|
||||
/// initialise water saturation to minimum everywhere.
|
||||
/// \snippet tutorial4.cpp two-phase state
|
||||
/// \internal[two-phase state]
|
||||
TwophaseState state;
|
||||
state.init(grid.number_of_cells , grid.number_of_faces, 2);
|
||||
TwophaseState state( grid.number_of_cells , grid.number_of_faces );
|
||||
initSaturation( allcells , props , state , MinSat );
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user