Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2021-10-20 18:10:47 -03:00
commit df4a9db539
4 changed files with 1041 additions and 115 deletions

View File

@ -48,7 +48,7 @@ program amun
use equations , only : nv, nf use equations , only : nv, nf
use evolution , only : initialize_evolution, finalize_evolution use evolution , only : initialize_evolution, finalize_evolution
use evolution , only : print_evolution use evolution , only : print_evolution
use evolution , only : advance, new_time_step use evolution , only : advance, initialize_time_step, new_time_step
use evolution , only : registers, step, time, dt, dtp, errtol use evolution , only : registers, step, time, dt, dtp, errtol
use forcing , only : initialize_forcing, finalize_forcing use forcing , only : initialize_forcing, finalize_forcing
use forcing , only : print_forcing use forcing , only : print_forcing
@ -62,7 +62,7 @@ program amun
use io , only : restart_snapshot_number, restart_from_snapshot use io , only : restart_snapshot_number, restart_from_snapshot
use io , only : read_snapshot_parameter use io , only : read_snapshot_parameter
use io , only : read_restart_snapshot, write_restart_snapshot use io , only : read_restart_snapshot, write_restart_snapshot
use io , only : write_snapshot, next_tout, precise_snapshots use io , only : write_snapshot, update_dtp
use mesh , only : initialize_mesh, finalize_mesh use mesh , only : initialize_mesh, finalize_mesh
use mesh , only : generate_mesh, store_mesh_stats use mesh , only : generate_mesh, store_mesh_stats
use mpitools , only : initialize_mpitools, finalize_mpitools use mpitools , only : initialize_mpitools, finalize_mpitools
@ -326,10 +326,6 @@ program amun
! !
trun = trun - tsav / 6.0d+01 trun = trun - tsav / 6.0d+01
! initialize dtp
!
dtp = 2.0d+00 * tmax
! get integral calculation interval ! get integral calculation interval
! !
call get_parameter("ndat", ndat) call get_parameter("ndat", ndat)
@ -553,9 +549,9 @@ program amun
! !
call boundary_variables(0.0d+00, 0.0d+00) call boundary_variables(0.0d+00, 0.0d+00)
! calculate new timestep ! estimate the initial timestep
! !
call new_time_step() call initialize_time_step()
end if end if
@ -621,10 +617,6 @@ program amun
! !
do while((nsteps <= nmax) .and. (time < tmax) .and. proceed) do while((nsteps <= nmax) .and. (time < tmax) .and. proceed)
! get the next snapshot time
!
if (precise_snapshots) dtp = next_tout() - time
! performe one step evolution ! performe one step evolution
! !
call advance(status) call advance(status)
@ -643,6 +635,14 @@ program amun
step = step + 1 step = step + 1
nsteps = nsteps + 1 nsteps = nsteps + 1
! update time step for precise snapshots
!
call update_dtp()
! estimate the next time step
!
call new_time_step()
! get current time in seconds ! get current time in seconds
! !
tm_curr = get_timer_total() tm_curr = get_timer_total()

File diff suppressed because it is too large Load Diff

View File

@ -438,7 +438,7 @@ module integrals
use equations , only : ien, imx, imy, imz use equations , only : ien, imx, imy, imz
use equations , only : magnetized, adiabatic_index, csnd use equations , only : magnetized, adiabatic_index, csnd
use equations , only : errors use equations , only : errors
use evolution , only : step, time, dtn, dth, dte use evolution , only : step, time, dt, dth, dte
use forcing , only : einj, rinj, arms use forcing , only : einj, rinj, arms
use helpers , only : flush_and_sync use helpers , only : flush_and_sync
#ifdef MPI #ifdef MPI
@ -1268,7 +1268,7 @@ module integrals
! write down the integrals and statistics to appropriate files ! write down the integrals and statistics to appropriate files
! !
if (stored) then if (stored) then
write(funit,"(i9,13(1x,1es18.8e3))") step, time, dtn, inarr(1:10), arms write(funit,"(i9,13(1x,1es18.8e3))") step, time, dt, inarr(1:10), arms
write(sunit,"(i9,23(1x,1es18.8e3))") step, time & write(sunit,"(i9,23(1x,1es18.8e3))") step, time &
, avarr(1), mnarr(1), mxarr(1) & , avarr(1), mnarr(1), mxarr(1) &
, avarr(2), mnarr(2), mxarr(2) & , avarr(2), mnarr(2), mxarr(2) &

View File

