PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
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 !------------------------------------------------------------------------------!
12 !------------------------------------------------------------------------------!
16 !------------------------------------------------------------------------------!
33 !------------------------------------------------------------------------------!
38 !------------------------------------------------------------------------------!
39 #define CHCKERR if(ierr.ne.0) then; call sudden_stop(ierr); end if
40 program post
41  use str_utilities, only: i2str
42  use num_vars, only: prog_name, prog_style, rank
43  use messages
44  use hdf5_vars, only: init_hdf5
49  use input_ops, only: read_input_opts
51  use pb3d_ops, only: reconstruct_pb3d_in
52  use input_utilities, only: dealloc_in
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
156 end program post
mpi_ops::stop_mpi
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
mpi_ops
Operations related to MPI.
Definition: MPI_ops.f90:4
num_vars
Numerical variables used by most other modules.
Definition: num_vars.f90:4
messages::passed_time
subroutine, public passed_time()
Display the time that has passed between t1 and t2.
Definition: messages.f90:152
str_utilities::i2str
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Definition: str_utilities.f90:18
messages::start_time
subroutine, public start_time()
Start a timer.
Definition: messages.f90:121
hdf5_vars
Variables pertaining to HDF5 and XDMF.
Definition: HDF5_vars.f90:4
messages::stop_time
subroutine, public stop_time()
Stop a timer.
Definition: messages.f90:132
files_ops::open_input
integer function, public open_input()
Open the input files.
Definition: files_ops.f90:178
str_utilities
Operations on strings.
Definition: str_utilities.f90:4
grid_vars::grid_type
Type for grids.
Definition: grid_vars.f90:59
num_vars::prog_style
integer, public prog_style
program style (1: PB3D, 2: PB3D_POST)
Definition: num_vars.f90:53
num_vars::prog_name
character(len=4), public prog_name
name of program, used for info
Definition: num_vars.f90:54
pb3d_ops::reconstruct_pb3d_in
integer function, public reconstruct_pb3d_in(data_name)
Reconstructs the input variables from PB3D HDF5 output.
Definition: PB3D_ops.f90:41
driver_post::stop_post
subroutine, public stop_post()
Cleans up main driver for postprocessing.
Definition: driver_POST.f90:816
eq_utilities
Numerical utilities related to equilibrium variables.
Definition: eq_utilities.f90:4
num_vars::ltest
logical, public ltest
whether or not to call the testing routines
Definition: num_vars.f90:112
files_ops::parse_args
integer function, public parse_args()
Parses the command line arguments.
Definition: files_ops.f90:79
test
Generic tests.
Definition: test.f90:4
files_ops::init_files
subroutine, public init_files()
Initialize the variables for the module.
Definition: files_ops.f90:25
hdf5_vars::init_hdf5
subroutine, public init_hdf5
Initializes the HDF5 types.
Definition: HDF5_vars.f90:82
driver_post::init_post
integer function, public init_post()
Initializes the POST driver.
Definition: driver_POST.f90:77
eq_utilities::eq_info
elemental character(len=max_str_ln) function, public eq_info()
Returns string with possible extension with equilibrium job as well as parallel job,...
Definition: eq_utilities.f90:974
mpi_ops::start_mpi
integer function, public start_mpi()
Start MPI and gather information.
Definition: MPI_ops.f90:22
input_ops
Operations concerning giving input.
Definition: input_ops.f90:4
driver_post
Main driver of PostProcessing of program Peeling Ballooning in 3D.
Definition: driver_POST.f90:4
messages::writo
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition: messages.f90:275
messages
Numerical utilities related to giving output.
Definition: messages.f90:4
pb3d_ops
Operations on PB3D output.
Definition: PB3D_ops.f90:8
input_ops::read_input_opts
integer function, public read_input_opts()
Reads input options from user-provided input file.
Definition: input_ops.f90:23
mpi_ops::broadcast_input_opts
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
files_ops
Operations related to files !
Definition: files_ops.f90:4
messages::print_goodbye
subroutine, public print_goodbye()
Prints last messag.
Definition: messages.f90:99
grid_vars
Variables pertaining to the different grids used.
Definition: grid_vars.f90:4
messages::lvl_ud
subroutine, public lvl_ud(inc)
Increases/decreases lvl of output.
Definition: messages.f90:254
files_ops::close_output
subroutine, public close_output()
Closes the output file.
Definition: files_ops.f90:703
driver_post::run_driver_post
integer function, public run_driver_post()
The main driver routine for postprocessing.
Definition: driver_POST.f90:542
mpi_ops::sudden_stop
subroutine, public sudden_stop(ierr)
Suddenly stops the computations, aborting MPI, etc.
Definition: MPI_ops.f90:483
messages::init_time
subroutine, public init_time()
Intialize the time passed to 0.
Definition: messages.f90:113
eq_utilities::do_eq
logical function, public do_eq()
If this equilibrium job should be done, also increment eq_job_nr.
Definition: eq_utilities.f90:949
messages::init_output
subroutine, public init_output()
Initialize the variables for the module.
Definition: messages.f90:32
num_vars::rank
integer, public rank
MPI rank.
Definition: num_vars.f90:68
input_utilities::dealloc_in
subroutine, public dealloc_in()
Cleans up input from equilibrium codes.
Definition: input_utilities.f90:268
input_utilities
Numerical utilities related to input.
Definition: input_utilities.f90:4
test::generic_tests
integer function, public generic_tests()
Performs generic tests.
Definition: test.f90:39
files_ops::open_output
integer function, public open_output()
Open the output files.
Definition: files_ops.f90:529
messages::print_hello
subroutine, public print_hello()
Prints first message.
Definition: messages.f90:61
post
program post
Peeling Ballooning in 3D: postprocessing.
Definition: POST.f90:40