MFC
Exascale flow solver
Loading...
Searching...
No Matches
p_main.fpp.f90
Go to the documentation of this file.
1# 1 "/home/runner/work/MFC/MFC/src/simulation/p_main.fpp"
2!>
3!! @file
4!! @brief Contains program p_main
5
6!> @brief Quasi-conservative, shock- and interface- capturing finite-volume scheme for the multicomponent Navier-Stokes equations.
7program p_main
8
10 use m_start_up
12 use m_nvtx
13
14 implicit none
15
16 integer :: t_step !< Iterator for the time-stepping loop
17 real(wp) :: time_avg, time_final
18 real(wp) :: io_time_avg, io_time_final
19 real(wp), allocatable, dimension(:) :: proc_time
20 real(wp), allocatable, dimension(:) :: io_proc_time
21 logical :: file_exists
22 real(wp) :: start, finish
23 integer :: nt
24
25 call system_clock(count=cpu_start, count_rate=cpu_rate)
26
27 call nvtxstartrange("INIT")
28
29 ! Initialize MPI
30 call nvtxstartrange("INIT-MPI")
32 call nvtxendrange
33
34 ! Initialize Modules
35 call nvtxstartrange("INIT-MODULES")
37 call nvtxendrange
38
39 allocate (proc_time(0:num_procs - 1))
40 allocate (io_proc_time(0:num_procs - 1))
41
42 call nvtxstartrange("INIT-GPU-VARS")
44 call nvtxendrange
45
46 ! Setting the time-step iterator to the first time-step
47 if (cfl_dt) then
48 t_step = 0
50 else
51 t_step = t_step_start
52 if (t_step == 0) then
53 mytime = 0._wp
54 else
55 mytime = t_step*dt
56 end if
58 end if
59
60 call nvtxendrange ! INIT
61
62 call nvtxstartrange("SIMULATION-TIME-MARCH")
63 ! Time-stepping Loop
64 do
65 if (cfl_dt) then
66 if (mytime >= t_stop) then
67 call s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, &
68 & file_exists)
69 exit
70 end if
71 else
72 if (t_step == t_step_stop) then
73 call s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, &
74 & file_exists)
75 exit
76 end if
77 end if
78
79 call s_perform_time_step(t_step, time_avg)
80
81 if (cfl_dt) then
82 if (abs(mod(mytime, t_save)) < dt .or. mytime >= t_stop) then
83 call s_save_data(t_step, start, finish, io_time_avg, nt)
84 end if
85 else
86 if (mod(t_step - t_step_start, t_step_save) == 0 .or. t_step == t_step_stop) then
87 call s_save_data(t_step, start, finish, io_time_avg, nt)
88 end if
89 end if
90
91 call system_clock(cpu_end)
92 end do
93
94 call nvtxendrange ! Simulation
95
96 deallocate (proc_time, io_proc_time)
97
98 call nvtxstartrange("FINALIZE-MODULES")
100 call nvtxendrange
101end program p_main
Global parameters for the computational domain, fluid properties, and simulation algorithm configurat...
real(wp) mytime
Current simulation time.
integer num_procs
Number of processors.
real(wp) dt
Size of the time-step.
real(wp) finaltime
Final simulation time.
NVIDIA NVTX profiling API bindings for GPU performance instrumentation.
Definition m_nvtx.f90:6
subroutine nvtxstartrange(name, id)
Push a named NVTX range for GPU profiling, optionally with a color based on the given identifier.
Definition m_nvtx.f90:62
subroutine nvtxendrange
Pop the current NVTX range to end the GPU profiling region.
Definition m_nvtx.f90:83
Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and...
impure subroutine, public s_initialize_modules
Initialize all simulation sub-modules in the required dependency order.
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.
subroutine, public s_initialize_gpu_vars
Transfer initial conservative variable and model parameter data to the GPU device.
impure subroutine, public s_initialize_mpi_domain
Set up the MPI execution environment, bind GPUs, and decompose the computational domain.
impure subroutine, public s_finalize_modules
Finalize and deallocate all simulation sub-modules in reverse initialization order.
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.
Total-variation-diminishing (TVD) Runge–Kutta time integrators (1st-, 2nd-, and 3rd-order SSP).
program p_main
Quasi-conservative, shock- and interface- capturing finite-volume scheme for the multicomponent Navie...
Definition p_main.fpp.f90:7