From f5816a643d890a1f201bb50b8c3800943113bbc8 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Fri, 29 Sep 2017 17:44:10 -0400 Subject: [PATCH] added offsetDeltaState to type-definition and respect this when applying deltaState --- src/crystallite.f90 | 40 ++++++++++++++++++++++++++++------------ src/prec.f90 | 15 ++++++++------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/crystallite.f90 b/src/crystallite.f90 index c5bd4d979..6f0ade021 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -3084,35 +3084,49 @@ logical function crystallite_stateJump(ipc,ip,el) implicit none integer(pInt), intent(in):: & - el, & ! element index - ip, & ! integration point index + el, & ! element index + ip, & ! integration point index ipc ! grain index integer(pInt) :: & c, & p, & mySource, & + myOffsetPlasticDeltaState, & + myOffsetSourceDeltaState, & mySizePlasticDeltaState, & mySizeSourceDeltaState - c= phasememberAt(ipc,ip,el) + c = phasememberAt(ipc,ip,el) p = phaseAt(ipc,ip,el) + call constitutive_collectDeltaState(crystallite_Tstar_v(1:6,ipc,ip,el), crystallite_Fe(1:3,1:3,ipc,ip,el), ipc,ip,el) - mySizePlasticDeltaState = plasticState(p)%sizeDeltaState - if( any(IEEE_is_NaN(plasticState(p)%deltaState(:,c)))) then ! NaN occured in deltaState + + myOffsetPlasticDeltaState = plasticState(p)%offsetDeltaState + mySizePlasticDeltaState = plasticState(p)%sizeDeltaState + + if( any(IEEE_is_NaN(plasticState(p)%deltaState(1:mySizePlasticDeltaState,c)))) then ! NaN occured in deltaState crystallite_stateJump = .false. return endif - plasticState(p)%state(1:mySizePlasticDeltaState,c) = plasticState(p)%state(1:mySizePlasticDeltaState,c) + & - plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) + + plasticState(p)%state(myOffsetPlasticDeltaState + 1_pInt : & + myOffsetPlasticDeltaState + mySizePlasticDeltaState,c) = & + plasticState(p)%state(myOffsetPlasticDeltaState + 1_pInt : & + myOffsetPlasticDeltaState + mySizePlasticDeltaState,c) + & + plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) + do mySource = 1_pInt, phase_Nsources(p) - mySizeSourceDeltaState = sourceState(p)%p(mySource)%sizeDeltaState - if( any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(:,c)))) then ! NaN occured in deltaState + myOffsetSourceDeltaState = sourceState(p)%p(mySource)%offsetDeltaState + mySizeSourceDeltaState = sourceState(p)%p(mySource)%sizeDeltaState + if (any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(1:mySizeSourceDeltaState,c)))) then ! NaN occured in deltaState crystallite_stateJump = .false. return endif - sourceState(p)%p(mySource)%state(1:mySizeSourceDeltaState,c) = & - sourceState(p)%p(mySource)%state(1:mySizeSourceDeltaState,c) + & + sourceState(p)%p(mySource)%state(myOffsetSourceDeltaState + 1_pInt : & + myOffsetSourceDeltaState + mySizeSourceDeltaState,c) = & + sourceState(p)%p(mySource)%state(myOffsetSourceDeltaState + 1_pInt : & + myOffsetSourceDeltaState + mySizeSourceDeltaState,c) + & sourceState(p)%p(mySource)%deltaState(1:mySizeSourceDeltaState,c) enddo @@ -3123,7 +3137,9 @@ logical function crystallite_stateJump(ipc,ip,el) .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then write(6,'(a,i8,1x,i2,1x,i3, /)') '<< CRYST >> update state at el ip ipc ',el,ip,ipc write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> deltaState', plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) - write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> new state', plasticState(p)%state (1:mySizePlasticDeltaState,c) + write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> new state', & + plasticState(p)%state(myOffsetSourceDeltaState + 1_pInt : & + myOffsetSourceDeltaState + mySizeSourceDeltaState,c) endif #endif diff --git a/src/prec.f90 b/src/prec.f90 index 671e15990..c130ba007 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -39,20 +39,21 @@ module prec !http://stackoverflow.com/questions/3948210/can-i-have-a-pointer-to-an-item-in-an-allocatable-array type, public :: tState integer(pInt) :: & - sizeState = 0_pInt , & !< size of state - sizeDotState = 0_pInt, & !< size of dot state, i.e. parts of the state that are integrated - sizeDeltaState = 0_pInt, & !< size of delta state, i.e. parts of the state that have discontinuous rates - sizePostResults = 0_pInt !< size of output data + sizeState = 0_pInt, & !< size of state + sizeDotState = 0_pInt, & !< size of dot state, i.e. state(1:sizeDot) follows time evolution by dotState rates + offsetDeltaState = 0_pInt, & !< offset of delta state + sizeDeltaState = 0_pInt, & !< size of delta state, i.e. state(offset+1:offset+sizeDot) follows time evolution by deltaState increments + sizePostResults = 0_pInt !< size of output data real(pReal), pointer, dimension(:), contiguous :: & atolState real(pReal), pointer, dimension(:,:), contiguous :: & ! a pointer is needed here because we might point to state/doState. However, they will never point to something, but are rather allocated and, hence, contiguous + state0, & state, & !< state - dotState, & !< state rate - state0 + dotState, & !< rate of state change + deltaState !< increment of state change real(pReal), allocatable, dimension(:,:) :: & partionedState0, & subState0, & - deltaState, & previousDotState, & !< state rate of previous xxxx previousDotState2, & !< state rate two xxxx ago RK4dotState