mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add restart I/O of suggested timestep length.
This commit is contained in:
@@ -144,9 +144,10 @@ public:
|
|||||||
{
|
{
|
||||||
WellState prev_well_state;
|
WellState prev_well_state;
|
||||||
|
|
||||||
|
ExtraData extra;
|
||||||
if (output_writer_.isRestart()) {
|
if (output_writer_.isRestart()) {
|
||||||
// This is a restart, populate WellState and ReservoirState state objects from restart file
|
// This is a restart, populate WellState and ReservoirState state objects from restart file
|
||||||
output_writer_.initFromRestartFile(props_.phaseUsage(), grid(), state, prev_well_state);
|
output_writer_.initFromRestartFile(props_.phaseUsage(), grid(), state, prev_well_state, extra);
|
||||||
initHydroCarbonState(state, props_.phaseUsage(), Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
|
initHydroCarbonState(state, props_.phaseUsage(), Opm::UgGridHelpers::numCells(grid()), has_disgas_, has_vapoil_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +171,10 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
|
adaptiveTimeStepping.reset( new AdaptiveTimeStepping( param_, terminal_output_ ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output_writer_.isRestart()) {
|
||||||
|
adaptiveTimeStepping->setSuggestedNextStep(extra.suggested_step);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
|
std::string restorefilename = param_.getDefault("restorefile", std::string("") );
|
||||||
@@ -354,7 +359,8 @@ public:
|
|||||||
// write simulation state at the report stage
|
// write simulation state at the report stage
|
||||||
Dune::Timer perfTimer;
|
Dune::Timer perfTimer;
|
||||||
perfTimer.start();
|
perfTimer.start();
|
||||||
output_writer_.writeTimeStep( timer, state, well_state, solver->model() );
|
const double nextstep = adaptiveTimeStepping ? adaptiveTimeStepping->suggestedNextStep() : -1.0;
|
||||||
|
output_writer_.writeTimeStep( timer, state, well_state, solver->model(), false, nextstep );
|
||||||
report.output_write_time += perfTimer.stop();
|
report.output_write_time += perfTimer.stop();
|
||||||
|
|
||||||
prev_well_state = well_state;
|
prev_well_state = well_state;
|
||||||
|
|||||||
@@ -197,6 +197,13 @@ namespace Opm
|
|||||||
const Grid& grid_;
|
const Grid& grid_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct ExtraData
|
||||||
|
{
|
||||||
|
double suggested_step;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/** \brief Wrapper class for VTK, Matlab, and ECL output. */
|
/** \brief Wrapper class for VTK, Matlab, and ECL output. */
|
||||||
class BlackoilOutputWriter
|
class BlackoilOutputWriter
|
||||||
{
|
{
|
||||||
@@ -224,7 +231,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer& reservoirState,
|
const SimulationDataContainer& reservoirState,
|
||||||
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
const Opm::WellStateFullyImplicitBlackoil& wellState,
|
||||||
const Model& physicalModel,
|
const Model& physicalModel,
|
||||||
bool substep = false);
|
bool substep = false,
|
||||||
|
const double nextstep = -1.0);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -280,11 +288,12 @@ namespace Opm
|
|||||||
const int desiredReportStep);
|
const int desiredReportStep);
|
||||||
|
|
||||||
|
|
||||||
template <class Grid, class WellStateFullyImplicitBlackOel>
|
template <class Grid, class WellState>
|
||||||
void initFromRestartFile(const PhaseUsage& phaseUsage,
|
void initFromRestartFile(const PhaseUsage& phaseUsage,
|
||||||
const Grid& grid,
|
const Grid& grid,
|
||||||
SimulationDataContainer& simulatorstate,
|
SimulationDataContainer& simulatorstate,
|
||||||
WellStateFullyImplicitBlackOel& wellstate);
|
WellState& wellstate,
|
||||||
|
ExtraData& extra);
|
||||||
|
|
||||||
bool isRestart() const;
|
bool isRestart() const;
|
||||||
|
|
||||||
@@ -401,14 +410,16 @@ namespace Opm
|
|||||||
initFromRestartFile( const PhaseUsage& phaseUsage,
|
initFromRestartFile( const PhaseUsage& phaseUsage,
|
||||||
const Grid& grid,
|
const Grid& grid,
|
||||||
SimulationDataContainer& simulatorstate,
|
SimulationDataContainer& simulatorstate,
|
||||||
WellState& wellstate)
|
WellState& wellstate,
|
||||||
|
ExtraData& extra )
|
||||||
{
|
{
|
||||||
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
std::map<std::string, UnitSystem::measure> solution_keys {{"PRESSURE" , UnitSystem::measure::pressure},
|
||||||
{"SWAT" , UnitSystem::measure::identity},
|
{"SWAT" , UnitSystem::measure::identity},
|
||||||
{"SGAS" , UnitSystem::measure::identity},
|
{"SGAS" , UnitSystem::measure::identity},
|
||||||
{"TEMP" , UnitSystem::measure::temperature},
|
{"TEMP" , UnitSystem::measure::temperature},
|
||||||
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
{"RS" , UnitSystem::measure::gas_oil_ratio},
|
||||||
{"RV" , UnitSystem::measure::oil_gas_ratio}};
|
{"RV" , UnitSystem::measure::oil_gas_ratio},
|
||||||
|
{"OPMEXTRA" , UnitSystem::measure::identity}};
|
||||||
|
|
||||||
// gives a dummy dynamic_list_econ_limited
|
// gives a dummy dynamic_list_econ_limited
|
||||||
DynamicListEconLimited dummy_list_econ_limited;
|
DynamicListEconLimited dummy_list_econ_limited;
|
||||||
@@ -435,6 +446,12 @@ namespace Opm
|
|||||||
|
|
||||||
solutionToSim( state.first, phaseUsage, simulatorstate );
|
solutionToSim( state.first, phaseUsage, simulatorstate );
|
||||||
wellsToState( state.second, phaseUsage, wellstate );
|
wellsToState( state.second, phaseUsage, wellstate );
|
||||||
|
|
||||||
|
if (state.first.has( "OPMEXTRA" ) ) {
|
||||||
|
std::vector<double> opmextra = state.first.data( "OPMEXTRA" );
|
||||||
|
assert(opmextra.size() == 1);
|
||||||
|
extra.suggested_step = opmextra[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -899,7 +916,8 @@ namespace Opm
|
|||||||
const SimulationDataContainer& localState,
|
const SimulationDataContainer& localState,
|
||||||
const WellStateFullyImplicitBlackoil& localWellState,
|
const WellStateFullyImplicitBlackoil& localWellState,
|
||||||
const Model& physicalModel,
|
const Model& physicalModel,
|
||||||
bool substep)
|
bool substep,
|
||||||
|
const double nextstep)
|
||||||
{
|
{
|
||||||
data::Solution localCellData{};
|
data::Solution localCellData{};
|
||||||
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
const RestartConfig& restartConfig = eclipseState_.getRestartConfig();
|
||||||
@@ -924,6 +942,13 @@ namespace Opm
|
|||||||
// sd will be invalid after getRestartData has been called
|
// sd will be invalid after getRestartData has been called
|
||||||
}
|
}
|
||||||
detail::getSummaryData( localCellData, phaseUsage_, physicalModel, summaryConfig );
|
detail::getSummaryData( localCellData, phaseUsage_, physicalModel, summaryConfig );
|
||||||
|
|
||||||
|
// Hack: add suggested next timestep.
|
||||||
|
assert(!localCellData.empty());
|
||||||
|
localCellData.insert("OPMEXTRA",
|
||||||
|
UnitSystem::measure::identity,
|
||||||
|
std::vector<double>(1, nextstep),
|
||||||
|
data::TargetType::RESTART_SOLUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, substep);
|
writeTimeStepWithCellProperties(timer, localState, localCellData, localWellState, substep);
|
||||||
|
|||||||
@@ -84,6 +84,10 @@ namespace Opm {
|
|||||||
Output& outputWriter,
|
Output& outputWriter,
|
||||||
const std::vector<int>* fipnum = nullptr);
|
const std::vector<int>* fipnum = nullptr);
|
||||||
|
|
||||||
|
double suggestedNextStep() const { return suggested_next_timestep_; }
|
||||||
|
|
||||||
|
void setSuggestedNextStep(const double x) { suggested_next_timestep_ = x; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <class Solver, class State, class WellState, class Output>
|
template <class Solver, class State, class WellState, class Output>
|
||||||
SimulatorReport stepImpl( const SimulatorTimer& timer,
|
SimulatorReport stepImpl( const SimulatorTimer& timer,
|
||||||
|
|||||||
Reference in New Issue
Block a user