nonlocal convergence check in function

This commit is contained in:
Martin Diehl 2019-01-29 05:11:29 +01:00
parent 3fdf8e19bb
commit 1e4da6fbdb
1 changed files with 44 additions and 64 deletions

View File

@ -1542,8 +1542,7 @@ subroutine integrateStateFPI()
nState, & nState, &
rTol_crystalliteState rTol_crystalliteState
use mesh, only: & use mesh, only: &
mesh_element, & mesh_element
mesh_NcpElems
use material, only: & use material, only: &
plasticState, & plasticState, &
sourceState, & sourceState, &
@ -1727,12 +1726,7 @@ subroutine integrateStateFPI()
!$OMP END PARALLEL !$OMP END PARALLEL
! --- NON-LOCAL CONVERGENCE CHECK --- if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
if (any(plasticState(:)%nonlocal)) then ! if not requesting Integration of just a single IP
if (any(.not. crystallite_converged .and. .not. crystallite_localPlasticity)) & ! any non-local not yet converged (or broken)...
crystallite_converged = crystallite_converged .and. crystallite_localPlasticity ! ...restart all non-local as not converged
endif
! --- CHECK IF DONE WITH INTEGRATION --- ! --- CHECK IF DONE WITH INTEGRATION ---
@ -1777,26 +1771,21 @@ end subroutine integrateStateFPI
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief integrate stress, and state with 1st order explicit Euler method !> @brief integrate state with 1st order explicit Euler method
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine integrateStateEuler() subroutine integrateStateEuler()
use material, only: & use material, only: &
plasticState plasticState
implicit none implicit none
call update_dotState(1.0_pReal) call update_dotState(1.0_pReal)
call update_State(1.0_pReal) call update_state(1.0_pReal)
call update_deltaState call update_deltaState
call update_dependentState call update_dependentState
call update_stress(1.0_pReal) call update_stress(1.0_pReal)
call setConvergenceFlag call setConvergenceFlag
if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
! --- CHECK NON-LOCAL CONVERGENCE ---
if (any(plasticState(:)%nonlocal)) then
if (any(.not. crystallite_converged .and. .not. crystallite_localPlasticity) ) & ! any non-local not yet converged (or broken)...
crystallite_converged = crystallite_converged .and. crystallite_localPlasticity ! ...restart all non-local as not converged
endif
end subroutine integrateStateEuler end subroutine integrateStateEuler
@ -1848,8 +1837,7 @@ real(pReal), dimension(constitutive_plasticity_maxSizeDotState, &
relSourceStateResiduum ! relative residuum from evolution in microstructure relSourceStateResiduum ! relative residuum from evolution in microstructure
logical :: & logical :: &
converged, & converged
NaN
plasticStateResiduum = 0.0_pReal plasticStateResiduum = 0.0_pReal
@ -1951,13 +1939,8 @@ real(pReal), dimension(constitutive_plasticity_maxSizeDotState, &
enddo; enddo; enddo enddo; enddo; enddo
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
! --- NONLOCAL CONVERGENCE CHECK ---
if (any(plasticState(:)%nonlocal)) then
if (any(.not. crystallite_converged .and. .not. crystallite_localPlasticity) ) & ! any non-local not yet converged (or broken)...
crystallite_converged = crystallite_converged .and. crystallite_localPlasticity ! ...restart all non-local as not converged
endif
end subroutine integrateStateAdaptiveEuler end subroutine integrateStateAdaptiveEuler
@ -2038,7 +2021,9 @@ subroutine integrateStateRK4()
!$OMP PARALLEL !$OMP PARALLEL
!$OMP DO PRIVATE(p,c) !$OMP DO PRIVATE(p,c)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
c = phasememberAt(g,i,e) c = phasememberAt(g,i,e)
@ -2066,14 +2051,9 @@ subroutine integrateStateRK4()
enddo enddo
call setConvergenceFlag call setConvergenceFlag
if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
! --- CHECK NONLOCAL CONVERGENCE ---
if (any(plasticState(:)%nonlocal)) then
if (any(.not. crystallite_converged .and. .not. crystallite_localPlasticity) ) & ! any non-local not yet converged (or broken)...
crystallite_converged = crystallite_converged .and. crystallite_localPlasticity ! ...restart all non-local as not converged
endif
end subroutine integrateStateRK4 end subroutine integrateStateRK4
@ -2148,11 +2128,7 @@ subroutine integrateStateRKCK45()
mySource, & mySource, &
mySizePlasticDotState, & ! size of dot States mySizePlasticDotState, & ! size of dot States
mySizeSourceDotState mySizeSourceDotState
integer(pInt), dimension(2) :: &
eIter ! bounds for element iteration
integer(pInt), dimension(2,mesh_NcpElems) :: &
iIter, & ! bounds for ip iteration
gIter ! bounds for grain iteration
real(pReal), dimension(constitutive_plasticity_maxSizeDotState, & real(pReal), dimension(constitutive_plasticity_maxSizeDotState, &
homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems) :: & homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems) :: &
@ -2163,18 +2139,7 @@ subroutine integrateStateRKCK45()
homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems) :: & homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems) :: &
sourceStateResiduum, & ! residuum from evolution in microstructure sourceStateResiduum, & ! residuum from evolution in microstructure
relSourceStateResiduum ! relative residuum from evolution in microstructure relSourceStateResiduum ! relative residuum from evolution in microstructure
logical :: &
singleRun ! flag indicating computation for single (g,i,e) triple
eIter = FEsolving_execElem(1:2)
! --- LOOP ITERATOR FOR ELEMENT, GRAIN, IP ---
do e = eIter(1),eIter(2)
iIter(1:2,e) = FEsolving_execIP(1:2,e)
gIter(1:2,e) = [ 1_pInt,homogenization_Ngrains(mesh_element(3,e))]
enddo
singleRun = (eIter(1) == eIter(2) .and. iIter(1,eIter(1)) == iIter(2,eIter(2)))
call update_dotState(1.0_pReal) call update_dotState(1.0_pReal)
@ -2188,7 +2153,9 @@ subroutine integrateStateRKCK45()
!$OMP PARALLEL !$OMP PARALLEL
!$OMP DO PRIVATE(p,cc) !$OMP DO PRIVATE(p,cc)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
cc = phasememberAt(g,i,e) cc = phasememberAt(g,i,e)
@ -2201,7 +2168,9 @@ subroutine integrateStateRKCK45()
!$OMP ENDDO !$OMP ENDDO
!$OMP DO PRIVATE(p,cc,n) !$OMP DO PRIVATE(p,cc,n)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
cc = phasememberAt(g,i,e) cc = phasememberAt(g,i,e)
@ -2239,7 +2208,9 @@ subroutine integrateStateRKCK45()
relSourceStateResiduum = 0.0_pReal relSourceStateResiduum = 0.0_pReal
!$OMP PARALLEL !$OMP PARALLEL
!$OMP DO PRIVATE(p,cc) !$OMP DO PRIVATE(p,cc)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
cc = phasememberAt(g,i,e) cc = phasememberAt(g,i,e)
@ -2252,7 +2223,9 @@ subroutine integrateStateRKCK45()
!$OMP ENDDO !$OMP ENDDO
!$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState,p,cc) !$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState,p,cc)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
cc = phasememberAt(g,i,e) cc = phasememberAt(g,i,e)
@ -2288,7 +2261,9 @@ subroutine integrateStateRKCK45()
! --- relative residui and state convergence --- ! --- relative residui and state convergence ---
!$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState,p,cc,s) !$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState,p,cc,s)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
cc = phasememberAt(g,i,e) cc = phasememberAt(g,i,e)
@ -2324,15 +2299,25 @@ subroutine integrateStateRKCK45()
call update_dependentState call update_dependentState
call update_stress(1.0_pReal) call update_stress(1.0_pReal)
call setConvergenceFlag call setConvergenceFlag
if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck
! --- nonlocal convergence check ---
if ((.not. singleRun) .and. any(.not. crystallite_converged .and. .not. crystallite_localPlasticity)) & ! any non-local not yet converged (or broken)...
crystallite_converged = crystallite_converged .and. crystallite_localPlasticity ! ...restart all non-local as not converged
end subroutine integrateStateRKCK45 end subroutine integrateStateRKCK45
!--------------------------------------------------------------------------------------------------
!> @brief sets convergence flag for nonlocal calculations
!> @detail one non-converged nonlocal sets all other nonlocals to non-converged to trigger cut back
!--------------------------------------------------------------------------------------------------
subroutine nonlocalConvergenceCheck()
implicit none
if (any(.not. crystallite_converged .and. .not. crystallite_localPlasticity)) & ! any non-local not yet converged (or broken)...
where( .not. crystallite_localPlasticity) crystallite_converged = .false.
end subroutine nonlocalConvergenceCheck
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Sets convergence flag based on "todo": every point that survived the integration (todo is !> @brief Sets convergence flag based on "todo": every point that survived the integration (todo is
! still .true. is considered as converged ! still .true. is considered as converged
@ -2361,11 +2346,6 @@ end subroutine setConvergenceFlag
!> @brief Standard forwarding of state as state = state0 + dotState * (delta t) !> @brief Standard forwarding of state as state = state0 + dotState * (delta t)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine update_stress(timeFraction) subroutine update_stress(timeFraction)
use material, only: &
plasticState, &
sourceState, &
phase_Nsources, &
phaseAt, phasememberAt
implicit none implicit none
real(pReal), intent(in) :: & real(pReal), intent(in) :: &