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
7!! scheme for the multicomponent Navier-Stokes equations. The system
8!! is augmented with the relevant advection equations to capture the
9!! material interfaces and closed by the stiffened equation of state
10!! as well as any required mixture relations. The effects of surface
11!! tension are included and modeled through a volume force that acts
12!! across the diffuse material interface regions. The implementation
13!! specifics of surface tension may be found in the work by Perigaud
14!! and Saurel (2005). Note that both viscous and capillarity effects
15!! are only available in the volume fraction model.
16program p_main
17
18 use m_global_parameters !< definitions of the global parameters
19
20 use m_start_up
21
23
24 use m_nvtx
25
26 implicit none
27
28 integer :: t_step !< Iterator for the time-stepping loop
29 real(wp) :: time_avg, time_final
30 real(wp) :: io_time_avg, io_time_final
31 real(wp), allocatable, dimension(:) :: proc_time
32 real(wp), allocatable, dimension(:) :: io_proc_time
33 logical :: file_exists
34 real(wp) :: start, finish
35 integer :: nt
36
37 call system_clock(count=cpu_start, count_rate=cpu_rate)
38
39 call nvtxstartrange("INIT")
40
41 !Initialize MPI
42 call nvtxstartrange("INIT-MPI")
44 call nvtxendrange
45
46 !Initialize Modules
47 call nvtxstartrange("INIT-MODULES")
49 call nvtxendrange
50
51 allocate (proc_time(0:num_procs - 1))
52 allocate (io_proc_time(0:num_procs - 1))
53
54 call nvtxstartrange("INIT-GPU-VARS")
56 call nvtxendrange
57
58 ! Setting the time-step iterator to the first time-step
59 if (cfl_dt) then
60 t_step = 0
62 else
63 t_step = t_step_start
64 if (t_step == 0) then
65 mytime = 0._wp
66 else
67 mytime = t_step*dt
68 end if
70 end if
71
72 call nvtxendrange ! INIT
73
74 call nvtxstartrange("SIMULATION-TIME-MARCH")
75 ! Time-stepping Loop
76 do
77
78 if (cfl_dt) then
79 if (mytime >= t_stop) then
80 call s_save_performance_metrics(time_avg, time_final, io_time_avg, &
81 io_time_final, proc_time, io_proc_time, file_exists)
82 exit
83 end if
84 else
85 if (t_step == t_step_stop) then
86 call s_save_performance_metrics(time_avg, time_final, io_time_avg, &
87 io_time_final, proc_time, io_proc_time, file_exists)
88 exit
89 end if
90 end if
91
92 call s_perform_time_step(t_step, time_avg)
93
94 if (cfl_dt) then
95 if (abs(mod(mytime, t_save)) < dt .or. mytime >= t_stop) then
96 call s_save_data(t_step, start, finish, io_time_avg, nt)
97 end if
98 else
99 if (mod(t_step - t_step_start, t_step_save) == 0 .or. t_step == t_step_stop) then
100 call s_save_data(t_step, start, finish, io_time_avg, nt)
101 end if
102 end if
103
104 call system_clock(cpu_end)
105 end do
106
107 call nvtxendrange ! Simulation
108
109 deallocate (proc_time, io_proc_time)
110
111 call nvtxstartrange("FINALIZE-MODULES")
112 call s_finalize_modules()
113 call nvtxendrange
114
115end 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)
Pushes a named NVTX range for GPU profiling, optionally with a color based on the given identifier.
Definition m_nvtx.f90:63
subroutine nvtxendrange
Pops the current NVTX range to end the GPU profiling region.
Definition m_nvtx.f90:84
Reads input files, loads initial conditions and grid data, and orchestrates solver initialization and...
impure subroutine, public s_initialize_modules
Initializes 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)
Collects per-process wall-clock times and writes aggregate performance metrics to file.
impure subroutine, public s_save_data(t_step, start, finish, io_time_avg, nt)
Saves conservative variable data to disk at the current time step.
subroutine, public s_initialize_gpu_vars
Transfers initial conservative variable and model parameter data to the GPU device.
impure subroutine, public s_initialize_mpi_domain
Sets up the MPI execution environment, binds GPUs, and decomposes the computational domain.
impure subroutine, public s_finalize_modules
Finalizes and deallocates all simulation sub-modules in reverse initialization order.
impure subroutine, public s_perform_time_step(t_step, time_avg)
Advances 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...