Add afterStep() hook to NewtonSolver::step().

Also implement (noop) afterStep() for BlackoilModel, and
make the hooks take non-const versions of the state data.
This commit is contained in:
Atgeirr Flø Rasmussen committed 2015-05-21 10:43:04 +02:00
1 parent f89297255f
commit 270a7c59fb
3 files changed
+32 -7

No files matched your search

+14 -5
View File
@@ -118,12 +118,21 @@ namespace Opm {
void setThresholdPressures(const std::vector<double>& threshold_pressures_by_face);
/// Called once before each time step.
/// \param[in] dt time step size
/// \param[in] reservoir_state reservoir state variables
/// \param[in] well_state well state variables
/// \param[in] dt time step size
/// \param[in, out] reservoir_state reservoir state variables
/// \param[in, out] well_state well state variables
void prepareStep(const double dt,
const ReservoirState& reservoir_state,
const WellState& well_state);
ReservoirState& reservoir_state,
WellState& well_state);
/// Called once after each time step.
/// In this class, this function does nothing.
/// \param[in] dt time step size
/// \param[in, out] reservoir_state reservoir state variables
/// \param[in, out] well_state well state variables
void afterStep(const double dt,
ReservoirState& reservoir_state,
WellState& well_state);
/// Assemble the residual and Jacobian of the nonlinear system.
/// \param[in] reservoir_state reservoir state variables
+15 -2
View File
@@ -228,8 +228,8 @@ namespace detail {
void
BlackoilModel<Grid>::
prepareStep(const double dt,
const ReservoirState& reservoir_state,
const WellState& /* well_state */)
ReservoirState& reservoir_state,
WellState& /* well_state */)
{
pvdt_ = geo_.poreVolume() / dt;
if (active_[Gas]) {
@@ -240,6 +240,19 @@ namespace detail {
template <class Grid>
void
BlackoilModel<Grid>::
afterStep(const double /* dt */,
ReservoirState& /* reservoir_state */,
WellState& /* well_state */)
{
// Does nothing in this model.
}
template <class Grid>
int
BlackoilModel<Grid>::
+3
View File
@@ -122,6 +122,9 @@ namespace Opm
linearIterations_ += linearIterations;
newtonIterations_ += iteration;
// Do model-specific post-step actions.
model_.afterStep(dt, reservoir_state, well_state);
return linearIterations;
}