From 46cb787934f1028b863b09ab395add5745a6160b Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sun, 12 Jan 2020 00:55:00 +0100 Subject: [PATCH] avoid HDF5 error when creating link twice --- src/DAMASK_marc.f90 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index a0a82500f..942c9afeb 100644 --- a/src/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -350,6 +350,9 @@ subroutine flux(f,ts,n,time) !-------------------------------------------------------------------------------------------------- !> @brief trigger writing of results +!> @details uedinc is called before each new increment, not at the end of a converged one. +!> Therefore, storing the last written inc with an 'save' variable is required to avoid writing the +! same increment multiple times. !-------------------------------------------------------------------------------------------------- subroutine uedinc(inc,incsub) use prec @@ -357,8 +360,12 @@ subroutine uedinc(inc,incsub) implicit none integer, intent(in) :: inc, incsub + integer, save :: inc_written #include QUOTE(PASTE(./MarcInclude/creeps,Marc4DAMASK)) ! creeps is needed for timinc (time increment) - call CPFEM_results(inc,cptim) + if (inc > inc_written) then + call CPFEM_results(inc,cptim) + inc_written = inc + endif end subroutine uedinc