1) terminallyIll was reset before FE did cutback --> useless extra calculations of same problem over and over...

2) local stiffness calculation is now standard for non-local grains
3) stressLoopDistribution discriminates between (a) central solution and (b) stiffness perturbation
4) debugger is switched on as standard... (but verboseDebugger not!)
This commit is contained in:
Philip Eisenlohr 2010-09-06 16:06:41 +00:00
parent 00922705eb
commit a3c92061f9
3 changed files with 81 additions and 78 deletions

View File

@ -480,7 +480,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
storedConvergenceFlag storedConvergenceFlag
logical, dimension(3,3) :: mask logical, dimension(3,3) :: mask
logical forceLocalStiffnessCalculation ! flag indicating that stiffness calculation is always done locally logical forceLocalStiffnessCalculation ! flag indicating that stiffness calculation is always done locally
forceLocalStiffnessCalculation = .false. forceLocalStiffnessCalculation = .true.
! ------ initialize to starting condition ------ ! ------ initialize to starting condition ------
@ -666,7 +666,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
do g = 1,myNgrains do g = 1,myNgrains
selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g) selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g)
if (crystallite_todo(g,i,e)) then ! all undone crystallites if (crystallite_todo(g,i,e)) then ! all undone crystallites
crystallite_todo(g,i,e) = crystallite_integrateStress(g,i,e) crystallite_todo(g,i,e) = crystallite_integrateStress(1_pInt,g,i,e) ! mode: central solution
if ( .not. crystallite_localConstitution(g,i,e) & if ( .not. crystallite_localConstitution(g,i,e) &
.and. .not. crystallite_todo(g,i,e)) & ! if broken non-local... .and. .not. crystallite_todo(g,i,e)) & ! if broken non-local...
crystallite_todo = crystallite_todo .and. crystallite_localConstitution ! ...all non-locals skipped crystallite_todo = crystallite_todo .and. crystallite_localConstitution ! ...all non-locals skipped
@ -835,27 +835,26 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g) selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g)
if (crystallite_requested(g,i,e)) then ! first check whether is requested at all! if (crystallite_requested(g,i,e)) then ! first check whether is requested at all!
if (crystallite_converged(g,i,e)) then ! grain converged in above iteration if (crystallite_converged(g,i,e)) then ! grain converged in above iteration
if (verboseDebugger .and. selectiveDebugger) then if (debugger .and. selectiveDebugger) then
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write (6,*) '#############' write (6,*) '#############'
write (6,*) 'central solution of cryst_StressAndTangent' write (6,*) 'central solution of cryst_StressAndTangent'
write (6,*) '#############' write (6,*) '#############'
write (6,'(a8,3(x,i4),/,3(3(f12.4,x)/))') ' P of', g, i, e, storedP(1:3,:,g,i,e)/1e6 write (6,'(a8,3(x,i4),/,3(3(f12.4,x)/))') ' P of', g, i, e, storedP(1:3,:,g,i,e)/1e6
write (6,'(a8,3(x,i4),/,3(3(f12.8,x)/))') ' Fp of', g, i, e, storedFp(1:3,:,g,i,e) write (6,'(a8,3(x,i4),/,3(3(f14.9,x)/))') ' Fp of', g, i, e, storedFp(1:3,:,g,i,e)
write (6,'(a8,3(x,i4),/,3(3(f12.8,x)/))') ' Lp of', g, i, e, storedLp(1:3,:,g,i,e) write (6,'(a8,3(x,i4),/,3(3(f14.9,x)/))') ' Lp of', g, i, e, storedLp(1:3,:,g,i,e)
!$OMPEND CRITICAL (write2out) !$OMPEND CRITICAL (write2out)
endif endif
do perturbation = 1,2 do perturbation = 1,2 ! forward and backward perturbation
if (iand(pert_method,perturbation) > 0) then if (iand(pert_method,perturbation) > 0) then ! mask for desired direction
myPert = -pert_Fg * (-1.0_pReal)**perturbation ! forward or backward perturbation myPert = -pert_Fg * (-1.0_pReal)**perturbation ! set perturbation step
do k = 1,3 ! perturbation... do k = 1,3; do l = 1,3 ! ...alter individual components
do l = 1,3 ! ...components to the positive direction crystallite_subF(k,l,g,i,e) = crystallite_subF(k,l,g,i,e) + myPert ! perturb either forward or backward
crystallite_subF(k,l,g,i,e) = crystallite_subF(k,l,g,i,e) + myPert ! perturb single component (either forward or backward) if (debugger .and. selectiveDebugger) then
if (verboseDebugger .and. selectiveDebugger) then
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write (6,'(i1,x,i1)') k,l write (6,'(i1,x,i1)') k,l
write (6,'(a8,3(x,i4),/,3(3(f12.6,x)/))') 'pertF of', g, i, e, crystallite_subF(1:3,:,g,i,e) write (6,'(a8,3(x,i4),/,3(3(f14.9,x)/))') 'pertF of', g, i, e, crystallite_subF(1:3,:,g,i,e)
!$OMPEND CRITICAL (write2out) !$OMPEND CRITICAL (write2out)
endif endif
onTrack = .true. onTrack = .true.
@ -863,7 +862,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
NiterationState = 0_pInt NiterationState = 0_pInt
do while(.not. converged .and. onTrack .and. NiterationState < nState) ! keep cycling until done (potentially non-converged) do while(.not. converged .and. onTrack .and. NiterationState < nState) ! keep cycling until done (potentially non-converged)
NiterationState = NiterationState + 1_pInt NiterationState = NiterationState + 1_pInt
onTrack = crystallite_integrateStress(g,i,e) ! stress of perturbed situation (overwrites _P,_Tstar_v,_Fp,_Lp,_Fe) onTrack = crystallite_integrateStress(2_pInt,g,i,e) ! stress of perturbed situation (overwrites _P,_Tstar_v,_Fp,_Lp,_Fe) with mode:2
if (onTrack) then if (onTrack) then
constitutive_dotState(g,i,e)%p = 0.0_pReal constitutive_dotState(g,i,e)%p = 0.0_pReal
call constitutive_collectDotState(crystallite_Tstar_v(:,g,i,e), crystallite_subTstar0_v(:,g,i,e), & call constitutive_collectDotState(crystallite_Tstar_v(:,g,i,e), crystallite_subTstar0_v(:,g,i,e), &
@ -874,7 +873,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
temperatureConverged = crystallite_updateTemperature(g,i,e) ! update temperature temperatureConverged = crystallite_updateTemperature(g,i,e) ! update temperature
converged = stateConverged .and. temperatureConverged converged = stateConverged .and. temperatureConverged
endif endif
if (verboseDebugger .and. selectiveDebugger) then if (debugger .and. selectiveDebugger) then
!$OMP CRITICAL (write2out) !$OMP CRITICAL (write2out)
write (6,*) '-------------' write (6,*) '-------------'
write (6,'(a,x,l,x,l)') 'ontrack + converged:',onTrack,converged write (6,'(a,x,l,x,l)') 'ontrack + converged:',onTrack,converged
@ -941,7 +940,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
do g = 1,myNgrains do g = 1,myNgrains
selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g) selectiveDebugger = (e == debug_e .and. i == debug_i .and. g == debug_g)
if (crystallite_todo(g,i,e)) then if (crystallite_todo(g,i,e)) then
crystallite_todo(g,i,e) = crystallite_integrateStress(g,i,e) ! stress integration crystallite_todo(g,i,e) = crystallite_integrateStress(2_pInt,g,i,e) ! stress integration for stiffness (mode:2)
if ( .not. crystallite_localConstitution(g,i,e) & if ( .not. crystallite_localConstitution(g,i,e) &
.and. .not. crystallite_todo(g,i,e)) & ! if broken non-local... .and. .not. crystallite_todo(g,i,e)) & ! if broken non-local...
crystallite_todo = crystallite_todo .and. crystallite_localConstitution ! ...all non-locals skipped crystallite_todo = crystallite_todo .and. crystallite_localConstitution ! ...all non-locals skipped
@ -1015,6 +1014,10 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
do g = 1,myNgrains do g = 1,myNgrains
if (crystallite_converged(g,i,e)) then ! if stiffness calculation converged... if (crystallite_converged(g,i,e)) then ! if stiffness calculation converged...
crystallite_dPdF(:,:,k,l,g,i,e) = (crystallite_P(:,:,g,i,e) - storedP(:,:,g,i,e))/pert_Fg ! ... use tangent dP_ij/dFg_kl crystallite_dPdF(:,:,k,l,g,i,e) = (crystallite_P(:,:,g,i,e) - storedP(:,:,g,i,e))/pert_Fg ! ... use tangent dP_ij/dFg_kl
!$OMP CRITICAL (out)
debug_StiffnessStateLoopDistribution(NiterationState) = &
debug_StiffnessstateLoopDistribution(NiterationState) + 1
!$OMPEND CRITICAL (out)
elseif (.not. storedConvergenceFlag(g,i,e)) then ! if crystallite didnÕt converge before... elseif (.not. storedConvergenceFlag(g,i,e)) then ! if crystallite didnÕt converge before...
crystallite_dPdF(:,:,:,:,g,i,e) = crystallite_fallbackdPdF(:,:,:,:,g,i,e) ! ... use (elastic) fallback crystallite_dPdF(:,:,:,:,g,i,e) = crystallite_fallbackdPdF(:,:,:,:,g,i,e) ! ... use (elastic) fallback
endif endif
@ -1038,10 +1041,6 @@ subroutine crystallite_stressAndItsTangent(updateJaco)
crystallite_Tstar_v = storedTstar_v crystallite_Tstar_v = storedTstar_v
crystallite_P = storedP crystallite_P = storedP
!$OMP CRITICAL (out)
debug_StiffnessStateLoopDistribution(NiterationState) = debug_StiffnessstateLoopDistribution(NiterationState) + 1
!$OMPEND CRITICAL (out)
crystallite_converged = storedConvergenceFlag crystallite_converged = storedConvergenceFlag
enddo;enddo ! k,l loop enddo;enddo ! k,l loop
@ -1219,10 +1218,12 @@ endsubroutine
!*** acceleration of the Newton-Raphson correction *** !*** acceleration of the Newton-Raphson correction ***
!*********************************************************************** !***********************************************************************
function crystallite_integrateStress(& function crystallite_integrateStress(&
mode, & ! 1: central solution, 2: stiffness (by perturbation)
g,& ! grain number g,& ! grain number
i,& ! integration point number i,& ! integration point number
e) ! element number e) ! element number
!*** variables and functions from other modules ***! !*** variables and functions from other modules ***!
use prec, only: pReal, & use prec, only: pReal, &
pInt, & pInt, &
@ -1256,7 +1257,8 @@ endsubroutine
implicit none implicit none
!*** input variables ***! !*** input variables ***!
integer(pInt), intent(in):: e, & ! element index integer(pInt), intent(in):: mode, & ! 1 or 2
e, & ! element index
i, & ! integration point index i, & ! integration point index
g ! grain index g ! grain index
@ -1510,7 +1512,7 @@ LpLoop: do
endif endif
!$OMP CRITICAL (distributionStress) !$OMP CRITICAL (distributionStress)
debug_StressLoopDistribution(NiterationStress) = debug_StressLoopDistribution(NiterationStress) + 1 debug_StressLoopDistribution(NiterationStress,mode) = debug_StressLoopDistribution(NiterationStress,mode) + 1
!$OMPEND CRITICAL (distributionStress) !$OMPEND CRITICAL (distributionStress)
return return

View File

@ -5,7 +5,7 @@
use prec use prec
implicit none implicit none
integer(pInt), dimension(:), allocatable :: debug_StressLoopDistribution integer(pInt), dimension(:,:), allocatable :: debug_StressLoopDistribution
integer(pInt), dimension(:), allocatable :: debug_CrystalliteStateLoopDistribution integer(pInt), dimension(:), allocatable :: debug_CrystalliteStateLoopDistribution
integer(pInt), dimension(:), allocatable :: debug_StiffnessStateLoopDistribution integer(pInt), dimension(:), allocatable :: debug_StiffnessStateLoopDistribution
integer(pInt), dimension(:), allocatable :: debug_CrystalliteLoopDistribution integer(pInt), dimension(:), allocatable :: debug_CrystalliteLoopDistribution
@ -22,7 +22,7 @@
integer(pInt) :: debug_g = 1_pInt integer(pInt) :: debug_g = 1_pInt
logical :: selectiveDebugger = .false. logical :: selectiveDebugger = .false.
logical :: verboseDebugger = .false. logical :: verboseDebugger = .false.
logical :: debugger = .false. logical :: debugger = .true.
logical :: distribution_init = .false. logical :: distribution_init = .false.
CONTAINS CONTAINS
@ -46,7 +46,7 @@ subroutine debug_init()
write(6,*) '$Id$' write(6,*) '$Id$'
write(6,*) write(6,*)
allocate(debug_StressLoopDistribution(nStress)) ; debug_StressLoopDistribution = 0_pInt allocate(debug_StressLoopDistribution(nStress,2)) ; debug_StressLoopDistribution = 0_pInt
allocate(debug_CrystalliteStateLoopDistribution(nState)) ; debug_CrystalliteStateLoopDistribution = 0_pInt allocate(debug_CrystalliteStateLoopDistribution(nState)) ; debug_CrystalliteStateLoopDistribution = 0_pInt
allocate(debug_StiffnessStateLoopDistribution(nState)) ; debug_StiffnessStateLoopDistribution = 0_pInt allocate(debug_StiffnessStateLoopDistribution(nState)) ; debug_StiffnessStateLoopDistribution = 0_pInt
allocate(debug_CrystalliteLoopDistribution(nCryst+1)) ; debug_CrystalliteLoopDistribution = 0_pInt allocate(debug_CrystalliteLoopDistribution(nCryst+1)) ; debug_CrystalliteLoopDistribution = 0_pInt
@ -125,10 +125,12 @@ endsubroutine
do i=1,nStress do i=1,nStress
if (debug_StressLoopDistribution(i) /= 0) then if (debug_StressLoopDistribution(i) /= 0) then
integral = integral + i*debug_StressLoopDistribution(i) integral = integral + i*debug_StressLoopDistribution(i)
write(6,'(i25,x,i10)') i,debug_StressLoopDistribution(i) write(6,'(i25,x,i10,x,i10)') i,debug_StressLoopDistribution(i,1),debug_StressLoopDistribution(i,2)
endif endif
enddo enddo
write(6,'(a15,i10,x,i10)') ' total',integral,sum(debug_StressLoopDistribution) write(6,'(a15,i10,x,i10,x,i10)') ' total',integral,&
sum(debug_StressLoopDistribution(:,1)), &
sum(debug_StressLoopDistribution(:,2))
integral = 0_pInt integral = 0_pInt
write(6,*) write(6,*)

View File

@ -267,7 +267,6 @@ subroutine hypela2(&
if ( lastMode .neqv. calcMode(nn,cp_en) ) then ! first after ping pong if ( lastMode .neqv. calcMode(nn,cp_en) ) then ! first after ping pong
call debug_reset() ! resets debugging call debug_reset() ! resets debugging
outdatedFFN1 = .false. outdatedFFN1 = .false.
terminallyIll = .false.
cycleCounter = cycleCounter + 1 cycleCounter = cycleCounter + 1
endif endif
if ( outdatedByNewInc ) then if ( outdatedByNewInc ) then