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.
7!! The system is augmented with the relevant advection equations to capture the material interfaces and closed by the stiffened
8!! equation of state as well as any required mixture relations. The effects of surface tension are included and modeled through a
9!! volume force that acts across the diffuse material interface regions. The implementation specifics of surface tension may be
10!! found in the work by Perigaud and Saurel (2005). Note that both viscous and capillarity effects are only available in the volume
11!! fraction model.
12program p_main
13
15 use m_start_up
17 use m_nvtx
18
19 implicit none
20
21 integer :: t_step !< Iterator for the time-stepping loop
22 real(wp) :: time_avg, time_final
23 real(wp) :: io_time_avg, io_time_final
24 real(wp), allocatable, dimension(:) :: proc_time
25 real(wp), allocatable, dimension(:) :: io_proc_time
26 logical :: file_exists
27 real(wp) :: start, finish
28 integer :: nt
29
30 call system_clock(count=cpu_start, count_rate=cpu_rate)
31
32 call nvtxstartrange("INIT")
33
34 ! Initialize MPI
35 call nvtxstartrange("INIT-MPI")
37 call nvtxendrange
38
39 ! Initialize Modules
40 call nvtxstartrange("INIT-MODULES")
42 call nvtxendrange
43
44 allocate (proc_time(0:num_procs - 1))
45 allocate (io_proc_time(0:num_procs - 1))
46
47 call nvtxstartrange("INIT-GPU-VARS")
49 call nvtxendrange
50
51 ! Setting the time-step iterator to the first time-step
52 if (cfl_dt) then
53 t_step = 0
55 else
56 t_step = t_step_start
57 if (t_step == 0) then
58 mytime = 0._wp
59 else
60 mytime = t_step*dt
61 end if
63 end if
64
65 call nvtxendrange ! INIT
66
67 call nvtxstartrange("SIMULATION-TIME-MARCH")
68 ! Time-stepping Loop
69 do
70 if (cfl_dt) then
71 if (mytime >= t_stop) then
72 call s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, &
73 & file_exists)
74 exit
75 end if
76 else
77 if (t_step == t_step_stop) then
78 call s_save_performance_metrics(time_avg, time_final, io_time_avg, io_time_final, proc_time, io_proc_time, &
79 & file_exists)
80 exit
81 end if
82 end if
83
84 call s_perform_time_step(t_step, time_avg)
85
86 if (cfl_dt) then
87 if (abs(mod(mytime, t_save)) < dt .or. mytime >= t_stop) then
88 call s_save_data(t_step, start, finish, io_time_avg, nt)
89 end if
90 else
91 if (mod(t_step - t_step_start, t_step_save) == 0 .or. t_step == t_step_stop) then
92 call s_save_data(t_step, start, finish, io_time_avg, nt)
93 end if
94 end if
95
96 call system_clock(cpu_end)
97 end do
98
99 call nvtxendrange ! Simulation
100
101 deallocate (proc_time, io_proc_time)
102
103 call nvtxstartrange("FINALIZE-MODULES")
104 call s_finalize_modules()
105 call nvtxendrange
106end 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...