20 #ifndef OPM_NEWTON_ITERATION_CONTEXT_HPP 21 #define OPM_NEWTON_ITERATION_CONTEXT_HPP 54 return inLocalSolve_ ? localIteration_ : globalIteration_;
69 return !timestepInitialized_ && !inLocalSolve_;
76 return globalIteration_ == 0 && !inLocalSolve_;
83 return globalIteration_ < nupcol;
97 if (inLocalSolve_)
return false;
98 return globalIteration_ < maxIter;
106 timestepInitialized_ =
true;
124 globalIteration_ = 0;
126 timestepInitialized_ =
false;
127 inLocalSolve_ =
false;
134 return {globalIteration_, 0,
true,
true};
139 : globalIteration_(globalIter), localIteration_(localIter)
140 , inLocalSolve_(localSolve), timestepInitialized_(tsInit)
142 int globalIteration_ = 0;
143 int localIteration_ = 0;
144 bool inLocalSolve_ =
false;
145 bool timestepInitialized_ =
false;
151 template<
class Problem>
156 , saved_(problem.iterationContext())
163 problem_.mutableIterationContext() = saved_;
181 #endif // OPM_NEWTON_ITERATION_CONTEXT_HPP Context for iteration-dependent decisions in the Newton solver.
Definition: NewtonIterationContext.hpp:43
bool shouldRunInnerWellIterations(int maxIter) const
Whether inner well iterations should run.
Definition: NewtonIterationContext.hpp:95
NewtonIterationContext forLocalSolve() const
Create a context for a domain-local solve.
Definition: NewtonIterationContext.hpp:132
bool timestepInitialized() const
Whether timestep initialization has been performed.
Definition: NewtonIterationContext.hpp:61
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
RAII guard for NLDD domain-local iteration context.
Definition: NewtonIterationContext.hpp:152
void resetForNewTimestep()
Reset all state for a new timestep.
Definition: NewtonIterationContext.hpp:122
bool needsTimestepInit() const
Semantic Queries.
Definition: NewtonIterationContext.hpp:67
bool isFirstGlobalIteration() const
Is this the first iteration of the global solve (not a local solve)? Use for one-time-per-timestep lo...
Definition: NewtonIterationContext.hpp:74
bool withinNupcol(int nupcol) const
Are we within the NUPCOL iteration window? Always uses global iteration regardless of local solve sta...
Definition: NewtonIterationContext.hpp:81
int iteration() const
Getters.
Definition: NewtonIterationContext.hpp:52
void advanceIteration()
Advance the current iteration counter.
Definition: NewtonIterationContext.hpp:112
void markTimestepInitialized()
State Mutations.
Definition: NewtonIterationContext.hpp:104
bool shouldRelax(int strictIterations) const
Should tolerances be relaxed based on iteration count? Uses local iteration for local solves...
Definition: NewtonIterationContext.hpp:88
bool inLocalSolve() const
Whether we are inside a domain-local solve (NLDD).
Definition: NewtonIterationContext.hpp:58