diff --git a/code/constitutive.f90 b/code/constitutive.f90 index 96c5ce857..3475dfbb1 100644 --- a/code/constitutive.f90 +++ b/code/constitutive.f90 @@ -121,7 +121,10 @@ subroutine constitutive_init if (any(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID)) call constitutive_phenopowerlaw_init(FILEUNIT) if (any(phase_plasticity == PLASTICITY_DISLOTWIN_ID)) call constitutive_dislotwin_init(FILEUNIT) if (any(phase_plasticity == PLASTICITY_TITANMOD_ID)) call constitutive_titanmod_init(FILEUNIT) - if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) call constitutive_nonlocal_init(FILEUNIT) + if (any(phase_plasticity == PLASTICITY_NONLOCAL_ID)) then + call constitutive_nonlocal_init(FILEUNIT) + call constitutive_nonlocal_stateInit() + endif close(FILEUNIT) write(6,'(/,a)') ' <<<+- constitutive init -+>>>' @@ -175,32 +178,6 @@ subroutine constitutive_init enddo close(FILEUNIT) - - PhaseLoop:do phase = 1_pInt,material_Nphase ! loop over phases - instance = phase_plasticityInstance(phase) - select case(phase_plasticity(phase)) - case (PLASTICITY_NONE_ID) - plasticState(phase)%sizePostResults = constitutive_none_sizePostResults(instance) - case (PLASTICITY_J2_ID) - plasticState(phase)%sizePostResults = constitutive_j2_sizePostResults(instance) - case (PLASTICITY_PHENOPOWERLAW_ID) - plasticState(phase)%sizePostResults = constitutive_phenopowerlaw_sizePostResults(instance) - case (PLASTICITY_DISLOTWIN_ID) - plasticState(phase)%sizePostResults = constitutive_dislotwin_sizePostResults(instance) - case (PLASTICITY_TITANMOD_ID) - plasticState(phase)%sizePostResults = constitutive_titanmod_sizePostResults(instance) - case (PLASTICITY_NONLOCAL_ID) - nonlocalConstitutionPresent = .true. - plasticState(phase)%nonlocal = .true. - plasticState(phase)%sizePostResults = constitutive_nonlocal_sizePostResults(instance) - end select - - enddo PhaseLoop - - if (nonlocalConstitutionPresent) & - call constitutive_nonlocal_stateInit() - - constitutive_maxSizeDotState = 0_pInt constitutive_maxSizePostResults = 0_pInt diff --git a/code/constitutive_dislotwin.f90 b/code/constitutive_dislotwin.f90 index ba41e5546..e8d013eae 100644 --- a/code/constitutive_dislotwin.f90 +++ b/code/constitutive_dislotwin.f90 @@ -716,6 +716,7 @@ subroutine constitutive_dislotwin_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState + plasticState(phase)%nonlocal = .false. allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) diff --git a/code/constitutive_j2.f90 b/code/constitutive_j2.f90 index d713e0fce..1d39c2c8b 100644 --- a/code/constitutive_j2.f90 +++ b/code/constitutive_j2.f90 @@ -315,6 +315,7 @@ subroutine constitutive_j2_init(fileUnit) sizeDotState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = constitutive_j2_sizePostResults(instance) + plasticState(phase)%nonlocal = .false. allocate(plasticState(phase)%aTolState (sizeState),source=constitutive_j2_aTolResistance(instance)) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase),source=constitutive_j2_tau0(instance)) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase),source=0.0_pReal) diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index a8771f7e2..dcc346f68 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -1055,37 +1055,14 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), !*** determine size of state array ns = totalNslip(instance) - -! Determine size of state array - ! plasticState(phase)%nonlocal = .true. + sizeDotState = int(size(BASICSTATES),pInt) * ns sizeDependentState = int(size(DEPENDENTSTATES),pInt) * ns sizeState = sizeDotState + sizeDependentState & + int(size(OTHERSTATES),pInt) * ns - - plasticState(phase)%sizeState = sizeState - plasticState(phase)%sizeDotState = sizeDotState - allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) - allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%state (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%deltaState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 1_pInt)) then - allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) - endif - if (any(numerics_integrator == 4_pInt)) & - allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) - if (any(numerics_integrator == 5_pInt)) & - allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) - !*** determine indices to state array - + l = 0_pInt do t = 1_pInt,4_pInt do s = 1_pInt,ns @@ -1235,7 +1212,30 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), constitutive_nonlocal_sizePostResults(instance) = constitutive_nonlocal_sizePostResults(instance) + mySize endif enddo outputsLoop - + + plasticState(phase)%sizeState = sizeState + plasticState(phase)%sizeDotState = sizeDotState + plasticState(phase)%sizePostResults = constitutive_nonlocal_sizePostResults(instance) + plasticState(phase)%nonlocal = .true. + allocate(plasticState(phase)%aTolState (sizeState), source=0.0_pReal) + allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%subState0 (sizeState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%state (sizeState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) + + allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%deltaState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) + if (any(numerics_integrator == 1_pInt)) then + allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) + allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) + endif + if (any(numerics_integrator == 4_pInt)) & + allocate(plasticState(phase)%RK4dotState (sizeDotState,NofMyPhase), source=0.0_pReal) + if (any(numerics_integrator == 5_pInt)) & + allocate(plasticState(phase)%RKCK45dotState (6,sizeDotState,NofMyPhase),source=0.0_pReal) + do s1 = 1_pInt,ns f = slipFamily(s1,instance) diff --git a/code/constitutive_phenopowerlaw.f90 b/code/constitutive_phenopowerlaw.f90 index 8ddce5cf5..5408b2b5a 100644 --- a/code/constitutive_phenopowerlaw.f90 +++ b/code/constitutive_phenopowerlaw.f90 @@ -510,10 +510,11 @@ subroutine constitutive_phenopowerlaw_init(fileUnit) 2_pInt + & constitutive_phenopowerlaw_totalNslip(instance)+ & constitutive_phenopowerlaw_totalNtwin(instance) ! s_slip, s_twin, sum(gamma), sum(f), accshear_slip, accshear_twin - plasticState(phase)%sizeState = sizeState sizeDotState = sizeState - plasticState(phase)%sizeDotState = sizeState + plasticState(phase)%sizeState = sizeState + plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = constitutive_phenopowerlaw_sizePostResults(instance) + plasticState(phase)%nonlocal = .false. allocate(plasticState(phase)%aTolState ( sizeState), source=0.0_pReal) allocate(plasticState(phase)%state0 ( sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 ( sizeState,NofMyPhase), source=0.0_pReal) diff --git a/code/constitutive_titanmod.f90 b/code/constitutive_titanmod.f90 index c1fd23982..de26fb4fa 100644 --- a/code/constitutive_titanmod.f90 +++ b/code/constitutive_titanmod.f90 @@ -847,6 +847,7 @@ subroutine constitutive_titanmod_init(fileUnit) plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizePostResults = constitutive_titanmod_sizePostResults(instance) + plasticState(phase)%nonlocal = .false. allocate(plasticState(phase)%aTolState (sizeState), source=constitutive_titanmod_aTolRho(instance)) allocate(plasticState(phase)%state0 (sizeState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase), source=0.0_pReal)