solver_state_2d Module

The local block may be a sub-block of the global grid under MPI decomposition (a decomp_2d component + per-rank nx_local/ny_local); for a single rank the local block equals the global grid.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: neq2d = 4

Number of conserved variables for 2D Euler: rho, rhou, rhov, E.


Derived Types

type, public ::  solver_state_2d_t

Components

Type Visibility Attributes Name Initial
type(config_2d_t), public :: cfg
integer, public :: nx = 0
integer, public :: ny = 0
integer, public :: nx_local = 0
integer, public :: ny_local = 0
real(kind=wp), public :: dx = 0.0_wp
real(kind=wp), public :: dy = 0.0_wp
type(mesh_2d_t), public :: mesh

Curvilinear grid metrics (uniform fast-path keeps dx/dy above).

integer, public :: halo_width = 3
type(decomp_2d_t), public :: decomp_2d

2D block decomposition for this rank (whole-domain at np=1).

type(block_t), public :: blocks(1)

Per-block discretization descriptor (one block; phases beyond 1 may extend).

logical, public :: use_fds = .true.

.true. when the active flux scheme is flux-difference splitting (FDS); .false. for flux-vector splitting (FVS). Set by init_from_config_2d.

real(kind=wp), public, allocatable :: ub(:,:,:)

Conserved variables, halo-padded: (neq2d, 1-h : nx_local+h, 1-h : ny_local+h).

real(kind=wp), public, allocatable :: resid(:,:,:)

Spatial residual R(Q), halo-padded like ub.

real(kind=wp), public, allocatable :: scratch1(:,:,:)

RK stage-save scratch array, halo-padded like ub.

real(kind=wp), public, allocatable :: scratch2(:,:,:)

second RK stage-save scratch (rk4/ssprk54), halo-padded like ub.

real(kind=wp), public, allocatable :: scratch3(:,:,:)

Third RK stage-save scratch (ssprk54: holds u3; L(u3) stays in resid), halo-padded like ub.

real(kind=wp), public :: dt = 0.0_wp

Current time-step size Δt [s]. Set by the time-integration layer.

procedure(reconstructor_iface), public, pointer, nopass :: reconstruct => null()

Reconstruction scheme dispatch + stencil geometry (bound by schemes_2d).

integer, public :: stencil_width = 0
integer, public :: stencil_start_offset = 0
real(kind=wp), public, allocatable :: rs_fx(:,:)

Persistent residual-assembly scratch (allocated once in compute_resid_2d, reused every RK substage; sizes fixed by nx_local/ny_local/stencil_width).

real(kind=wp), public, allocatable :: rs_gy(:,:)
real(kind=wp), public, allocatable :: rs_stencil(:,:)
real(kind=wp), public, allocatable :: fp_all(:,:,:)

FVS split-flux scratch, halo-padded like ub (neq2d, 1-h:nx+h, 1-h:ny+h). Used ONLY by the FDM+FVS residual (compute_resid_fdm_fvs_2d); allocated lazily on first FVS call (ensure_fvs_scratch_2d) so FDS/FVM runs never pay for them. fp_all holds F^+ (positive split flux), fm_all holds F^-; both are re-filled per sweep (x then y) since the split is direction-dependent.

real(kind=wp), public, allocatable :: fm_all(:,:,:)

Subroutines

public subroutine init_from_config_2d(state, cfg)

Build mesh from config and derive grid scalars.

Arguments

Type IntentOptional Attributes Name
type(solver_state_2d_t), intent(inout) :: state
type(config_2d_t), intent(in) :: cfg

public subroutine allocate_work_arrays_2d(state)

Allocate the conserved-variable array with halo layers on both axes.

Arguments

Type IntentOptional Attributes Name
type(solver_state_2d_t), intent(inout) :: state