constitutive should handle state jump alone

This commit is contained in:
Martin Diehl 2020-04-01 14:42:38 +02:00
parent b5efaa08a4
commit 70dd06c4ec
2 changed files with 35 additions and 48 deletions

View File

@ -809,7 +809,9 @@ function constitutive_deltaState(S, Fe, Fi, ipc, ip, el, phase, of) result(broke
Mp Mp
integer :: & integer :: &
i, & i, &
instance instance, &
myOffset, &
mySize
logical :: & logical :: &
broken broken
@ -831,6 +833,17 @@ function constitutive_deltaState(S, Fe, Fi, ipc, ip, el, phase, of) result(broke
end select plasticityType end select plasticityType
if(.not. broken) then
select case(phase_plasticity(phase))
case (PLASTICITY_NONLOCAL_ID,PLASTICITY_KINEHARDENING_ID)
myOffset = plasticState(phase)%offsetDeltaState
mySize = plasticState(phase)%sizeDeltaState
plasticState(phase)%state(myOffset + 1:myOffset + mySize,of) = &
plasticState(phase)%state(myOffset + 1:myOffset + mySize,of) + plasticState(phase)%deltaState(1:mySize,of)
end select
endif
sourceLoop: do i = 1, phase_Nsources(phase) sourceLoop: do i = 1, phase_Nsources(phase)
@ -840,6 +853,12 @@ function constitutive_deltaState(S, Fe, Fi, ipc, ip, el, phase, of) result(broke
call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(ipc,ip,el), Fe, & call source_damage_isoBrittle_deltaState (constitutive_homogenizedC(ipc,ip,el), Fe, &
ipc, ip, el) ipc, ip, el)
broken = broken .or. any(IEEE_is_NaN(sourceState(phase)%p(i)%deltaState(:,of))) broken = broken .or. any(IEEE_is_NaN(sourceState(phase)%p(i)%deltaState(:,of)))
if(.not. broken) then
myOffset = sourceState(phase)%p(i)%offsetDeltaState
mySize = sourceState(phase)%p(i)%sizeDeltaState
sourceState(phase)%p(i)%state(myOffset + 1: myOffset + mySize,of) = &
sourceState(phase)%p(i)%state(myOffset + 1: myOffset + mySize,of) + sourceState(phase)%p(i)%deltaState(1:mySize,of)
endif
end select sourceType end select sourceType

View File

@ -1107,7 +1107,9 @@ subroutine integrateStateFPI(todo)
enddo enddo
if(crystallite_converged(g,i,e)) then if(crystallite_converged(g,i,e)) then
broken = stateJump(g,i,e,p,c) broken = constitutive_deltaState(crystallite_S(1:3,1:3,g,i,e), &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fi(1:3,1:3,g,i,e),g,i,e,p,c)
exit iteration exit iteration
endif endif
@ -1193,7 +1195,9 @@ subroutine integrateStateEuler(todo)
* crystallite_subdt(g,i,e) * crystallite_subdt(g,i,e)
enddo enddo
broken = stateJump(g,i,e,p,c) broken = constitutive_deltaState(crystallite_S(1:3,1:3,g,i,e), &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fi(1:3,1:3,g,i,e),g,i,e,p,c)
if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true. if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true.
if(broken) cycle if(broken) cycle
@ -1265,7 +1269,9 @@ subroutine integrateStateAdaptiveEuler(todo)
+ sourceState(p)%p(s)%dotstate(1:sizeDotState,c) * crystallite_subdt(g,i,e) + sourceState(p)%p(s)%dotstate(1:sizeDotState,c) * crystallite_subdt(g,i,e)
enddo enddo
broken = stateJump(g,i,e,p,c) broken = constitutive_deltaState(crystallite_S(1:3,1:3,g,i,e), &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fi(1:3,1:3,g,i,e),g,i,e,p,c)
if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true. if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true.
if(broken) cycle if(broken) cycle
@ -1428,7 +1434,9 @@ subroutine integrateStateRK4(todo)
* crystallite_subdt(g,i,e) * crystallite_subdt(g,i,e)
enddo enddo
broken = stateJump(g,i,e,p,c) broken = constitutive_deltaState(crystallite_S(1:3,1:3,g,i,e), &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fi(1:3,1:3,g,i,e),g,i,e,p,c)
if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true. if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true.
if(broken) cycle if(broken) cycle
@ -1582,7 +1590,9 @@ subroutine integrateStateRKCK45(todo)
if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true. if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true.
if(broken) cycle if(broken) cycle
broken = stateJump(g,i,e,p,c) broken = constitutive_deltaState(crystallite_S(1:3,1:3,g,i,e), &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fi(1:3,1:3,g,i,e),g,i,e,p,c)
if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true. if(broken .and. plasticState(p)%nonlocal) nonlocalBroken = .true.
if(broken) cycle if(broken) cycle
@ -1627,48 +1637,6 @@ logical pure function converged(residuum,state,atol)
end function converged end function converged
!--------------------------------------------------------------------------------------------------
!> @brief calculates a jump in the state according to the current state and the current stress
!> returns true, if state jump was successfull or not needed. false indicates NaN in delta state
!--------------------------------------------------------------------------------------------------
function stateJump(ipc,ip,el,p,c) result(broken)
integer, intent(in):: &
el, & ! element index
ip, & ! integration point index
ipc ! grain index
integer :: &
c, &
p, &
mySource, &
myOffset, &
mySize
logical :: broken
broken = constitutive_deltaState(crystallite_S(1:3,1:3,ipc,ip,el), &
crystallite_Fe(1:3,1:3,ipc,ip,el), &
crystallite_Fi(1:3,1:3,ipc,ip,el), &
ipc,ip,el,p,c)
if(broken) return
myOffset = plasticState(p)%offsetDeltaState
mySize = plasticState(p)%sizeDeltaState
plasticState(p)%state(myOffset + 1:myOffset + mySize,c) = &
plasticState(p)%state(myOffset + 1:myOffset + mySize,c) + plasticState(p)%deltaState(1:mySize,c)
do mySource = 1, phase_Nsources(p)
myOffset = sourceState(p)%p(mySource)%offsetDeltaState
mySize = sourceState(p)%p(mySource)%sizeDeltaState
sourceState(p)%p(mySource)%state(myOffset + 1: myOffset + mySize,c) = &
sourceState(p)%p(mySource)%state(myOffset + 1: myOffset + mySize,c) + sourceState(p)%p(mySource)%deltaState(1:mySize,c)
enddo
end function stateJump
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Write current restart information (Field and constitutive data) to file. !> @brief Write current restart information (Field and constitutive data) to file.
! ToDo: Merge data into one file for MPI, move state to constitutive and homogenization, respectively ! ToDo: Merge data into one file for MPI, move state to constitutive and homogenization, respectively