Opm::NewtonIterationContext Struct Reference

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

#include <NewtonIterationContext.hpp>

Public Member Functions

 NewtonIterationContext ()=default
 
int iteration () const
 Getters. More...
 
bool inLocalSolve () const
 Whether we are inside a domain-local solve (NLDD). More...
 
bool timestepInitialized () const
 Whether timestep initialization has been performed. More...
 
bool needsTimestepInit () const
 Semantic Queries. More...
 
bool isFirstGlobalIteration () const
 
bool withinNupcol (int nupcol) const
 
bool shouldRelax (int strictIterations) const
 
bool shouldRunInnerWellIterations (int maxIter) const
 
void markTimestepInitialized ()
 State Mutations. More...
 
void advanceIteration ()
 
void resetForNewTimestep ()
 Reset all state for a new timestep. More...
 
NewtonIterationContext forLocalSolve () const
 

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.

Constructor & Destructor Documentation

◆ NewtonIterationContext()

Opm::NewtonIterationContext::NewtonIterationContext ( )
default

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.

Referenced by Opm::FvBaseProblem< TypeTag >::advanceIteration().

◆ forLocalSolve()

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

Create a context for a domain-local solve. Preserves global iteration, resets local iteration to 0.

Referenced by Opm::LocalContextGuard< Problem >::LocalContextGuard().

◆ inLocalSolve()

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

Whether we are inside a domain-local solve (NLDD).

◆ isFirstGlobalIteration()

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

Is this the first iteration of the global solve (not a local solve)? Use for one-time-per-timestep logic

◆ 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.

Referenced by shouldRelax().

◆ markTimestepInitialized()

void Opm::NewtonIterationContext::markTimestepInitialized ( )
inline

State Mutations.

Mark timestep initialization as complete.

Referenced by Opm::FvBaseProblem< TypeTag >::markTimestepInitialized().

◆ needsTimestepInit()

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

Semantic Queries.

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

◆ resetForNewTimestep()

void Opm::NewtonIterationContext::resetForNewTimestep ( )
inline

Reset all state for a new timestep.

Referenced by Opm::FvBaseProblem< TypeTag >::resetIterationForNewTimestep().

◆ 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.

References iteration().

◆ 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.

◆ timestepInitialized()

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

Whether timestep initialization has been performed.

◆ 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: