avoid superflous variables

This commit is contained in:
Martin Diehl 2019-01-30 13:24:35 +01:00
parent 64b89484d2
commit 1d88057ce4
1 changed files with 27 additions and 33 deletions

View File

@ -1836,9 +1836,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) = 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)%dotState(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
@ -1847,9 +1847,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.&
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)%dotState(1:sizeDotState,c), &
sourceState(p)%p(s)%aTolState(1:sizeDotState)) sourceState(p)%p(s)%aTolState(1:sizeDotState)))
enddo enddo
endif endif
@ -1863,25 +1863,22 @@ subroutine integrateStateAdaptiveEuler()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged !> @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: & use prec, only: &
dNeq0 dEq0
use numerics, only: & use numerics, only: &
rTol_crystalliteState rTol_crystalliteState
implicit none implicit none
real(pReal), dimension(:), intent(in) ::& real(pReal), intent(in) ::&
residuum, dotState, absoluteTolerance residuum, dotState, absoluteTolerance
logical, dimension(size(residuum,1)) ::&
converged_array
where(dNeq0(dotState)) if (dEq0(dotState)) then
converged_array = abs(residuum) < absoluteTolerance .or. (abs(residuum/dotState) < rTol_crystalliteState) converged = .true.
else where else
converged_array = .true. converged = abs(residuum) < absoluteTolerance &
end where .or. abs(residuum/dotState) < rTol_crystalliteState
endif
converged = all(converged_array)
end function converged end function converged
@ -2116,17 +2113,17 @@ subroutine integrateStateRKCK45()
sizeDotState = plasticState(p)%sizeDotState 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)%dotState(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.&
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)%dotState(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
@ -2143,25 +2140,22 @@ subroutine integrateStateRKCK45()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief determines whether a point is converged !> @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: & use prec, only: &
dNeq0 dEq0
use numerics, only: & use numerics, only: &
rTol_crystalliteState rTol_crystalliteState
implicit none implicit none
real(pReal), dimension(:), intent(in) ::& real(pReal), intent(in) ::&
residuum, dotState, absoluteTolerance residuum, dotState, absoluteTolerance
logical, dimension(size(residuum,1)) ::&
converged_array
where(dNeq0(dotState)) if (dEq0(dotState)) then
converged_array = abs(residuum) < absoluteTolerance .or. (abs(residuum/dotState) < rTol_crystalliteState) converged = .true.
else where else
converged_array = .true. converged = abs(residuum) < absoluteTolerance &
end where .or. abs(residuum/dotState) < rTol_crystalliteState
endif
converged = all(converged_array)
end function converged end function converged