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 !< 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) :: h
20 real(wp) :: start, finish
21
23
25
26 if (cfl_dt) then
27 t_step = n_start
28 n_save = int(t_stop/t_save) + 1
29 else
30 ! Setting the time-step iterator to the first time step to be post-processed
31 t_step = t_step_start
32 end if
33
34 ! Time-Marching Loop
35 do
36 ! If all time-steps are not ready to be post-processed and one rank is faster than another, the slower rank processing the
37 ! last available step might be killed when the faster rank attempts to process the first missing step, before the slower
38 ! rank finishes writing the last available step. To avoid this, we force synchronization here.
39 call s_mpi_barrier()
40
41 call cpu_time(start)
42
43 call s_perform_time_step(t_step)
44
45 call s_save_data(t_step, varname, pres, c, h)
46
47 call cpu_time(finish)
48
49 wall_time = abs(finish - start)
50
51 if (t_step >= 2) then
52 wall_time_avg = (wall_time + (t_step - 2)*wall_time_avg)/(t_step - 1)
53 else
54 wall_time_avg = 0._wp
55 end if
56
57 if (cfl_dt) then
58 if (t_step == n_save - 1) then
59 exit
60 end if
61 else
62 ! Adjust time-step iterator to reach final step if needed, else exit
63 if ((t_step_stop - t_step) < t_step_save .and. t_step_stop /= t_step) then
64 t_step = t_step_stop - t_step_save
65 else if (t_step == t_step_stop) then
66 exit
67 end if
68 end if
69
70 if (cfl_dt) then
71 t_step = t_step + 1
72 else
73 ! Incrementing time-step iterator to next time-step to be post-processed
74 t_step = t_step + t_step_save
75 end if
76 end do
77 ! END: Time-Marching Loop
78
79 if (proc_rank == 0 .and. ib_state_wrt) then
80 call s_write_ib_state_files()
81 end if
82
83 close (11)
84
86end program p_main
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
integer proc_rank
Rank of the local processor.
integer t_step_save
Interval between consecutive time-step directory.
integer t_step_start
First time-step directory.
real(wp) wall_time_avg
Wall time measurements.
integer t_step_stop
Last time-step directory.
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, h)
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