Add new step() overload taking initial states separately.

This commit is contained in:
Atgeirr Flø Rasmussen 2016-01-15 15:16:40 +01:00
parent fab64f5afb
commit 19f4cef6c1
2 changed files with 36 additions and 5 deletions

View File

@ -76,15 +76,32 @@ namespace Opm {
/// Take a single forward step, after which the states will be modified /// Take a single forward step, after which the states will be modified
/// according to the physical model. /// according to the physical model.
/// \param[in] dt time step size /// \param[in] dt time step size
/// \param[in] reservoir_state reservoir state variables /// \param[in, out] reservoir_state reservoir state variables
/// \param[in] well_state well state variables /// \param[in, out] well_state well state variables
/// \return number of linear iterations used /// \return number of linear iterations used
int int
step(const double dt, step(const double dt,
ReservoirState& reservoir_state, ReservoirState& reservoir_state,
WellState& well_state); WellState& well_state);
/// Take a single forward step, after which the states will be modified
/// according to the physical model. This version allows for the
/// states passed as in/out arguments to be different from the initial
/// states.
/// \param[in] dt time step size
/// \param[in] initial_reservoir_state reservoir state variables at start of timestep
/// \param[in] initial_well_state well state variables at start of timestep
/// \param[in, out] reservoir_state reservoir state variables
/// \param[in, out] well_state well state variables
/// \return number of linear iterations used
int
step(const double dt,
const ReservoirState& initial_reservoir_state,
const WellState& initial_well_state,
ReservoirState& reservoir_state,
WellState& well_state);
/// Number of nonlinear solver iterations used in all calls to step(). /// Number of nonlinear solver iterations used in all calls to step().
unsigned int nonlinearIterations() const; unsigned int nonlinearIterations() const;

View File

@ -85,9 +85,23 @@ namespace Opm
step(const double dt, step(const double dt,
ReservoirState& reservoir_state, ReservoirState& reservoir_state,
WellState& well_state) WellState& well_state)
{
return step(dt, reservoir_state, well_state, reservoir_state, well_state);
}
template <class PhysicalModel>
int
NonlinearSolver<PhysicalModel>::
step(const double dt,
const ReservoirState& initial_reservoir_state,
const WellState& initial_well_state,
ReservoirState& reservoir_state,
WellState& well_state)
{ {
// Do model-specific once-per-step calculations. // Do model-specific once-per-step calculations.
model_->prepareStep(dt, reservoir_state, well_state); model_->prepareStep(dt, initial_reservoir_state, initial_well_state);
int iteration = 0; int iteration = 0;