diff --git a/src/module_definitions.f90 b/src/module_definitions.f90 index 403757a56fd023d8fa766786f3463a3b467abfe4..0314e1c58855f9a614b4c3a7bdba822192d03a10 100644 --- a/src/module_definitions.f90 +++ b/src/module_definitions.f90 @@ -263,6 +263,8 @@ module definitions integer levelcut integer levelapprox integer nstep + integer savstep + integer savoffset integer nstep_spinup integer noctreemax integer levelmax_oct diff --git a/src/read_input_file.f90 b/src/read_input_file.f90 index 1746cc182443892a54e78748eebe99ed273ec316..04e504eda1f9b3705542db1aabbe2c4cce63e5fb 100644 --- a/src/read_input_file.f90 +++ b/src/read_input_file.f90 @@ -162,6 +162,14 @@ params%nstep_spinup=0 if (iproc==0) call scanfile (params%infile,'nstep_spinup',params%nstep_spinup,ires) call mpi_bcast(params%nstep_spinup,1,mpi_integer,0,mpi_comm_world,ierr) +params%savstep=1 +if (iproc==0) call scanfile (params%infile,'savstep',params%savstep,ires) +call mpi_bcast(params%savstep,1,mpi_integer,0,mpi_comm_world,ierr) + +params%savoffset=0 +if (iproc==0) call scanfile (params%infile,'savoffset',params%savoffset,ires) +call mpi_bcast(params%savoffset,1,mpi_integer,0,mpi_comm_world,ierr) + !=====[material properties]==================================================== material0=0 diff --git a/src/write_global_output.f90 b/src/write_global_output.f90 index 112cdc1fbff4e33506fbe49ad7c2ac298895e3a2..a6872b829ac6057eb55a208169027a5921bd5a71 100644 --- a/src/write_global_output.f90 +++ b/src/write_global_output.f90 @@ -67,9 +67,9 @@ character*5 outputtype !(((((((((((((((( declaration of the subroutine internal variables ))))))))))))) !------------------------------------------------------------------------------| -integer i,j,is,k,err,size_str(2) -integer iproc,nproc,ierr -character*4 cistep,citer +integer i,j,is,k,err,size_str(2),stat +integer iproc,nproc,ierr,prevstep +character*4 cistep,citer,cprevstep character(len=5) :: outdir !------------------------------------------------------------------------------| @@ -235,6 +235,17 @@ if (iproc.eq.0) then close (9) + !delete file from previous timestep if not marked for permanent save + !mschmiddunser 12.14 + if (outputtype=='final') then + prevstep = istep-1 + if (prevstep < params%savoffset .AND. prevstep >=0 .OR. & + prevstep >= params%savoffset .AND. (.NOT. mod(prevstep-params%savoffset,params%savstep)==0)) then + call int_to_char (cprevstep,4,prevstep) + open (91,file=trim(outdir)//'/time_'//cprevstep//'.bin',iostat=stat,status='old',form='unformatted') + if (stat.eq.0) close(91, status='delete') + end if + end if end if return diff --git a/test/input_schmiddu.txt b/test/input_schmiddu.txt index ed959a80198b5ba84103aed5df1efa69f963aa67..ebb65f587aa6e798eee3c37ca618f4f774607316 100644 --- a/test/input_schmiddu.txt +++ b/test/input_schmiddu.txt @@ -46,6 +46,20 @@ produce the DoRuRes. DoRuRe stands for 'Douar Run Report'. compute_qpgram = F +SAVING +_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- +The current output file is always kept temporarily and deleted after the next +output file was written. When time equals n*savstep + savoffset the files are +kept permanently. + +[int] savoffset is the timestep from which on output will be saved + + savoffset = 1 + +[int] every savstep'th value after savoffset will be saved + + savstep = 2 + RESTART _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-