MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_start_up Module Reference

Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and finalization. More...

Functions/Subroutines

impure subroutine, public s_read_data_files (q_cons_vf)
 Read data files. Dispatch subroutine that replaces procedure pointer.
impure subroutine, public s_read_input_file
 Verify the input file exists and read it.
impure subroutine, public s_check_input_file
 Validate that all user-provided inputs form a consistent simulation configuration.
impure subroutine, public s_read_serial_data_files (q_cons_vf)
 Read serial initial condition and grid data files and compute cell-width distributions.
impure subroutine, public s_read_parallel_data_files (q_cons_vf)
 Read parallel initial condition and grid data files via MPI I/O.
impure subroutine s_check_restart_file_size (ifile, file_loc, expected_bytes)
 Abort if an open restart file holds fewer bytes than are about to be read from it, as a job killed while writing it leaves. MPI reads past the end return short without an error, so the missing tail would come back as garbage.
subroutine, public s_initialize_internal_energy_equations (v_vf)
 Initialize internal-energy equations from phase mass, mixture momentum, and total energy.
impure subroutine, public s_perform_time_step (t_step, time_avg)
 Advance the simulation by one time step, handling CFL-based dt and time-stepper dispatch.
impure subroutine, public s_save_performance_metrics (time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, file_exists)
 Collect per-process wall-clock times and write aggregate performance metrics to file.
impure subroutine, public s_save_data (t_step, start, finish, io_time_avg, nt)
 Save conservative variable data to disk at the current time step.
impure subroutine, public s_initialize_modules
 Initialize all simulation sub-modules in the required dependency order.
impure subroutine, public s_initialize_mpi_domain
 Set up the MPI execution environment, bind GPUs, and decompose the computational domain.
subroutine, public s_initialize_gpu_vars
 Transfer initial conservative variable and model parameter data to the GPU device.
impure subroutine, public s_amr_start_fresh_blocks
 Fresh AMR run, before the first save: put the initial condition patches on the blocks and, under dynamic regrid, regrid once per level, so each level is tagged on the one above it.
impure subroutine s_read_lag_entities (save_count, rows, ids, n_loc)
 Read the Lagrangian bubbles or particles this rank starts with: the input-file rows (and their global IDs) on a fresh start, otherwise the restart-file rows, which also reset mytime and dt.
impure subroutine s_read_lag_input (path, ncols, n_glb, rows, ids, n_loc, n_read)
 Read the initial Lagrangian entities from path, one per line with ncols values, and return those in this rank's physical domain: rows(1:n_loc, :) and their global IDs ids(1:n_loc), which are the line numbers among the n_read lines read.
impure subroutine s_read_lag_restart (lag_kind, save_count, io_data, n_loc)
 Read restart_data/lag_<lag_kind>_<save_count>.dat written by s_write_lag_restart: set mytime and dt from the header and return this rank's n_loc rows in io_data(1:n_loc, 1:lag_io_vars). Each rank reads what the same rank wrote, so the run must use the same number of ranks as the one that wrote the file.
impure subroutine, public s_finalize_modules
 Finalize and deallocate all simulation sub-modules in reverse initialization order.
subroutine s_assign_particle_cloud_ib_defaults (cloud_ib_idx, ib_patch)
 Fills the properties of a generated particle-cloud IB that the IB state file does not carry (geometry, mass, moving_ibm, inert surface, identity rotation matrix, zeroed step state). This is the only place they are set - pre_process (s_add_cloud_particle) generates only position, kinematics and radius. cloud_ib_idx is the global patch id minus the number of namelist patches; pre_process numbers particles cloud by cloud.
impure subroutine s_read_ib_restart_data (t_step)
 Loads the IBs this rank owns from the IB state file for t_step into patch_ib(1:num_ibs), all of which are local. Under file_per_process the rank reads only its own restart_data/lustre_<t_step>/ib_state_<t_step>_<rank>.dat, which holds exactly its IBs; otherwise every rank reads every record of restart_data/ib_state_<t_step>.dat and keeps the ones f_local_rank_owns_location assigns it. Records carry kinematics, position, radius and the lumped wall temperature (read for thermal_bc = 3 only); every other property comes from the namelist patch (global id <= num_ibs) or the particle cloud the IB was generated from. Written by pre_process at t_step = 0 (src/pre_process/m_data_output.fpp:s_write_ib_state_0_file) and by s_write_ib_state_file on later steps.
impure subroutine s_resolve_ib_mass_relax ()
 ib_mass_relax = -1 (default): N = 30 for a moving body, else 0 (a fixed body leaks little, and the slip-wall N = 1 costs too much on some GPUs to be a default). It is 0 wherever an explicit value is refused (amr, cyl_coord, igr, bubbles, model_eqns /= 2, a blowing body), with a surface reaction (ib_flux_wall conserves there), and with hypoelasticity or mhd (their extra variables are not scaled), so the default never invalidates a case. Explicit values are unchanged. Called while patch_ib still holds the case-file patches (particle-cloud bodies carry no blowing or reaction), so every rank resolves alike.
