Procedures

ProcedureLocationProcedure TypeDescription
agree_outcome checkpoint_io Function

Collective outcome agreement (write-side): failed = any rank not ok. On failure the optional status pair gets fail_text; on SUCCESS the pair is left exactly as the caller preset it — hence intent(inout), NOT intent(out) (which would leave the caller's values undefined on the success path). COLLECTIVE — every rank must call.

all_finite_2d mesh_2d Function

True iff every element of a 2D coordinate array is finite (no NaN/Inf).

allocate_work_arrays solver_state Subroutine

Allocate all solver work arrays owned by a solver instance.

Read more…
allocate_work_arrays_2d solver_state_2d Subroutine

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

apply_bcs boundary_conditions Subroutine

Method dispatcher for boundary-condition enforcement.

Read more…
apply_bcs_fdm boundary_conditions Subroutine

Update halo cells of state%ub from the current interior solution and BC types (NODAL / finite-difference path). Rank-aware: only edge ranks act.

Read more…
apply_bcs_fdm_2d boundary_2d Subroutine

Fill the four halo bands for the NODAL finite-difference (FDM) path.

Read more…
apply_bcs_fvm_1d boundary_conditions Subroutine

Update ghost cells of state%ub for the CELL-CENTERED finite-volume path.

Read more…
apply_halos_2d boundary_2d Subroutine

Fill all four halo bands per cfg % bc_* edge type.

Read more…
apply_initial_condition initial_conditions Subroutine

Fill state%ub (interior + halo) with the initial condition selected by cfg%problem_type. Boundary halo cells are also pre-populated for Dirichlet-style BCs (dirichlet/inflow/supersonic_inlet) which use early return in apply_bcs.

apply_initial_condition_2d initial_conditions_2d Subroutine

Fill state % ub over interior cells according to cfg % problem_type.

apply_left_bc_into_halo boundary_conditions Subroutine

Compute the left-boundary ghost state and broadcast it across the h halo cells state%ub(:, 1-h .. 0).

apply_periodic_halos_2d boundary_2d Subroutine

Fill all four halo bands by periodic wrap of the opposite interior edge.

apply_right_bc_into_halo boundary_conditions Subroutine

Compute the right-boundary ghost state and broadcast it across the h halo cells state%ub(:, n_local+1 .. n_local+h).

apply_weno_js_generic weno_family Subroutine

Generic Jiang-Shu WENO reconstruction for odd-width schemes.

Read more…
ausm_plus euler_physics Subroutine

AUSM+ FDS scheme (AUSM family).

Read more…
axis_split domain_decomposition_2d Subroutine

Split one Cartesian axis (n_global cells across dim process slots) for the slot at coord. Delegates to the shared 1D slab-partition helpers so the per-axis block layout matches the 1D decompose() exactly (single source of truth: domain_decomposition%rank_local_count/rank_first_global).

band_lapack_solve time_integration Subroutine

Banded linear solver using LAPACK dgbsv.

Read more…
band_lu_solve time_integration Subroutine

Banded Gaussian elimination without pivoting. Band storage: AB(ku+1+i-j, j) = A(i,j). On exit x = A^{-1} b. The matrix ab_loc is overwritten with LU factors.

bcast_bytes cortex_run_attached_mod Subroutine
bdf2_step time_integration Subroutine

Advance the solution by one time step using the BDF2 (Gear) scheme.

Read more…
bdf2_step_serial_body time_integration Subroutine

Serial Newton + banded-solve body for BDF2 (including the backward-Euler bootstrap path). Operates entirely on state%ub / state%bdf2_ub_prev / state%resid at whatever size state%decomp%n_local says. Does NOT call compute_resid_glob — the wrapper does, from every rank, after restore_local_layout.

be_u32_to_i64 cortex_link Function

Decode a 4-byte big-endian length prefix as an UNSIGNED 32-bit value widened to int64. Each byte is masked into int64 before the shift/OR, so a wire value with the high bit set (0x80000000.. 0xFFFFFFFF) decodes as a large positive int64 — not a negative int32 (the desync bug). Range: [0, 4294967295].

beuler_step time_integration Subroutine

Advance the solution by one time step using backward (implicit) Euler.

Read more…
beuler_step_serial_body time_integration Subroutine

Serial (rank-aware-decomp-agnostic) Newton + banded-solve body for backward Euler. Operates entirely on state%ub / state%resid; the caller is responsible for sizing the state correctly. Does NOT call compute_resid_glob — the wrapper does, after restore_local_layout brings every rank back to its local view so the par_sum_real call involves all ranks.

Read more…
build_counts_displs implicit_gather_scatter Subroutine
build_field_table config Function

Bind the 62-entry field-descriptor table (ABI schema order) to cfg. Entry order IS the externally visible schema index — append only.

build_field_table_2d config_2d Function

Bind the 38-entry field-descriptor table (frozen ensure_schema_2d order) to cfg. No casefold flags: the 2D reader already stores lowercased selectors, and the engine's choice compare casefolds the candidate anyway, preserving the direct-call validate_config_2d mixed-case tolerance. Help texts are empty (the 2D schema never published help).

build_mesh_2d_fdm_curvilinear mesh_2d Subroutine

Build a curvilinear-FDM mesh from a single-block Plot3D grid: the Plot3D points are treated as NODES (mesh % nx = ni, mesh % ny = nj, nodes lying ON the boundaries), mesh % uniform = .false., dx/dy = 0 (unused on the curvilinear path), then compute_metrics_fdm_2d fills the nodal metrics. Distinct from build_mesh_2d_global's 'plot3d' branch, which treats the points as CELL CORNERS (nx = ni-1 cells) and builds finite-volume metrics.

build_mesh_2d_global mesh_2d Subroutine

Build the global (whole-domain) mesh from either a uniform specification or a Plot3D grid file. For 'uniform', nx/ny are read from the caller. For 'plot3d', ni/nj are read from the file and nx/ny are written back (intent(inout)) so the caller knows the derived sizes. Calls compute_metrics_2d at the end and propagates its status — a metric failure (e.g. a folded or zero-area cell) fails the build.

build_mesh_2d_local mesh_2d Subroutine

Slice the (global) metric arrays of mesh into this rank's local sub-block. Cells ix_first..ix_first+nx_local-1, iy_first..iy_first+ny_local-1 (1-based global). xi-faces span nx_local+1 columns starting at global column ix_first; eta-faces span ny_local+1 rows starting at iy_first. Shared inter-rank faces are identical on both ranks because both slice the same global metrics. No-op for uniform grids (they use scalar dx/dy).

build_mesh_2d_uniform_nodal mesh_2d Subroutine

Build a uniform Cartesian NODAL mesh for the finite-difference (FDM) path. Unlike build_mesh_2d_global's 'uniform' branch (which stores CELL counts and derives FV metrics), this stores NODE counts directly: mesh % nx = npx, mesh % ny = npy, with grid points lying ON both boundaries. The spacing is dx = (x_right - x_left) / (npx - 1) (equal to the FV cell size for the same number of cells). The FV metric arrays (vol, s_xi, s_eta, xc, yc) are left UNALLOCATED on purpose — the uniform FDM residual divides by the scalar dx/dy, not by vol — so this builder does NOT call compute_metrics_2d.

build_mesh_cellcentered_1d mesh_1d Subroutine

Build cell-centered coordinates and widths for the FVM path.

Read more…
build_mesh_cellcentered_global mesh_1d Subroutine

Build the replicated GLOBAL cell-centered mesh for a NON-UNIFORM FVM grid.

Read more…
build_mesh_cellcentered_local mesh_1d Subroutine

Build this rank's local cell-centered coordinates and widths (FVM path).

Read more…
build_mesh_global mesh_1d Subroutine

Build the replicated global mesh; for file grids, derive n_cell/endpoints.

build_mesh_local mesh_1d Subroutine

Slice the replicated global mesh into this rank's local node arrays.

bytes_to_string protocol_codec Subroutine
c_cortex_close cortex_link Interface
c_cortex_connect_tcp cortex_link Interface
c_cortex_recv_all cortex_link Interface
c_cortex_send_all cortex_link Interface
cart_comm_2d mpi_cart_2d Function

Return the Cartesian communicator handle.

Read more…
cart_is_setup mpi_cart_2d Function

True once cart_setup_2d / setup_decomp_2d has created the Cartesian comm.

Read more…
cart_rank_2d mpi_cart_2d Function

This rank's index within the Cartesian communicator.

Read more…
cart_setup_2d mpi_cart_2d Subroutine

Create the Cartesian communicator (dims auto-chosen by MPI_Dims_create) and return this rank's per-rank decomposition.

Read more…
case_base_dir path_util Function

The case directory used to anchor a namelist's relative file paths: the explicit override when supplied and non-empty (the OpenFOAM -case / GUI-supplied case dir), otherwise the namelist file's own directory. This is the single place the "override-or-namelist-dir" rule lives.

casefolds_on_set config_schema_2d Function

Keys whose value read_config_2d stores lowercased (selector-like fields): every kind_choice field in the table, PLUS grid_type and output_format, which are kind_string rather than kind_choice but get the same historical to_lower-on-parse treatment, so the setter must special-case them alongside the choice keys. Table-driven rather than a hand-maintained key list, but yields the identical 12 keys the old list named (10 choice-kind fields + these 2 string-kind fields).

central2_reconstruct central2 Subroutine

Second-order central reconstruction in physical space.

Read more…
cfd_solver_call_udf initial_conditions Interface
cfd_solver_get_pid initial_conditions Interface
cfd_solver_host_platform initial_conditions Interface
check_plot3d_dims mesh_2d Subroutine

Validate a Plot3D header: lower bound (>= 2 nodes per axis) and upper sanity caps (per-axis and total node count). Returns is_ok=.false. with a descriptive message on violation.

choice_violation_message config_engine Function

Compose the historical choice-violation text for one field.

ckpt_filename checkpoint_io Function

'_.bin' (width-agnostic I0 — never overflows the field).

classify_build run_banner Subroutine

Classify a compiler_options() string as debug/release/unknown and return the optimization flag actually present. Pure string scan; the last '-O' token wins (compilers honour the last -O). No MPI / no intrinsics.

compute_boundary_ghost boundary_conditions Subroutine

Compute one boundary ghost-state vector from a boundary cell. Caller decides whether to broadcast the value across all halo cells or to use the per-cell mirror pattern (signalled by @p per_cell_pattern).

Read more…
compute_candidate_reconstructions weno_family Subroutine

Evaluate candidate reconstruction polynomials from tabulated coefficients.

Read more…
compute_candidate_smoothness weno_family Subroutine

Evaluate candidate Jiang-Shu smoothness indicators from quadratic forms.

Read more…
compute_dt_2d time_integration_2d Function
compute_eigensystem euler_physics Subroutine

Compute the right eigenvector matrix K and its inverse K^{-1} of the Euler Jacobian at a given state.

Read more…
compute_eigensystem_2d euler_physics_2d Subroutine

Right-eigenvector matrix K and its inverse for the flux Jacobian in direction dir (1 = x: eigenvalues u-c,u,u,u+c; 2 = y: v-c,v,v,v+c). Columns of K, conserved variables Q=(rho,rho u,rho v,E): x: [1, u-c, v, H-u c] [1, u, v, q2] [0, 0, 1, v] [1, u+c, v, H+u c] y: [1, u, v-c, H-v c] [1, u, v, q2] [0, 1, 0, u] [1, u, v+c, H+v c] where H=(E+p)/rho, q2=0.5*(u^2+v^2). K^{-1} via LAPACK getrf/getri.

compute_euler_flux euler_physics Subroutine

Compute the Euler flux vector F(Q) for a given conserved state.

Read more…
compute_euler_flux_2d euler_physics_2d Subroutine

Compute both directional flux vectors F (x) and G (y) for state Q.

compute_full_stencil_smoothness weno_family Subroutine

Evaluate a quadratic smoothness form on the full stencil.

Read more…
compute_max_wave_speed euler_physics Function

Return the global maximum wave speed max_i(|u_i| + c_i).

Read more…
compute_max_wave_speed_2d euler_physics_2d Function

Global maximum signal speed max_{i,j}( max(|u|,|v|) + c ) over interior cells.

Read more…
compute_metrics_2d mesh_2d Subroutine

Compute finite-volume metrics from node coordinates already in mesh%x_node / mesh%y_node. Allocates (with stat=) and fills vol(nx,ny), s_xi(2,nx+1,ny), s_eta(2,nx,ny+1), xc(nx,ny), yc(nx,ny). Returns is_ok=.false. and a diagnostic message naming the first (i,j) with non-positive cell area.

Read more…
compute_metrics_fdm_2d mesh_2d Subroutine

Compute NODAL transformation metrics for curvilinear FDM from the node coordinates already in mesh%x_node / mesh%y_node (shape (nx, ny), the Plot3D points treated as nodes; unit computational spacing dxi=deta=1).

Read more…
compute_resid spatial_discretization Subroutine

Compute the spatial residual R(Q), dispatching on the block's method.

Read more…
compute_resid_2d spatial_discretization_2d Subroutine
compute_resid_2d_curvilinear spatial_discretization_2d Subroutine

Curvilinear residual: R = -(1/V)[ (Fhat_{i+1}-Fhat_i) + (Ghat_{j+1}-Ghat_j) ] with contravariant face fluxes Fhat = |S_xi| * f_n(qL,qR; n_xi), Ghat = |S_eta| * f_n(qL,qR; n_eta). Reconstruction is identical to the uniform path (uniform computational stencil); geometry enters via s_xi/s_eta/vol.

compute_resid_fdm spatial_discretization Subroutine

Compute the spatial residual R(Q) = -1/dx * (F_{i+1/2} - F_{i-1/2}).

Read more…
compute_resid_fdm_curv_2d spatial_discretization_2d Subroutine

Curvilinear-FDM (FDS) residual on NODAL transformation metrics: R = -(1/J)[ (Fhat_{i+1/2}-Fhat_{i-1/2}) + (Ghat_{j+1/2}-Ghat_{j-1/2}) ] with contravariant face fluxes Fhat = |S_xi| * f_n(qL,qR; n_xi), Ghat = |S_eta| * f_n(qL,qR; n_eta) and S_xi=mesh%sx_xi, S_eta=mesh%sx_eta, J=mesh%jac. Structurally identical to compute_resid_2d_curvilinear (the FVM curvilinear residual); only the metric SOURCE differs — FVM face-area vectors (s_xi/s_eta/vol) become the nodal transformation metrics here. Reconstruction and the contravariant flux machinery are reused verbatim. Freestream/GCL preservation (the Phase 1 gate) relies on the consistent metric evaluation in compute_metrics_fdm_2d: a constant flow telescopes the face fluxes to ~0.

Read more…
compute_resid_fdm_curv_fvs_2d spatial_discretization_2d Subroutine

Curvilinear-FDM FLUX-VECTOR-SPLITTING residual on NODAL transformation metrics (the FVS counterpart of compute_resid_fdm_curv_2d): R = -(1/J)[ (Fhat_{i+1/2}-Fhat_{i-1/2}) + (Ghat_{j+1/2}-Ghat_{j-1/2}) ] with the contravariant split-flux reconstruction Fhat_{i+1/2} = recon_L[ Fhat^+ ] + recon_R[ Fhat^- ], mirroring the uniform FVS residual compute_resid_fdm_fvs_2d but with CONTRAVARIANT split fluxes and the 1/J divisor.

Read more…
compute_resid_fdm_fvs_2d spatial_discretization_2d Subroutine

FDM + flux-vector-splitting residual (Shu-style conservative finite difference). Per direction: split the physical flux at every node (interior + halo) into F^+/F^-, reconstruct F^+ with the LEFT-biased stencil and F^- with the RIGHT-biased (mirror) stencil, sum the two reconstructions at each face, then take the conservative difference.

Read more…
compute_resid_fvm_1d spatial_discretization Subroutine

Compute the cell-centered finite-volume residual R_i = -1/dx_i * (F_{i+1/2} - F_{i-1/2}) on a block of cell averages.

Read more…
compute_resid_glob time_integration Subroutine

Accumulate the global L2 norm of the residual into state%resid_glob.

Read more…
compute_resid_glob_2d solver_runtime_2d Subroutine

Reduce the global L2 norm of the last-substage residual into ctx % resid_glob (2D analogue of the 1D compute_resid_glob): resid_glob = sqrt( par_sum(sum resid^2) / (nx_g*ny_g * neq2d) ) The denominator uses GLOBAL counts so the norm is decomposition- independent (np=1 == np=2 up to summation reordering, ~1e-13). Collective: every rank must call. Dummy widened type -> class (Q2c): called from the ctx2d_observe hook, whose own dummy is class(solver_run_context_2d_t) per the abstract run_loop_ctx_t interface, so the actual argument here is polymorphic and the callee must accept it as such.

compute_roe_averages euler_physics Subroutine

Compute Roe-averaged velocity, enthalpy, and sound speed.

Read more…
conclude_read checkpoint_io Function

Shared read epilogue: ONE collective decision point (the only par_lor of the read path's conclusion); returns the agreed failure flag so callers write if (conclude_read(...)) return. The failing rank reports its own err, other ranks the generic text; error-stop fallback when the caller passed no status arguments. COLLECTIVE — every rank must call. Status pair semantics as in agree_outcome: assigned only on failure, caller presets preserved on success (intent(inout)).

config_2d_get_integer config_schema_2d Subroutine

Read one integer-valued field from cfg by schema key.

config_2d_get_logical config_schema_2d Subroutine

Read one logical field from cfg by schema key.

config_2d_get_real config_schema_2d Subroutine

Read one scalar real-valued field from cfg by schema key.

config_2d_get_real3 config_schema_2d Subroutine

config_2d has no real3 parameters: always unknown-key.

config_2d_get_string config_schema_2d Subroutine

Read one string or choice-token field from cfg by schema key.

config_2d_set_integer config_schema_2d Subroutine

Write one integer-valued field in cfg by schema key.

config_2d_set_logical config_schema_2d Subroutine

Write one logical field in cfg by schema key.

config_2d_set_real config_schema_2d Subroutine

Write one scalar real-valued field in cfg by schema key.

config_2d_set_real3 config_schema_2d Subroutine

config_2d has no real3 parameters: always unknown-key.

config_2d_set_string config_schema_2d Subroutine

Write one string or choice-token field in cfg by schema key. Choice tokens (and grid_type/output_format) are lowercased on write, mirroring read_config_2d's to_lower-on-parse behavior: downstream dispatch (schemes_2d, boundary_2d/boundary_conditions, resolve_*_scheme) compares these fields with exact-case ==, so a value set through this wire-protocol path must land already-normalized.

config_default_integer config_schema Subroutine

Read the compiled-in default integer value for a schema key.

config_default_logical config_schema Subroutine

Read the compiled-in default logical value for a schema key.

config_default_real config_schema Subroutine

Read the compiled-in default scalar real value for a schema key.

config_default_real3 config_schema Subroutine

Read the compiled-in default length-3 real vector for a schema key.

config_default_string config_schema Subroutine

Read the compiled-in default string or choice token for a schema key.

config_get_integer config_schema Subroutine

Read one integer-valued field from cfg by schema key.

config_get_logical config_schema Subroutine

Read one logical field from cfg by schema key.

config_get_real config_schema Subroutine

Read one scalar real-valued field from cfg by schema key.

config_get_real3 config_schema Subroutine

Read one fixed-length real-3 field from cfg by schema key.

config_get_string config_schema Subroutine

Read one string or choice token from cfg by schema key.

config_schema_choice_count config_schema Function

Return the number of allowed choices for a choice-valued schema entry.

Read more…
config_schema_count config_schema Function

Return the number of published schema entries.

config_set_integer config_schema Subroutine

Write one integer-valued field in cfg by schema key.

Read more…
config_set_logical config_schema Subroutine

Write one logical field in cfg by schema key.

config_set_real config_schema Subroutine

Write one scalar real-valued field in cfg by schema key.

config_set_real3 config_schema Subroutine

Write one fixed-length real-3 field in cfg by schema key.

config_set_string config_schema Subroutine

Write one string or choice token in cfg by schema key.

cons_flux_1d_unit mesh_2d Subroutine

High-order freestream-consistent CONSERVATIVE-FLUX face values of a unit-spacing nodal line g(1..n): hf(1..n+1), where face iface lies between node iface-1 and node iface. The construction guarantees the telescoping identity

Read more…
cons_width mesh_2d Function

Stencil width for the high-order conservative-flux metric operator on n nodes: 6 (6th-order) when n>=6, 4 (4th-order) when n>=4, else 2 (the classical central scheme). Even widths keep the interior operator a symmetric central difference, whose conservative flux telescopes cleanly.

consume_cli_arg solver_runtime Subroutine

Dispatch one parsed CLI token onto the worker-CLI state.

Read more…
copy_choice config_schema Subroutine

Copy one 1-based choice-list item into value.

copy_current_solution solver_runtime Subroutine

Copy the current solution into primitive-variable arrays.

cortex_close_fd cortex_link Subroutine
cortex_open cortex_link Subroutine

Open a TCP loopback connection to the Cortex server.

cortex_recv_frame cortex_link Subroutine

Receive a length-prefixed frame. Both header and payload are returned as allocatable byte arrays (caller owns).

cortex_run_attached cortex_run_attached_mod Subroutine
cortex_send_frame cortex_link Subroutine

Send a length-prefixed frame: 4-byte BE header length, header bytes, 4-byte BE payload length, payload bytes. Both length prefixes are always present (payload length is zero when payload is empty; spec §12.2).

ctx1d_begin_work solver_runtime Subroutine

1D begin_work hook: start total wall-time accounting only when real work is about to begin, so a zero-step polling call does not consume elapsed time.

ctx1d_checkpoint solver_runtime Subroutine

1D write_checkpoint_now hook: write the checkpoint and own the failure policy.

ctx1d_finish_work solver_runtime Subroutine

1D finish_work hook: stop the total timer once the run finishes.

ctx1d_log_line solver_runtime Subroutine

1D log_iteration_line hook: one iteration summary line.

ctx1d_progress_residual solver_runtime Function

1D progress_residual hook: state residual norm for progress ticks.

ctx1d_raw_dt solver_runtime Function

1D raw_dt hook: recompute state % dt from the CFL condition when CFL-driven, then return the stored dt (Q2c; body lifted verbatim from the pre-engine run_solver_steps loop).

ctx1d_set_dt solver_runtime Subroutine

1D set_dt hook: store the engine's clipped dt.

ctx1d_snapshot solver_runtime Subroutine

1D write_snapshot_now hook: live snapshot side channel.

ctx1d_step solver_runtime Subroutine

1D step hook: advance one step, wrapped in the per-iteration timer.

ctx2d_checkpoint solver_runtime_2d Subroutine

2D write_checkpoint_now hook: write the checkpoint and own the failure policy.

ctx2d_log_line solver_runtime_2d Subroutine

2D log_iteration_line hook: one iteration summary line.

ctx2d_observe solver_runtime_2d Subroutine

2D observe hook: reduce the global L2 residual norm (collective, observation only — no state change).

ctx2d_raw_dt solver_runtime_2d Function

2D raw_dt hook: recompute and store state % dt from the adaptive CFL condition, then return it (Q2c; body lifted verbatim from the pre-engine run_solver_steps_2d loop).

ctx2d_set_dt solver_runtime_2d Subroutine

2D set_dt hook: store the engine's time_stop-clipped dt.

ctx2d_step solver_runtime_2d Subroutine

2D step hook: advance one step via the bound integrator.

curvilinear_sigma time_integration_2d Function

Per-cell contravariant spectral radius for the curvilinear CFL limit: (|u.Sxi| + c|Sxi| + |u.Seta| + c|Seta|) / V, with cell-averaged face vectors.

decode_advance protocol_codec Subroutine
decode_copy_solution protocol_codec Subroutine
decode_frame_header protocol_codec Subroutine
decode_keyed_request protocol_codec Subroutine

Decode the {"args":{"key":}} shape shared by GET_ and SET_. SET adds a value field; SET decoders call this first to extract the key, then decode value separately.

decode_load_config_inline protocol_codec Subroutine

Decode {"args":{"config":{key1:v1,key2:v2,...}}}. Walks every key, resolves it against =config_schema= via =schema_lookup=, and validates the corresponding value's JSON type. On the first unknown / mistyped entry returns =ok=.false.= with the offending key carried in =message=. Bounds checking is delegated to the caller (the SET dispatch path runs =solver_session_set_*= which re-validates against schema bounds); this decoder only validates type-level shape.

decode_load_namelist protocol_codec Subroutine
decode_run_to_end protocol_codec Subroutine
decode_set_value protocol_codec Subroutine

Decode the {"args":{"key":"...","value":}} request shape used by SET_. Caller passes =expected_kind= obtained from =schema_lookup= so this routine knows which JSON field to pull. Returns =ok=.false.= with =code="type_mismatch"= when the value is missing or the wrong JSON type.

decode_write_checkpoint protocol_codec Subroutine
decode_write_result protocol_codec Subroutine
decompose domain_decomposition Function

Compute this rank's decomposition. Pure: no MPI calls, no global state.

Read more…
decompose_2d domain_decomposition_2d Function
deriv_1d_unit mesh_2d Subroutine

Matching high-order first derivative of a unit-spacing nodal line: the undivided difference of the conservative-flux face values (cons_flux_1d_unit), so dg(i) reproduces the high-order central derivative AND stays bit-consistent with the face metrics built from the same operator (the property that makes freestream telescope to round-off, design spec §5.3).

derived_filename output_format_list Function

Derive the output filename for token. One format -> base verbatim; many formats -> stem (a trailing known extension stripped) + canonical ext.

destroy_solver_state solver_state Subroutine

Nullify procedure pointer components of a solver_state_t instance.

Read more…
directional_flux euler_physics_2d Subroutine

Return the directional Euler flux: fx for dir==1, gy for dir==2.

dispatch_opcode cortex_run_attached_mod Subroutine
drop_slab solution_gather_2d Subroutine

Deallocate a frame slab buffer with the mandatory stat check.

emit logger Subroutine
emit_progress_tick cortex_run_attached_mod Subroutine

Tick handler bound on rank 0 only. Encodes a PROGRESS_TICK and writes it to the existing attached-mode socket fd.

encode_advance_reply protocol_codec Subroutine
encode_copy_solution_reply protocol_codec Subroutine
encode_copy_solution_reply_2d protocol_codec Subroutine

2D COPY_SOLUTION reply header: like the 1D encoder but with the grid shape (nx, ny) alongside n = nx*ny, so the client can reshape each offset block C-order to (ny, nx). Offsets are byte offsets in request order, one block of nx*ny little-endian float64 per primitive, packed i-fastest (x-contiguous) to match solution_gather_2d.write_global_field.

encode_error_push protocol_codec Subroutine

Encode a server-pushed ERROR frame (spec §3.2). Rank 0 only. Always followed by parallel_fatal; the supervisor reads this frame, then observes socket EOF + non-zero exit and raises WorkerError.

encode_get_integer_reply protocol_codec Subroutine
encode_get_logical_reply protocol_codec Subroutine
encode_get_point_count_reply protocol_codec Subroutine
encode_get_progress_reply protocol_codec Subroutine
encode_get_real3_reply protocol_codec Subroutine
encode_get_real_reply protocol_codec Subroutine
encode_get_string_reply protocol_codec Subroutine
encode_hello_push protocol_codec Subroutine
encode_initialize_reply protocol_codec Subroutine
encode_keyed_failure cortex_run_attached_mod Subroutine

Encode a rank-0-only ok=false reply for a config-key read/write. Centralised so the same code shape is used by every SET/GET arm.

encode_progress_tick protocol_codec Subroutine

Encode a PROGRESS_TICK push frame (spec §3.2). Rank 0 only.

encode_push protocol_codec Subroutine
encode_reply_error protocol_codec Subroutine
encode_reply_ok protocol_codec Subroutine
encode_run_to_end_reply protocol_codec Subroutine
encode_write_checkpoint_reply protocol_codec Subroutine

WRITE_CHECKPOINT reply header: data.files is the list of file paths actually written by rank 0 (protocol.md §WRITE_CHECKPOINT). v1 always writes a single file; files is kept as a JSON array for forward compatibility with a future multi-file checkpoint format.

encode_write_result_reply protocol_codec Subroutine
eno3_reconstruct eno3 Subroutine

Perform classical ENO3 reconstruction on the supplied stencil.

Read more…
ensure_fvs_scratch_2d spatial_discretization_2d Subroutine

Allocate (or re-allocate on a dimension change) the FVS split-flux scratch fp_all/fm_all, halo-padded like ub (1-h:nx+h, 1-h:ny+h). Allocated lazily from compute_resid_fdm_fvs_2d so non-FVS paths never pay the memory cost.

ensure_resid_scratch_2d spatial_discretization_2d Subroutine

Allocate (or re-allocate on a dimension change) the reconstruction scratch arrays shared by the uniform and curvilinear residual paths. Consistent stat= handling: the two paths previously diverged (one omitted stat=).

ensure_schema config_schema Subroutine

Populate the saved schema table on first use, bound to a saved default config_t instance (the single-source-of-defaults property the spec requires).

ensure_schema_2d config_schema_2d Subroutine

Populate the saved schema table on first use, bound to a saved default config_2d_t instance (mirrors config_schema's ensure_schema).

euler_step time_integration Subroutine

Advance the solution by one time step using the explicit Euler scheme.

Read more…
euler_step_2d time_integration_2d Subroutine

Explicit Euler via the shared kernel (whole-array flat update under the halo-zero resid invariant — see rk4_step_2d notes). Retired from the legacy interior-slice form in Q2a: u + dt*resid is the identical expression and halo resid is zero, so this one is bit-neutral.

eval_face_sensor spatial_discretization Function

Evaluate the hybrid shock sensor for face iface.

Read more…
exchange_halos halo_exchange Subroutine

Fill state%ub's halo cells from neighbours.

exchange_halos_2d halo_exchange_2d Subroutine

Fill state%ub halo cells from MPI neighbours in both x and y directions.

ext_for_format output_format_list Function

Canonical file extension for a format token.

extract_primitives euler_physics Subroutine

Extract primitive variables (rho, u, p) from a conserved state vector.

Read more…
face_flux_2d euler_riemann_2d Subroutine
face_flux_2d_normal euler_riemann_2d Subroutine

Face flux through an arbitrary UNIT normal nrm=(nx,ny). Rotates the conserved momentum into the face frame, reuses the axis solver (dir=1), then rotates the momentum flux back to (x,y). nrm must be a unit vector.

field_index config_engine Function

1-based index of key in the table (normalized compare); 0 when absent.

field_meta config_engine Function

Metadata-only constructor. Callers associate the matching pointer component afterwards (build_field_table binds them to a target config).

fields_get_integer config_engine Function

Typed by-name read. .false. on unknown key OR kind mismatch; the caller composes its historical error text (they differ between 1D and 2D).

fields_get_logical config_engine Function
fields_get_real config_engine Function
fields_get_real3 config_engine Function
fields_get_string config_engine Function

Strings and choices are both readable as strings (historical behavior).

fields_set_integer config_engine Function
fields_set_logical config_engine Function
fields_set_real config_engine Function
fields_set_real3 config_engine Function
fields_set_string config_engine Function
fill_stencil spatial_discretization Subroutine

Fill a reconstruction stencil from a halo'd field.

Read more…
fill_x_edge boundary_2d Subroutine

Fill a left (is_min=.true.) or right x-edge band over rows j=1..ny.

fill_x_edge_fdm boundary_2d Subroutine

Fill a left (is_min=.true.) or right x-edge band over rows j=1..ny, NODAL.

fill_y_edge boundary_2d Subroutine

Fill a bottom (is_min=.true.) or top y-edge band over columns i=1..nx.

fill_y_edge_fdm boundary_2d Subroutine

Fill a bottom (is_min=.true.) or top y-edge band over columns i=1..nx, NODAL.

finalize_runtime solver_runtime Subroutine

Write the final solution to the output file and print the performance table.

Read more…
find_config_schema_entry config_schema Function

Find a schema entry by key and return its 1-based index.

Read more…
find_config_schema_entry_2d config_schema_2d Function

Find a 2D schema entry by key; 0 when absent.

finish solver_session Subroutine

Store the last writable-operation error and mirror it to optional outputs.

finish_readonly solver_session Subroutine

Mirror readonly-operation status without mutating the session state.

format_run_banner run_banner Function

Assemble the single ASCII banner line. Pure; ASCII separators only so it renders correctly on Windows consoles as well. version must include the leading v (e.g. v0.1.0-dev). Optional prog overrides the default program name euler_1d.

frame_slab_extents solution_gather_2d Subroutine

Slab geometry of one rank's owned piece of the GLOBAL boundary-ghost frame (the four width-h bands outside the global interior, corners included). Ownership is disjoint and exhaustive: the left/right bands cover global rows 1..ny_g only; the bottom/top bands span the FULL padded width 1-h..nx_g+h and therefore own the four corners. A rank owns a band segment iff its tile touches that global edge; a bottom/top-edge rank's segment extends into the corner columns iff it is also a left/right-edge rank (ilo/ihi below, in LOCAL i). Ghost cells of a rank that are NOT global-boundary cells are interior MPI-halo words: they are refreshed from neighbour interiors by the next halo exchange and are deliberately not part of the frame.

fvs_vacuum_guard_2d spatial_discretization_2d Subroutine

Vacuum/positivity guard for the FVS split-flux precompute. The FVS split routines evaluate sqrt(gam*p/rho); a non-positive density or pressure would produce NaN that then propagates silently through the reconstructed face fluxes and the residual. Detect it here and fail clearly instead. Mirrors the 1D FVS guard in spatial_discretization.f90 (block-guarded check + parallel_fatal). Operands are guarded with nested ifs because Fortran .and. does not short-circuit (rho is a divisor in p).

gather_and_write_2d solution_gather_2d Subroutine

Gather all per-rank tiles to rank 0 and write the global field as ASCII.

Read more…
gather_boundary_ghosts_to_root solution_gather_2d Subroutine

Gather the GLOBAL boundary-ghost frame to cart rank 0: the four width-h ghost bands outside the global interior, corners included — every ghost cell of every rank that is NOT an interior MPI-halo cell. The 2D twin of 1D's gather_edge_ghosts_to_root (checkpoint v6; 1D's is v5/F2): the checkpoint must persist these words because the multi-stage whole-array RK kernels leave a stage-snapshot blend in them that is not reconstructable from the interior (see checkpoint_2d.f90's record-block comment for the full root cause).

Read more…
gather_edge_ghosts_to_root solution_gather Subroutine

Gather the boundary halo/ghost cells owned by the global left- and right-edge ranks to rank 0: left(neq,h) = the left-edge rank's ub(:,1-h:0), right(neq,h) = the right-edge rank's ub(:,n_local+1:n_local+h). Needed because checkpoint/restart must persist these cells for "prescribed" BCs (dirichlet/inflow/ supersonic_inlet) whose ghost values are never recomputed by apply_bcs after the initial seed, yet are NOT actually constant across a run (see checkpoint.f90's module header for the full story) — F2.

Read more…
gather_field_to_root implicit_gather_scatter Subroutine

Gather (neq, n_local) slices from every rank into (neq, n_global) on rank 0 via MPI_Gatherv. On non-root ranks gather_buf is not accessed; pass a (neq, 0) sentinel allocation.

gather_solution_to_root solution_gather Subroutine

Gather (neq, n_local) primitives from every rank into (neq, n_global) on rank 0 via MPI_Gatherv.

Read more…
gather_solution_to_root_2d solution_gather_2d Subroutine

Gather all per-rank tiles to rank 0, assembling the full global solution field.

Read more…
get_config_schema_choice config_schema Subroutine

Copy one allowed string token from a schema entry's choice list.

Read more…
get_config_schema_entry config_schema Subroutine

Copy one schema entry by its 1-based index.

Read more…
get_host_platform initial_conditions Function

Return the host platform detected by the C portability shim.

get_q_at_face spatial_discretization Function

Return Q at grid cell idx, reading directly from the halo'd state%ub.

Read more…
get_windows_temp_dir initial_conditions Function

Return the preferred runtime-UDF output directory on Windows.

global_point_count_2d solver_runtime_2d Function

Whole-domain point count (FVM cells / FDM nodes), identical on all ranks.

grid_fingerprint checkpoint Function

Coordinate fingerprint of the global node grid: (sum x, sum x^2). Cheap, sensitive to the node distribution, and bit-reproducible because the grid is rebuilt deterministically from the same grid_file.

grid_fingerprint_2d checkpoint_2d Function

Rank-independent geometric fingerprint of the grid: (sum, sum-of-squares) of cell-centre coordinates. For curvilinear grids it reduces over local cells (each cell owned once); for uniform grids it is a deterministic scalar combo identical on every rank.

handle_copy_solution cortex_run_attached_mod Subroutine

Service a COPY_SOLUTION request.

Read more…
handle_copy_solution_2d cortex_run_attached_mod Subroutine

2D COPY_SOLUTION: session packs one i-fastest float64 block per requested primitive (x,y,rho,u,v,p) into a flat buffer; rank 0 transfers it to the binary payload and emits the nx/ny-bearing reply header. Collective.

handle_version_flag version_info Subroutine

Shared --version handler for all driver programs. If --version is on the command line, print <exe_name> <build-id> and stop 0. Called pre-MPI_Init by every driver, so the stop 0 is correct (single image, no ranks to orphan) and euler[_1d|_2d] --version works without mpirun.

hll_flux euler_physics Subroutine

HLL approximate Riemann solver.

Read more…
hllc_flux euler_physics Subroutine

HLLC approximate Riemann solver with contact-wave restoration.

Read more…
hllc_flux_2d euler_riemann_2d Subroutine
hook_noop run_step_engine Subroutine

Default no-op hook body for the overridable bindings.

hook_zero run_step_engine Function

Default zero-residual hook body for progress_residual.

ic_config3 initial_conditions_2d Subroutine

Lax-Liu Config 3 four-quadrant Riemann problem (split at the domain centre).

ic_freestream initial_conditions_2d Subroutine

Uniform free-stream from the config reference state (rho_inf,u_inf,v_inf,p_inf). Used to initialise supersonic inflow cases (e.g. the compression ramp).

ic_from_file initial_conditions Subroutine

Load the initial condition from a data file containing columns: x rho u p.

Read more…
ic_isentropic_vortex initial_conditions_2d Subroutine

Classic isentropic vortex (Shu 1998). Mean flow rho=1,p=1,u=v=1; strength beta=5; centred at the domain midpoint. Exact, smooth, periodic.

ic_sedov initial_conditions_2d Subroutine

Sedov-Taylor blast: ambient rho=1,p=1e-5; total energy E=1 deposited as high pressure in cells within r0 = 3.5*dx of the domain centre (cylindrical).

Read more…
ic_toro_explosion initial_conditions_2d Subroutine

Toro 2D explosion: circle R=0.4 at the domain centre; inside rho=1,p=1; outside rho=0.125,p=0.1; u=v=0.

ic_udf initial_conditions Subroutine

Compile a user-defined Fortran source file to a shared library at runtime and call its ic_udf subroutine to fill the initial state.

Read more…
ic_uniform initial_conditions_2d Subroutine

Constant state rho=1, u=0, v=0, p=1.

init_flux_scheme euler_physics Subroutine

Bind the flux dispatch pointers in @p state to the requested scheme.

Read more…
init_from_config solver_state Subroutine

Populate a solver_state_t from a config_t.

Read more…
init_from_config_2d solver_state_2d Subroutine

Build mesh from config and derive grid scalars.

init_recon_scheme reconstruction Subroutine

Bind the reconstruction procedure pointers and stencil metadata in @p state to the requested scheme, then resolve state%use_char_proj.

Read more…
init_recon_scheme_2d schemes_2d Subroutine

Bind the reconstruction procedure pointer and stencil metadata in @p state to the requested scheme (taken from state%cfg%recon_scheme).

init_run_context_2d solver_runtime_2d Subroutine

Bring a 2D run context to ready-to-step state.

Read more…
init_time_scheme time_integration Subroutine

Bind the procedure pointer @p step to the requested scheme.

Read more…
initialize_runtime solver_runtime Subroutine

Populate ctx and bring the solver to a ready-to-run state.

Read more…
invert_4x4 euler_physics_2d Subroutine

Inverse of a 4x4 matrix via LAPACK LU (dgetrf) + inversion (dgetri).

is_absolute_path path_util Function

True if path is absolute: POSIX "/…", a Windows drive "X:\…"/"X:/…", or a UNC "\…" path. Used so a user-supplied absolute grid path is left untouched while relative paths are anchored to the case directory.

is_decomp_2d_feasible domain_decomposition_2d Function
is_decomp_feasible domain_decomposition Function

Return .true. iff this rank's n_local is large enough to accommodate the halo (and, for periodic grids, the wrap send's one-cell offset).

is_fds_flux_scheme option_registry Function
is_frame_len_valid cortex_link Function

A decoded frame length is acceptable iff it is non-negative and within the =MAX_FRAME_BYTES= cap. (Non-negativity is structurally guaranteed by =be_u32_to_i64=, but kept explicit so the predicate is correct for any int64 caller.)

is_send_frame_valid cortex_link Function

Check that a send-side frame field (header or payload) can be represented by the u32 wire length prefix. Deliberately NOT symmetric with =is_frame_len_valid=: the 64 MiB inbound cap guards against an untrusted peer's request sizes, while outbound frames are sized by the worker itself and legitimately carry bulk COPY_SOLUTION replies far beyond 64 MiB (audit 2026-07-06 N1).

is_valid_boundary_condition option_registry Function
is_valid_char_proj_mode option_registry Function
is_valid_flux_scheme option_registry Function
is_valid_hybrid_sensor option_registry Function
is_valid_limiter option_registry Function
is_valid_method option_registry Function
is_valid_nrbc_mode option_registry Function
is_valid_problem_type option_registry Function
is_valid_recon_scheme option_registry Function
is_valid_time_scheme option_registry Function
itoa protocol_codec Function
jac_store_col time_integration Subroutine

Store one Jacobian column into band storage AB(diag_row_loc+i-j, j) = J(i,j). Works for both the custom (diag_row_loc = ku+1) and LAPACK (diag_row_loc = kl+ku+1) storage layouts.

join_path initial_conditions Function

Join a directory and leaf name with a platform-appropriate separator.

join_token_list option_registry Function
kernel_euler stepper_kernels Subroutine

Explicit Euler: Q^{n+1} = Q^n + dt R(Q^n).

kernel_rk4 stepper_kernels Subroutine

Classic RK4 (not SSP). s1 holds Q^n; s2 accumulates the weighted stages.

kernel_ssprk22 stepper_kernels Subroutine

SSPRK(2,2) (Shu & Osher 1988). 1D-verbatim stage expressions.

kernel_ssprk54 stepper_kernels Subroutine

SSPRK(5,4) — Spiteri & Ruuth (2002), SIAM J. Numer. Anal. 40(2), 469-491, Shu-Osher form. Coefficients independently cross-checked against NodePy (ketch/nodepy, runge_kutta_method.py, RK['SSP54']/'SSPRK54', fetched 2026-07-08): converting this routine's Shu-Osher coefficients to Butcher (A, b) form reproduces every one of NodePy's 30-digit A/b entries to 8-12 significant digits, consistent with NodePy's own documented note that its table is a higher-precision (30-digit) re-solve of the same Ruuth-Spiteri method whose originally published coefficients (as coded below, ~15 digits) are only accurate to about 10 digits. Five stages, order 4, SSP coefficient c ~= 1.508. Register use: s1 = u0 (stages 2-4), s2 = u2 then the final stage's partial sum, s3 = u3; the final stage's L(u3) piece is accumulated into s2 before stage 4 overwrites resid (avoids a fourth scratch array). HISTORY: before 2026-07 this routine carried an unpublished 3rd-order tableau (initial-commit transcription defect; see the 2026-07-07 retrospective). The observed-order tripwire test guards against any regression.

kernel_tvd_rk3 stepper_kernels Subroutine

TVD-RK3 (Shu & Osher 1988). 1D-verbatim stage expressions.

kind_label cortex_run_attached_mod Function

Human-readable label for a cfg_kind_* tag, used only in type_mismatch messages (never as a wire code).

lagrange_unit_weights mesh_2d Subroutine

Lagrange weights c(1:w) for interpolating/extrapolating a unit-spacing line sampled at local positions 0,1,...,w-1 to the (possibly out-of-range) target offset t. Used to build the ghost values that close the symmetric stencil at domain boundaries.

lax_friedrichs_split euler_physics Subroutine

Lax-Friedrichs flux splitting.

Read more…
lax_friedrichs_split_2d euler_physics_2d Subroutine

Lax-Friedrichs directional splitting: F± = ½(F ± α Q), α = |vel_dir| + c. Guarantees fp + fm == F exactly (same α applied to both halves).

lax_friedrichs_split_both euler_physics Subroutine

Fused Lax-Friedrichs flux splitting: returns F^+ and F^- in one call.

Read more…
left_right_states_from_namelist initial_conditions Subroutine

Convert namelist primitives (rho_left, u_left, p_left / rho_right, ...) to conserved state vectors.

lim_koren muscl Function

Koren TVD limiter. Third-order accurate for smooth data; preserves monotonicity near discontinuities.

Read more…
lim_mc muscl Function

Monotonized Central (MC) TVD limiter. Good balance between dissipation and resolution; recommended for most shock-capturing applications.

Read more…
lim_minmod muscl Function

Minmod TVD limiter. Most dissipative of the standard limiters; guaranteed TVD for any CFL within the stability limit.

Read more…
lim_superbee muscl Function

Superbee TVD limiter. Least dissipative TVD limiter; may over-sharpen contact discontinuities on smooth problems.

Read more…
lim_van_leer muscl Function

van Leer smooth TVD limiter.

Read more…
limit_pos_2d spatial_discretization_2d Subroutine

Zhang-Shu positivity limiter for a 2D Euler face state (neq2d=4). Blends the reconstructed face state toward the cell average until density rho >= eps and pressure p >= eps. A no-op in smooth regions.

limit_positivity positivity_limiter Subroutine

Scale a reconstructed face state toward the cell average to ensure density ρ ≥ ε and pressure p ≥ ε (Zhang-Shu 2010).

Read more…
linear_weno5_reconstruct linear_weno Subroutine

5th-order linear WENO reconstruction on a 5-point stencil.

Read more…
linear_weno7_reconstruct linear_weno Subroutine

7th-order linear WENO reconstruction on a 7-point stencil.

Read more…
log_debug logger Subroutine

Emit a DEBUG-level message.

log_effective_config solver_runtime Subroutine

Log the effective (post-promotion) configuration at startup. Reads from the authoritative copy ctx % state % cfg, which may differ from the original namelist values when BC promotions have been applied (e.g. smooth_wave → periodic, woodward_colella → reflecting).

log_error logger Subroutine

Emit an ERROR-level message.

log_finalize logger Subroutine

Close the log file and reset file-logging state.

log_info logger Subroutine

Emit an INFO-level message.

log_init logger Subroutine

Initialise the logger: set verbosity level and optionally open a log file.

log_iteration solver_runtime Subroutine

Log one iteration summary line (time, residual, per-iteration and elapsed wall time). The lightweight iter_s and elapsed_s fields are always populated. Called every ctx % print_freq iterations and once unconditionally after the loop.

log_performance_summary solver_runtime Subroutine

Print the wall-clock performance table after the run completes. Reports total time, I/O time, and the three hot-path timers (compute_resid, flux precompute, face loop) plus overall throughput. Only called when ctx % state % cfg % do_timing is .true..

log_run_banner run_banner Subroutine

Emit the one-line startup banner via log_info on rank 0. log_info's private emit already returns early on ranks > 0 (unless LOG_ALL_RANKS), so no explicit rank guard is needed here. Optional name overrides the default program name euler_1d.

log_warn logger Subroutine

Emit a WARN-level message.

lowercase_token string_utils Function

Return a left-justified, trimmed, lowercased copy of value. Pure: has no side effects (usable inside other pure procedures).

minmod2 mp5 Function

Two-argument minmod function. Returns the value with the smaller magnitude if a and b have the same sign, else 0.

minmod4 mp5 Function

Four-argument minmod function. Returns 0 if the arguments do not all share the same sign; otherwise returns the value with the smallest magnitude.

mp5_reconstruct mp5 Subroutine

Perform MP5 reconstruction on the supplied stencil.

Read more…
mpi_proc_null_value mpi_runtime Function

Expose MPI_PROC_NULL as a value so callers that don't use mpi* themselves can compare against it.

mpi_runtime_finalize mpi_runtime Subroutine

Finalise the MPI library. Idempotent: a second call is a no-op.

mpi_runtime_init mpi_runtime Subroutine

Initialise the MPI library and cache rank/size.

Read more…
mpi_runtime_is_initialised mpi_runtime Function

True after mpi_runtime_init and before mpi_runtime_finalize.

mpi_world mpi_runtime Function

Return the world communicator handle. Convenience accessor so call sites never reference MPI_COMM_WORLD directly. Always call this function at the point of use rather than caching the return value, so the call site stays correct once sub-communicators are introduced.

muscl_koren_reconstruct muscl Subroutine

MUSCL reconstruction with the Koren limiter.

muscl_mc_reconstruct muscl Subroutine

MUSCL reconstruction with the Monotonized Central (MC) limiter.

muscl_minmod_reconstruct muscl Subroutine

MUSCL reconstruction with the Minmod limiter.

muscl_reconstruct muscl Subroutine

Core MUSCL reconstruction kernel (component-wise, left-biased stencil).

Read more…
muscl_superbee_reconstruct muscl Subroutine

MUSCL reconstruction with the Superbee limiter.

muscl_van_leer_reconstruct muscl Subroutine

MUSCL reconstruction with the van Leer smooth limiter.

my_rank mpi_runtime Function

Local rank in MPI_COMM_WORLD. Aborts if called before init.

n_ranks mpi_runtime Function

Size of MPI_COMM_WORLD. Aborts if called before init.

neumann_gradient_ghost boundary_conditions Subroutine

'neumann_gradient' ghost: prescribed-gradient Neumann BC.

Read more…
nonreflecting_ghost boundary_conditions Subroutine

'nonreflecting' ghost: characteristic (LODI/Thompson) non-reflecting BC.

Read more…
normal_phys_flux euler_riemann_2d Subroutine
normalize_fields config_engine Subroutine

Lowercase every casefold-flagged string field in place (the table-driven replacement for the 1D normalize_config).

normalize_key config_schema Function

Normalise a user-provided parameter key to lowercase trimmed form. Thin wrapper over lowercase_token (from string_utils) fixing the result to the schema's 32-character key field width.

op_failed cortex_run_attached_mod Function

Turn a failed session operation into a proper reply-level error and tell the caller to stop handling the current opcode. Returns .true. on failure.

Read more…
opcode_kind_matches cortex_run_attached_mod Function

True when a SET_/GET_ opcode's own wire kind is compatible with the schema's expected_kind for the target key. Choice-typed keys (e.g. flux_scheme) travel as JSON strings on the wire and are accepted by SET_STRING/GET_STRING, mirroring decode_set_value's existing wire-compatible grouping of cfg_kind_string with cfg_kind_choice.

outflow_ghost boundary_conditions Subroutine

'outflow' ghost: first-order linear extrapolation with a positivity guard.

Read more…
pack_be_u32 cortex_link Subroutine

Pack an UNSIGNED 32-bit length prefix from an int64 value in [0, 4294967295]. Takes int64 so a length in (2^31-1, 2^32-1] — legitimate for large COPY_SOLUTION replies — never round-trips through int32 (an out-of-range conversion, processor-dependent). Inverse of =be_u32_to_i64=.

pack_field time_integration Subroutine

Flatten a (neq x n_pt) field into a length-neq*n_pt 1-D array. Ordering: (eq=1,cell=1), (eq=2,cell=1), ..., (eq=neq,cell=n_pt).

par_lor parallel_reductions Function

Return the logical OR of a scalar logical across all ranks.

par_max_real parallel_reductions Function

Return the maximum of a scalar real(wp) across all ranks.

par_sum_real parallel_reductions Function

Return the sum of a scalar real(wp) across all ranks.

parallel_fatal mpi_runtime Subroutine

Abort the entire MPI world with a diagnostic message.

Read more…
parse_format_list output_format_list Subroutine

Split spec on spaces/commas into deduped tokens validated against allowed. Assumes spec is already lowercased by the config layer.

parse_uri cortex_link Subroutine

Parse a "tcp://host:port" URI into host string and integer port. Errors fatally on a malformed URI — bug in the caller.

path_dirname path_util Function

Directory part of path (everything up to the last '/' or '\'); '.' when path has no directory component. The trailing separator is dropped.

prim_split euler_riemann_2d Subroutine
primitives_2d euler_physics_2d Subroutine

Extract primitives (rho, u, v, p) from a 2D conserved state.

quote_shell_arg initial_conditions Function

Wrap a filesystem path for the shell used by execute_command_line.

Read more…
rank_first_global domain_decomposition Function

1-based global index of rank_id's first owned cell under the same partition as rank_local_count. Equals the sum of all lower ranks' counts, plus 1. Pure — single source of truth (see rank_local_count).

rank_local_count domain_decomposition Function

Single source of truth for the slab/block partition: the number of global cells owned by rank_id (0-based) when n_global cells are split across n_ranks. floor(n_global/n_ranks) per rank, with the remainder distributed one extra cell each to the first mod(n_global,n_ranks) ranks. Pure — used by decompose(), the gather/scatter count builders, and the 2D axis split so the partition arithmetic exists in exactly one place.

read_checkpoint checkpoint Subroutine

Read a checkpoint file and restore solver state.

Read more…
read_checkpoint_2d checkpoint_2d Subroutine

Read a checkpoint and restore state. Every rank reads the global file read-only, validates magic/version/dim/nx/ny/neq/grid/halo-width, then slices its interior block and its owned piece of the GLOBAL boundary-ghost frame (v6; see the write-side record-block comment).

Read more…
read_ckpt_header checkpoint_io Subroutine

Read + validate the unified header against the caller's expectations. On any failure ok=.false. and err carries ': '.

read_config config Subroutine

Read simulation parameters from a namelist file.

Read more…
read_config_2d config_2d Subroutine

Read a namelist file into a config_2d_t and validate it.

read_dim config_dim Subroutine

Read the problem dimension from the &control group of filename.

read_grid_record_and_check checkpoint_io Subroutine

Read the grid record and compare against the configured grid using the historical 1e-12 relative tolerance.

read_node_coords mesh_1d Subroutine

Read strictly-increasing node coordinates from a text file. One value per line; blank lines and lines beginning with '#' are ignored.

read_plot3d_2d mesh_2d Subroutine

Read a single-block 2D Plot3D grid. Header ni nj, then all x(i,j) (i fastest), then all y(i,j). ASCII (binary=.false.) or Fortran unformatted sequential (binary=.true.).

recon_uses_char_proj_by_default option_registry Function
reconstruct_with_proj spatial_discretization Subroutine

Reconstruct a face flux or state with optional characteristic projection.

Read more…
recv_bytes cortex_link Subroutine
recv_slab solution_gather_2d Subroutine

Allocate buf to (n1, n2, n3) and blocking-receive one frame slab into it from cart rank src (gather_boundary_ghosts_to_root's root side).

ref_state boundary_2d Function

Conserved free-stream reference state from config.

reflect_velocity_2d boundary_2d Function

Reflect the velocity of a conserved state about unit normal nrm, preserving density and total energy (|v| is unchanged). Inviscid no-penetration wall. The density is floored to eps (matching limit_pos_2d): the halo fill runs BEFORE any residual-side positivity guard can fire, so a transient non-positive boundary-adjacent state (near-vacuum off a strong expansion) must not divide-by-zero / SIGFPE here (audit 2026-07-06 N2); the residual guards still abort cleanly on the interior state itself.

reject_kind_mismatch cortex_run_attached_mod Function

Rank-0-only ok=false type_mismatch reply for a SET_/GET_ opcode whose own kind does not match the schema's expected_kind for key. Callers must check session_schema_lookup's ok first and keep reporting unknown_key when the key itself is not found; this only covers a key that does exist but was addressed by the wrong-kind opcode (e.g. SET_INTEGER on the real-valued key cfl), aligning the real worker with the cortex stub's stricter behaviour.

release_work_arrays solver_state Subroutine

Release all allocatable arrays owned by a solver instance.

report_performance_summary solver_runtime Subroutine

Print the end-of-run performance table once after a completed run.

Read more…
required_local domain_decomposition Function

Minimum interior cell count this rank must hold. A non-periodic rank needs at least halo_width cells. A periodic decomposition needs one more: the wrap send skips the duplicated endpoint node (global node n_global == node 1), so the periodic edge ranks send cells [2 .. h+1] / [n_local-h .. n_local-1], which require n_local >= halo_width + 1. The bound is applied to every rank (not just the edges) so the feasibility guarantee is uniform.

reset_runtime solver_session Subroutine

Tear down the live runtime context while keeping editable config state.

Read more…
resolve_case_path path_util Function

Resolve a namelist file-valued parameter against a case directory. Absolute or empty value is returned unchanged; a relative value is joined onto base_dir with a '/' (accepted by the runtime on both POSIX and Windows). A '.' or empty base_dir leaves value unchanged.

resolve_cli solver_runtime Subroutine

Parse the worker's CLI: --cortex-socket=URI plus a positional namelist path. Either may be absent. or empty.

resolve_cli_namelist solver_runtime Subroutine

Read the namelist filename from the first command-line argument. Falls back to 'input.nml' when no argument is supplied.

resolve_latest_pointer checkpoint_io Function

If fname names the pointer file, read the real path from it; otherwise return fname unchanged. Detects >512-char truncation explicitly.

resolve_time_scheme time_integration Subroutine

Resolve a scheme name to a specific stepper procedure pointer.

Read more…
resolve_time_scheme_2d time_integration_2d Subroutine
restore_local_layout time_integration Subroutine

Restore the per-rank local layout captured by save_local_layout. Releases all work arrays, swaps state%decomp back to the saved local decomp, reallocates work arrays at local size, and copies the saved ub-interior (and bdf2_ub_prev if present) back in. The bdf2_initialized flag is also restored.

rhs_1d time_integration Subroutine

stepper_kernels rhs callback: recompute the 1D residual (halo exchange + BCs + interior resid happen inside compute_resid).

rhs_2d time_integration_2d Subroutine

stepper_kernels rhs callback: recompute the 2D residual (halo exchange + BCs + interior resid happen inside compute_resid_2d).

rk4_step time_integration Subroutine

Advance the solution by one time step using the classic RK4 scheme.

Read more…
rk4_step_2d time_integration_2d Subroutine

Classic RK4 via the shared kernel. Whole-array flat update (halos included) — legal under the halo-zero resid invariant; halos are refreshed inside compute_resid_2d before each use. New in R2; no bit-history to preserve.

roe_flux euler_physics Subroutine

Roe approximate Riemann solver with Harten entropy fix.

Read more…
run_bounded_steps run_step_engine Subroutine

Advance ctx by at most max_steps iterations (see module header for the ordering contract). All cadence/exit arithmetic that was duplicated between the per-dim loops lives here and only here. Hooks must not mutate the cfg fields passed as cadence arguments (time_stop, max_iter, checkpoint_freq/print_freq/snapshot_freq are snapshotted at call time and alias the ctx).

run_euler_1d euler_driver Subroutine

Run a 1D Euler case from nml_file. MPI must already be initialized.

run_euler_2d euler_driver_2d Subroutine

Run the full 2D Euler solve: read config, init, time-march, gather and write.

run_newton time_integration Subroutine

Shared Newton + banded-solve inner loop for the implicit steppers.

Read more…
run_solver solver_runtime Subroutine

Execute the main time-marching loop until time_stop is reached.

Read more…
run_solver_steps solver_runtime Subroutine

Advance the main time loop by at most max_steps iterations.

Read more…
run_solver_steps_2d solver_runtime_2d Subroutine

Advance the 2D time loop by at most max_steps iterations.

Read more…
rusanov_flux_2d euler_riemann_2d Subroutine
safe_vel precision Function

FP-trap-safe velocity = momentum / density for output/diagnostics.

Read more…
save_local_layout time_integration Subroutine

Capture the per-rank local layout of state so it can be restored after the implicit gather-solve-scatter window. Saves the decomp, the ub-interior slice, and bdf2_ub_prev if present.

scatter_boundary_ghosts_from_root solution_gather_2d Subroutine

Inverse of gather_boundary_ghosts_to_root: deliver the checkpoint's GLOBAL boundary-ghost frame bands into this rank's ub ghost cells. Same band layout and disjoint ownership as the gather (the slab geometry lives ONLY in frame_slab_extents, so gather and scatter cannot drift).

Read more…
scatter_edge_ghosts_from_root solution_gather Subroutine

Inverse of gather_edge_ghosts_to_root: rank 0 delivers the left/ right ghost blocks (as just read from a checkpoint) to the ranks that own those edges, copying directly into state % ub's halo columns. Same ownership derivation and np=1 pure-local-copy behaviour as the gather — F2.

scatter_field_from_root implicit_gather_scatter Subroutine

Scatter (neq, n_global) on rank 0 into per-rank (neq, n_local) slices via MPI_Scatterv. On non-root ranks gather_buf is not accessed; pass a (neq, 0) sentinel allocation.

schema_lookup protocol_codec Subroutine

Resolve a wire-protocol key against the configuration schema.

Read more…
schema_lookup_2d config_schema_2d Subroutine

Resolve a wire-protocol key against the 2D schema (same shape as protocol_codec.schema_lookup). Unknown key: ok=.false. with an "unknown config key: ..." message the transport forwards verbatim.

schema_lookup_dim protocol_codec Subroutine

Resolve a wire key against the schema for dim — the single dimension-selection point for config schemas on the wire path (spec 4.3). A 3D schema plugs in here as one new case.

seed_dirichlet_halos initial_conditions Subroutine

Fill the boundary halo cells with the prescribed Dirichlet states.

Read more…
send_bytes cortex_link Subroutine
send_hello cortex_run_attached_mod Subroutine
session_schema_lookup cortex_run_attached_mod Subroutine

Resolve a config key against the schema matching the session's dim. dim=1 behaviour is byte-identical to the old direct schema_lookup call.

set_farfield_ghost boundary_2d Function

Characteristic (Riemann-invariant) far-field ghost state for an OUTWARD unit normal nrm. q_int is the boundary-adjacent interior conserved state, q_inf the free-stream. With interior/free-stream normal velocities Un_i, Un_inf and sound speeds c_i, c_inf: * supersonic in/out (|Un_i| >= c_i) short-circuit to pure free-stream / pure interior extrapolation; * otherwise combine the outgoing (interior) invariant R+ = Un_i + 2 c_i/(gam-1) with the incoming (free-stream) R- = Un_inf - 2 c_inf/(gam-1) to get Un_b = (R+ + R-)/2, c_b = (gam-1)/4 (R+ - R-). Entropy and tangential velocity are taken from the free-stream on inflow (Un_b <= 0) and from the interior on outflow; rho_b, p_b follow from entropy + c_b. gam is passed explicitly (no module-level thermodynamic state here).

set_status config_schema Subroutine

Fan out a success flag and optional message to caller-provided outputs.

set_status_2d config_schema_2d Subroutine

Fan out a success flag and message to optional outputs (mirrors 1D).

setup_band_storage time_integration Subroutine

Compute banded-storage dimensions for the Newton-step Jacobian.

Read more…
setup_decomp_2d mpi_cart_2d Subroutine

Build the MPI Cartesian decomposition and store it on the state (MPI runs).

Read more…
solver_build version_info Function

Full build identity: the stamped git describe string when present, otherwise the recognizable unstamped fallback v<version>-dev.

solver_session_advance solver_session Subroutine

Advance the runtime by at most max_steps iterations.

Read more…
solver_session_copy_global_solution solver_session Subroutine

Gather the current solution from every rank onto rank 0 and fill the caller-owned global arrays. Collective: must be invoked on every rank with the same call sequence as the MPI worker pool. On non-root ranks the output arrays may be size 0 and are not written.

Read more…
solver_session_copy_global_solution_2d solver_session Subroutine

Gather the 2D solution to rank 0 and pack the requested primitive fields into ONE flat buffer, one nxny block per primitive in request order, each block i-fastest (x-contiguous) — the pack order of solution_gather_2d.write_global_field, so these fields match result_2d.dat columns exactly. offsets are 0-based BYTE offsets ((k-1)nxny8), computed identically on every rank. Supported names: x, y, rho, u, v, p; unknown names copy x with a warning (1D wire-compat leniency). Collective: every rank must call; buffer-size agreement is reduced with par_lor so no rank can return early past the gather.

solver_session_copy_solution solver_session Subroutine

Copy the current primitive-variable solution into caller-owned arrays.

Read more…
solver_session_create solver_session Subroutine

Reset a session to its default empty state.

solver_session_destroy solver_session Subroutine

Tear down any live runtime allocations and clear the last error.

solver_session_get_global_grid_shape solver_session Subroutine

Global structured-grid shape. dim=2: (nx_global, ny_global); dim=1: (n_pt_global, 1). Feeds the nx/ny fields of the 2D INITIALIZE and COPY_SOLUTION replies (spec §4.2).

solver_session_get_global_point_count solver_session Subroutine

Return the global grid-point count (= n_cell + 1, identical on every rank). Distinct from solver_session_get_point_count, which returns this rank's local interior point count after domain decomposition. Callers that need to size a whole-domain buffer (e.g. the GUI's plot frame, post-run result reader) want this value.

solver_session_get_integer solver_session Subroutine

Read an integer configuration field by canonical schema key.

solver_session_get_logical solver_session Subroutine

Read a logical configuration field by canonical schema key.

solver_session_get_point_count solver_session Subroutine

Return the current grid-point count expected by solution copy-out buffers.

solver_session_get_progress solver_session Subroutine

Copy out a lightweight progress snapshot for polling clients.

solver_session_get_real solver_session Subroutine

Read a scalar real configuration field by canonical schema key.

solver_session_get_real3 solver_session Subroutine

Read a real-3 configuration field by canonical schema key.

solver_session_get_string solver_session Subroutine

Read a string or choice-token configuration field by canonical schema key.

solver_session_initialize solver_session Subroutine

Validate the current configuration and allocate the runtime context.

solver_session_last_error solver_session Subroutine

Copy the last stored writable-operation error message.

solver_session_load_namelist solver_session Subroutine

Load configuration from a namelist file into the session.

Read more…
solver_session_prepare_inline solver_session Subroutine

Prepare a session to receive a LOAD_CONFIG_INLINE config: discard any live runtime, fix the problem dimension, and record the case directory that anchors relative file paths (inline configs carry no namelist path to derive it from). Must be called BEFORE applying the config entries so the dim-aware SET_* setters target the correct 1D/2D config. Collective-safe: every rank passes the same decoded dim/case_dir.

solver_session_resolve_case_paths solver_session Subroutine

Resolve relative file-valued parameters (grid_file) in the active config against the session's case directory. The inline path bypasses read_config/read_config_2d, where this resolution otherwise lives, so it is applied here after the inline entries land. Absolute paths and an empty case_dir are left unchanged.

solver_session_run_to_end solver_session Subroutine

Run the current session until time_stop is reached.

Read more…
solver_session_set_integer solver_session Subroutine

Set an integer configuration field and invalidate any live runtime.

solver_session_set_logical solver_session Subroutine

Set a logical configuration field and invalidate any live runtime.

solver_session_set_real solver_session Subroutine

Set a scalar real configuration field and invalidate any live runtime.

solver_session_set_real3 solver_session Subroutine

Set a real-3 configuration field and invalidate any live runtime.

solver_session_set_string solver_session Subroutine

Set a string or choice-token configuration field and invalidate any runtime.

solver_session_write_checkpoint solver_session Subroutine

Force an immediate checkpoint write using the configured or overridden base name.

Read more…
solver_session_write_result solver_session Subroutine

Write the current solution in the standard result.dat-style text format.

Read more…
split_contravariant_2d euler_physics_2d Subroutine

Contravariant flux-vector splitting along a general metric/area vector smetric = S_xi or S_eta (size 2). Splits the CONTRAVARIANT flux Fhat = smetric(1)F + smetric(2)G (F,G physical Euler fluxes) into fp/fm with eigenvalues U, U, U +- c|S| where the contravariant velocity is U = smetric(1)u + smetric(2)v and |S| = norm2(smetric).

Read more…
split_flux_2d euler_physics_2d Subroutine

Dispatch to one of the three FVS routines by scheme name. dir=1 → x-splitting (uses F, eigenvalues u±c); dir=2 → y-splitting (uses G, v±c). scheme: 'lax_friedrichs' | 'steger_warming' | 'van_leer'. NOT pure: may call steger_warming_split_2d (which calls LAPACK).

ssprk22_step time_integration Subroutine

Advance the solution by one time step using the SSPRK(2,2) scheme.

Read more…
ssprk22_step_2d time_integration_2d Subroutine

SSPRK(2,2) via the shared kernel (see rk4_step_2d notes). Q2a authorized last-bit change: the kernel's 1D-verbatim distributed stage groupings replace the legacy factored groupings (spec 2026-07-10 §5).

ssprk54_step time_integration Subroutine

Advance the solution by one time step using the SSPRK(5,4) scheme.

Read more…
ssprk54_step_2d time_integration_2d Subroutine

SSPRK(5,4) via the shared kernel (see rk4_step_2d notes).

steger_warming_split euler_physics Subroutine

Steger-Warming flux vector splitting.

Read more…
steger_warming_split_2d euler_physics_2d Subroutine

Steger-Warming splitting: F± = R·diag(λ±)·R⁻¹·Q. Exact for the homogeneous Euler flux (F = A·Q); fp+fm == F to machine precision. Eigenvalue order: x → (u-c, u, u, u+c); y → (v-c, v, v, v+c). NOT pure: calls compute_eigensystem_2d which uses LAPACK.

steger_warming_split_both euler_physics Subroutine

Fused Steger-Warming flux splitting: returns F^+ and F^- in one call.

Read more…
string_to_bytes protocol_codec Subroutine
subsonic_inlet_ghost boundary_conditions Subroutine

'subsonic_inlet' ghost: characteristic-based subsonic inflow.

Read more…
subsonic_outlet_ghost boundary_conditions Subroutine

'subsonic_outlet' ghost: characteristic-based subsonic outflow.

Read more…
teardown_run_context_2d solver_runtime_2d Subroutine

Release runtime handles and finalise the logger. The state's allocatable arrays are released by intrinsic assignment when the owner resets the context (ctx = solver_run_context_2d_t()), mirroring the 1D session.

teardown_runtime solver_runtime Subroutine

Release all allocations held by ctx and finalise the logger. Must be the last call in the lifecycle; ctx is invalid afterwards.

teno5_reconstruct teno5 Subroutine

Perform TENO5 reconstruction on the supplied stencil.

tick_seconds run_step_engine Function

Convert a system_clock delta to seconds.

Read more…
timer_elapsed_running_s timer Function

Return elapsed wall time in seconds, including the current running segment.

Read more…
timer_elapsed_s timer Function

Return accumulated wall time in seconds.

Read more…
timer_report timer Subroutine

Print a one-line performance report to stdout.

Read more…
timer_reset timer Subroutine

Reset a timer to the zero state.

timer_start timer Subroutine

Start (or resume) the timer.

Read more…
timer_stop timer Subroutine

Stop the timer and accumulate elapsed counts.

Read more…
to_lower string_utils Function

Return a lowercased copy of an ASCII string, preserving length and whitespace.

token_in_list option_registry Function
tvd_rk3_step time_integration Subroutine

Advance the solution by one time step using the TVD-RK3 scheme.

Read more…
tvd_rk3_step_2d time_integration_2d Subroutine

TVD-RK3 via the shared kernel (see rk4_step_2d notes). Q2a authorized last-bit change, as ssprk22 above. This is every 2D deck's default integrator, so all 2D golden outputs move at the last bit.

unpack_add time_integration Subroutine

Add a flattened 1-D correction to a (neq x n_pt) 2-D field in place.

update_latest_pointer checkpoint_io Subroutine

Write the most-recent checkpoint path to the pointer file (rank 0 only — the caller gates on rank).

upwind1_reconstruct upwind1 Subroutine

First-order upwind reconstruction.

Read more…
upwind2_reconstruct upwind2 Subroutine

Second-order upwind reconstruction.

Read more…
validate_config config Subroutine

Validate that all namelist parameters are physically and numerically sensible.

Read more…
validate_config_2d config_2d Subroutine

Validate ranges and enumerated selectors.

validate_decomp domain_decomposition Subroutine

Abort with a clear message if this rank's n_local is too small to hold the halo cells the chosen reconstruction scheme requires.

validate_decomp_2d domain_decomposition_2d Subroutine

Abort with a clear message if either local tile dimension is too small to hold the halo cells the chosen reconstruction scheme requires. Mirrors the 1D validate_decomp; called from the 2D driver right after the decomposition is built (an over-fine MPI process grid, e.g. a thin axis from MPI_Dims_create, would otherwise silently over-read halos).

validate_fields config_engine Subroutine

Enforce every unconditional per-field constraint, in table order; first violation wins. prefix is the historical message prefix ('config' or 'config_2d'). Choice comparison casefolds the candidate via to_lower (length/blank-preserving), NOT lowercase_token (which adjustl's first): a leading-whitespace value like ' hllc' must be REJECTED here, matching the 2D to_lower-on-compare behavior; the 1D path already normalizes (adjustl+lowercase) via normalize_fields before this runs, so its stored values never carry leading blanks by the time they reach here.

van_leer_split euler_physics Subroutine

van Leer flux vector splitting.

Read more…
van_leer_split_2d euler_physics_2d Subroutine

van Leer splitting: Mach-split mass flux carrying transverse momentum. Pressure split: p± = p(M±1)²(2∓M)/4 (subsonic); supersonic branches are fully upwind (fp==F, fm==0 for M≥1; fp==0, fm==F for M≤-1). Uses in (normal) and it (transverse) momentum indices to handle both directions uniformly.

van_leer_split_both euler_physics Subroutine

Fused van Leer flux splitting: returns F^+ and F^- in one call.

Read more…
wall_edges_2d boundary_2d Subroutine

Report which of the four block edges are PHYSICAL solid (reflecting) walls, for the curvilinear residual's weak pressure-wall flux. Mirrors apply_halos_2d's serial/MPI dual-path edge selection exactly (single source of truth): serial (np=1 or no Cart comm) => all four edges are physical; MPI => an edge is physical only if its Cartesian neighbour is MPI_PROC_NULL. An edge is a wall iff it is physical AND its cfg % bc_* is 'reflecting'.

wall_flux_2d_normal euler_riemann_2d Subroutine

Inviscid solid-wall (no-penetration) face flux through unit normal nrm. At a solid wall v.n = 0, so the Euler flux collapses to the pressure term: F = [ 0, pnx, pny, 0 ], with p the interior-side pressure and (nx,ny) the boundary-face normal. Mass and energy flux are EXACTLY zero by construction (a "weak"/pressure wall), so no spurious mass crosses the wall and no spurious entropy is generated by an acoustic over-pressure -- unlike a ghost-reflection wall, whose Riemann star pressure carries an O(rhoc|v_n|) error wherever the reconstructed interior normal velocity is non-zero (always, on a curved wall). q is the interior-side (reconstructed) conserved state; gam the ratio of specific heats. nrm need not be normalised in sign: the residual's +xi/+eta divergence orientation makes the resulting wall pressure force act into the domain at both min and max edges.

weno11_js_reconstruct weno11_js Subroutine
weno5_js_reconstruct weno5_js Subroutine

Perform WENO5-JS reconstruction on the supplied stencil.

Read more…
weno5_smoothness weno_family Subroutine

Compute the Jiang-Shu smoothness indicators for a 5-point WENO5 stencil.

Read more…
weno5_substencils weno_family Subroutine

Compute the three 3rd-order substencil reconstructions for WENO5.

Read more…
weno5_z_reconstruct weno5_z Subroutine

Perform WENO5-Z reconstruction on the supplied stencil.

weno7_js_reconstruct weno7_js Subroutine

Perform WENO7-JS reconstruction on the supplied stencil.

Read more…
weno9_js_reconstruct weno9_js Subroutine
weno_cu6_reconstruct weno_cu6 Subroutine
write_checkpoint checkpoint Subroutine

Write a checkpoint file for the current solver state.

Read more…
write_checkpoint_2d checkpoint_2d Subroutine

Write a checkpoint: gather to root, write the global file on rank 0, agree outcome across ranks, update the latest_checkpoint_2d pointer file.

Read more…
write_ckpt_header checkpoint_io Subroutine

Write the unified header (magic/ckpt_version/dim) + scalars. extents carries the dim global extents (1D: [n_pt_global]; 2D: [nx_global, ny_global]).

write_global_field solution_gather_2d Subroutine

Write the assembled global field to filename in the standard ASCII format.

Read more…
write_global_field_vtk solution_gather_2d Subroutine

Write the assembled global field as legacy-ASCII VTK STRUCTURED_POINTS. Cell-centred: ORIGIN at the first cell centre, SPACING=(dx,dy). Emits SCALARS rho, SCALARS pressure, VECTORS velocity (i fastest, then j).

write_grid_record checkpoint_io Subroutine

Write the grid record: grid_type token + 2-component fingerprint.

write_result_2d output_2d Subroutine

Write this rank's interior cells as "x y rho u v p" (6ES24.12E3), i fastest, with a blank line after each constant-j row (gnuplot/ParaView structured grid). This is the per-rank/test-only writer; the production gathered-field writer is solution_gather_2d.write_global_field. The two share the same ASCII layout and column format (6ES24.12E3) — this routine writes per-rank local cells using each cell's global-index offset, while write_global_field writes the assembled global field on rank 0.

write_snapshot solver_runtime Subroutine

Write a live snapshot of the current solution to snapshot_file. The file is overwritten on each call. A header comment records the current iteration and time; subsequent rows are (x, ρ, u, p) in '(4ES20.12)' format. Open/write failures are logged as warnings rather than fatal errors so that a snapshot glitch does not abort the run. This file path is retained for compatibility with legacy file-watching tooling; new integrations should prefer the polling session/API surface.

write_solution_file solver_runtime Subroutine

Write the current solution to a text file.

write_solution_file_2d solver_runtime_2d Subroutine

Gather to root and write the standard 6-column x y rho u v p result (plus any tec/plt/vtk formats the config requests). Collective.

write_tecplot_ascii tecplot_writer Subroutine
write_tecplot_binary tecplot_writer Subroutine
write_tp_string tecplot_writer Subroutine

Write a Tecplot binary string: each character as an int32, null-terminated. Returns ios /= 0 on the first failing write so callers can abort cleanly.