PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
Loading...
Searching...
No Matches
POST.f90
Go to the documentation of this file.
1! (from http://patorjk.com/software/taag/ ANSI shadow)
2
3! ██████╗ ██████╗ ███████╗████████╗
4! ██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝
5! ██████╔╝██║ ██║███████╗ ██║
6! ██╔═══╝ ██║ ██║╚════██║ ██║
7! ██║ ╚██████╔╝███████║ ██║
8! ╚═╝ ╚═════╝ ╚══════╝ ╚═╝
9
10!------------------------------------------------------------------------------!
11!> Peeling Ballooning in 3D: postprocessing
12!------------------------------------------------------------------------------!
13!> \author
14!! Toon Weyens,
15!! Contact: weyenst@gmail.com
16!------------------------------------------------------------------------------!
17!> \version 2.41
18!! \date 2012-2018
19!! Copyright (C) 2019 Toon Weyens
20!!
21!! This program is free software: you can redistribute it and/or modify
22!! it under the terms of the GNU General Public License as published by
23!! the Free Software Foundation, either version 3 of the License, or
24!! (at your option) any later version.
25!!
26!! This program is distributed in the hope that it will be useful,
27!! but WITHOUT ANY WARRANTY; without even the implied warranty of
28!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29!! GNU General Public License for more details.
30!!
31!! You should have received a copy of the License along with this program.
32!! If not, contact weyenst@gmail.com
33!------------------------------------------------------------------------------!
34!> \see
35!! References:
36!! \cite weyens2014theory
37!! \cite Weyens2017PB3D
38!------------------------------------------------------------------------------!
39#define CHCKERR if(ierr.ne.0) then; call sudden_stop(ierr); end if
40program post
41 use str_utilities, only: i2str
43 use messages
44 use hdf5_vars, only: init_hdf5
49 use input_ops, only: read_input_opts
53 use eq_utilities, only: do_eq, eq_info
54 use grid_vars, only: grid_type
55#if ldebug
56 use num_vars, only: ltest
57 use test, only: generic_tests
58#endif
59
60 implicit none
61
62 ! local variables
63 integer :: ierr ! error
64
65 !------------------------------!
66 ! Initialize some routines !
67 !------------------------------!
68 ierr = start_mpi() ! start MPI
69 chckerr
70 prog_name = 'POST' ! program name
71 prog_style = 2 ! post-processing part
72 call print_hello() ! print message with time, etc
73 call init_output() ! initialize output
74 call init_files() ! initialize file operations
75 call init_time() ! initialize time
76 call init_hdf5() ! initialize HDF5
77
78 !--------------------------!
79 ! Read the PB3D output !
80 !--------------------------!
81 call start_time
82 call writo('Initialization')
83 call lvl_ud(1)
84 if (rank.eq.0) then
85 ierr = parse_args() ! parse argument (options are used in open_input)
86 chckerr
87 ierr = open_input() ! open the input files
88 chckerr
89 ierr = reconstruct_pb3d_in('in') ! reconstruct miscellaneous PB3D output variables
90 chckerr
91 ierr = read_input_opts() ! read input options file
92 chckerr
93 ierr = open_output() ! open output file per alpha group
94 chckerr
95 call dealloc_in() ! clean up input from equilibrium codes
96 end if
97 ierr = broadcast_input_opts() ! broadcast input options to other processors
98 chckerr
99 call writo('')
100 call passed_time
101 call writo('')
102 call lvl_ud(-1)
103
104#if ldebug
105 !-------------------!
106 ! Do some tests !
107 !-------------------!
108 if (ltest) then
109 call start_time
110 call writo('Generic Tests')
111 call lvl_ud(1)
112 ierr = generic_tests()
113 chckerr
114 call writo('')
115 call passed_time
116 call writo('')
117 call lvl_ud(-1)
118 end if
119#endif
120
121 !-----------------!
122 ! Main driver !
123 !-----------------!
124 call start_time
125 call writo('Initializing POST')
126 call lvl_ud(1)
127 ierr = init_post()
128 chckerr
129 call stop_time
130 call writo('')
131 call lvl_ud(-1)
132 par: do while(do_eq())
133 call start_time
134 call writo('Main driver'//trim(eq_info()))
135 call lvl_ud(1)
136 ierr = run_driver_post()
137 chckerr
138 call writo('')
139 call passed_time
140 call writo('')
141 call lvl_ud(-1)
142 end do par
143 call stop_post()
144
145 !--------------!
146 ! clean up !
147 !--------------!
148 call writo('Clean up')
149 call lvl_ud(1)
150 ierr = stop_mpi()
151 chckerr
152 call close_output
153 call lvl_ud(-1)
154
155 call print_goodbye
156end program post
Main driver of PostProcessing of program Peeling Ballooning in 3D.
integer function, public run_driver_post()
The main driver routine for postprocessing.
subroutine, public stop_post()
Cleans up main driver for postprocessing.
integer function, public init_post()
Initializes the POST driver.
Numerical utilities related to equilibrium variables.
elemental character(len=max_str_ln) function, public eq_info()
Returns string with possible extension with equilibrium job as well as parallel job,...
logical function, public do_eq()
If this equilibrium job should be done, also increment eq_job_nr.
Operations related to files !
Definition files_ops.f90:4
integer function, public parse_args()
Parses the command line arguments.
Definition files_ops.f90:79
subroutine, public init_files()
Initialize the variables for the module.
Definition files_ops.f90:25
subroutine, public close_output()
Closes the output file.
integer function, public open_input()
Open the input files.
integer function, public open_output()
Open the output files.
Variables pertaining to the different grids used.
Definition grid_vars.f90:4
Variables pertaining to HDF5 and XDMF.
Definition HDF5_vars.f90:4
subroutine, public init_hdf5
Initializes the HDF5 types.
Definition HDF5_vars.f90:82
Operations concerning giving input.
Definition input_ops.f90:4
integer function, public read_input_opts()
Reads input options from user-provided input file.
Definition input_ops.f90:23
Numerical utilities related to input.
subroutine, public dealloc_in()
Cleans up input from equilibrium codes.
Numerical utilities related to giving output.
Definition messages.f90:4
subroutine, public passed_time()
Display the time that has passed between t1 and t2.
Definition messages.f90:152
subroutine, public print_goodbye()
Prints last messag.
Definition messages.f90:99
subroutine, public init_output()
Initialize the variables for the module.
Definition messages.f90:32
subroutine, public print_hello()
Prints first message.
Definition messages.f90:61
subroutine, public lvl_ud(inc)
Increases/decreases lvl of output.
Definition messages.f90:254
subroutine, public start_time()
Start a timer.
Definition messages.f90:121
subroutine, public init_time()
Intialize the time passed to 0.
Definition messages.f90:113
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition messages.f90:275
subroutine, public stop_time()
Stop a timer.
Definition messages.f90:132
Operations related to MPI.
Definition MPI_ops.f90:4
integer function, public stop_mpi(grid_eq, grid_eq_b, grid_x, grid_x_b, grid_sol, eq_1, eq_2, x_1, x_2, vac, sol)
Stop MPI.
Definition MPI_ops.f90:81
subroutine, public sudden_stop(ierr)
Suddenly stops the computations, aborting MPI, etc.
Definition MPI_ops.f90:483
integer function, public start_mpi()
Start MPI and gather information.
Definition MPI_ops.f90:22
integer function, public broadcast_input_opts()
Broadcasts options (e.g. user-prescribed) that are not passed through the HDF5 output file (i....
Definition MPI_ops.f90:247
Numerical variables used by most other modules.
Definition num_vars.f90:4
logical, public ltest
whether or not to call the testing routines
Definition num_vars.f90:112
integer, public prog_style
program style (1: PB3D, 2: PB3D_POST)
Definition num_vars.f90:53
character(len=4), public prog_name
name of program, used for info
Definition num_vars.f90:54
integer, public rank
MPI rank.
Definition num_vars.f90:68
Operations on PB3D output.
Definition PB3D_ops.f90:8
integer function, public reconstruct_pb3d_in(data_name)
Reconstructs the input variables from PB3D HDF5 output.
Definition PB3D_ops.f90:41
Operations on strings.
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Generic tests.
Definition test.f90:4
integer function, public generic_tests()
Performs generic tests.
Definition test.f90:39
Type for grids.
Definition grid_vars.f90:59