initial_conditions Module

Provides a single public entry point apply_initial_condition that fills the conserved-state array state%ub and the ghost-state vectors (state%q_left, state%q_right, and the boundary split fluxes for FVS schemes) based on the problem_type field in the supplied configuration.

Supported problems: 'sod' — Sod shock tube 'shu_osher' — Shu-Osher shock/entropy-wave interaction 'smooth_wave' — Smooth advecting density wave (periodic) 'linear_advection' — Sinusoidal density on uniform background flow (periodic) 'woodward_colella' — Woodward-Colella interacting blast waves 'lax' — Lax shock tube 'from_file' — Read primitives (x, rho, u, p) from an external data file 'udf' — Call a user-defined Fortran subroutine compiled at runtime 'acoustic_pulse' — Gaussian acoustic pulse (quiescent background; NRBC benchmark)



Variables

Type Visibility Attributes Name Initial
integer(kind=c_int), private, parameter :: host_platform_windows = 1_c_int
integer(kind=c_int), private, parameter :: host_platform_macos = 2_c_int
integer(kind=c_int), private, parameter :: host_platform_linux = 3_c_int

Interfaces

interface

  • private function cfd_solver_host_platform() bind(C, name="cfd_solver_host_platform")

    Arguments

    None

    Return Value integer(kind=c_int)

interface

  • private function cfd_solver_call_udf(libpath, n, x, rho, rho_u, e_arr) bind(C, name="cfd_solver_call_udf")

    Arguments

    Type IntentOptional Attributes Name
    character(kind=c_char, len=1), intent(in) :: libpath(*)
    integer(kind=c_int), intent(in), value :: n
    real(kind=c_double), intent(in) :: x(n)
    real(kind=c_double), intent(out) :: rho(n)
    real(kind=c_double), intent(out) :: rho_u(n)
    real(kind=c_double), intent(out) :: e_arr(n)

    Return Value integer(kind=c_int)

interface

  • private function cfd_solver_get_pid() bind(C, name="cfd_solver_get_pid")

    Arguments

    None

    Return Value integer(kind=c_int)


Functions

private function get_host_platform() result(platform)

Return the host platform detected by the C portability shim.

Arguments

None

Return Value integer(kind=c_int)

private function get_windows_temp_dir() result(temp_dir)

Return the preferred runtime-UDF output directory on Windows.

Arguments

None

Return Value character(len=512)

private function join_path(dirpath, leafname, separator) result(full_path)

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

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dirpath
character(len=*), intent(in) :: leafname
character(len=1), intent(in) :: separator

Return Value character(len=len_trim)

private function quote_shell_arg(raw_path) result(quoted_path)

Wrap a filesystem path for the shell used by execute_command_line.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: raw_path

Return Value character(len=len_trim)


Subroutines

public subroutine apply_initial_condition(state, cfg)

Fill state%ub with the initial condition selected by cfg%problem_type.

Read more…

Arguments

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

Solver state (must have ub allocated, schemes bound)

type(config_t), intent(in) :: cfg

Runtime configuration

private subroutine set_left_right_states(state, cfg)

Convert namelist primitives (rho_left, u_left, p_left / rho_right, …) to conserved ghost state vectors and optionally pre-compute boundary split fluxes for FVS schemes.

Arguments

Type IntentOptional Attributes Name
type(solver_state_t), intent(inout) :: state
type(config_t), intent(in) :: cfg

private subroutine precompute_boundary_fluxes(state)

Pre-compute the boundary split fluxes fl_pos/fl_neg/fr_pos/fr_neg for FVS schemes. No-op when the FDS path is active (state%use_fds = .true.).

Arguments

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

private subroutine ic_from_file(state, cfg)

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

Read more…

Arguments

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

Solver state (must have ub allocated, schemes bound)

type(config_t), intent(in) :: cfg

Runtime configuration (uses cfg%ic_file, cfg%ic_interp, cfg%gam)

private subroutine ic_udf(state, cfg)

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…

Arguments

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

Solver state (must have ub allocated, schemes bound)

type(config_t), intent(in) :: cfg

Runtime configuration (uses cfg%ic_udf_src)