Merge branch 'master' into binaries

This commit is contained in:
Grzegorz Kowal 2021-11-25 11:57:25 -03:00
commit 1c8341ac53
3 changed files with 70 additions and 17 deletions

View File

@ -43,7 +43,7 @@ program amun
use random , only : initialize_random, finalize_random
use system , only : initialize_system, finalize_system
use system , only : print_system_info, prepare_system, evolve_system
use system , only : quit, nsteps, rngtype, nwork
use system , only : quit, nsteps, nwork
use timers , only : initialize_timers, finalize_timers
use timers , only : start_timer, stop_timer, set_timer, get_timer
use timers , only : get_timer_total, timer_enabled, timer_description
@ -138,21 +138,21 @@ program amun
call print_message(loc, "Could not read parameters!")
if (check_status(status /= 0)) go to 6000
! initialize a few basic modules: IO, SYSTEM, RRANDOM, and WORKSPACE
! initialize a few basic modules: IO, RANDOM, SYSTEM, and WORKSPACE
!
call initialize_io(verbose, status)
if (status /= 0) &
call print_message(loc, "Could not initialize module IO!")
if (check_status(status /= 0)) go to 5000
call initialize_random("same", 1, 0, nproc, status)
if (status /= 0) &
call print_message(loc, "Could not initialize module RANDOM!")
if (check_status(status /= 0)) go to 4000
call initialize_system(verbose, status)
if (status /= 0) &
call print_message(loc, "Could not initialize module SYSTEM!")
if (check_status(status /= 0)) go to 4000
call initialize_random(rngtype, 1, 0, nproc, status)
if (status /= 0) &
call print_message(loc, "Could not initialize module RANDOM!")
if (check_status(status /= 0)) go to 3000
call initialize_workspace(nwork, status)
@ -196,14 +196,14 @@ program amun
call print_message(loc, "Could not finalize module WORKSPACE!")
2000 continue
call finalize_random(status)
if (status /= 0) &
call print_message(loc, "Could not finalize module RANDOM!")
3000 continue
call finalize_system(verbose, status)
if (status /= 0) &
call print_message(loc, "Could not finalize module SYSTEM!")
3000 continue
call finalize_random(status)
if (status /= 0) &
call print_message(loc, "Could not finalize module RANDOM!")
4000 continue
call finalize_io(status)

View File

@ -53,14 +53,10 @@ module random
!
real(kind=8), parameter :: i64tor8 = 2.0d+00**(-53)
! by default everything is private
!
private
! declare public subroutines
!
public :: initialize_random, finalize_random
public :: nseeds, set_seeds, get_seeds, gentype
public :: nseeds, reset_seeds, set_seeds, get_seeds, gentype
public :: randuni, randsym, randnorz
contains
@ -175,6 +171,60 @@ module random
!
!===============================================================================
!
! subroutine RESET_SEEDS:
! ----------------------
!
! Subroutine resets the seeds, according to the generator type.
!
! Arguments:
!
! rngtype - the generator type ('same' or 'random');
!
!===============================================================================
!
subroutine reset_seeds(rngtype)
implicit none
character(len=*), intent(in) :: rngtype
integer :: i
integer(kind=8), dimension(4) :: s
!-------------------------------------------------------------------------------
!
select case(trim(rngtype))
case('random')
state = 1234567890
s(1) = splitmix64()
s(2) = splitmix64()
s(3) = splitmix64()
s(4) = splitmix64()
do i = 1, nseeds * np
call jump(s(:))
end do
seeds(:,0) = s(:)
do i = 1, lseed
call jump(s(:))
seeds(:,i) = s(:)
end do
gentype = 'random'
case default
state = 1234567890
seeds(1,:) = splitmix64()
seeds(2,:) = splitmix64()
seeds(3,:) = splitmix64()
seeds(4,:) = splitmix64()
gentype = 'same'
end select
!-------------------------------------------------------------------------------
!
end subroutine reset_seeds
!
!===============================================================================
!
! subroutine SET_SEEDS:
! --------------------
!

View File

@ -115,6 +115,7 @@ module system
use mesh , only : initialize_mesh
use mpitools , only : check_status
use problems , only : initialize_problems
use random , only : reset_seeds
use statistics , only : initialize_statistics
implicit none
@ -133,6 +134,8 @@ module system
call print_message(loc, "Could not restore the system parameters!")
if (check_status(status /= 0)) return
call reset_seeds(rngtype)
call initialize_equations(eqsys, eos, verbose, status)
if (status /=0) &
call print_message(loc, "Could not initialize module EQUATIONS!")