subroutine s_build_ib_neighborhood ()
 Completes this rank's IB neighborhood once s_read_ib_restart_data has loaded only the IBs it owns: every rank sends its own IBs to, and receives the owned IBs of, each distinct rank in ib_neighbor_ranks, appending them to patch_ib after its own.
subroutine s_compute_ib_neighbor_ranks ()
 Build ib_neighbor_ranks(-1:1,-1:1,-1:1): MPI ranks of all neighbor domains. Uses two rounds of MPI_SENDRECV cascades - face neighbors are known from bc_*, edge neighbors are obtained in round 1, and (3D) corner neighbors in round 2.
subroutine s_get_neighbor_bounds ()

Variables

type(scalar_field), dimension(:), allocatable q_cons_temp
real(wp) dt_init
logical amr_fresh_start = .false.
 AMR: the fine level was prolonged from level 0 at start-up (no restart file), so the first step regrids onto the initial features.

Detailed Description

Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and finalization.

Function/Subroutine Documentation

◆ s_amr_start_fresh_blocks()

impure subroutine, public m_start_up::s_amr_start_fresh_blocks

Fresh AMR run, before the first save: put the initial condition patches on the blocks and, under dynamic regrid, regrid once per level, so each level is tagged on the one above it.

Definition at line 2105 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_assign_particle_cloud_ib_defaults()

subroutine m_start_up::s_assign_particle_cloud_ib_defaults ( integer, intent(in) cloud_ib_idx,
type(ib_patch_parameters), intent(inout) ib_patch )

Fills the properties of a generated particle-cloud IB that the IB state file does not carry (geometry, mass, moving_ibm, inert surface, identity rotation matrix, zeroed step state). This is the only place they are set - pre_process (s_add_cloud_particle) generates only position, kinematics and radius. cloud_ib_idx is the global patch id minus the number of namelist patches; pre_process numbers particles cloud by cloud.

Definition at line 2375 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_build_ib_neighborhood()

subroutine m_start_up::s_build_ib_neighborhood

Completes this rank's IB neighborhood once s_read_ib_restart_data has loaded only the IBs it owns: every rank sends its own IBs to, and receives the owned IBs of, each distinct rank in ib_neighbor_ranks, appending them to patch_ib after its own.

Definition at line 2559 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_check_input_file()

impure subroutine, public m_start_up::s_check_input_file

Validate that all user-provided inputs form a consistent simulation configuration.

Definition at line 561 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_check_restart_file_size()

impure subroutine m_start_up::s_check_restart_file_size ( integer, intent(in) ifile,
character(len=*), intent(in) file_loc,
integer(kind=mpi_offset_kind), intent(in) expected_bytes )

Abort if an open restart file holds fewer bytes than are about to be read from it, as a job killed while writing it leaves. MPI reads past the end return short without an error, so the missing tail would come back as garbage.

Definition at line 951 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_compute_ib_neighbor_ranks()

subroutine m_start_up::s_compute_ib_neighbor_ranks

Build ib_neighbor_ranks(-1:1,-1:1,-1:1): MPI ranks of all neighbor domains. Uses two rounds of MPI_SENDRECV cascades - face neighbors are known from bc_*, edge neighbors are obtained in round 1, and (3D) corner neighbors in round 2.

Definition at line 2635 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_finalize_modules()

impure subroutine, public m_start_up::s_finalize_modules

Finalize and deallocate all simulation sub-modules in reverse initialization order.

Definition at line 2321 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_get_neighbor_bounds()

subroutine m_start_up::s_get_neighbor_bounds

Definition at line 2846 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_initialize_gpu_vars()

subroutine, public m_start_up::s_initialize_gpu_vars

Transfer initial conservative variable and model parameter data to the GPU device.

Definition at line 1679 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_initialize_internal_energy_equations()

subroutine, public m_start_up::s_initialize_internal_energy_equations ( type(scalar_field), dimension(sys_size), intent(inout) v_vf)

Initialize internal-energy equations from phase mass, mixture momentum, and total energy.

Definition at line 972 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_initialize_modules()

impure subroutine, public m_start_up::s_initialize_modules

Initialize all simulation sub-modules in the required dependency order.

Definition at line 1399 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_initialize_mpi_domain()

impure subroutine, public m_start_up::s_initialize_mpi_domain

Set up the MPI execution environment, bind GPUs, and decompose the computational domain.

Definition at line 1590 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_perform_time_step()

impure subroutine, public m_start_up::s_perform_time_step ( integer, intent(inout) t_step,
real(wp), intent(inout) time_avg )

Advance the simulation by one time step, handling CFL-based dt and time-stepper dispatch.

Definition at line 1032 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_data_files()

impure subroutine, public m_start_up::s_read_data_files ( type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf)

Read data files. Dispatch subroutine that replaces procedure pointer.

Definition at line 464 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_ib_restart_data()

impure subroutine m_start_up::s_read_ib_restart_data ( integer, intent(in) t_step)

