mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
Merge pull request #268 from dr-robertk/PR/EclipseWriter-revision-to-write-substeps
Support of writing substeps with EclipseWriter.
This commit is contained in:
commit
9d6e55c4a1
@ -102,10 +102,12 @@ namespace Opm
|
||||
const parameter::ParameterGroup param_;
|
||||
|
||||
// Parameters for output.
|
||||
bool output_;
|
||||
bool output_vtk_;
|
||||
std::string output_dir_;
|
||||
int output_interval_;
|
||||
const bool output_;
|
||||
const bool output_vtk_;
|
||||
const bool output_matlab_;
|
||||
const std::string output_dir_;
|
||||
const int output_interval_;
|
||||
|
||||
// Observed objects.
|
||||
const Grid& grid_;
|
||||
BlackoilPropsAdInterface& props_;
|
||||
@ -240,6 +242,11 @@ namespace Opm
|
||||
EclipseWriter& output_writer,
|
||||
const std::vector<double>& threshold_pressures_by_face)
|
||||
: param_(param),
|
||||
output_( param.getDefault("output", true) ),
|
||||
output_vtk_( output_ ? param.getDefault("output_vtk",true) : false ),
|
||||
output_matlab_( output_ ? param.getDefault("output_matlab", true) : false ),
|
||||
output_dir_( output_ ? param.getDefault("output_dir", std::string("output")) : "" ),
|
||||
output_interval_( output_ ? param.getDefault("output_interval", 1): 0 ),
|
||||
grid_(grid),
|
||||
props_(props),
|
||||
rock_comp_props_(rock_comp_props),
|
||||
@ -254,10 +261,7 @@ namespace Opm
|
||||
threshold_pressures_by_face_(threshold_pressures_by_face)
|
||||
{
|
||||
// For output.
|
||||
output_ = param.getDefault("output", true);
|
||||
if (output_) {
|
||||
output_vtk_ = param.getDefault("output_vtk", true);
|
||||
output_dir_ = param.getDefault("output_dir", std::string("output"));
|
||||
// Ensure that output dir exists
|
||||
boost::filesystem::path fpath(output_dir_);
|
||||
try {
|
||||
@ -266,7 +270,6 @@ namespace Opm
|
||||
catch (...) {
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
output_interval_ = param.getDefault("output_interval", 1);
|
||||
}
|
||||
|
||||
// Misc init.
|
||||
@ -330,14 +333,17 @@ namespace Opm
|
||||
if (output_vtk_) {
|
||||
outputStateVtk(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
}
|
||||
outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
outputWellStateMatlab(well_state,timer.currentStepNum(), output_dir_);
|
||||
if (output_matlab_) {
|
||||
outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
outputWellStateMatlab(well_state,timer.currentStepNum(), output_dir_);
|
||||
}
|
||||
}
|
||||
if (output_) {
|
||||
if (timer.currentStepNum() == 0) {
|
||||
output_writer_.writeInit(timer);
|
||||
}
|
||||
output_writer_.writeTimeStep(timer, state, well_state.basicWellState());
|
||||
if( ! adaptiveTimeStepping || timer.currentStepNum() == 0 )
|
||||
output_writer_.writeTimeStep(timer, state, well_state);
|
||||
}
|
||||
|
||||
// Max oil saturation (for VPPARS), hysteresis update.
|
||||
@ -361,8 +367,7 @@ namespace Opm
|
||||
// \Note: The report steps are met in any case
|
||||
// \Note: The sub stepping will require a copy of the state variables
|
||||
if( adaptiveTimeStepping ) {
|
||||
adaptiveTimeStepping->step( solver, state, well_state,
|
||||
timer.simulationTimeElapsed(), timer.currentStepLength() );
|
||||
adaptiveTimeStepping->step( timer, solver, state, well_state, output_writer_ );
|
||||
}
|
||||
else {
|
||||
// solve for complete report step
|
||||
@ -393,9 +398,13 @@ namespace Opm
|
||||
if (output_vtk_) {
|
||||
outputStateVtk(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
}
|
||||
outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
outputWellStateMatlab(prev_well_state, timer.currentStepNum(), output_dir_);
|
||||
output_writer_.writeTimeStep(timer, state, prev_well_state.basicWellState());
|
||||
if (output_matlab_) {
|
||||
outputStateMatlab(grid_, state, timer.currentStepNum(), output_dir_);
|
||||
outputWellStateMatlab(prev_well_state, timer.currentStepNum(), output_dir_);
|
||||
}
|
||||
if( ! adaptiveTimeStepping )
|
||||
//std::cout << "Write last step" << std::endl;
|
||||
output_writer_.writeTimeStep(timer, state, prev_well_state);
|
||||
}
|
||||
|
||||
// Stop timer and create timing report
|
||||
|
@ -39,11 +39,15 @@ namespace Opm
|
||||
/// The state of a set of wells, tailored for use by the fully
|
||||
/// implicit blackoil simulator.
|
||||
class WellStateFullyImplicitBlackoil
|
||||
: public WellState
|
||||
{
|
||||
typedef WellState BaseType;
|
||||
public:
|
||||
typedef std::array< int, 2 > mapentry_t;
|
||||
typedef std::map< std::string, mapentry_t > WellMapType;
|
||||
|
||||
using BaseType :: wellRates;
|
||||
using BaseType :: bhp;
|
||||
|
||||
/// Allocate and initialize if wells is non-null. Also tries
|
||||
/// to give useful initial values to the bhp(), wellRates()
|
||||
@ -60,7 +64,7 @@ namespace Opm
|
||||
|
||||
// We use the WellState::init() function to do bhp and well rates init.
|
||||
// The alternative would be to copy that function wholesale.
|
||||
basic_well_state_.init(wells, state);
|
||||
BaseType :: init(wells, state);
|
||||
|
||||
// Initialize perfphaserates_, which must be done here.
|
||||
const int nw = wells->number_of_wells;
|
||||
@ -135,14 +139,6 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
/// One bhp pressure per well.
|
||||
std::vector<double>& bhp() { return basic_well_state_.bhp(); }
|
||||
const std::vector<double>& bhp() const { return basic_well_state_.bhp(); }
|
||||
|
||||
/// One rate per well and phase.
|
||||
std::vector<double>& wellRates() { return basic_well_state_.wellRates(); }
|
||||
const std::vector<double>& wellRates() const { return basic_well_state_.wellRates(); }
|
||||
|
||||
/// One rate per phase and well connection.
|
||||
std::vector<double>& perfPhaseRates() { return perfphaserates_; }
|
||||
const std::vector<double>& perfPhaseRates() const { return perfphaserates_; }
|
||||
@ -151,12 +147,6 @@ namespace Opm
|
||||
std::vector<int>& currentControls() { return current_controls_; }
|
||||
const std::vector<int>& currentControls() const { return current_controls_; }
|
||||
|
||||
/// For interfacing with functions that take a WellState.
|
||||
const WellState& basicWellState() const
|
||||
{
|
||||
return basic_well_state_;
|
||||
}
|
||||
|
||||
/// The number of wells present.
|
||||
int numWells() const
|
||||
{
|
||||
@ -172,7 +162,6 @@ namespace Opm
|
||||
const WellMapType& wellMap() const { return wellMap_; }
|
||||
|
||||
private:
|
||||
WellState basic_well_state_;
|
||||
std::vector<double> perfphaserates_;
|
||||
std::vector<int> current_controls_;
|
||||
WellMapType wellMap_;
|
||||
|
Loading…
Reference in New Issue
Block a user