opm-simulators
Opm::NewtonIterationContext Struct Reference

Context for iteration-dependent decisions in the Newton solver. More...

#include <NewtonIterationContext.hpp>

Public Member Functions

int iteration () const
 Getters. More...
 
bool inLocalSolve () const
 Whether we are inside a domain-local solve (NLDD).
 
bool timestepInitialized () const
 Whether timestep initialization has been performed.
 
bool needsTimestepInit () const
 Semantic Queries. More...
 
bool isFirstGlobalIteration () const
 Is this the first iteration of the global solve (not a local solve)? Use for one-time-per-timestep logic.
 
bool withinNupcol (int nupcol) const
 Are we within the NUPCOL iteration window? Always uses global iteration regardless of local solve state. More...
 
bool shouldRelax (int strictIterations) const
 Should tolerances be relaxed based on iteration count? Uses local iteration for local solves, global otherwise. More...
 
bool shouldRunInnerWellIterations (int maxIter) const
 Whether inner well iterations should run. More...
 
void markTimestepInitialized ()
 State Mutations. More...
 
void advanceIteration ()
 Advance the current iteration counter. More...
 
void resetForNewTimestep ()
 Reset all state for a new timestep.
 
NewtonIterationContext forLocalSolve () const
 Create a context for a domain-local solve. More...
 

Detailed Description

Context for iteration-dependent decisions in the Newton solver.

Provides explicit state for iteration-dependent behavior:

  • Global iteration: The top-level Newton iteration count (0-based). Used for NUPCOL checks, group controls, gas lift timing.
  • Local iteration: Iteration count within a nested domain solve. Starts at 0 for each domain.
  • Timestep initialization: One-time setup at the start of each timestep, independent of iteration number.

For domain-local solves, forLocalSolve() creates a context that preserves the global iteration but resets local state.

Member Function Documentation

◆ advanceIteration()

void Opm::NewtonIterationContext::advanceIteration ( )
inline

Advance the current iteration counter.

Advances the local iteration during domain-local solves, and the global iteration otherwise.

◆ forLocalSolve()

NewtonIterationContext Opm::NewtonIterationContext::forLocalSolve ( ) const
inline

Create a context for a domain-local solve.

Preserves global iteration, resets local iteration to 0.

◆ iteration()

int Opm::NewtonIterationContext::iteration ( ) const
inline

Getters.

Current iteration number (0-based). Returns the local iteration during domain-local solves, and the global iteration otherwise.

◆ markTimestepInitialized()

void Opm::NewtonIterationContext::markTimestepInitialized ( )
inline

State Mutations.

Mark timestep initialization as complete.

◆ needsTimestepInit()

bool Opm::NewtonIterationContext::needsTimestepInit ( ) const
inline

Semantic Queries.

Should timestep initialization run? True only on first global iteration before initialization is done.

◆ shouldRelax()

bool Opm::NewtonIterationContext::shouldRelax ( int  strictIterations) const
inline

Should tolerances be relaxed based on iteration count? Uses local iteration for local solves, global otherwise.

◆ shouldRunInnerWellIterations()

bool Opm::NewtonIterationContext::shouldRunInnerWellIterations ( int  maxIter) const
inline

Whether inner well iterations should run.

Returns false during local solves, otherwise true while below maxIter.

◆ withinNupcol()

bool Opm::NewtonIterationContext::withinNupcol ( int  nupcol) const
inline

Are we within the NUPCOL iteration window? Always uses global iteration regardless of local solve state.


The documentation for this struct was generated from the following file: