Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2020-08-19 22:50:52 -03:00
commit 98006c3799

View File

@ -251,6 +251,7 @@ module io
use hdf5 , only : h5pset_deflate_f, h5pset_filter_f use hdf5 , only : h5pset_deflate_f, h5pset_filter_f
#endif /* HDF5 */ #endif /* HDF5 */
use iso_fortran_env, only : error_unit use iso_fortran_env, only : error_unit
use mpitools , only : nproc
use parameters , only : get_parameter use parameters , only : get_parameter
! local variables are not implicit by default ! local variables are not implicit by default
@ -264,6 +265,8 @@ module io
! local variables ! local variables
! !
logical :: test
character(len=255) :: dname
character(len=255) :: sformat = "xml" character(len=255) :: sformat = "xml"
character(len=255) :: precise = "off" character(len=255) :: precise = "off"
character(len=255) :: ghosts = "on" character(len=255) :: ghosts = "on"
@ -275,6 +278,7 @@ module io
integer, dimension(1) :: cd_values = 3 integer, dimension(1) :: cd_values = 3
#endif /* HDF5 */ #endif /* HDF5 */
#ifdef HDF5 #ifdef HDF5
! local parameters ! local parameters
! !
@ -341,6 +345,38 @@ module io
restart_format = snapshot_xml restart_format = snapshot_xml
end select end select
! check the last available restart snapshot
!
if (nrest < 0) then
test = .true.
nrest = 0
select case(restart_format)
#ifdef HDF5
case(snapshot_hdf5)
do while (test)
nrest = nrest + 1
write(dname, "(a,'r',i6.6,'_',i5.5,'.h5')") &
trim(respath), nrest, nproc
inquire(file = dname, exist = test)
end do
#endif /* HDF5 */
case default
do while (test)
nrest = nrest + 1
write(dname, "(a,'restart-',i5.5)") trim(respath), nrest
#ifdef __INTEL_COMPILER
inquire(directory = dname, exist = test)
#else /* __INTEL_COMPILER */
inquire(file = dname, exist = test)
#endif /* __INTEL_COMPILER */
end do
end select
nrest = nrest - 1
end if
! get compression format and level for XML+binary files ! get compression format and level for XML+binary files
! !
call get_parameter("compression_format", cformat) call get_parameter("compression_format", cformat)
@ -4219,8 +4255,8 @@ module io
! restore forcing coefficients ! restore forcing coefficients
! !
call read_attribute(gid, 'nmodes', lnmodes) call read_attribute(gid, 'nmodes', lnmodes)
if (lnmodes == nmodes .and. lnmodes > 0) then if (lnmodes == nmodes) then
call read_attribute(gid, 'fcoefs', fcoefs) if (lnmodes > 0) call read_attribute(gid, 'fcoefs', fcoefs)
else else
write(error_unit,"('[',a,']: ',a)") trim(loc) & write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "The number of driving modes does not match!" , "The number of driving modes does not match!"