Skip to content

Commit 6c183ec

Browse files
committed
Merge branch '407-discussion-about-restart-structure' into 'development'
remember at which increment restart happened Closes #407 See merge request damask/DAMASK!1026
2 parents 72a4092 + b76d846 commit 6c183ec

5 files changed

+12
-4
lines changed

src/grid/DAMASK_grid.f90

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ program DAMASK_grid
1717
use parallelization
1818
use signal
1919
use CLI
20+
use HDF5_utilities
2021
use IO
2122
use config
2223
use math
@@ -116,6 +117,7 @@ program DAMASK_grid
116117
solver
117118
character(len=:), allocatable :: &
118119
fileContent, fname
120+
integer(HID_T) :: fileHandle
119121

120122

121123
!--------------------------------------------------------------------------------------------------
@@ -386,6 +388,9 @@ program DAMASK_grid
386388
call MPI_Allreduce(signal_SIGUSR2,sig,1_MPI_INTEGER_KIND,MPI_LOGICAL,MPI_LOR,MPI_COMM_WORLD,err_MPI)
387389
call parallelization_chkerr(err_MPI)
388390
if (mod(inc,loadCases(l)%f_restart) == 0 .or. sig) then
391+
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
392+
call HDF5_addAttribute(fileHandle,'increment',totalIncsCounter)
393+
call HDF5_closeFile(fileHandle)
389394
do field = 1, nActiveFields
390395
select case (ID(field))
391396
case(FIELD_MECH_ID)

src/grid/grid_mech_FEM.f90

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ subroutine grid_mechanical_FEM_restartWrite()
435435

436436
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
437437

438-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
438+
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
439439
groupHandle = HDF5_addGroup(fileHandle,'solver')
440440
call HDF5_write(reshape(F,[3,3,product(cells(1:2))*cells3]),groupHandle,'F')
441441
call HDF5_write(reshape(F_lastInc,[3,3,product(cells(1:2))*cells3]),groupHandle,'F_lastInc')

src/grid/grid_mech_spectral_Galerkin.f90

+2-1
Original file line numberDiff line numberDiff line change
@@ -478,12 +478,13 @@ subroutine grid_mechanical_spectral_Galerkin_restartWrite()
478478
integer(HID_T) :: fileHandle, groupHandle
479479
real(pREAL), dimension(:,:,:,:), pointer :: F
480480

481+
481482
call DMDAVecGetArrayReadF90(DM_mech,F_PETSc,F,err_PETSc)
482483
CHKERRQ(err_PETSc)
483484

484485
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
485486

486-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
487+
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
487488
groupHandle = HDF5_addGroup(fileHandle,'solver')
488489
call HDF5_write(reshape(F,[3,3,product(cells(1:2))*cells3]),groupHandle,'F')
489490
call HDF5_write(reshape(F_lastInc,[3,3,product(cells(1:2))*cells3]),groupHandle,'F_lastInc')

src/grid/grid_mech_spectral_basic.f90

+2-1
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,15 @@ subroutine grid_mechanical_spectral_basic_restartWrite()
394394
integer(HID_T) :: fileHandle, groupHandle
395395
real(pREAL), dimension(:,:,:,:), pointer :: F
396396

397+
397398
call DMDAVecGetArrayReadF90(DM_mech,F_PETSc,F,err_PETSc)
398399
CHKERRQ(err_PETSc)
399400

400401
if (num%update_gamma) C_minMaxAvgRestart = C_minMaxAvg
401402

402403
print'(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
403404

404-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
405+
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
405406
groupHandle = HDF5_addGroup(fileHandle,'solver')
406407
call HDF5_write(reshape(F,[3,3,product(cells(1:2))*cells3]),groupHandle,'F')
407408
call HDF5_write(reshape(F_lastInc,[3,3,product(cells(1:2))*cells3]),groupHandle,'F_lastInc')

src/grid/grid_mech_spectral_polarization.f90

+2-1
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ subroutine grid_mech_spectral_polarization_restartWrite()
450450
integer(HID_T) :: fileHandle, groupHandle
451451
real(pREAL), dimension(:,:,:,:), pointer :: FandF_tau, F, F_tau
452452

453+
453454
call DMDAVecGetArrayReadF90(DM_mech,FandF_tau_PETSc,FandF_tau,err_PETSc)
454455
CHKERRQ(err_PETSc)
455456
F => FandF_tau(0: 8,:,:,:)
@@ -459,7 +460,7 @@ subroutine grid_mech_spectral_polarization_restartWrite()
459460

460461
print '(1x,a)', 'saving solver data required for restart'; flush(IO_STDOUT)
461462

462-
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','w')
463+
fileHandle = HDF5_openFile(getSolverJobName()//'_restart.hdf5','a')
463464
groupHandle = HDF5_addGroup(fileHandle,'solver')
464465
call HDF5_write(reshape(F,[3,3,product(cells(1:2))*cells3]),groupHandle,'F')
465466
call HDF5_write(reshape(F_lastInc,[3,3,product(cells(1:2))*cells3]),groupHandle,'F_lastInc')

0 commit comments

Comments
 (0)