Merge branch '46-simplification-of-crystallite-f90-NEW5' into development

This commit is contained in:
Martin Diehl 2019-01-24 06:36:04 +01:00
commit ff5de988ee
1 changed files with 37 additions and 89 deletions

View File

@ -656,9 +656,9 @@ function crystallite_stress()
#endif #endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! integrate --- requires fully defined state array (basic + dependent state) ! integrate --- requires fully defined state array (basic + dependent state)
if (any(crystallite_todo)) call integrateState() ! TODO: unroll into proper elementloop to avoid N^2 for single point evaluation if (any(crystallite_todo)) call integrateState() ! TODO: unroll into proper elementloop to avoid N^2 for single point evaluation
where(.not. crystallite_converged .and. crystallite_subStep > subStepMinCryst) & ! do not try non-converged & fully cutbacked any further where(.not. crystallite_converged .and. crystallite_subStep > subStepMinCryst) & ! do not try non-converged but fully cutbacked any further
crystallite_todo = .true. ! TODO: again unroll this into proper elementloop to avoid N^2 for single point evaluation crystallite_todo = .true. ! TODO: again unroll this into proper elementloop to avoid N^2 for single point evaluation
NiterationCrystallite = NiterationCrystallite + 1_pInt NiterationCrystallite = NiterationCrystallite + 1_pInt
@ -1579,6 +1579,7 @@ subroutine integrateStateFPI()
g, & !< grain index in grain loop g, & !< grain index in grain loop
p, & p, &
c, & c, &
s, &
mySource, & mySource, &
mySizePlasticDotState, & ! size of dot states mySizePlasticDotState, & ! size of dot states
mySizeSourceDotState mySizeSourceDotState
@ -1600,7 +1601,6 @@ subroutine integrateStateFPI()
tempSourceState tempSourceState
logical :: & logical :: &
converged, & converged, &
NaN, &
singleRun, & ! flag indicating computation for single (g,i,e) triple singleRun, & ! flag indicating computation for single (g,i,e) triple
doneWithIntegration doneWithIntegration
@ -1617,36 +1617,8 @@ subroutine integrateStateFPI()
write(6,'(a,i8,a)') '<< CRYST >> ', count(crystallite_todo(:,:,:)),' grains todo at start of state integration' write(6,'(a,i8,a)') '<< CRYST >> ', count(crystallite_todo(:,:,:)),' grains todo at start of state integration'
#endif #endif
!--------------------------------------------------------------------------------------------------
! initialize dotState
if (.not. singleRun) then
forall(p = 1_pInt:size(plasticState))
plasticState(p)%previousDotState = 0.0_pReal
plasticState(p)%previousDotState2 = 0.0_pReal
end forall
do p = 1_pInt, size(sourceState); do mySource = 1_pInt, phase_Nsources(p)
sourceState(p)%p(mySource)%previousDotState = 0.0_pReal
sourceState(p)%p(mySource)%previousDotState2 = 0.0_pReal
enddo; enddo
else
e = eIter(1)
i = iIter(1,e)
do g = gIter(1,e), gIter(2,e)
p = phaseAt(g,i,e)
c = phasememberAt(g,i,e)
plasticState(p)%previousDotState (:,c) = 0.0_pReal
plasticState(p)%previousDotState2(:,c) = 0.0_pReal
do mySource = 1_pInt, phase_Nsources(p)
sourceState(p)%p(mySource)%previousDotState (:,c) = 0.0_pReal
sourceState(p)%p(mySource)%previousDotState2(:,c) = 0.0_pReal
enddo
enddo
endif
! --+>> PREGUESS FOR STATE <<+-- ! --+>> PREGUESS FOR STATE <<+--
! --- DOT STATES ---
call update_dotState(1.0_pReal) call update_dotState(1.0_pReal)
call update_state(1.0_pReal) call update_state(1.0_pReal)
@ -1657,27 +1629,32 @@ subroutine integrateStateFPI()
crystalliteLooping: do while (.not. doneWithIntegration .and. NiterationState < nState) crystalliteLooping: do while (.not. doneWithIntegration .and. NiterationState < nState)
NiterationState = NiterationState + 1_pInt NiterationState = NiterationState + 1_pInt
!$OMP PARALLEL ! store previousDotState and previousDotState2
!$OMP PARALLEL DO PRIVATE(p,c)
do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e))
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) then
p = phaseAt(g,i,e); c = phasememberAt(g,i,e)
! --- UPDATE DEPENDENT STATES --- plasticState(p)%previousDotState2(:,c) = merge(plasticState(p)%previousDotState(:,c),&
0.0_pReal,&
!$OMP DO PRIVATE(p,c) NiterationState > 1_pInt)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains plasticState(p)%previousDotState (:,c) = plasticState(p)%dotState(:,c)
if (crystallite_todo(g,i,e) .and. .not. crystallite_converged(g,i,e)) & do s = 1_pInt, phase_Nsources(p)
call constitutive_microstructure(crystallite_orientation, & sourceState(p)%p(s)%previousDotState2(:,c) = merge(sourceState(p)%p(s)%previousDotState(:,c),&
crystallite_Fe(1:3,1:3,g,i,e), & 0.0_pReal, &
crystallite_Fp(1:3,1:3,g,i,e), & NiterationState > 1_pInt)
g, i, e) ! update dependent state variables to be consistent with basic states sourceState(p)%p(s)%previousDotState (:,c) = sourceState(p)%p(s)%dotState(:,c)
p = phaseAt(g,i,e) enddo
c = phasememberAt(g,i,e) endif
plasticState(p)%previousDotState2(:,c) = plasticState(p)%previousDotState(:,c)
plasticState(p)%previousDotState (:,c) = plasticState(p)%dotState(:,c)
do mySource = 1_pInt, phase_Nsources(p)
sourceState(p)%p(mySource)%previousDotState2(:,c) = sourceState(p)%p(mySource)%previousDotState(:,c)
sourceState(p)%p(mySource)%previousDotState (:,c) = sourceState(p)%p(mySource)%dotState(:,c)
enddo enddo
enddo; enddo; enddo enddo
!$OMP ENDDO enddo
!$OMP END PARALLEL DO
call update_dependentState
!$OMP PARALLEL
! --- STRESS INTEGRATION --- ! --- STRESS INTEGRATION ---
@ -1912,9 +1889,6 @@ subroutine integrateStateEuler()
mesh_element, & mesh_element, &
mesh_NcpElems mesh_NcpElems
use material, only: & use material, only: &
plasticState, &
sourceState, &
phaseAt, phasememberAt, &
phase_Nsources, & phase_Nsources, &
homogenization_Ngrains homogenization_Ngrains
use constitutive, only: & use constitutive, only: &
@ -1926,19 +1900,14 @@ subroutine integrateStateEuler()
integer(pInt) :: & integer(pInt) :: &
e, & ! element index in element loop e, & ! element index in element loop
i, & ! integration point index in ip loop i, & ! integration point index in ip loop
g, & ! grain index in grain loop g ! grain index in grain loop
p, & ! phase loop
c, &
mySource, &
mySizePlasticDotState, &
mySizeSourceDotState
integer(pInt), dimension(2) :: & integer(pInt), dimension(2) :: &
eIter ! bounds for element iteration eIter ! bounds for element iteration
integer(pInt), dimension(2,mesh_NcpElems) :: & integer(pInt), dimension(2,mesh_NcpElems) :: &
iIter, & ! bounds for ip iteration iIter, & ! bounds for ip iteration
gIter ! bounds for grain iteration gIter ! bounds for grain iteration
logical :: & logical :: &
NaN, &
singleRun ! flag indicating computation for single (g,i,e) triple singleRun ! flag indicating computation for single (g,i,e) triple
@ -2158,21 +2127,10 @@ subroutine integrateStateAdaptiveEuler()
endif endif
enddo; enddo; enddo enddo; enddo; enddo
!$OMP ENDDO !$OMP ENDDO
! --- UPDATE DEPENDENT STATES (EULER INTEGRATION) ---
!$OMP DO
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains
if (crystallite_todo(g,i,e)) &
call constitutive_microstructure(crystallite_orientation, &
crystallite_Fe(1:3,1:3,g,i,e), &
crystallite_Fp(1:3,1:3,g,i,e), &
g, i, e) ! update dependent state variables to be consistent with basic states
enddo; enddo; enddo
!$OMP ENDDO
!$OMP END PARALLEL !$OMP END PARALLEL
call update_dependentState
! --- STRESS INTEGRATION (EULER INTEGRATION) --- ! --- STRESS INTEGRATION (EULER INTEGRATION) ---
@ -2191,11 +2149,9 @@ subroutine integrateStateAdaptiveEuler()
enddo; enddo; enddo enddo; enddo; enddo
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
!$OMP PARALLEL
! --- DOT STATE (HEUN METHOD) ---
!$OMP END PARALLEL
call update_dotState(1.0_pReal) call update_dotState(1.0_pReal)
!$OMP PARALLEL !$OMP PARALLEL
!$OMP DO PRIVATE(p,c,NaN) !$OMP DO PRIVATE(p,c,NaN)
do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains do e = eIter(1),eIter(2); do i = iIter(1,e),iIter(2,e); do g = gIter(1,e),gIter(2,e) ! iterate over elements, ips and grains
@ -2349,14 +2305,11 @@ subroutine integrateStateRK4()
p, & ! phase loop p, & ! phase loop
c, & c, &
n, & n, &
mySource, & mySource
mySizePlasticDotState, &
mySizeSourceDotState
integer(pInt), dimension(2) :: eIter ! bounds for element iteration integer(pInt), dimension(2) :: eIter ! bounds for element iteration
integer(pInt), dimension(2,mesh_NcpElems) :: iIter, & ! bounds for ip iteration integer(pInt), dimension(2,mesh_NcpElems) :: iIter, & ! bounds for ip iteration
gIter ! bounds for grain iteration gIter ! bounds for grain iteration
logical :: NaN, & logical :: singleRun ! flag indicating computation for single (g,i,e) triple
singleRun ! flag indicating computation for single (g,i,e) triple
eIter = FEsolving_execElem(1:2) eIter = FEsolving_execElem(1:2)
do e = eIter(1),eIter(2) do e = eIter(1),eIter(2)
@ -2567,7 +2520,6 @@ subroutine integrateStateRKCK45()
sourceStateResiduum, & ! residuum from evolution in microstructure sourceStateResiduum, & ! residuum from evolution in microstructure
relSourceStateResiduum ! relative residuum from evolution in microstructure relSourceStateResiduum ! relative residuum from evolution in microstructure
logical :: & logical :: &
NaN, &
singleRun ! flag indicating computation for single (g,i,e) triple singleRun ! flag indicating computation for single (g,i,e) triple
eIter = FEsolving_execElem(1:2) eIter = FEsolving_execElem(1:2)
@ -2850,8 +2802,6 @@ end subroutine integrateStateRKCK45
!> @brief tbd !> @brief tbd
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine update_dependentState() subroutine update_dependentState()
use material, only: &
plasticState
use constitutive, only: & use constitutive, only: &
constitutive_dependentState => constitutive_microstructure constitutive_dependentState => constitutive_microstructure
@ -2860,8 +2810,7 @@ subroutine update_dependentState()
i, & ! integration point index in ip loop i, & ! integration point index in ip loop
g ! grain index in grain loop g ! grain index in grain loop
!$OMP PARALLEL !$OMP PARALLEL DO
!$OMP DO
do e = FEsolving_execElem(1),FEsolving_execElem(2) do e = FEsolving_execElem(1),FEsolving_execElem(2)
do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e)
do g = 1,homogenization_Ngrains(mesh_element(3,e)) do g = 1,homogenization_Ngrains(mesh_element(3,e))
@ -2871,8 +2820,7 @@ subroutine update_dependentState()
crystallite_Fp(1:3,1:3,g,i,e), & crystallite_Fp(1:3,1:3,g,i,e), &
g, i, e) g, i, e)
enddo; enddo; enddo enddo; enddo; enddo
!$OMP ENDDO !$OMP END PARALLEL DO
!$OMP END PARALLEL
end subroutine update_dependentState end subroutine update_dependentState