From a88baf93b21dc8e6530fe024b4643e4ca2d971ec Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Fri, 28 Jun 2019 17:09:27 -0700 Subject: [PATCH] avoid division (mod) by zero --- src/grid/DAMASK_grid.f90 | 6 ++---- src/grid/spectral_utilities.f90 | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/grid/DAMASK_grid.f90 b/src/grid/DAMASK_grid.f90 index a55cbbe17..5d78f8f13 100644 --- a/src/grid/DAMASK_grid.f90 +++ b/src/grid/DAMASK_grid.f90 @@ -217,8 +217,7 @@ program DAMASK_spectral case('freq','frequency','outputfreq') ! frequency of result writings newLoadCase%outputfrequency = IO_intValue(line,chunkPos,i+1) case('r','restart','restartwrite') ! frequency of writing restart information - newLoadCase%restartfrequency = & - max(0,IO_intValue(line,chunkPos,i+1)) + newLoadCase%restartfrequency = IO_intValue(line,chunkPos,i+1) case('guessreset','dropguessing') newLoadCase%followFormerTrajectory = .false. ! do not continue to predict deformation along former trajectory case('euler') ! rotation of load case given in euler angles @@ -561,8 +560,7 @@ program DAMASK_spectral fileOffset = fileOffset + sum(outputSize) ! forward to current file position call CPFEM_results(totalIncsCounter,time) endif - if ( loadCases(currentLoadCase)%restartFrequency > 0 & ! writing of restart info requested ... - .and. mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0) then ! ... and at frequency of writing restart information + if (mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0) then ! at frequency of writing restart information restartWrite = .true. ! set restart parameter for FEsolving lastRestartWritten = inc ! QUESTION: first call to CPFEM_general will write? endif diff --git a/src/grid/spectral_utilities.f90 b/src/grid/spectral_utilities.f90 index 509ec9e77..7b468b4f4 100644 --- a/src/grid/spectral_utilities.f90 +++ b/src/grid/spectral_utilities.f90 @@ -98,7 +98,7 @@ module spectral_utilities real(pReal) :: time = 0.0_pReal !< length of increment integer :: incs = 0, & !< number of increments outputfrequency = 1, & !< frequency of result writes - restartfrequency = 0, & !< frequency of restart writes + restartfrequency = huge(0), & !< frequency of restart writes logscale = 0 !< linear/logarithmic time inc flag logical :: followFormerTrajectory = .true. !< follow trajectory of former loadcase integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:)