only needed per point

This commit is contained in:
Martin Diehl 2020-12-23 17:14:26 +01:00
parent ea25b22f13
commit 895cad6506
1 changed files with 34 additions and 36 deletions

View File

@ -152,31 +152,29 @@ subroutine materialpoint_stressAndItsTangent(dt)
NiterationMPstate, & NiterationMPstate, &
ip, & !< integration point number ip, & !< integration point number
el, & !< element number el, & !< element number
myNgrains, co myNgrains, co, ce
real(pReal), dimension(discretization_nIPs,discretization_Nelems) :: & real(pReal) :: &
subFrac, & subFrac, &
subStep subStep
logical, dimension(discretization_nIPs,discretization_Nelems) :: & logical :: &
requested, & requested, &
converged converged
logical, dimension(2,discretization_nIPs,discretization_Nelems) :: & logical, dimension(2) :: &
doneAndHappy doneAndHappy
integer :: ce
!$OMP PARALLEL DO PRIVATE(ce,myNgrains,NiterationMPstate,NiterationHomog,subFrac,converged,subStep,requested,doneAndHappy)
!$OMP PARALLEL DO PRIVATE(ce,myNgrains,NiterationMPstate,NiterationHomog)
do el = FEsolving_execElem(1),FEsolving_execElem(2) do el = FEsolving_execElem(1),FEsolving_execElem(2)
do ip = FEsolving_execIP(1),FEsolving_execIP(2); do ip = FEsolving_execIP(1),FEsolving_execIP(2)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! initialize restoration points ! initialize restoration points
call constitutive_initializeRestorationPoints(ip,el) call constitutive_initializeRestorationPoints(ip,el)
subFrac(ip,el) = 0.0_pReal subFrac = 0.0_pReal
converged(ip,el) = .false. ! pretend failed step ... converged = .false. ! pretend failed step ...
subStep(ip,el) = 1.0_pReal/num%subStepSizeHomog ! ... larger then the requested calculation subStep = 1.0_pReal/num%subStepSizeHomog ! ... larger then the requested calculation
requested(ip,el) = .true. ! everybody requires calculation requested = .true. ! everybody requires calculation
if (homogState(material_homogenizationAt(el))%sizeState > 0) & if (homogState(material_homogenizationAt(el))%sizeState > 0) &
homogState(material_homogenizationAt(el))%subState0(:,material_homogenizationMemberAt(ip,el)) = & homogState(material_homogenizationAt(el))%subState0(:,material_homogenizationMemberAt(ip,el)) = &
@ -188,15 +186,15 @@ subroutine materialpoint_stressAndItsTangent(dt)
NiterationHomog = 0 NiterationHomog = 0
cutBackLooping: do while (.not. terminallyIll .and. subStep(ip,el) > num%subStepMinHomog) cutBackLooping: do while (.not. terminallyIll .and. subStep > num%subStepMinHomog)
myNgrains = homogenization_Nconstituents(material_homogenizationAt(el)) myNgrains = homogenization_Nconstituents(material_homogenizationAt(el))
if (converged(ip,el)) then if (converged) then
subFrac(ip,el) = subFrac(ip,el) + subStep(ip,el) subFrac = subFrac + subStep
subStep(ip,el) = min(1.0_pReal-subFrac(ip,el),num%stepIncreaseHomog*subStep(ip,el)) ! introduce flexibility for step increase/acceleration subStep = min(1.0_pReal-subFrac,num%stepIncreaseHomog*subStep) ! introduce flexibility for step increase/acceleration
steppingNeeded: if (subStep(ip,el) > num%subStepMinHomog) then steppingNeeded: if (subStep > num%subStepMinHomog) then
! wind forward grain starting point ! wind forward grain starting point
call constitutive_windForward(ip,el) call constitutive_windForward(ip,el)
@ -211,17 +209,17 @@ subroutine materialpoint_stressAndItsTangent(dt)
endif steppingNeeded endif steppingNeeded
else else
if ( (myNgrains == 1 .and. subStep(ip,el) <= 1.0 ) .or. & ! single grain already tried internal subStepping in crystallite if ( (myNgrains == 1 .and. subStep <= 1.0 ) .or. & ! single grain already tried internal subStepping in crystallite
num%subStepSizeHomog * subStep(ip,el) <= num%subStepMinHomog ) then ! would require too small subStep num%subStepSizeHomog * subStep <= num%subStepMinHomog ) then ! would require too small subStep
! cutback makes no sense ! cutback makes no sense
if (.not. terminallyIll) then ! so first signals terminally ill... if (.not. terminallyIll) then ! so first signals terminally ill...
print*, ' Integration point ', ip,' at element ', el, ' terminally ill' print*, ' Integration point ', ip,' at element ', el, ' terminally ill'
endif endif
terminallyIll = .true. ! ...and kills all others terminallyIll = .true. ! ...and kills all others
else ! cutback makes sense else ! cutback makes sense
subStep(ip,el) = num%subStepSizeHomog * subStep(ip,el) ! crystallite had severe trouble, so do a significant cutback subStep = num%subStepSizeHomog * subStep ! crystallite had severe trouble, so do a significant cutback
call crystallite_restore(ip,el,subStep(ip,el) < 1.0_pReal) call crystallite_restore(ip,el,subStep < 1.0_pReal)
call constitutive_restore(ip,el) call constitutive_restore(ip,el)
if(homogState(material_homogenizationAt(el))%sizeState > 0) & if(homogState(material_homogenizationAt(el))%sizeState > 0) &
@ -233,46 +231,46 @@ subroutine materialpoint_stressAndItsTangent(dt)
endif endif
endif endif
if (subStep(ip,el) > num%subStepMinHomog) then if (subStep > num%subStepMinHomog) then
requested(ip,el) = .true. requested = .true.
doneAndHappy(1:2,ip,el) = [.false.,.true.] doneAndHappy = [.false.,.true.]
endif endif
NiterationMPstate = 0 NiterationMPstate = 0
convergenceLooping: do while (.not. terminallyIll .and. requested(ip,el) & convergenceLooping: do while (.not. terminallyIll .and. requested &
.and. .not. doneAndHappy(1,ip,el) & .and. .not. doneAndHappy(1) &
.and. NiterationMPstate < num%nMPstate) .and. NiterationMPstate < num%nMPstate)
NiterationMPstate = NiterationMPstate + 1 NiterationMPstate = NiterationMPstate + 1
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! deformation partitioning ! deformation partitioning
if(requested(ip,el) .and. .not. doneAndHappy(1,ip,el)) then ! requested but not yet done if(requested .and. .not. doneAndHappy(1)) then ! requested but not yet done
ce = (el-1)*discretization_nIPs + ip ce = (el-1)*discretization_nIPs + ip
call mech_partition(homogenization_F0(1:3,1:3,ce) & call mech_partition(homogenization_F0(1:3,1:3,ce) &
+ (homogenization_F(1:3,1:3,ce)-homogenization_F0(1:3,1:3,ce))& + (homogenization_F(1:3,1:3,ce)-homogenization_F0(1:3,1:3,ce))&
*(subStep(ip,el)+subFrac(ip,el)), & *(subStep+subFrac), &
ip,el) ip,el)
converged(ip,el) = .true. converged = .true.
do co = 1, myNgrains do co = 1, myNgrains
converged(ip,el) = converged(ip,el) .and. crystallite_stress(dt*subStep(ip,el),co,ip,el) converged = converged .and. crystallite_stress(dt*subStep,co,ip,el)
enddo enddo
endif endif
if (requested(ip,el) .and. .not. doneAndHappy(1,ip,el)) then if (requested .and. .not. doneAndHappy(1)) then
if (.not. converged(ip,el)) then if (.not. converged) then
doneAndHappy(1:2,ip,el) = [.true.,.false.] doneAndHappy = [.true.,.false.]
else else
ce = (el-1)*discretization_nIPs + ip ce = (el-1)*discretization_nIPs + ip
doneAndHappy(1:2,ip,el) = updateState(dt*subStep(ip,el), & doneAndHappy = updateState(dt*subStep, &
homogenization_F0(1:3,1:3,ce) & homogenization_F0(1:3,1:3,ce) &
+ (homogenization_F(1:3,1:3,ce)-homogenization_F0(1:3,1:3,ce)) & + (homogenization_F(1:3,1:3,ce)-homogenization_F0(1:3,1:3,ce)) &
*(subStep(ip,el)+subFrac(ip,el)), & *(subStep+subFrac), &
ip,el) ip,el)
converged(ip,el) = all(doneAndHappy(1:2,ip,el)) ! converged if done and happy converged = all(doneAndHappy)
endif endif
endif endif