| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | solver_status_ok | = | 0 |
Operation completed successfully. |
| integer, | public, | parameter | :: | solver_status_invalid_argument | = | 1 |
Caller supplied an invalid handle, key, buffer, or scalar argument. |
| integer, | public, | parameter | :: | solver_status_invalid_state | = | 2 |
Operation requires an initialised runtime, but the session is not ready. |
| integer, | public, | parameter | :: | solver_status_config_error | = | 3 |
Config loading or validation failed. |
| integer, | public, | parameter | :: | solver_status_io_error | = | 4 |
File I/O or other runtime setup/output work failed. |
| integer, | public, | parameter | :: | solver_status_busy | = | 5 |
Reserved for adapters that need to report temporary v1 exclusivity/busy state. |
Polling-friendly runtime summary exposed to adapters.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | iteration | = | 0 | ||
| integer, | public | :: | n_point | = | 0 | ||
| logical, | public | :: | is_initialized | = | .false. | ||
| logical, | public | :: | is_finished | = | .false. | ||
| real(kind=wp), | public | :: | sim_time | = | 0.0_wp | ||
| real(kind=wp), | public | :: | time_stop | = | 0.0_wp | ||
| real(kind=wp), | public | :: | dt | = | 0.0_wp | ||
| real(kind=wp), | public | :: | residual | = | 0.0_wp |
Mutable solver session that owns one configuration and, optionally, one runtime.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(config_t), | public | :: | cfg | ||||
| type(solver_run_context_t), | public | :: | ctx | ||||
| integer, | public | :: | dim | = | 1 |
Problem dimension: 1 or 2. Set ONLY by solver_session_load_namelist via config_dim.read_dim on the namelist PATH; LOAD_CONFIG_INLINE / SET-built configs carry no namelist buffer and stay dim=1 (spec 2026-07-03 §2.7). |
|
| type(config_2d_t), | public | :: | cfg_2d | ||||
| type(solver_run_context_2d_t), | public | :: | ctx_2d | ||||
| character(len=512), | public | :: | nml_path | = | '' | ||
| character(len=512), | public | :: | case_dir | = | '' |
Case directory anchoring relative file paths for a LOAD_CONFIG_INLINE config (which has no namelist path to derive it from); '' -> resolve against the process cwd (unchanged legacy behaviour). |
|
| logical, | public | :: | has_runtime | = | .false. | ||
| character(len=512), | public | :: | last_error | = | '' |
Reset a session to its default empty state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(out) | :: | session |
Tear down any live runtime allocations and clear the last error.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session |
Load configuration from a namelist file into the session.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | filename | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message | ||
| character(len=*), | intent(in), | optional | :: | case_dir |
Optional case directory (LOAD_NAMELIST's case_dir) to anchor relative file paths; when absent/empty the namelist's own directory is used. |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| integer, | intent(in) | :: | dim | |||
| character(len=*), | intent(in), | optional | :: | case_dir |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session |
Validate the current configuration and allocate the runtime context.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Advance the runtime by at most max_steps iterations.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| integer, | intent(in) | :: | max_steps | |||
| integer, | intent(out) | :: | steps_taken | |||
| logical, | intent(out) | :: | finished | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Run the current session until time_stop is reached.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message | ||
| procedure(progress_callback_i), | optional | :: | on_progress | |||
| integer, | intent(in), | optional | :: | every_steps | ||
| real(kind=wp), | intent(in), | optional | :: | every_seconds |
Copy out a lightweight progress snapshot for polling clients.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| type(solver_progress_t), | intent(out) | :: | progress | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Return the current grid-point count expected by solution copy-out buffers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| integer, | intent(out) | :: | n_point | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| integer, | intent(out) | :: | n_point_global | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
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).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| integer, | intent(out) | :: | nx | |||
| integer, | intent(out) | :: | ny | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Copy the current primitive-variable solution into caller-owned arrays.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| real(kind=wp), | intent(out) | :: | x(:) | |||
| real(kind=wp), | intent(out) | :: | rho(:) | |||
| real(kind=wp), | intent(out) | :: | u(:) | |||
| real(kind=wp), | intent(out) | :: | p(:) | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| real(kind=wp), | intent(out) | :: | x_global(:) | |||
| real(kind=wp), | intent(out) | :: | rho_global(:) | |||
| real(kind=wp), | intent(out) | :: | u_global(:) | |||
| real(kind=wp), | intent(out) | :: | p_global(:) | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | primitives(:) | |||
| real(kind=wp), | intent(out) | :: | buf(:) | |||
| integer(kind=int64), | intent(out) | :: | offsets(:) | |||
| integer, | intent(out) | :: | nx | |||
| integer, | intent(out) | :: | ny | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Write the current solution in the standard result.dat-style text format.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in), | optional | :: | filename | ||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Force an immediate checkpoint write using the configured or overridden base name.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in), | optional | :: | base | ||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message | ||
| character(len=*), | intent(out), | optional | :: | written_path |
Optional. On success, the real on-disk path the |
Copy the last stored writable-operation error message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(out) | :: | message |
Read an integer configuration field by canonical schema key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| integer, | intent(out) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Read a scalar real configuration field by canonical schema key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| real(kind=wp), | intent(out) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Read a logical configuration field by canonical schema key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| logical, | intent(out) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Read a string or choice-token configuration field by canonical schema key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| character(len=*), | intent(out) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Read a real-3 configuration field by canonical schema key.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(in) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| real(kind=wp), | intent(out) | :: | value(3) | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Set an integer configuration field and invalidate any live runtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| integer, | intent(in) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Set a scalar real configuration field and invalidate any live runtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| real(kind=wp), | intent(in) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Set a logical configuration field and invalidate any live runtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| logical, | intent(in) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Set a string or choice-token configuration field and invalidate any runtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| character(len=*), | intent(in) | :: | value | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Set a real-3 configuration field and invalidate any live runtime.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| character(len=*), | intent(in) | :: | key | |||
| real(kind=wp), | intent(in) | :: | value(3) | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Tear down the live runtime context while keeping editable config state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session |
Store the last writable-operation error and mirror it to optional outputs.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(solver_session_t), | intent(inout) | :: | session | |||
| integer, | intent(in) | :: | status_code | |||
| character(len=*), | intent(in) | :: | err | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |
Mirror readonly-operation status without mutating the session state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | status_code | |||
| character(len=*), | intent(in) | :: | err | |||
| integer, | intent(out), | optional | :: | status | ||
| character(len=*), | intent(out), | optional | :: | message |