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!> @brief The post-process restructures raw unformatted data, outputted by
7!! the simulation, into a formatted database, Silo-HDF5 or Binary,
8!! chosen by the user. The user may also specify which variables to
9!! include in the database. The choices range from any one of the
10!! primitive and conservative variables, as well as quantities that
11!! can be derived from those such as the unadvected volume fraction,
12!! specific heat ratio, liquid stiffness, speed of sound, vorticity
13!! and the numerical Schlieren function.
14program p_main
15
16 use m_global_parameters !< global parameters for the code
17 use m_start_up
18
19 implicit none
20
21 integer :: t_step !< Iterator for the main time-stepping loop
22
23 character(LEN=name_len) :: varname !<
24 !! Generic storage for the name(s) of the flow variable(s) that will be added
25 !! to the formatted database file(s)
26
27 real(wp) :: pres
28 real(wp) :: c
29 real(wp) :: h
30 real(wp) :: start, finish
31
33
35
36 if (cfl_dt) then
37 t_step = n_start
38 n_save = int(t_stop/t_save) + 1
39 else
40 ! Setting the time-step iterator to the first time step to be post-processed
41 t_step = t_step_start
42 end if
43
44 ! Time-Marching Loop
45 do
46
47 ! If all time-steps are not ready to be post-processed and one rank is
48 ! faster than another, the slower rank processing the last available
49 ! step might be killed when the faster rank attempts to process the
50 ! first missing step, before the slower rank finishes writing the last
51 ! available step. To avoid this, we force synchronization here.
52 call s_mpi_barrier()
53
54 call cpu_time(start)
55
56 call s_perform_time_step(t_step)
57
58 call s_save_data(t_step, varname, pres, c, h)
59
60 call cpu_time(finish)
61
62 wall_time = abs(finish - start)
63
64 if (t_step >= 2) then
65 wall_time_avg = (wall_time + (t_step - 2)*wall_time_avg)/(t_step - 1)
66 else
67 wall_time_avg = 0._wp
68 end if
69
70 if (cfl_dt) then
71 if (t_step == n_save - 1) then
72 exit
73 end if
74 else
75 ! Modifies the time-step iterator so that it may reach the final time-
76 ! step to be post-processed, in the case that this one is not originally
77 ! attainable through constant incrementation from the first time-step.
78 ! This modification is performed upon reaching the final time-step. In
79 ! case that it is not needed, the post-processor is done and may exit.
80 if ((t_step_stop - t_step) < t_step_save .and. t_step_stop /= t_step) then
81 t_step = t_step_stop - t_step_save
82 elseif (t_step == t_step_stop) then
83 exit
84 end if
85 end if
86
87 if (cfl_dt) then
88 t_step = t_step + 1
89 else
90 ! Incrementing time-step iterator to next time-step to be post-processed
91 t_step = t_step + t_step_save
92 end if
93
94 end do
95 ! END: Time-Marching Loop
96
97 close (11)
98
100
101end program p_main
Global parameters for the post-process: domain geometry, equation of state, and output database setti...
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
The post-process restructures raw unformatted data, outputted by the simulation, into a formatted dat...