DRIVER: Reorganize the initialization/finalization of modules.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2019-01-29 18:13:24 -02:00
parent 099d077ab9
commit 6c23e9af19

View File

@ -215,7 +215,7 @@ program amun
!
if (iret > 0) then
call stop_timer(iin)
go to 500
go to 400
end if
! print the welcome message
@ -256,7 +256,7 @@ program amun
if (master) then
write(error_unit,"('[AMUN::program]: ', a)") "Problem reading parameters!"
end if
go to 400
go to 300
end if
#ifdef MPI
@ -275,14 +275,14 @@ program amun
write(error_unit,"('[AMUN::program]: ', a)") &
"Problem broadcasting parameters!"
end if
go to 400
go to 300
end if
#endif /* MPI */
! initialize IO to handle restart snapshots if necessary
!
call initialize_io(master, iret)
if (iret > 0) go to 380
if (iret > 0) go to 200
! get the run number
!
@ -364,55 +364,42 @@ program amun
! initialize the remaining modules
!
call initialize_random(1, 0)
if (iret > 0) go to 190
call initialize_equations(eqsys, eos, master, iret)
if (iret > 0) go to 360
if (iret > 0) go to 180
call initialize_coordinates(ncells, nghosts, toplev, bdims, xmin, xmax, &
ymin, ymax, zmin, zmax, master, iret)
if (iret > 0) go to 340
if (iret > 0) go to 170
call initialize_blocks((/ nv, nv, im, jm, km /), master, iret)
if (iret > 0) go to 320
call initialize_operators(master, iret)
if (iret > 0) go to 300
call initialize_sources(master, iret)
if (iret > 0) go to 280
call initialize_user_problem(problem, master, iret)
if (iret > 0) go to 260
call initialize_problems(problem, master, iret)
if (iret > 0) go to 240
call initialize_domains(problem, master, iret)
if (iret > 0) go to 220
call initialize_refinement(master, iret)
if (iret > 0) go to 200
! initialize module GRAVITY
!
call initialize_gravity(master, iret)
if (iret > 0) go to 260
! initialize boundaries
!
call initialize_boundaries(master, iret)
if (iret > 0) go to 200
! initialize module SHAPES
!
call initialize_shapes(master, iret)
if (iret > 0) go to 160
! initialize evolution
!
call initialize_evolution(master, iret)
call initialize_operators(master, iret)
if (iret > 0) go to 150
call initialize_sources(master, iret)
if (iret > 0) go to 140
! initialize module SCHEMES
!
call initialize_schemes(master, iret)
call initialize_user_problem(problem, master, iret)
if (iret > 0) go to 130
call initialize_problems(problem, master, iret)
if (iret > 0) go to 120
! initialize module INTERPOLATIONS
!
call initialize_interpolations(master, iret)
call initialize_domains(problem, master, iret)
if (iret > 0) go to 110
call initialize_boundaries(master, iret)
if (iret > 0) go to 100
call initialize_refinement(master, iret)
if (iret > 0) go to 90
call initialize_mesh(nrun, master, iret)
if (iret > 0) go to 80
call initialize_shapes(master, iret)
if (iret > 0) go to 70
call initialize_gravity(master, iret)
if (iret > 0) go to 60
call initialize_interpolations(master, iret)
if (iret > 0) go to 50
call initialize_schemes(master, iret)
if (iret > 0) go to 40
call initialize_evolution(master, iret)
if (iret > 0) go to 30
call initialize_integrals(master, nrun, iret)
if (iret > 0) go to 20
! print module information
!
@ -430,11 +417,6 @@ program amun
!
if (restart_from_snapshot()) then
! initialize the mesh module
!
call initialize_mesh(nrun, master, iret)
if (iret > 0) go to 40
! reconstruct the meta and data block structures from a given restart file
!
call read_restart_snapshot(iterm)
@ -447,7 +429,7 @@ program amun
! quit if there was a problem with reading restart snapshots
!
if (iterm > 0) go to 40
if (iterm > 0) go to 10
! update the list of leafs
!
@ -455,11 +437,6 @@ program amun
else
! initialize the mesh module
!
call initialize_mesh(nrun, master, iret)
if (iret > 0) go to 40
! generate the initial mesh, refine that mesh to the desired level according to
! the initialized problem
!
@ -475,11 +452,6 @@ program amun
end if
! initialize the integrals module
!
call initialize_integrals(master, nrun, iret)
if (iret > 0) go to 20
! store mesh statistics
!
call store_mesh_stats(step, time)
@ -665,72 +637,51 @@ program amun
! a label to go to if there are any problems, but since all modules have been
! initialized, we have to finalize them first
!
10 continue
10 continue
! start time accounting for the termination
!
call start_timer(itm)
! finalize integrals module
! finalize modules
!
20 continue
call finalize_integrals()
! finalize the mesh module
!
40 continue
call finalize_mesh(iret)
! finalize module INTERPOLATIONS
!
100 continue
call finalize_interpolations(iret)
! finalize module SCHEMES
!
120 continue
call finalize_schemes(iret)
! finalize module EVOLUTION
!
140 continue
30 continue
call finalize_evolution(iret)
! finalize module SHAPES
!
160 continue
call finalize_shapes(iret)
! finalize module BOUNDARIES
!
call finalize_boundaries(iret)
! finalize module GRAVITY
!
40 continue
call finalize_schemes(iret)
50 continue
call finalize_interpolations(iret)
60 continue
call finalize_gravity(iret)
! finalize modules
!
200 continue
70 continue
call finalize_shapes(iret)
80 continue
call finalize_mesh(iret)
90 continue
call finalize_refinement(iret)
220 continue
100 continue
call finalize_boundaries(iret)
110 continue
call finalize_domains(iret)
240 continue
120 continue
call finalize_problems(iret)
260 continue
130 continue
call finalize_user_problem(iret)
280 continue
140 continue
call finalize_sources(iret)
300 continue
150 continue
call finalize_operators(iret)
320 continue
160 continue
call finalize_blocks(iret)
340 continue
170 continue
call finalize_coordinates(iret)
360 continue
180 continue
call finalize_equations(iret)
190 continue
call finalize_random()
380 continue
200 continue
call finalize_io(iret)
! stop time accounting for the termination
@ -806,12 +757,12 @@ program amun
! finalize modules PARAMETERS
!
400 continue
300 continue
call finalize_parameters()
! finalize module MPITOOLS
!
500 continue
400 continue
call finalize_mpitools()
! finalize module TIMERS