diff --git a/src/module_param.f90 b/src/module_param.f90 index 69628f7ef..22bc27d15 100644 --- a/src/module_param.f90 +++ b/src/module_param.f90 @@ -304,6 +304,7 @@ module param real(mytype) :: dens1, dens2 real(mytype) :: C_filter character(len=512) :: inflowpath + logical :: validation_restart ! Logical, true when synchronization is needed logical, save :: sync_vel_needed = .true. diff --git a/src/parameters.f90 b/src/parameters.f90 index 53b15eced..c1e5365bc 100644 --- a/src/parameters.f90 +++ b/src/parameters.f90 @@ -50,7 +50,8 @@ subroutine parameter(input_i3d) NAMELIST /NumOptions/ ifirstder, isecondder, itimescheme, iimplicit, & nu0nu, cnu, ipinter NAMELIST /InOutParam/ irestart, icheckpoint, ioutput, nvisu, ilist, iprocessing, & - ninflows, ntimesteps, inflowpath, ioutflow, output2D, nprobes + ninflows, ntimesteps, inflowpath, ioutflow, output2D, nprobes, & + validation_restart NAMELIST /Statistics/ wrotation,spinup_time, nstat, initstat, istatfreq NAMELIST /ProbesParam/ flag_all_digits, flag_extra_probes, xyzprobes NAMELIST /ScalarParam/ sc, ri, uset, cp, & @@ -685,6 +686,7 @@ subroutine parameter_defaults() ioutflow=0 output2D = 0 nprobes=0 + validation_restart = .true. !! PROBES flag_all_digits = .false. diff --git a/src/tools.f90 b/src/tools.f90 index 938afa1af..e76224729 100644 --- a/src/tools.f90 +++ b/src/tools.f90 @@ -252,7 +252,7 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho if (adios2_restart_initialised) then ! First, rename old checkpoint in case of error - call rename(resfile, resfile_old) + if (validation_restart) call rename(resfile, resfile_old) end if end if @@ -315,46 +315,47 @@ subroutine restart(ux1,uy1,uz1,dux1,duy1,duz1,ep1,pp3,phi1,dphi1,px1,py1,pz1,rho call decomp_2d_close_io(io_restart, resfile) ! Validate restart file then remove old file and update restart.info - if (validate_restart(resfile_old, resfile)) then - call delete_filedir(resfile_old) - - ! Write info file for restart - Kay Schäfer - if (nrank == 0) then - write(filename,"('restart.info')") - write(fmt2,'("(A,I16)")') - write(fmt3,'("(A,F16.4)")') - write(fmt4,'("(A,F16.12)")') - ! - open (111,file=filename,action='write',status='replace') - write(111,'(A)')'!=========================' - write(111,'(A)')'&Time' - write(111,'(A)')'!=========================' - write(111,fmt3) 'tfield= ',t - write(111,fmt2) 'itime= ',itime - write(111,'(A)')'/End' - write(111,'(A)')'!=========================' - write(111,'(A)')'&NumParam' - write(111,'(A)')'!=========================' - write(111,fmt2) 'nx= ',nx - write(111,fmt2) 'ny= ',ny - write(111,fmt2) 'nz= ',nz - write(111,fmt3) 'Lx= ',xlx - write(111,fmt3) 'Ly= ',yly - write(111,fmt3) 'Lz= ',zlz - write(111,fmt2) 'istret= ',istret - write(111,fmt4) 'beta= ',beta - write(111,fmt2) 'iscalar= ',iscalar - write(111,fmt2) 'numscalar=',numscalar - write(111,'(A,I14)') 'itimescheme=',itimescheme - write(111,fmt2) 'iimplicit=',iimplicit - write(111,'(A)')'/End' - write(111,'(A)')'!=========================' - - close(111) - end if - else - call decomp_2d_abort(1, & - "Writing restart - validation failed!") + if (validation_restart) then + if (validate_restart(resfile_old, resfile)) then + call delete_filedir(resfile_old) + else + call decomp_2d_abort(1, "Writing restart - validation failed!") + endif + endif + + ! Write info file for restart - Kay Schäfer + if (nrank == 0) then + write(filename,"('restart.info')") + write(fmt2,'("(A,I16)")') + write(fmt3,'("(A,F16.4)")') + write(fmt4,'("(A,F16.12)")') + ! + open (111,file=filename,action='write',status='replace') + write(111,'(A)')'!=========================' + write(111,'(A)')'&Time' + write(111,'(A)')'!=========================' + write(111,fmt3) 'tfield= ',t + write(111,fmt2) 'itime= ',itime + write(111,'(A)')'/End' + write(111,'(A)')'!=========================' + write(111,'(A)')'&NumParam' + write(111,'(A)')'!=========================' + write(111,fmt2) 'nx= ',nx + write(111,fmt2) 'ny= ',ny + write(111,fmt2) 'nz= ',nz + write(111,fmt3) 'Lx= ',xlx + write(111,fmt3) 'Ly= ',yly + write(111,fmt3) 'Lz= ',zlz + write(111,fmt2) 'istret= ',istret + write(111,fmt4) 'beta= ',beta + write(111,fmt2) 'iscalar= ',iscalar + write(111,fmt2) 'numscalar=',numscalar + write(111,'(A,I14)') 'itimescheme=',itimescheme + write(111,fmt2) 'iimplicit=',iimplicit + write(111,'(A)')'/End' + write(111,'(A)')'!=========================' + + close(111) end if else if (nrank==0) then