fixed missing sizeState initialization causing problem with output (only for new state)

This commit is contained in:
Martin Diehl 2014-05-27 12:10:16 +00:00
parent 9834c8466c
commit f7e574d7ab
2 changed files with 28 additions and 18 deletions

View File

@ -274,9 +274,9 @@ subroutine constitutive_init
ConstitutivePosition(phase) = ConstitutivePosition(phase)+1_pInt ! not distinguishing between instances of same phase
mappingConstitutive(1:2,g,i,e) = [ConstitutivePosition(phase),phase]
#endif
#ifndef NEWSTATE
select case(phase_plasticity(material_phase(g,i,e)))
case (PLASTICITY_NONE_ID)
#ifndef NEWSTATE
allocate(constitutive_state0(g,i,e)%p(constitutive_none_sizeState(instance)))
allocate(constitutive_partionedState0(g,i,e)%p(constitutive_none_sizeState(instance)))
allocate(constitutive_subState0(g,i,e)%p(constitutive_none_sizeState(instance)))
@ -302,9 +302,11 @@ subroutine constitutive_init
constitutive_aTolState(g,i,e)%p = 1.0_pReal
constitutive_sizeState(g,i,e) = 0_pInt
constitutive_sizeDotState(g,i,e) = 0_pInt
#endif
constitutive_sizePostResults(g,i,e) = 0_pInt
case (PLASTICITY_J2_ID)
#ifndef NEWSTATE
allocate(constitutive_state0(g,i,e)%p(constitutive_j2_sizeState(instance)))
allocate(constitutive_partionedState0(g,i,e)%p(constitutive_j2_sizeState(instance)))
allocate(constitutive_subState0(g,i,e)%p(constitutive_j2_sizeState(instance)))
@ -330,9 +332,11 @@ subroutine constitutive_init
constitutive_aTolState(g,i,e)%p = constitutive_j2_aTolState(instance)
constitutive_sizeState(g,i,e) = constitutive_j2_sizeState(instance)
constitutive_sizeDotState(g,i,e) = constitutive_j2_sizeDotState(instance)
#endif
constitutive_sizePostResults(g,i,e) = constitutive_j2_sizePostResults(instance)
case (PLASTICITY_PHENOPOWERLAW_ID)
#ifndef NEWSTATE
allocate(constitutive_state0(g,i,e)%p(constitutive_phenopowerlaw_sizeState(instance)))
allocate(constitutive_partionedState0(g,i,e)%p(constitutive_phenopowerlaw_sizeState(instance)))
allocate(constitutive_subState0(g,i,e)%p(constitutive_phenopowerlaw_sizeState(instance)))
@ -358,7 +362,9 @@ subroutine constitutive_init
constitutive_aTolState(g,i,e)%p = constitutive_phenopowerlaw_aTolState(instance)
constitutive_sizeState(g,i,e) = constitutive_phenopowerlaw_sizeState(instance)
constitutive_sizeDotState(g,i,e) = constitutive_phenopowerlaw_sizeDotState(instance)
#endif
constitutive_sizePostResults(g,i,e) = constitutive_phenopowerlaw_sizePostResults(instance)
#ifndef NEWSTATE
case (PLASTICITY_DISLOTWIN_ID)
allocate(constitutive_state0(g,i,e)%p(constitutive_dislotwin_sizeState(instance)))
@ -442,8 +448,8 @@ subroutine constitutive_init
constitutive_sizeState(g,i,e) = constitutive_nonlocal_sizeState(instance)
constitutive_sizeDotState(g,i,e) = constitutive_nonlocal_sizeDotState(instance)
constitutive_sizePostResults(g,i,e) = constitutive_nonlocal_sizePostResults(instance)
end select
#endif
end select
enddo GrainLoop
enddo IPloop
enddo ElemLoop
@ -500,6 +506,8 @@ subroutine constitutive_init
write(6,'(a32,1x,7(i8,1x))') 'maxSizePostResults: ', constitutive_maxSizePostResults
endif
flush(6)
#else
constitutive_maxSizePostResults = maxval(constitutive_sizePostResults)
#endif
end subroutine constitutive_init
@ -811,6 +819,7 @@ subroutine constitutive_collectDotState(Tstar_v, FeArray, FpArray, Temperature,
case (PLASTICITY_J2_ID)
#ifdef NEWSTATE
write(6,*) plasticState(mappingConstitutive(2,ipc,ip,el))%dotState(:,mappingConstitutive(1,ipc,ip,el)); flush(6)
plasticState(mappingConstitutive(2,ipc,ip,el))%dotState(:,mappingConstitutive(1,ipc,ip,el)) &
= constitutive_j2_dotState(Tstar_v,plasticState(mappingConstitutive(2,ipc,ip,el))% &
state(:,mappingConstitutive(1,ipc,ip,el)), ipc,ip,el)

View File

@ -162,7 +162,7 @@ subroutine constitutive_phenopowerlaw_init(fileUnit)
Nchunks_SlipSlip, Nchunks_SlipTwin, Nchunks_TwinSlip, Nchunks_TwinTwin, &
Nchunks_SlipFamilies, Nchunks_TwinFamilies, Nchunks_nonSchmid, &
index_myFamily, index_otherFamily, &
mySize=0_pInt
mySize=0_pInt,sizeState,sizeDotState
character(len=65536) :: &
tag = '', &
line = ''
@ -489,6 +489,7 @@ allocate(constitutive_phenopowerlaw_sizePostResults(maxNinstance),
outputFound: if (mySize > 0_pInt) then
constitutive_phenopowerlaw_sizePostResult(o,instance) = mySize
constitutive_phenopowerlaw_sizePostResults(instance) = constitutive_phenopowerlaw_sizePostResults(instance) + mySize
write(6,*) constitutive_phenopowerlaw_sizePostResults(instance); flush(6)
endif outputFound
enddo outputsLoop
@ -500,30 +501,30 @@ allocate(constitutive_phenopowerlaw_sizePostResults(maxNinstance),
constitutive_phenopowerlaw_totalNtwin(instance) ! s_slip, s_twin, sum(gamma), sum(f), accshear_slip, accshear_twin
constitutive_phenopowerlaw_sizeState(instance) = constitutive_phenopowerlaw_sizeDotState(instance)
#else
mySize = constitutive_phenopowerlaw_totalNslip(instance)+ &
sizeState = constitutive_phenopowerlaw_totalNslip(instance)+ &
constitutive_phenopowerlaw_totalNtwin(instance)+ &
2_pInt + &
constitutive_phenopowerlaw_totalNslip(instance)+ &
constitutive_phenopowerlaw_totalNtwin(instance) ! s_slip, s_twin, sum(gamma), sum(f), accshear_slip, accshear_twin
plasticState(phase)%stateSize = mySize
allocate(plasticState(phase)%aTolState (mySize), source=0.0_pReal)
allocate(plasticState(phase)%state0 (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%partionedState0(mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%subState0 (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%state (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%state_backup (mySize,NofMyPhase), source=0.0_pReal)
plasticState(phase)%stateSize = sizeState
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 (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%deltaState (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%dotState_backup(mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%dotState (sizeState,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%deltaState (sizeState,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%dotState_backup(sizeState,NofMyPhase), source=0.0_pReal)
if (any(numerics_integrator == 1_pInt)) then
allocate(plasticState(phase)%previousDotState (mySize,NofMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%previousDotState2 (mySize,NofMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%previousDotState (sizeState,NofMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%previousDotState2 (sizeState,NofMyPhase),source=0.0_pReal)
endif
if (any(numerics_integrator == 4_pInt)) &
allocate(plasticState(phase)%RK4dotState (mySize,NofMyPhase), source=0.0_pReal)
allocate(plasticState(phase)%RK4dotState (sizeState,NofMyPhase), source=0.0_pReal)
if (any(numerics_integrator == 5_pInt)) &
allocate(plasticState(phase)%RKCK45dotState (6,mySize,NofMyPhase),source=0.0_pReal)
allocate(plasticState(phase)%RKCK45dotState (6,sizeState,NofMyPhase),source=0.0_pReal)
#endif
do f = 1_pInt,lattice_maxNslipFamily ! >>> interaction slip -- X
index_myFamily = sum(constitutive_phenopowerlaw_Nslip(1:f-1_pInt,instance))