diff --git a/code/constitutive.f90 b/code/constitutive.f90 index 12c4243ff..1d5e94dfa 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -134,7 +134,8 @@ subroutine constitutive_init myNgrains integer(pInt), dimension(:,:), pointer :: thisSize character(len=64), dimension(:,:), pointer :: thisOutput - logical :: knownPlasticity + logical :: knownPlasticity, nonlocalConstitutionPresent + nonlocalConstitutionPresent = .false. !-------------------------------------------------------------------------------------------------- @@ -378,6 +379,7 @@ subroutine constitutive_init constitutive_sizePostResults(g,i,e) = constitutive_dislotwin_sizePostResults(myInstance) case (constitutive_nonlocal_label) + nonlocalConstitutionPresent = .true. if(myNgrains/=1_pInt) call IO_error(252_pInt, e,i,g) allocate(constitutive_state0(g,i,e)%p(constitutive_nonlocal_sizeState(myInstance))) allocate(constitutive_partionedState0(g,i,e)%p(constitutive_nonlocal_sizeState(myInstance))) @@ -412,7 +414,8 @@ subroutine constitutive_init enddo enddo enddo - call constitutive_nonlocal_stateInit(constitutive_state0(1,1:iMax,1:eMax)) + if (nonlocalConstitutionPresent) & + call constitutive_nonlocal_stateInit(constitutive_state0(1,1:iMax,1:eMax)) do e = 1_pInt,mesh_NcpElems ! loop over elements myNgrains = homogenization_Ngrains(mesh_element(3,e)) forall(i = 1_pInt:FE_Nips(FE_geomtype(mesh_element(2,e))), g = 1_pInt:myNgrains) diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index 748624580..5e215445f 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -1044,7 +1044,6 @@ integer(pInt) el, & ip, & e, & i, & - g, & idx, & ns, & ! short notation for total number of active slip systems f, & ! index of lattice family @@ -1070,9 +1069,8 @@ maxNinstance = int(count(phase_plasticity == CONSTITUTIVE_NONLOCAL_LABEL),pInt) do e = 1_pInt,mesh_NcpElems do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) - do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) - state(g,i,e)%p = 0.0_pReal - enddo + if (CONSTITUTIVE_NONLOCAL_LABEL == phase_plasticity(material_phase(1,i,e))) & + state(1,i,e)%p = 0.0_pReal enddo enddo