mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Make nonlinearIteration() the only interface to the model.
This means that details such as calling assemble(), solveJacobianSystem(), updateState() etc. are now left to the model class. This will make it easier to create new model classes with different behaviour (such as sequential models).
This commit is contained in:
@@ -76,6 +76,17 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
/// Class used for reporting the outcome of a nonlinearIteration() call.
|
||||
struct IterationReport
|
||||
{
|
||||
bool failed;
|
||||
bool converged;
|
||||
int linear_iterations;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/// Traits to encapsulate the types used by classes using or
|
||||
/// extending this model. Forward declared here, must be
|
||||
/// specialised for each concrete model class.
|
||||
@@ -155,6 +166,22 @@ namespace Opm {
|
||||
ReservoirState& reservoir_state,
|
||||
WellState& well_state);
|
||||
|
||||
/// Called once per nonlinear iteration.
|
||||
/// This model will perform a Newton-Raphson update, changing reservoir_state
|
||||
/// and well_state. It will also use the nonlinear_solver to do relaxation of
|
||||
/// updates if necessary.
|
||||
/// \param[in] iteration should be 0 for the first call of a new timestep
|
||||
/// \param[in] dt time step size
|
||||
/// \param[in] nonlinear_solver nonlinear solver used (for oscillation/relaxation control)
|
||||
/// \param[in, out] reservoir_state reservoir state variables
|
||||
/// \param[in, out] well_state well state variables
|
||||
template <class NonlinearSolverType>
|
||||
IterationReport nonlinearIteration(const int iteration,
|
||||
const double dt,
|
||||
NonlinearSolverType& nonlinear_solver,
|
||||
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
|
||||
@@ -290,6 +317,9 @@ namespace Opm {
|
||||
std::vector<int> primalVariable_;
|
||||
V pvdt_;
|
||||
std::vector<std::string> material_name_;
|
||||
std::vector<std::vector<double>> residual_norms_history_;
|
||||
double current_relaxation_;
|
||||
V dx_old_;
|
||||
|
||||
// --------- Protected methods ---------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user