DRIVER, PROBLEMS, IO: Initiate problems earlier.
Also store the problem name in the restart snapshot. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
2ae8cd14f1
commit
4aa92643ab
@ -89,12 +89,13 @@ program amun
|
||||
|
||||
! default parameters
|
||||
!
|
||||
character(len=32) :: eqsys = "hydrodynamic"
|
||||
character(len=32) :: eos = "adiabatic"
|
||||
integer :: toplev = 1
|
||||
integer :: nmax = huge(1), ndat = 1
|
||||
real(kind=8) :: tmax = 0.0d+00, trun = 9.999d+03, tsav = 3.0d+01
|
||||
real(kind=8) :: dtnext = 0.0d+00
|
||||
character(len=64) :: problem = "none"
|
||||
character(len=32) :: eqsys = "hydrodynamic"
|
||||
character(len=32) :: eos = "adiabatic"
|
||||
integer :: toplev = 1
|
||||
integer :: nmax = huge(1), ndat = 1
|
||||
real(kind=8) :: tmax = 0.0d+00, trun = 9.999d+03, tsav = 3.0d+01
|
||||
real(kind=8) :: dtnext = 0.0d+00
|
||||
|
||||
! flag to adjust time precisely to the snapshots
|
||||
!
|
||||
@ -280,13 +281,15 @@ program amun
|
||||
! the restart snapshot, otherwise, read them from the parameter file
|
||||
!
|
||||
if (job_restart) then
|
||||
call read_snapshot_parameter("eqsys" , eqsys , iret)
|
||||
call read_snapshot_parameter("eos" , eos , iret)
|
||||
call read_snapshot_parameter("maxlev", toplev, iret)
|
||||
call read_snapshot_parameter("problem", problem, iret)
|
||||
call read_snapshot_parameter("eqsys" , eqsys , iret)
|
||||
call read_snapshot_parameter("eos" , eos , iret)
|
||||
call read_snapshot_parameter("maxlev" , toplev , iret)
|
||||
else
|
||||
call get_parameter("equation_system" , eqsys )
|
||||
call get_parameter("equation_of_state", eos )
|
||||
call get_parameter("maxlev" , toplev)
|
||||
call get_parameter("problem" , problem)
|
||||
call get_parameter("equation_system" , eqsys )
|
||||
call get_parameter("equation_of_state", eos )
|
||||
call get_parameter("maxlev" , toplev )
|
||||
end if
|
||||
|
||||
! get the execution termination parameters
|
||||
@ -326,6 +329,16 @@ program amun
|
||||
!
|
||||
call initialize_random(1, 0)
|
||||
|
||||
! initialize module USER_PROBLEM
|
||||
!
|
||||
call initialize_user_problem(problem, master, iret)
|
||||
if (iret > 0) go to 340
|
||||
|
||||
! initialize module PROBLEMS
|
||||
!
|
||||
call initialize_problems(problem, master, iret)
|
||||
if (iret > 0) go to 320
|
||||
|
||||
! initialize module EQUATIONS
|
||||
!
|
||||
call initialize_equations(eqsys, eos, master, iret)
|
||||
@ -350,17 +363,6 @@ program amun
|
||||
!
|
||||
if (iret > 0) go to 60
|
||||
|
||||
! print information about the problem
|
||||
!
|
||||
if (master) then
|
||||
write (*,*)
|
||||
write (*,"(1x,a)" ) "Problem:"
|
||||
end if
|
||||
|
||||
! initialize module USER_PROBLEM
|
||||
!
|
||||
call initialize_user_problem(master, iret)
|
||||
|
||||
! initialize refinement module and print info
|
||||
!
|
||||
if (master) then
|
||||
@ -422,10 +424,6 @@ program amun
|
||||
!
|
||||
call initialize_boundaries(master, iret)
|
||||
|
||||
! initialize module PROBLEMS
|
||||
!
|
||||
call initialize_problems(master, iret)
|
||||
|
||||
! initialize module SHAPES
|
||||
!
|
||||
call initialize_shapes(master, iret)
|
||||
@ -723,10 +721,6 @@ program amun
|
||||
!
|
||||
call finalize_io(iret)
|
||||
|
||||
! finalize module PROBLEMS
|
||||
!
|
||||
call finalize_problems(iret)
|
||||
|
||||
! finalize module SOURCES
|
||||
!
|
||||
call finalize_sources(iret)
|
||||
@ -755,10 +749,6 @@ program amun
|
||||
!
|
||||
call finalize_random()
|
||||
|
||||
! finalize the user problem module
|
||||
!
|
||||
call finalize_user_problem(iret)
|
||||
|
||||
! finalize module OPERATORS
|
||||
!
|
||||
call finalize_operators(iret)
|
||||
@ -808,6 +798,16 @@ program amun
|
||||
300 continue
|
||||
call finalize_equations(iret)
|
||||
|
||||
! finalize module PROBLEMS
|
||||
!
|
||||
320 continue
|
||||
call finalize_problems(iret)
|
||||
|
||||
! finalize module USER_PROBLEMS
|
||||
!
|
||||
340 continue
|
||||
call finalize_user_problem(iret)
|
||||
|
||||
! stop time accounting for the termination
|
||||
!
|
||||
call stop_timer(itm)
|
||||
|
@ -1640,6 +1640,7 @@ module io
|
||||
use hdf5 , only : h5gcreate_f, h5gclose_f
|
||||
use iso_fortran_env, only : error_unit
|
||||
use mpitools , only : nprocs, nproc
|
||||
use problems , only : problem_name
|
||||
use random , only : nseeds, get_seeds
|
||||
|
||||
! local variables are not implicit by default
|
||||
@ -1699,6 +1700,7 @@ module io
|
||||
|
||||
! store string attributes
|
||||
!
|
||||
call write_attribute(gid, 'problem', problem_name )
|
||||
call write_attribute(gid, 'eqsys' , eqsys )
|
||||
call write_attribute(gid, 'eos' , eos )
|
||||
|
||||
|
@ -47,6 +47,10 @@ module problems
|
||||
integer, save :: imi, imu
|
||||
#endif /* PROFILE */
|
||||
|
||||
! problem name
|
||||
!
|
||||
character(len=64), save :: problem_name = "none"
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
abstract interface
|
||||
@ -68,6 +72,7 @@ module problems
|
||||
!
|
||||
public :: initialize_problems, finalize_problems
|
||||
public :: setup_problem
|
||||
public :: problem_name
|
||||
|
||||
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
!
|
||||
@ -88,12 +93,13 @@ module problems
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! problem - the problem name
|
||||
! verbose - a logical flag turning the information printing;
|
||||
! iret - an integer flag for error return value;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine initialize_problems(verbose, iret)
|
||||
subroutine initialize_problems(problem, verbose, iret)
|
||||
|
||||
! include external procedures and variables
|
||||
!
|
||||
@ -106,12 +112,9 @@ module problems
|
||||
|
||||
! subroutine arguments
|
||||
!
|
||||
logical, intent(in) :: verbose
|
||||
integer, intent(inout) :: iret
|
||||
|
||||
! local variables
|
||||
!
|
||||
character(len=64) :: problem_name = "blast"
|
||||
character(len=64), intent(in) :: problem
|
||||
logical , intent(in) :: verbose
|
||||
integer , intent(inout) :: iret
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -126,14 +129,14 @@ module problems
|
||||
call start_timer(imi)
|
||||
#endif /* PROFILE */
|
||||
|
||||
! get the problem name
|
||||
! set problem name
|
||||
!
|
||||
call get_parameter("problem", problem_name)
|
||||
problem_name = problem
|
||||
|
||||
! associate the setup_problem pointer with the respective problem setup
|
||||
! subroutine
|
||||
!
|
||||
select case(trim(problem_name))
|
||||
select case(trim(problem))
|
||||
|
||||
! general test problems
|
||||
!
|
||||
|
@ -66,12 +66,13 @@ module user_problem
|
||||
!
|
||||
! Arguments:
|
||||
!
|
||||
! problem - the problem name
|
||||
! verbose - a logical flag turning the information printing;
|
||||
! iret - an integer flag for error return value;
|
||||
!
|
||||
!===============================================================================
|
||||
!
|
||||
subroutine initialize_user_problem(verbose, iret)
|
||||
subroutine initialize_user_problem(problem, verbose, iret)
|
||||
|
||||
! include external procedures and variables
|
||||
!
|
||||
@ -83,12 +84,9 @@ module user_problem
|
||||
|
||||
! subroutine arguments
|
||||
!
|
||||
logical, intent(in) :: verbose
|
||||
integer, intent(inout) :: iret
|
||||
|
||||
! local variables
|
||||
!
|
||||
character(len=64) :: problem_name = "none"
|
||||
character(len=64), intent(in) :: problem
|
||||
logical , intent(in) :: verbose
|
||||
integer , intent(inout) :: iret
|
||||
!
|
||||
!-------------------------------------------------------------------------------
|
||||
!
|
||||
@ -107,16 +105,16 @@ module user_problem
|
||||
call start_timer(imi)
|
||||
#endif /* PROFILE */
|
||||
|
||||
! get the problem name
|
||||
!
|
||||
call get_parameter("problem", problem_name)
|
||||
|
||||
! print information about the user problem such as problem name, its
|
||||
! parameters, etc.
|
||||
!
|
||||
if (verbose) then
|
||||
|
||||
write (*,"(4x,a14, 9x,'=',2x,a)") "problem name ", trim(problem_name)
|
||||
! print information about the problem
|
||||
!
|
||||
write (*,*)
|
||||
write (*,"(1x,a)") "Problem:"
|
||||
write (*,"(4x,a12,11x,'=',1x,a)") "problem name", trim(problem)
|
||||
|
||||
end if
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user