include/pops/runtime/system/system_stepper.hpp File ReferenceΒΆ

adc_cpp: include/pops/runtime/system/system_stepper.hpp File Reference
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
system_stepper.hpp File Reference

SystemStepper: the TIME ADVANCE responsibility extracted from the god-class System::Impl (audit Lot B, continuation of SystemFieldSolver #176). More...

#include <pops/core/state/state.hpp>
#include <pops/core/foundation/types.hpp>
#include <pops/coupling/source/coupled_source_program.hpp>
#include <pops/mesh/execution/for_each.hpp>
#include <pops/parallel/comm.hpp>
#include <pops/runtime/context/grid_context.hpp>
#include <stdexcept>
#include <algorithm>
#include <cmath>
#include <limits>
#include <string>
#include <vector>
+ Include dependency graph for system_stepper.hpp:

Go to the source code of this file.

Classes

class  pops::stepper::SystemStepper< Impl >
 SystemStepper<Impl>: see the contract above. More...
 

Namespaces

namespace  pops
 
namespace  pops::stepper
 

Enumerations

enum class  pops::stepper::SplitScheme { pops::stepper::Lie , pops::stepper::Strang }
 Time SPLITTING policy of the macro-step (hyperbolic transport H + source stage S). More...
 

Detailed Description

SystemStepper: the TIME ADVANCE responsibility extracted from the god-class System::Impl (audit Lot B, continuation of SystemFieldSolver #176).

Extracted VERBATIM from python/system.cpp: no change to numerics, to the CFL formula, to the stride/substeps cadence, to the semantics of the macro-step counter, to the fences, nor to the order (solve_fields; advance; source stage; couplings). STRICTLY bit-identical – the code is moved as-is, only access to the SHARED members of Impl (sp, fields_, aux, couplings, t, macro_step_, geom, pgeom_, polar_) goes through the back-pointer owner_->.

CONTRACT / INVARIANTS

  • ORCHESTRATES the time advance: step(dt), advance(dt, nsteps), step_cfl(cfl), step_adaptive(cfl), plus the cadence helpers (stride_due), the Schur-condensed source stage (run_source_stage) and the inter-species couplings (apply_couplings) that the steps invoke AFTER transport.
  • READS (without owning) via owner_->: the block list (sp) and each advance closure (s.advance), the elliptic solver (fields_, for solve_fields() at the head of the step and fields_.ell_phi() read by the source stage), the SHARED aux and its B_z component (kAuxBaseComps), the coupling list, the time t and the macro_step_ counter (which it advances), the geometry (Cartesian geom / polar pgeom_) and the polar_ flag for the CFL physical step h.
  • CFL PHYSICAL STEP h: Cartesian = min(dx, dy); POLAR = min(dr, r_min * dtheta) (the azimuthal step r*dtheta is minimal at the inner radius r_min of the ring -> most constraining edge).
  • MULTIRATE CADENCE INVARIANT (hold-then-catch-up): a block of cadence M is HELD as long as (macro_step + 1) % M != 0, then advances by an effective step M*dt at the macro-step where (macro_step + 1) % M == 0 (END of window). macro_step_ is incremented ONCE per macro-step, AFTER the advance of the blocks and the couplings. DO NOT reorder solve_fields; advance; run_source_stage; apply_couplings; t += dt; ++macro_step_.
  • PER-BLOCK CFL FORMULA (substeps-aware, post-#121): dt <= cfl * h * substeps_b / (stride_b * w_b); the global dt is the min over the evolving blocks. PRESERVED as is.

Since System::Impl stays PRIVATE to python/system.cpp, this helper is a TEMPLATE parameterized on the real Impl type (same technique as system_field_solver / native_loader): python/system.cpp instantiates it with System::Impl after defining Impl. owner_ is an Impl* (the helper lifetime is subordinate to that of Impl). System::step / advance / step_cfl / step_adaptive become simple delegations to stepper_.