@ -213,7 +213,7 @@ module io
public :: restart_snapshot_number, restart_from_snapshot public :: restart_snapshot_number, restart_from_snapshot
public :: read_snapshot_parameter public :: read_snapshot_parameter
public :: read_restart_snapshot, write_restart_snapshot, write_snapshot public :: read_restart_snapshot, write_restart_snapshot, write_snapshot
public :: next_tout, precise_snapshots public :: update_dtp
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! !
@ -916,31 +916,32 @@ module io
! !
!=============================================================================== !===============================================================================
! !
! function NEXT_TOUT: ! subroutine UPDATE_DTP:
! ------------------ ! ---------------------
!
! Function returns the next data snapshot time.
! !
! Subroutine updates dtp from module EVOLUTION.
! !
!=============================================================================== !===============================================================================
! !
real(kind=8) function next_tout() subroutine update_dtp()
use evolution, only : time, dtp
! local variables are not implicit by default
!
implicit none implicit none
! !
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
if (hsnap > 0.0d+00) then if (precise_snapshots) then
next_tout = tsnap if (tsnap > time) then
else dtp = tsnap - time
next_tout = huge(hsnap) else
dtp = hsnap
endif
end if end if
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
end function next_tout end subroutine update_dtp
! !
!=============================================================================== !===============================================================================
!! !!
@ -1260,7 +1261,7 @@ module io
use blocks , only : change_blocks_process use blocks , only : change_blocks_process
use coordinates , only : nn => bcells, ncells, nghosts use coordinates , only : nn => bcells, ncells, nghosts
use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax
use evolution , only : step, time, dt, dtn, dte use evolution , only : step, time, dt, dth, dte
use evolution , only : niterations, nrejections, errs use evolution , only : niterations, nrejections, errs
use forcing , only : nmodes, fcoefs, einj use forcing , only : nmodes, fcoefs, einj
use hash , only : xxh64 use hash , only : xxh64
@ -1415,8 +1416,8 @@ module io
read(svalue, fmt = *) time read(svalue, fmt = *) time
case('dt') case('dt')
read(svalue, fmt = *) dt read(svalue, fmt = *) dt
case('dtn') case('dth')
read(svalue, fmt = *) dtn read(svalue, fmt = *) dth
case('dte') case('dte')
read(svalue, fmt = *) dte read(svalue, fmt = *) dte
case('niterations') case('niterations')
@ -2248,7 +2249,7 @@ module io
#endif /* NDIMS == 3 */ #endif /* NDIMS == 3 */
use coordinates , only : bdims => domain_base_dims use coordinates , only : bdims => domain_base_dims
use equations , only : eqsys, eos, nv use equations , only : eqsys, eos, nv
use evolution , only : step, time, dt, dtn, dte, cfl, glm_alpha, errs use evolution , only : step, time, dt, dth, dte, cfl, glm_alpha, errs
use evolution , only : atol, rtol, mrej, niterations, nrejections use evolution , only : atol, rtol, mrej, niterations, nrejections
use forcing , only : nmodes, fcoefs, einj use forcing , only : nmodes, fcoefs, einj
use iso_fortran_env, only : error_unit use iso_fortran_env, only : error_unit
@ -2396,7 +2397,7 @@ module io
call write_attribute_xml(lun, "step" , step) call write_attribute_xml(lun, "step" , step)
call write_attribute_xml(lun, "time" , time) call write_attribute_xml(lun, "time" , time)
call write_attribute_xml(lun, "dt" , dt) call write_attribute_xml(lun, "dt" , dt)
call write_attribute_xml(lun, "dtn" , dtn) call write_attribute_xml(lun, "dth" , dth)
call write_attribute_xml(lun, "dte" , dte) call write_attribute_xml(lun, "dte" , dte)
call write_attribute_xml(lun, "cfl" , cfl) call write_attribute_xml(lun, "cfl" , cfl)
call write_attribute_xml(lun, "glm_alpha", glm_alpha) call write_attribute_xml(lun, "glm_alpha", glm_alpha)
@ -4184,7 +4185,7 @@ module io
use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax
use coordinates , only : periodic use coordinates , only : periodic
use equations , only : eqsys, eos, adiabatic_index, csnd use equations , only : eqsys, eos, adiabatic_index, csnd
use evolution , only : step, time, dt, dtn, dte, cfl, glm_alpha, errs use evolution , only : step, time, dt, dth, dte, cfl, glm_alpha, errs
use evolution , only : atol, rtol, mrej, niterations, nrejections use evolution , only : atol, rtol, mrej, niterations, nrejections
use forcing , only : nmodes, einj, fcoefs use forcing , only : nmodes, einj, fcoefs
use hdf5 , only : hid_t use hdf5 , only : hid_t
@ -4287,7 +4288,7 @@ module io
call write_attribute(gid, 'zmax', zmax) call write_attribute(gid, 'zmax', zmax)
call write_attribute(gid, 'time', time) call write_attribute(gid, 'time', time)
call write_attribute(gid, 'dt' , dt ) call write_attribute(gid, 'dt' , dt )
call write_attribute(gid, 'dtn' , dtn ) call write_attribute(gid, 'dth' , dth )
call write_attribute(gid, 'dte' , dte ) call write_attribute(gid, 'dte' , dte )
call write_attribute(gid, 'cfl' , cfl ) call write_attribute(gid, 'cfl' , cfl )
call write_attribute(gid, 'glm_alpha', glm_alpha) call write_attribute(gid, 'glm_alpha', glm_alpha)
@ -4385,7 +4386,7 @@ module io
use blocks , only : get_mblocks, get_dblocks, get_nleafs use blocks , only : get_mblocks, get_dblocks, get_nleafs
use coordinates , only : ncells use coordinates , only : ncells
use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax use coordinates , only : xmin, xmax, ymin, ymax, zmin, zmax
use evolution , only : step, time, dt, dtn, dte use evolution , only : step, time, dt, dth, dte
use evolution , only : niterations, nrejections, errs use evolution , only : niterations, nrejections, errs
use forcing , only : nmodes, fcoefs use forcing , only : nmodes, fcoefs
use hdf5 , only : hid_t use hdf5 , only : hid_t
@ -4460,7 +4461,7 @@ module io
call read_attribute(gid, 'zmax', zmax) call read_attribute(gid, 'zmax', zmax)
call read_attribute(gid, 'time', time) call read_attribute(gid, 'time', time)
call read_attribute(gid, 'dt' , dt ) call read_attribute(gid, 'dt' , dt )
call read_attribute(gid, 'dtn' , dtn ) call read_attribute(gid, 'dth' , dth )
call read_attribute(gid, 'dte' , dte ) call read_attribute(gid, 'dte' , dte )
call read_attribute(gid, 'errs(1)', errs(1)) call read_attribute(gid, 'errs(1)', errs(1))
call read_attribute(gid, 'errs(2)', errs(2)) call read_attribute(gid, 'errs(2)', errs(2))