Loads the IBs this rank owns from the IB state file for t_step into patch_ib(1:num_ibs), all of which are local. Under file_per_process the rank reads only its own restart_data/lustre_<t_step>/ib_state_<t_step>_<rank>.dat, which holds exactly its IBs; otherwise every rank reads every record of restart_data/ib_state_<t_step>.dat and keeps the ones f_local_rank_owns_location assigns it. Records carry kinematics, position, radius and the lumped wall temperature (read for thermal_bc = 3 only); every other property comes from the namelist patch (global id <= num_ibs) or the particle cloud the IB was generated from. Written by pre_process at t_step = 0 (src/pre_process/m_data_output.fpp:s_write_ib_state_0_file) and by s_write_ib_state_file on later steps.

Definition at line 2438 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_input_file()

impure subroutine, public m_start_up::s_read_input_file

Verify the input file exists and read it.

Definition at line 477 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_lag_entities()

impure subroutine m_start_up::s_read_lag_entities ( integer, intent(in) save_count,
real(wp), dimension(:,:), intent(out), allocatable rows,
integer, dimension(:), intent(out), allocatable ids,
integer, intent(out) n_loc )

Read the Lagrangian bubbles or particles this rank starts with: the input-file rows (and their global IDs) on a fresh start, otherwise the restart-file rows, which also reset mytime and dt.

Definition at line 2122 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_lag_input()

impure subroutine m_start_up::s_read_lag_input ( character(len=*), intent(in) path,
integer, intent(in) ncols,
integer, intent(in) n_glb,
real(wp), dimension(:,:), intent(out), allocatable rows,
integer, dimension(:), intent(out), allocatable ids,
integer, intent(out) n_loc,
integer, intent(out) n_read )

Read the initial Lagrangian entities from path, one per line with ncols values, and return those in this rank's physical domain: rows(1:n_loc, :) and their global IDs ids(1:n_loc), which are the line numbers among the n_read lines read.

Definition at line 2155 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_read_lag_restart()

impure subroutine m_start_up::s_read_lag_restart ( character(len=*), intent(in) lag_kind,
integer, intent(in) save_count,
real(wp), dimension(:,:), intent(out), allocatable io_data,
integer, intent(out) n_loc )

Read restart_data/lag_<lag_kind>_<save_count>.dat written by s_write_lag_restart: set mytime and dt from the header and return this rank's n_loc rows in io_data(1:n_loc, 1:lag_io_vars). Each rank reads what the same rank wrote, so the run must use the same number of ranks as the one that wrote the file.

Definition at line 2201 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_read_parallel_data_files()

impure subroutine, public m_start_up::s_read_parallel_data_files ( type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf)

Read parallel initial condition and grid data files via MPI I/O.

Definition at line 697 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_read_serial_data_files()

impure subroutine, public m_start_up::s_read_serial_data_files ( type(scalar_field), dimension(sys_size), intent(inout) q_cons_vf)

Read serial initial condition and grid data files and compute cell-width distributions.

Definition at line 580 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_resolve_ib_mass_relax()

impure subroutine m_start_up::s_resolve_ib_mass_relax

ib_mass_relax = -1 (default): N = 30 for a moving body, else 0 (a fixed body leaks little, and the slip-wall N = 1 costs too much on some GPUs to be a default). It is 0 wherever an explicit value is refused (amr, cyl_coord, igr, bubbles, model_eqns /= 2, a blowing body), with a surface reaction (ib_flux_wall conserves there), and with hypoelasticity or mhd (their extra variables are not scaled), so the default never invalidates a case. Explicit values are unchanged. Called while patch_ib still holds the case-file patches (particle-cloud bodies carry no blowing or reaction), so every rank resolves alike.

Definition at line 2545 of file m_start_up.fpp.f90.

Here is the caller graph for this function:

◆ s_save_data()

impure subroutine, public m_start_up::s_save_data ( integer, intent(inout) t_step,
real(wp), intent(inout) start,
real(wp), intent(inout) finish,
real(wp), intent(inout) io_time_avg,
integer, intent(inout) nt )

Save conservative variable data to disk at the current time step.

Definition at line 1240 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_save_performance_metrics()

impure subroutine, public m_start_up::s_save_performance_metrics ( real(wp), intent(inout) time_avg,
real(wp), intent(inout) time_final,
real(wp), intent(inout) io_time_avg,
real(wp), intent(inout) io_time_final,
real(wp), dimension(:), intent(inout) proc_time,
real(wp), dimension(:), intent(inout) io_proc_time,
logical, intent(inout) file_exists )

Collect per-process wall-clock times and write aggregate performance metrics to file.

Definition at line 1178 of file m_start_up.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ amr_fresh_start

logical m_start_up::amr_fresh_start = .false.

AMR: the fine level was prolonged from level 0 at start-up (no restart file), so the first step regrids onto the initial features.

Definition at line 459 of file m_start_up.fpp.f90.

◆ dt_init

real(wp) m_start_up::dt_init

Definition at line 455 of file m_start_up.fpp.f90.

◆ q_cons_temp

type(scalar_field), dimension(:), allocatable m_start_up::q_cons_temp

Definition at line 454 of file m_start_up.fpp.f90.