diff --git a/src/crystallite.f90 b/src/crystallite.f90 index dc3e5b154..4adae2a19 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -1836,9 +1836,9 @@ subroutine integrateStateAdaptiveEuler() 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) - crystallite_converged(g,i,e) = converged(residuum_plastic(1:sizeDotState,g,i,e), & + crystallite_converged(g,i,e) = all(converged(residuum_plastic(1:sizeDotState,g,i,e), & plasticState(p)%dotState(1:sizeDotState,c), & - plasticState(p)%aTolState(1:sizeDotState)) + plasticState(p)%aTolState(1:sizeDotState))) do s = 1_pInt, phase_Nsources(p) sizeDotState = sourceState(p)%p(s)%sizeDotState @@ -1847,9 +1847,9 @@ subroutine integrateStateAdaptiveEuler() + 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.& - converged(residuum_source(1:sizeDotState,s,g,i,e), & + all(converged(residuum_source(1:sizeDotState,s,g,i,e), & sourceState(p)%p(s)%dotState(1:sizeDotState,c), & - sourceState(p)%p(s)%aTolState(1:sizeDotState)) + sourceState(p)%p(s)%aTolState(1:sizeDotState))) enddo endif @@ -1863,25 +1863,22 @@ subroutine integrateStateAdaptiveEuler() !-------------------------------------------------------------------------------------------------- !> @brief determines whether a point is converged !-------------------------------------------------------------------------------------------------- - logical pure function converged(residuum,dotState,absoluteTolerance) + logical pure elemental function converged(residuum,dotState,absoluteTolerance) use prec, only: & - dNeq0 + dEq0 use numerics, only: & rTol_crystalliteState implicit none - real(pReal), dimension(:), intent(in) ::& + real(pReal), intent(in) ::& residuum, dotState, absoluteTolerance - logical, dimension(size(residuum,1)) ::& - converged_array - where(dNeq0(dotState)) - converged_array = abs(residuum) < absoluteTolerance .or. (abs(residuum/dotState) < rTol_crystalliteState) - else where - converged_array = .true. - end where - - converged = all(converged_array) + if (dEq0(dotState)) then + converged = .true. + else + converged = abs(residuum) < absoluteTolerance & + .or. abs(residuum/dotState) < rTol_crystalliteState + endif end function converged @@ -2116,17 +2113,17 @@ subroutine integrateStateRKCK45() sizeDotState = plasticState(p)%sizeDotState - crystallite_todo(g,i,e) = converged(residuum_plastic(1:sizeDotState,g,i,e), & + crystallite_todo(g,i,e) = all(converged(residuum_plastic(1:sizeDotState,g,i,e), & plasticState(p)%dotState(1:sizeDotState,cc), & - plasticState(p)%aTolState(1:sizeDotState)) + plasticState(p)%aTolState(1:sizeDotState))) do s = 1_pInt, phase_Nsources(p) sizeDotState = sourceState(p)%p(s)%sizeDotState crystallite_todo(g,i,e) = crystallite_todo(g,i,e) .and.& - converged(residuum_source(1:sizeDotState,s,g,i,e), & + all(converged(residuum_source(1:sizeDotState,s,g,i,e), & sourceState(p)%p(s)%dotState(1:sizeDotState,cc), & - sourceState(p)%p(s)%aTolState(1:sizeDotState)) + sourceState(p)%p(s)%aTolState(1:sizeDotState))) enddo endif enddo; enddo; enddo @@ -2138,30 +2135,27 @@ subroutine integrateStateRKCK45() call setConvergenceFlag if (any(plasticState(:)%nonlocal)) call nonlocalConvergenceCheck - contains + contains !-------------------------------------------------------------------------------------------------- !> @brief determines whether a point is converged !-------------------------------------------------------------------------------------------------- - logical pure function converged(residuum,dotState,absoluteTolerance) + logical pure elemental function converged(residuum,dotState,absoluteTolerance) use prec, only: & - dNeq0 + dEq0 use numerics, only: & rTol_crystalliteState implicit none - real(pReal), dimension(:), intent(in) ::& + real(pReal), intent(in) ::& residuum, dotState, absoluteTolerance - logical, dimension(size(residuum,1)) ::& - converged_array - where(dNeq0(dotState)) - converged_array = abs(residuum) < absoluteTolerance .or. (abs(residuum/dotState) < rTol_crystalliteState) - else where - converged_array = .true. - end where - - converged = all(converged_array) + if (dEq0(dotState)) then + converged = .true. + else + converged = abs(residuum) < absoluteTolerance & + .or. abs(residuum/dotState) < rTol_crystalliteState + endif end function converged