no need for two variables

only resulted in confusing code
This commit is contained in:
Martin Diehl 2019-01-29 05:39:01 +01:00
parent a24d8b86bf
commit 41832fb554
1 changed files with 33 additions and 34 deletions

View File

@ -1565,8 +1565,7 @@ subroutine integrateStateFPI()
p, & p, &
c, & c, &
s, & s, &
mySizePlasticDotState, & ! size of dot states sizeDotState
mySizeSourceDotState
real(pReal) :: & real(pReal) :: &
stateDamper stateDamper
real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: & real(pReal), dimension(constitutive_plasticity_maxSizeDotState) :: &
@ -1618,7 +1617,7 @@ subroutine integrateStateFPI()
!$OMP PARALLEL !$OMP PARALLEL
! --- UPDATE STATE --- ! --- UPDATE STATE ---
!$OMP DO PRIVATE(mySizePlasticDotState,mySizeSourceDotState, & !$OMP DO PRIVATE(sizeDotState, &
!$OMP& plasticStateResiduum,sourceStateResiduum, & !$OMP& plasticStateResiduum,sourceStateResiduum, &
!$OMP& stateDamper, & !$OMP& stateDamper, &
!$OMP& tempPlasticState,tempSourceState,converged,p,c) !$OMP& tempPlasticState,tempSourceState,converged,p,c)
@ -1633,18 +1632,18 @@ subroutine integrateStateFPI()
plasticState(p)%previousDotState (:,c), & plasticState(p)%previousDotState (:,c), &
plasticState(p)%previousDotState2(:,c)) plasticState(p)%previousDotState2(:,c))
mySizePlasticDotState = plasticState(p)%sizeDotState sizeDotState = plasticState(p)%sizeDotState
plasticStateResiduum(1:mySizePlasticDotState) = & plasticStateResiduum(1:sizeDotState) = &
plasticState(p)%state(1:mySizePlasticDotState,c) & plasticState(p)%state(1:sizeDotState,c) &
- plasticState(p)%subState0(1:mySizePlasticDotState,c) & - plasticState(p)%subState0(1:sizeDotState,c) &
- ( plasticState(p)%dotState(1:mySizePlasticDotState,c) * stateDamper & - ( plasticState(p)%dotState(1:sizeDotState,c) * stateDamper &
+ plasticState(p)%previousDotState(1:mySizePlasticDotState,c) & + plasticState(p)%previousDotState(1:sizeDotState,c) &
* (1.0_pReal - stateDamper)) * crystallite_subdt(g,i,e) * (1.0_pReal - stateDamper)) * crystallite_subdt(g,i,e)
! --- correct state with residuum --- ! --- correct state with residuum ---
tempPlasticState(1:mySizePlasticDotState) = & tempPlasticState(1:sizeDotState) = &
plasticState(p)%state(1:mySizePlasticDotState,c) & plasticState(p)%state(1:sizeDotState,c) &
- plasticStateResiduum(1:mySizePlasticDotState) ! need to copy to local variable, since we cant flush a pointer in openmp - plasticStateResiduum(1:sizeDotState) ! need to copy to local variable, since we cant flush a pointer in openmp
! --- store corrected dotState --- (cannot do this before state update, because not sure how to flush pointers in openmp) ! --- store corrected dotState --- (cannot do this before state update, because not sure how to flush pointers in openmp)
@ -1652,29 +1651,29 @@ subroutine integrateStateFPI()
+ plasticState(p)%previousDotState(:,c) & + plasticState(p)%previousDotState(:,c) &
* (1.0_pReal - stateDamper) * (1.0_pReal - stateDamper)
converged = all( abs(plasticStateResiduum(1:mySizePlasticDotState)) < & converged = all( abs(plasticStateResiduum(1:sizeDotState)) < &
plasticState(p)%aTolState(1:mySizePlasticDotState) & plasticState(p)%aTolState(1:sizeDotState) &
.or. abs(plasticStateResiduum(1:mySizePlasticDotState)) < & .or. abs(plasticStateResiduum(1:sizeDotState)) < &
rTol_crystalliteState * abs(tempPlasticState(1:mySizePlasticDotState))) rTol_crystalliteState * abs(tempPlasticState(1:sizeDotState)))
plasticState(p)%state(1:mySizePlasticDotState,c) = tempPlasticState(1:mySizePlasticDotState) plasticState(p)%state(1:sizeDotState,c) = tempPlasticState(1:sizeDotState)
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
StateDamper = damper(sourceState(p)%p(s)%dotState (:,c), & StateDamper = damper(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)%previousDotState2(:,c))
mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState sizeDotState = sourceState(p)%p(s)%sizeDotState
sourceStateResiduum(1:mySizeSourceDotState,s) = & sourceStateResiduum(1:sizeDotState,s) = &
sourceState(p)%p(s)%state(1:mySizeSourceDotState,c) & sourceState(p)%p(s)%state(1:sizeDotState,c) &
- sourceState(p)%p(s)%subState0(1:mySizeSourceDotState,c) & - sourceState(p)%p(s)%subState0(1:sizeDotState,c) &
- ( sourceState(p)%p(s)%dotState(1:mySizeSourceDotState,c) * stateDamper & - ( sourceState(p)%p(s)%dotState(1:sizeDotState,c) * stateDamper &
+ sourceState(p)%p(s)%previousDotState(1:mySizeSourceDotState,c) & + sourceState(p)%p(s)%previousDotState(1:sizeDotState,c) &
* (1.0_pReal - stateDamper)) * crystallite_subdt(g,i,e) * (1.0_pReal - stateDamper)) * crystallite_subdt(g,i,e)
! --- correct state with residuum --- ! --- correct state with residuum ---
tempSourceState(1:mySizeSourceDotState,s) = & tempSourceState(1:sizeDotState,s) = &
sourceState(p)%p(s)%state(1:mySizeSourceDotState,c) & sourceState(p)%p(s)%state(1:sizeDotState,c) &
- sourceStateResiduum(1:mySizeSourceDotState,s) ! need to copy to local variable, since we cant flush a pointer in openmp - sourceStateResiduum(1:sizeDotState,s) ! need to copy to local variable, since we cant flush a pointer in openmp
! --- store corrected dotState --- (cannot do this before state update, because not sure how to flush pointers in openmp) ! --- store corrected dotState --- (cannot do this before state update, because not sure how to flush pointers in openmp)
sourceState(p)%p(s)%dotState(:,c) = & sourceState(p)%p(s)%dotState(:,c) = &
@ -1684,20 +1683,20 @@ subroutine integrateStateFPI()
enddo enddo
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState sizeDotState = sourceState(p)%p(s)%sizeDotState
converged = converged .and. & converged = converged .and. &
all( abs(sourceStateResiduum(1:mySizeSourceDotState,s)) < & all( abs(sourceStateResiduum(1:sizeDotState,s)) < &
sourceState(p)%p(s)%aTolState(1:mySizeSourceDotState) & sourceState(p)%p(s)%aTolState(1:sizeDotState) &
.or. abs(sourceStateResiduum(1:mySizeSourceDotState,s)) < & .or. abs(sourceStateResiduum(1:sizeDotState,s)) < &
rTol_crystalliteState * abs(tempSourceState(1:mySizeSourceDotState,s))) rTol_crystalliteState * abs(tempSourceState(1:sizeDotState,s)))
enddo enddo
if (converged) crystallite_converged(g,i,e) = .true. ! ... converged per definition if (converged) crystallite_converged(g,i,e) = .true. ! ... converged per definition
do s = 1_pInt, phase_Nsources(p) do s = 1_pInt, phase_Nsources(p)
mySizeSourceDotState = sourceState(p)%p(s)%sizeDotState sizeDotState = sourceState(p)%p(s)%sizeDotState
sourceState(p)%p(s)%state(1:mySizeSourceDotState,c) = & sourceState(p)%p(s)%state(1:sizeDotState,c) = &
tempSourceState(1:mySizeSourceDotState,s) tempSourceState(1:sizeDotState,s)
enddo enddo
endif endif
enddo; enddo; enddo enddo; enddo; enddo