From 5a89c783d4b7ad3fc168cbc6b4cb5ba2c4e0b2de Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 31 Jul 2012 14:00:15 +0000 Subject: [PATCH] deallocating already allocated arrays in case of regridding/restarting (i.e. when calling init more than once) --- code/debug.f90 | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/code/debug.f90 b/code/debug.f90 index 02a03c784..96bcaa0d8 100644 --- a/code/debug.f90 +++ b/code/debug.f90 @@ -142,18 +142,30 @@ subroutine debug_init #include "compilation_info.f90" !$OMP END CRITICAL (write2out) - allocate(debug_StressLoopDistribution(nStress,2)) - debug_StressLoopDistribution = 0_pInt - allocate(debug_LeapfrogBreakDistribution(nStress,2)) - debug_LeapfrogBreakDistribution = 0_pInt - allocate(debug_StateLoopDistribution(nState,2)) - debug_StateLoopDistribution = 0_pInt - allocate(debug_CrystalliteLoopDistribution(nCryst+1)) - debug_CrystalliteLoopDistribution = 0_pInt - allocate(debug_MaterialpointStateLoopDistribution(nMPstate)) - debug_MaterialpointStateLoopDistribution = 0_pInt - allocate(debug_MaterialpointLoopDistribution(nHomog+1)) - debug_MaterialpointLoopDistribution = 0_pInt + if (allocated(debug_StressLoopDistribution)) & + deallocate(debug_StressLoopDistribution) + allocate(debug_StressLoopDistribution(nStress,2)) + debug_StressLoopDistribution = 0_pInt + if (allocated(debug_LeapfrogBreakDistribution)) & + deallocate(debug_LeapfrogBreakDistribution) + allocate(debug_LeapfrogBreakDistribution(nStress,2)) + debug_LeapfrogBreakDistribution = 0_pInt + if (allocated(debug_StateLoopDistribution)) & + deallocate(debug_StateLoopDistribution) + allocate(debug_StateLoopDistribution(nState,2)) + debug_StateLoopDistribution = 0_pInt + if (allocated(debug_CrystalliteLoopDistribution)) & + deallocate(debug_CrystalliteLoopDistribution) + allocate(debug_CrystalliteLoopDistribution(nCryst+1)) + debug_CrystalliteLoopDistribution = 0_pInt + if (allocated(debug_MaterialpointStateLoopDistribution)) & + deallocate(debug_MaterialpointStateLoopDistribution) + allocate(debug_MaterialpointStateLoopDistribution(nMPstate)) + debug_MaterialpointStateLoopDistribution = 0_pInt + if (allocated(debug_MaterialpointLoopDistribution)) & + deallocate(debug_MaterialpointLoopDistribution) + allocate(debug_MaterialpointLoopDistribution(nHomog+1)) + debug_MaterialpointLoopDistribution = 0_pInt ! try to open the config file