use the same formulation for convergence every where

This commit is contained in:
Martin Diehl 2019-01-31 09:12:44 +01:00
parent 5eaeb37ea4
commit cbeb3dcff0
1 changed files with 38 additions and 35 deletions

View File

@ -1535,11 +1535,8 @@ end function integrateStress
!> using Fixed Point Iteration to adapt the stepsize !> using Fixed Point Iteration to adapt the stepsize
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine integrateStateFPI() subroutine integrateStateFPI()
use, intrinsic :: &
IEEE_arithmetic
use numerics, only: & use numerics, only: &
nState, & nState
rTol_crystalliteState
use mesh, only: & use mesh, only: &
mesh_element mesh_element
use material, only: & use material, only: &
@ -1549,7 +1546,6 @@ subroutine integrateStateFPI()
phase_Nsources, & phase_Nsources, &
homogenization_Ngrains homogenization_Ngrains
use constitutive, only: & use constitutive, only: &
constitutive_collectDotState, &
constitutive_plasticity_maxSizeDotState, & constitutive_plasticity_maxSizeDotState, &
constitutive_source_maxSizeDotState constitutive_source_maxSizeDotState
@ -1635,9 +1631,9 @@ subroutine integrateStateFPI()
plasticState(p)%dotState(:,c) = plasticState(p)%dotState(:,c) * zeta & plasticState(p)%dotState(:,c) = plasticState(p)%dotState(:,c) * zeta &
+ plasticState(p)%previousDotState(:,c) * (1.0_pReal - zeta) + plasticState(p)%previousDotState(:,c) * (1.0_pReal - zeta)
crystallite_converged(g,i,e) = all(abs(residuum_plastic(1:sizeDotState)) & crystallite_converged(g,i,e) = converged(residuum_plastic(1:sizeDotState), &
< max(plasticState(p)%aTolState(1:sizeDotState), & plasticState(p)%state(1:sizeDotState,c), &
abs(plasticState(p)%state(1:sizeDotState,c)*rTol_crystalliteState))) plasticState(p)%aTolState(1:sizeDotState))
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
@ -1659,9 +1655,9 @@ subroutine integrateStateFPI()
+ sourceState(p)%p(s)%previousDotState(:,c)* (1.0_pReal - zeta) + sourceState(p)%p(s)%previousDotState(:,c)* (1.0_pReal - zeta)
crystallite_converged(g,i,e) = crystallite_converged(g,i,e) .and. & crystallite_converged(g,i,e) = crystallite_converged(g,i,e) .and. &
all(abs(residuum_source(1:sizeDotState)) & converged(residuum_source(1:sizeDotState), &
< max(sourceState(p)%p(s)%aTolState(1:sizeDotState), & sourceState(p)%p(s)%state(1:sizeDotState,c), &
abs(sourceState(p)%p(s)%state(1:sizeDotState,c)*rTol_crystalliteState))) sourceState(p)%p(s)%aTolState(1:sizeDotState))
enddo enddo
endif endif
enddo; enddo; enddo enddo; enddo; enddo
@ -1730,6 +1726,23 @@ subroutine integrateStateFPI()
end function damper end function damper
!--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged
!--------------------------------------------------------------------------------------------------
logical pure function converged(residuum,state,aTol)
use prec, only: &
dEq0
use numerics, only: &
rTol => rTol_crystalliteState
implicit none
real(pReal), intent(in), dimension(:) ::&
residuum, state, aTol
converged = all(abs(residuum) <= max(aTol, rTol*abs(state)))
end function converged
end subroutine integrateStateFPI end subroutine integrateStateFPI
@ -1835,9 +1848,9 @@ subroutine integrateStateAdaptiveEuler()
residuum_plastic(1:sizeDotState,g,i,e) = residuum_plastic(1:sizeDotState,g,i,e) & residuum_plastic(1:sizeDotState,g,i,e) = residuum_plastic(1:sizeDotState,g,i,e) &
+ 0.5_pReal * plasticState(p)%dotState(:,c) * crystallite_subdt(g,i,e) + 0.5_pReal * plasticState(p)%dotState(:,c) * crystallite_subdt(g,i,e)
crystallite_converged(g,i,e) = all(converged(residuum_plastic(1:sizeDotState,g,i,e), & crystallite_converged(g,i,e) = converged(residuum_plastic(1:sizeDotState,g,i,e), &
plasticState(p)%state(1:sizeDotState,c), & plasticState(p)%state(1:sizeDotState,c), &
plasticState(p)%aTolState(1:sizeDotState))) plasticState(p)%aTolState(1:sizeDotState))
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
sizeDotState = sourceState(p)%p(s)%sizeDotState sizeDotState = sourceState(p)%p(s)%sizeDotState
@ -1846,9 +1859,9 @@ subroutine integrateStateAdaptiveEuler()
+ 0.5_pReal * sourceState(p)%p(s)%dotState(:,c) * crystallite_subdt(g,i,e) + 0.5_pReal * sourceState(p)%p(s)%dotState(:,c) * crystallite_subdt(g,i,e)
crystallite_converged(g,i,e) = crystallite_converged(g,i,e) .and.& crystallite_converged(g,i,e) = crystallite_converged(g,i,e) .and.&
all(converged(residuum_source(1:sizeDotState,s,g,i,e), & converged(residuum_source(1:sizeDotState,s,g,i,e), &
sourceState(p)%p(s)%state(1:sizeDotState,c), & sourceState(p)%p(s)%state(1:sizeDotState,c), &
sourceState(p)%p(s)%aTolState(1:sizeDotState))) sourceState(p)%p(s)%aTolState(1:sizeDotState))
enddo enddo
endif endif
@ -1862,22 +1875,17 @@ subroutine integrateStateAdaptiveEuler()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged !> @brief determines whether a point is converged
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
logical pure elemental function converged(residuum,state,aTol) logical pure function converged(residuum,state,aTol)
use prec, only: & use prec, only: &
dEq0 dEq0
use numerics, only: & use numerics, only: &
rTol => rTol_crystalliteState rTol => rTol_crystalliteState
implicit none implicit none
real(pReal), intent(in) ::& real(pReal), intent(in), dimension(:) ::&
residuum, state, aTol residuum, state, aTol
if (dEq0(state)) then converged = all(abs(residuum) <= max(aTol, rTol*abs(state)))
converged = .true. ! ToDo: intended behavior? Not rely on absoluteTolerance
else
converged = abs(residuum) < aTol &
.or. abs(residuum/state) < rTol
endif
end function converged end function converged
@ -2111,17 +2119,17 @@ subroutine integrateStateRKCK45()
sizeDotState = plasticState(p)%sizeDotState sizeDotState = plasticState(p)%sizeDotState
crystallite_todo(g,i,e) = all(converged(residuum_plastic(1:sizeDotState,g,i,e), & crystallite_todo(g,i,e) = converged(residuum_plastic(1:sizeDotState,g,i,e), &
plasticState(p)%state(1:sizeDotState,cc), & plasticState(p)%state(1:sizeDotState,cc), &
plasticState(p)%aTolState(1:sizeDotState))) plasticState(p)%aTolState(1:sizeDotState))
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
sizeDotState = sourceState(p)%p(s)%sizeDotState sizeDotState = sourceState(p)%p(s)%sizeDotState
crystallite_todo(g,i,e) = crystallite_todo(g,i,e) .and.& crystallite_todo(g,i,e) = crystallite_todo(g,i,e) .and.&
all(converged(residuum_source(1:sizeDotState,s,g,i,e), & converged(residuum_source(1:sizeDotState,s,g,i,e), &
sourceState(p)%p(s)%state(1:sizeDotState,cc), & sourceState(p)%p(s)%state(1:sizeDotState,cc), &
sourceState(p)%p(s)%aTolState(1:sizeDotState))) sourceState(p)%p(s)%aTolState(1:sizeDotState))
enddo enddo
endif endif
enddo; enddo; enddo enddo; enddo; enddo
@ -2138,22 +2146,17 @@ subroutine integrateStateRKCK45()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged !> @brief determines whether a point is converged
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
logical pure elemental function converged(residuum,state,aTol) logical pure function converged(residuum,state,aTol)
use prec, only: & use prec, only: &
dEq0 dEq0
use numerics, only: & use numerics, only: &
rTol => rTol_crystalliteState rTol => rTol_crystalliteState
implicit none implicit none
real(pReal), intent(in) ::& real(pReal), intent(in), dimension(:) ::&
residuum, state, aTol residuum, state, aTol
if (dEq0(state)) then converged = all(abs(residuum) <= max(aTol, rTol*abs(state)))
converged = .true. ! ToDo: intended behavior? Not rely on absoluteTolerance
else
converged = abs(residuum) < aTol &
.or. abs(residuum/state) < rTol
endif
end function converged end function converged