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/post_process/p_main.fpp"
2!>
3!! @file
4!! @brief Contains program p_main
5
6!> Post-process raw simulation data into formatted database files (Silo-HDF5 or Binary)
7program p_main
8
10 use m_start_up
11
12 implicit none
13
14 integer :: t_step, nt_step !< Iterator for the main time-stepping loop
15 !> Generic storage for the name(s) of the flow variable(s) that will be added to the formatted database file(s)
16 character(LEN=name_len) :: varname
17 real(wp) :: pres
18 real(wp) :: c
19 real(wp) :: start, finish
20
22
24
25 if (cfl_dt) then
26 t_step = n_start
27 n_save = int(t_stop/t_save) + 1
28 else
29 ! Setting the time-step iterator to the first time step to be post-processed
30 t_step = t_step_start
31 end if
32
33 ! Time-Marching Loop
34 do
35 ! If all time-steps are not ready to be post-processed and one rank is faster than another, the slower rank processing the
36 ! last available step might be killed when the faster rank attempts to process the first missing step, before the slower
37 ! rank finishes writing the last available step. To avoid this, we force synchronization here.
38 call s_mpi_barrier()
39
40 call cpu_time(start)
41
42 call s_perform_time_step(t_step)
43
44 call s_save_data(t_step, varname, pres, c)
45
46 call cpu_time(finish)
47
48 wall_time = abs(finish - start)
49
50 if (cfl_dt) then
51 nt_step = t_step - n_start + 1
52 else
53 nt_step = (t_step - t_step_start)/t_step_save + 1
54 end if
55 if (nt_step >= 2) then
56 wall_time_avg = (wall_time + (nt_step - 2)*wall_time_avg)/(nt_step - 1)
57 else
58 wall_time_avg = 0._wp
59 end if
60
61 if (cfl_dt) then
62 if (t_step == n_save - 1) then
63 exit
64 end if
65 else
66 ! Adjust time-step iterator to reach final step if needed, else exit
67 if ((t_step_stop - t_step) < t_step_save .and. t_step_stop /= t_step) then
68 t_step = t_step_stop - t_step_save
69 else if (t_step == t_step_stop) then
70 exit
71 end if
72 end if
73
74 if (cfl_dt) then
75 t_step = t_step + 1
76 else
77 ! Incrementing time-step iterator to next time-step to be post-processed
78 t_step = t_step + t_step_save
79 end if
80 end do
81 ! END: Time-Marching Loop
82
83 close (11)
84
86end program p_main
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
real(wp) wall_time_avg
Wall time measurements.
Reads and validates user inputs, allocates variables, and configures MPI decomposition and I/O for po...
impure subroutine s_save_data(t_step, varname, pres, c)
Derive requested flow quantities from primitive variables and write them to the formatted database fi...
impure subroutine s_initialize_mpi_domain
Set up the MPI environment, read and broadcast user inputs, and decompose the computational domain.
impure subroutine s_perform_time_step(t_step)
Load grid and conservative data for a time step, fill ghost-cell buffers, and convert to primitive va...
impure subroutine s_finalize_modules
Destroy FFTW plans, free MPI communicators, and finalize all post-process sub-modules.
impure subroutine s_initialize_modules
Initialize all post-process sub-modules, set up I/O pointers, and prepare FFTW plans and MPI communic...
program p_main
Post-process raw simulation data into formatted database files (Silo-HDF5 or Binary).
Definition p_main.fpp.f90:7