Merge branch 'FPI-one-loop' into 'development'
FPI in one loop See merge request damask/DAMASK!144
This commit is contained in:
commit
b6103cc7cb
|
@ -1019,29 +1019,22 @@ subroutine integrateStateFPI
|
|||
real(pReal), dimension(constitutive_source_maxSizeDotState) :: &
|
||||
residuum_source ! residuum for source state
|
||||
logical :: &
|
||||
doneWithIntegration
|
||||
nonlocalBroken
|
||||
|
||||
! --+>> PREGUESS FOR STATE <<+--
|
||||
call update_dotState(1.0_pReal)
|
||||
call update_state(1.0_pReal)
|
||||
|
||||
NiterationState = 0
|
||||
doneWithIntegration = .false.
|
||||
crystalliteLooping: do while (.not. doneWithIntegration .and. NiterationState < num%nState)
|
||||
NiterationState = NiterationState + 1
|
||||
|
||||
#ifdef DEBUG
|
||||
if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0) &
|
||||
write(6,'(a,i6)') '<< CRYST stateFPI >> state iteration ',NiterationState
|
||||
#endif
|
||||
|
||||
! store previousDotState and previousDotState2
|
||||
|
||||
!$OMP PARALLEL DO PRIVATE(p,c)
|
||||
nonlocalBroken = .false.
|
||||
!$OMP PARALLEL DO PRIVATE(sizeDotState,residuum_plastic,residuum_source,zeta,p,c)
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) then
|
||||
if(crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e) .and. &
|
||||
(.not. nonlocalBroken .or. crystallite_localPlasticity(g,i,e)) ) then
|
||||
|
||||
iteration: do NiterationState = 1, num%nState
|
||||
|
||||
p = material_phaseAt(g,e); c = material_phaseMemberAt(g,i,e)
|
||||
|
||||
plasticState(p)%previousDotState2(:,c) = merge(plasticState(p)%previousDotState(:,c),&
|
||||
|
@ -1054,112 +1047,79 @@ subroutine integrateStateFPI
|
|||
NiterationState > 1)
|
||||
sourceState(p)%p(s)%previousDotState (:,c) = sourceState(p)%p(s)%dotState(:,c)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
call update_dependentState
|
||||
call update_stress(1.0_pReal)
|
||||
call update_dotState(1.0_pReal)
|
||||
call constitutive_dependentState(crystallite_partionedF(1:3,1:3,g,i,e), &
|
||||
crystallite_Fp(1:3,1:3,g,i,e), &
|
||||
g, i, e)
|
||||
|
||||
crystallite_todo(g,i,e) = integrateStress(g,i,e,1.0_pReal)
|
||||
if(.not. (crystallite_todo(g,i,e) .or. crystallite_localPlasticity(g,i,e))) &
|
||||
nonlocalBroken = .true.
|
||||
if(.not. crystallite_todo(g,i,e)) exit iteration
|
||||
|
||||
call constitutive_collectDotState(crystallite_S(1:3,1:3,g,i,e), &
|
||||
crystallite_partionedF0, &
|
||||
crystallite_Fi(1:3,1:3,g,i,e), &
|
||||
crystallite_partionedFp0, &
|
||||
crystallite_subdt(g,i,e), g,i,e)
|
||||
crystallite_todo(g,i,e) = all(.not. IEEE_is_NaN(plasticState(p)%dotState(:,c)))
|
||||
do s = 1, phase_Nsources(p)
|
||||
crystallite_todo(g,i,e) = crystallite_todo(g,i,e) .and. all(.not. IEEE_is_NaN(sourceState(p)%p(s)%dotState(:,c)))
|
||||
enddo
|
||||
if(.not. (crystallite_todo(g,i,e) .or. crystallite_localPlasticity(g,i,e))) &
|
||||
nonlocalBroken = .true.
|
||||
if(.not. crystallite_todo(g,i,e)) exit iteration
|
||||
|
||||
!$OMP PARALLEL
|
||||
!$OMP DO PRIVATE(sizeDotState,residuum_plastic,residuum_source,zeta,p,c)
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) then
|
||||
p = material_phaseAt(g,e); c = material_phaseMemberAt(g,i,e)
|
||||
sizeDotState = plasticState(p)%sizeDotState
|
||||
|
||||
zeta = damper(plasticState(p)%dotState (:,c), &
|
||||
plasticState(p)%previousDotState (:,c), &
|
||||
plasticState(p)%previousDotState2(:,c))
|
||||
|
||||
residuum_plastic(1:SizeDotState) = plasticState(p)%state (1:sizeDotState,c) &
|
||||
- plasticState(p)%subState0(1:sizeDotState,c) &
|
||||
- ( plasticState(p)%dotState (:,c) * zeta &
|
||||
+ plasticState(p)%previousDotState(:,c) * (1.0_pReal-zeta) &
|
||||
) * crystallite_subdt(g,i,e)
|
||||
|
||||
plasticState(p)%state(1:sizeDotState,c) = plasticState(p)%state(1:sizeDotState,c) &
|
||||
- residuum_plastic(1:sizeDotState)
|
||||
plasticState(p)%dotState(:,c) = plasticState(p)%dotState(:,c) * zeta &
|
||||
+ plasticState(p)%previousDotState(:,c) * (1.0_pReal - zeta)
|
||||
|
||||
residuum_plastic(1:SizeDotState) = plasticState(p)%state (1:sizeDotState,c) &
|
||||
- plasticState(p)%subState0(1:sizeDotState,c) &
|
||||
- plasticState(p)%dotState (1:sizeDotState,c) &
|
||||
* crystallite_subdt(g,i,e)
|
||||
plasticState(p)%state(1:sizeDotState,c) = plasticState(p)%state(1:sizeDotState,c) &
|
||||
- residuum_plastic(1:sizeDotState)
|
||||
crystallite_converged(g,i,e) = converged(residuum_plastic(1:sizeDotState), &
|
||||
plasticState(p)%state(1:sizeDotState,c), &
|
||||
plasticState(p)%atol(1:sizeDotState))
|
||||
|
||||
|
||||
do s = 1, phase_Nsources(p)
|
||||
sizeDotState = sourceState(p)%p(s)%sizeDotState
|
||||
|
||||
zeta = damper(sourceState(p)%p(s)%dotState (:,c), &
|
||||
sourceState(p)%p(s)%previousDotState (:,c), &
|
||||
sourceState(p)%p(s)%previousDotState2(:,c))
|
||||
|
||||
residuum_source(1:sizeDotState) = sourceState(p)%p(s)%state (1:sizeDotState,c) &
|
||||
- sourceState(p)%p(s)%subState0(1:sizeDotState,c) &
|
||||
- ( sourceState(p)%p(s)%dotState (:,c) * zeta &
|
||||
+ sourceState(p)%p(s)%previousDotState(:,c) * (1.0_pReal - zeta) &
|
||||
) * crystallite_subdt(g,i,e)
|
||||
|
||||
sourceState(p)%p(s)%state(1:sizeDotState,c) = sourceState(p)%p(s)%state(1:sizeDotState,c) &
|
||||
- residuum_source(1:sizeDotState)
|
||||
sourceState(p)%p(s)%dotState(:,c) = sourceState(p)%p(s)%dotState(:,c) * zeta &
|
||||
+ sourceState(p)%p(s)%previousDotState(:,c)* (1.0_pReal - zeta)
|
||||
|
||||
residuum_source(1:sizeDotState) = sourceState(p)%p(s)%state (1:sizeDotState,c) &
|
||||
- sourceState(p)%p(s)%subState0(1:sizeDotState,c) &
|
||||
- sourceState(p)%p(s)%dotState (1:sizeDotState,c) &
|
||||
* crystallite_subdt(g,i,e)
|
||||
sourceState(p)%p(s)%state(1:sizeDotState,c) = sourceState(p)%p(s)%state(1:sizeDotState,c) &
|
||||
- residuum_source(1:sizeDotState)
|
||||
crystallite_converged(g,i,e) = &
|
||||
crystallite_converged(g,i,e) .and. converged(residuum_source(1:sizeDotState), &
|
||||
sourceState(p)%p(s)%state(1:sizeDotState,c), &
|
||||
sourceState(p)%p(s)%atol(1:sizeDotState))
|
||||
enddo
|
||||
endif
|
||||
enddo; enddo; enddo
|
||||
!$OMP ENDDO
|
||||
|
||||
!$OMP DO
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
!$OMP FLUSH(crystallite_todo)
|
||||
if (crystallite_todo(g,i,e) .and. crystallite_converged(g,i,e)) then ! converged and still alive...
|
||||
if(crystallite_converged(g,i,e)) then
|
||||
crystallite_todo(g,i,e) = stateJump(g,i,e)
|
||||
!$OMP FLUSH(crystallite_todo)
|
||||
if (.not. crystallite_todo(g,i,e)) then ! if state jump fails, then convergence is broken
|
||||
crystallite_converged(g,i,e) = .false.
|
||||
if (.not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local...
|
||||
!$OMP CRITICAL (checkTodo)
|
||||
crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped
|
||||
!$OMP END CRITICAL (checkTodo)
|
||||
endif
|
||||
if(.not. (crystallite_todo(g,i,e) .or. crystallite_localPlasticity(g,i,e))) &
|
||||
nonlocalBroken = .true.
|
||||
exit iteration
|
||||
endif
|
||||
|
||||
enddo iteration
|
||||
|
||||
endif
|
||||
enddo; enddo; enddo
|
||||
!$OMP ENDDO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
if(nonlocalBroken) where(.not. crystallite_localPlasticity) crystallite_todo = .false.
|
||||
if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
|
||||
|
||||
|
||||
! --- CHECK IF DONE WITH INTEGRATION ---
|
||||
doneWithIntegration = .true.
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) then
|
||||
doneWithIntegration = .false.
|
||||
exit
|
||||
endif
|
||||
enddo; enddo
|
||||
enddo
|
||||
|
||||
enddo crystalliteLooping
|
||||
|
||||
|
||||
contains
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -1584,26 +1544,28 @@ subroutine update_stress(timeFraction)
|
|||
e, & !< element index in element loop
|
||||
i, & !< integration point index in ip loop
|
||||
g
|
||||
logical :: &
|
||||
nonlocalBroken
|
||||
|
||||
nonlocalBroken = .false.
|
||||
!$OMP PARALLEL DO
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
!$OMP FLUSH(crystallite_todo)
|
||||
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) then
|
||||
if(crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e) .and. &
|
||||
(.not. nonlocalBroken .or. crystallite_localPlasticity(g,i,e)) ) then
|
||||
crystallite_todo(g,i,e) = integrateStress(g,i,e,timeFraction)
|
||||
!$OMP FLUSH(crystallite_todo)
|
||||
if (.not. crystallite_todo(g,i,e) .and. .not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local...
|
||||
!$OMP CRITICAL (checkTodo)
|
||||
crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped
|
||||
!$OMP END CRITICAL (checkTodo)
|
||||
endif
|
||||
if (.not. (crystallite_todo(g,i,e) .or. crystallite_localPlasticity(g,i,e))) &
|
||||
nonlocalBroken = .true.
|
||||
endif
|
||||
enddo; enddo; enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
if(nonlocalBroken) where(.not. crystallite_localPlasticity) crystallite_todo = .false.
|
||||
|
||||
end subroutine update_stress
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief tbd
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
@ -1617,7 +1579,7 @@ subroutine update_dependentState
|
|||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) &
|
||||
call constitutive_dependentState(crystallite_Fe(1:3,1:3,g,i,e), &
|
||||
call constitutive_dependentState(crystallite_partionedF(1:3,1:3,g,i,e), &
|
||||
crystallite_Fp(1:3,1:3,g,i,e), &
|
||||
g, i, e)
|
||||
enddo; enddo; enddo
|
||||
|
@ -1666,10 +1628,10 @@ subroutine update_state(timeFraction)
|
|||
end subroutine update_state
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief triggers calculation of all new rates
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
!> @brief Trigger calculation of all new rates
|
||||
!> if NaN occurs, crystallite_todo is set to FALSE. Any NaN in a nonlocal propagates to all others
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
subroutine update_dotState(timeFraction)
|
||||
|
||||
real(pReal), intent(in) :: &
|
||||
|
@ -1682,40 +1644,40 @@ subroutine update_dotState(timeFraction)
|
|||
c, &
|
||||
s
|
||||
logical :: &
|
||||
NaN, &
|
||||
nonlocalStop
|
||||
nonlocalBroken
|
||||
|
||||
nonlocalStop = .false.
|
||||
|
||||
!$OMP PARALLEL DO PRIVATE (p,c,NaN)
|
||||
nonlocalBroken = .false.
|
||||
!$OMP PARALLEL DO PRIVATE (p,c)
|
||||
do e = FEsolving_execElem(1),FEsolving_execElem(2)
|
||||
do i = FEsolving_execIP(1),FEsolving_execIP(2)
|
||||
do g = 1,homogenization_Ngrains(material_homogenizationAt(e))
|
||||
!$OMP FLUSH(nonlocalStop)
|
||||
if ((crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) .and. .not. nonlocalStop) then
|
||||
if(crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e) .and. &
|
||||
(.not. nonlocalBroken .or. crystallite_localPlasticity(g,i,e)) ) then
|
||||
call constitutive_collectDotState(crystallite_S(1:3,1:3,g,i,e), &
|
||||
crystallite_partionedF0, &
|
||||
crystallite_Fi(1:3,1:3,g,i,e), &
|
||||
crystallite_partionedFp0, &
|
||||
crystallite_subdt(g,i,e)*timeFraction, g,i,e)
|
||||
p = material_phaseAt(g,e); c = material_phaseMemberAt(g,i,e)
|
||||
NaN = any(IEEE_is_NaN(plasticState(p)%dotState(:,c)))
|
||||
crystallite_todo(g,i,e) = all(.not. IEEE_is_NaN(plasticState(p)%dotState(:,c)))
|
||||
do s = 1, phase_Nsources(p)
|
||||
NaN = NaN .or. any(IEEE_is_NaN(sourceState(p)%p(s)%dotState(:,c)))
|
||||
crystallite_todo(g,i,e) = crystallite_todo(g,i,e) .and. all(.not. IEEE_is_NaN(sourceState(p)%p(s)%dotState(:,c)))
|
||||
enddo
|
||||
if (NaN) then
|
||||
crystallite_todo(g,i,e) = .false. ! this one done (and broken)
|
||||
if (.not. crystallite_localPlasticity(g,i,e)) nonlocalStop = .True.
|
||||
endif
|
||||
if (.not. (crystallite_todo(g,i,e) .or. crystallite_localPlasticity(g,i,e))) &
|
||||
nonlocalBroken = .true.
|
||||
endif
|
||||
enddo; enddo; enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
if (nonlocalStop) crystallite_todo = crystallite_todo .and. crystallite_localPlasticity
|
||||
if(nonlocalBroken) where(.not. crystallite_localPlasticity) crystallite_todo = .false.
|
||||
|
||||
end subroutine update_DotState
|
||||
|
||||
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
!> @brief Trigger calculation of all new sudden state change
|
||||
!> if NaN occurs, crystallite_todo is set to FALSE. Any NaN in a nonlocal propagates to all others
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
subroutine update_deltaState
|
||||
|
||||
integer :: &
|
||||
|
@ -1806,7 +1768,7 @@ logical function stateJump(ipc,ip,el)
|
|||
myOffset = plasticState(p)%offsetDeltaState
|
||||
mySize = plasticState(p)%sizeDeltaState
|
||||
|
||||
if( any(IEEE_is_NaN(plasticState(p)%deltaState(1:mySize,c)))) then ! NaN occured in deltaState
|
||||
if( any(IEEE_is_NaN(plasticState(p)%deltaState(1:mySize,c)))) then
|
||||
stateJump = .false.
|
||||
return
|
||||
endif
|
||||
|
@ -1817,7 +1779,7 @@ logical function stateJump(ipc,ip,el)
|
|||
do mySource = 1, phase_Nsources(p)
|
||||
myOffset = sourceState(p)%p(mySource)%offsetDeltaState
|
||||
mySize = sourceState(p)%p(mySource)%sizeDeltaState
|
||||
if (any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(1:mySize,c)))) then ! NaN occured in deltaState
|
||||
if (any(IEEE_is_NaN(sourceState(p)%p(mySource)%deltaState(1:mySize,c)))) then
|
||||
stateJump = .false.
|
||||
return
|
||||
endif
|
||||
|
@ -1825,19 +1787,6 @@ logical function stateJump(ipc,ip,el)
|
|||
sourceState(p)%p(mySource)%state(myOffset + 1: myOffset + mySize,c) + sourceState(p)%p(mySource)%deltaState(1:mySize,c)
|
||||
enddo
|
||||
|
||||
#ifdef DEBUG
|
||||
if (any(dNeq0(plasticState(p)%deltaState(1:mySize,c))) &
|
||||
.and. iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0 &
|
||||
.and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) &
|
||||
.or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0)) 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:mySize,c)
|
||||
write(6,'(a,/,(12x,12(e12.5,1x)),/)') '<< CRYST >> new state', &
|
||||
plasticState(p)%state(myOffset + 1 : &
|
||||
myOffset + mySize,c)
|
||||
endif
|
||||
#endif
|
||||
|
||||
stateJump = .true.
|
||||
|
||||
end function stateJump
|
||||
|
|
Loading…
Reference in New Issue