avoid code duplication

This commit is contained in:
Martin Diehl 2019-01-29 00:46:57 +01:00
parent 2cf44f4060
commit ee586dfa0c
1 changed files with 7 additions and 40 deletions

View File

@ -1568,8 +1568,6 @@ subroutine integrateStateFPI()
mySizePlasticDotState, & ! size of dot states mySizePlasticDotState, & ! size of dot states
mySizeSourceDotState mySizeSourceDotState
real(pReal) :: & real(pReal) :: &
dot_prod12, &
dot_prod22, &
stateDamper stateDamper
real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: & real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: &
plasticStateResiduum, & plasticStateResiduum, &
@ -1620,8 +1618,7 @@ subroutine integrateStateFPI()
!$OMP PARALLEL !$OMP PARALLEL
! --- UPDATE STATE --- ! --- UPDATE STATE ---
!$OMP DO PRIVATE(dot_prod12,dot_prod22, & !$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState, &
!$OMP& mySizePlasticDotState,mySizeSourceDotState, &
!$OMP& plasticStateResiduum,sourceStateResiduum, & !$OMP& plasticStateResiduum,sourceStateResiduum, &
!$OMP& stateDamper, & !$OMP& stateDamper, &
!$OMP& tempPlasticState,tempSourceState,converged,p,c) !$OMP& tempPlasticState,tempSourceState,converged,p,c)
@ -1632,23 +1629,9 @@ subroutine integrateStateFPI()
p = phaseAt(g,i,e) p = phaseAt(g,i,e)
c = phasememberAt(g,i,e) c = phasememberAt(g,i,e)
dot_prod12 = dot_product( plasticState(p)%dotState (:,c) & StateDamper = damper(plasticState(p)%dotState (:,c), &
- plasticState(p)%previousDotState (:,c), & plasticState(p)%previousDotState (:,c), &
plasticState(p)%previousDotState (:,c) & plasticState(p)%previousDotState2(:,c))
- plasticState(p)%previousDotState2(:,c))
dot_prod22 = dot_product( plasticState(p)%previousDotState (:,c) &
- plasticState(p)%previousDotState2(:,c), &
plasticState(p)%previousDotState (:,c) &
- plasticState(p)%previousDotState2(:,c))
if ( dot_prod22 > 0.0_pReal &
.and. ( dot_prod12 < 0.0_pReal &
.or. dot_product(plasticState(p)%dotState(:,c), &
plasticState(p)%previousDotState(:,c)) < 0.0_pReal) ) then
stateDamper = 0.75_pReal + 0.25_pReal * tanh(2.0_pReal + 4.0_pReal * dot_prod12 / dot_prod22)
else
stateDamper = 1.0_pReal
endif
! --- get residui ---
mySizePlasticDotState = plasticState(p)%sizeDotState mySizePlasticDotState = plasticState(p)%sizeDotState
plasticStateResiduum(1:mySizePlasticDotState) = & plasticStateResiduum(1:mySizePlasticDotState) = &
@ -1670,25 +1653,9 @@ subroutine integrateStateFPI()
* (1.0_pReal - stateDamper) * (1.0_pReal - stateDamper)
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState StateDamper = damper(sourceState(p)%p(s)%dotState (:,c), &
dot_prod12 = dot_product( sourceState(p)%p(s)%dotState (:,c) & sourceState(p)%p(s)%previousDotState (:,c), &
- sourceState(p)%p(s)%previousDotState (:,c), & sourceState(p)%p(s)%previousDotState2(:,c))
sourceState(p)%p(s)%previousDotState (:,c) &
- sourceState(p)%p(s)%previousDotState2(:,c))
dot_prod22 = dot_product( sourceState(p)%p(s)%previousDotState (:,c) &
- sourceState(p)%p(s)%previousDotState2(:,c), &
sourceState(p)%p(s)%previousDotState (:,c) &
- sourceState(p)%p(s)%previousDotState2(:,c))
if ( dot_prod22 > 0.0_pReal &
.and. ( dot_prod12 < 0.0_pReal &
.or. dot_product(sourceState(p)%p(s)%dotState(:,c), &
sourceState(p)%p(s)%previousDotState(:,c)) < 0.0_pReal) ) then
stateDamper = 0.75_pReal + 0.25_pReal * tanh(2.0_pReal + 4.0_pReal * dot_prod12 / dot_prod22)
else
stateDamper = 1.0_pReal
endif
! --- get residui ---
mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState
sourceStateResiduum(1:mySizeSourceDotState,s) = & sourceStateResiduum(1:mySizeSourceDotState,s) = &
sourceState(p)%p(s)%state(1:mySizeSourceDotState,c) & sourceState(p)%p(s)%state(1:mySizeSourceDotState,c) &