From 0980920b66fc48c46b91da7f58b6da77b7ca408c Mon Sep 17 00:00:00 2001 From: Christoph Kords Date: Mon, 22 Oct 2012 07:59:35 +0000 Subject: [PATCH] In crystallite: for state integrators 2 and 3 the deltaState always has to be done at the beginning of the integration, not at the end; otherwise the stiffness calculation can be completely wrong, when the state is changed after the stress integration for the central solution. Also changed some debugging levels in crystallite and mainly in constitutive_nonlocal --- code/constitutive_nonlocal.f90 | 14 ++++-- code/crystallite.f90 | 83 ++++++++++++++++------------------ 2 files changed, 47 insertions(+), 50 deletions(-) diff --git a/code/constitutive_nonlocal.f90 b/code/constitutive_nonlocal.f90 index 20bdbb696..0111b57a3 100644 --- a/code/constitutive_nonlocal.f90 +++ b/code/constitutive_nonlocal.f90 @@ -1163,6 +1163,7 @@ use math, only: math_Mandel33to6, & use debug, only: debug_level, & debug_constitutive, & debug_levelBasic, & + debug_levelExtensive, & debug_levelSelective, & debug_g, & debug_i, & @@ -1437,7 +1438,7 @@ state(g,ip,el)%p(12_pInt*ns+1:13_pInt*ns) = tauBack #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt & + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & .and. ((debug_e == el .and. debug_i == ip .and. debug_g == g)& .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then write(6,*) @@ -1465,6 +1466,7 @@ use prec, only: pReal, & use debug, only: debug_level, & debug_constitutive, & debug_levelBasic, & + debug_levelExtensive, & debug_levelSelective, & debug_g, & debug_i, & @@ -1623,7 +1625,7 @@ endif #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt & + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & .and. ((debug_e == el .and. debug_i == ip .and. debug_g == g)& .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt)) then write(6,*) @@ -1655,6 +1657,7 @@ use math, only: math_Plain3333to99, & use debug, only: debug_level, & debug_constitutive, & debug_levelBasic, & + debug_levelExtensive, & debug_levelSelective, & debug_g, & debug_i, & @@ -1780,7 +1783,7 @@ dLp_dTstar99 = math_Plain3333to99(dLp_dTstar3333) #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt & + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & .and. ((debug_e == el .and. debug_i == ip .and. debug_g == g)& .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt )) then write(6,*) @@ -1806,6 +1809,7 @@ use prec, only: pReal, & use debug, only: debug_level, & debug_constitutive, & debug_levelBasic, & + debug_levelExtensive, & debug_levelSelective, & debug_g, & debug_i, & @@ -1969,7 +1973,7 @@ deltaState%p = reshape(deltaRho,(/10_pInt*ns/)) #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt & + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & .and. ((debug_e == el .and. debug_i == ip .and. debug_g == g)& .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt )) then write(6,'(a,/,8(12x,12(e12.5,1x),/))') '<< CONST >> dislocation remobilization', deltaRhoRemobilization(1:ns,1:8) @@ -2490,7 +2494,7 @@ endif #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelBasic) /= 0_pInt & + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & .and. ((debug_e == el .and. debug_i == ip .and. debug_g == g)& .or. .not. iand(debug_level(debug_constitutive),debug_levelSelective) /= 0_pInt )) then write(6,'(a,/,4(12x,12(e12.5,1x),/))') '<< CONST >> dislocation multiplication', rhoDotMultiplication(1:ns,1:4) * timestep diff --git a/code/crystallite.f90 b/code/crystallite.f90 index 9c3fa48b7..8fd2782f7 100644 --- a/code/crystallite.f90 +++ b/code/crystallite.f90 @@ -1865,6 +1865,25 @@ endif if (numerics_integrationMode < 2) then + ! --- STATE JUMP --- + + !$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) .and. crystallite_converged(g,i,e)) then ! converged and still alive... + crystallite_todo(g,i,e) = .false. ! ... integration done + crystallite_converged(g,i,e) = crystallite_stateJump(g,i,e) ! if state jump fails, then convergence is broken + if (.not. crystallite_converged(g,i,e)) then + if (.not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local... + !$OMP CRITICAL (checkTodo) + crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped + !$OMP END CRITICAL (checkTodo) + endif + endif + endif + enddo; enddo; enddo + !$OMP ENDDO + + ! --- DOT STATE AND TEMPERATURE (EULER INTEGRATION) --- stateResiduum = 0.0_pReal @@ -2043,28 +2062,6 @@ relTemperatureResiduum = 0.0_pReal endif enddo; enddo; enddo !$OMP ENDDO - - -if (numerics_integrationMode < 2) then ! in stiffness calculation mode we do not need to do the state integration again, since this is not influenced by a small perturbation in F - ! --- STATE JUMP --- - - !$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) .and. crystallite_converged(g,i,e)) then ! converged and still alive... - crystallite_todo(g,i,e) = .false. ! ... integration done - crystallite_converged(g,i,e) = crystallite_stateJump(g,i,e) ! if state jump fails, then convergence is broken - if (.not. crystallite_converged(g,i,e)) then - if (.not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local... - !$OMP CRITICAL (checkTodo) - crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped - !$OMP END CRITICAL (checkTodo) - endif - endif - endif - enddo; enddo; enddo - !$OMP ENDDO -endif - !$OMP END PARALLEL @@ -2151,6 +2148,22 @@ endif if (numerics_integrationMode < 2) then ! in stiffness calculation mode we do not need to do the state integration again, since this is not influenced by a small perturbation in F + ! --- STATE JUMP --- + + !$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)) then + crystallite_todo(g,i,e) = crystallite_stateJump(g,i,e) + if (.not. crystallite_todo(g,i,e) .and. .not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local... + !$OMP CRITICAL (checkTodo) + crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped + !$OMP END CRITICAL (checkTodo) + endif + endif + enddo; enddo; enddo + !$OMP ENDDO + + ! --- DOT STATE AND TEMPERATURE --- !$OMP DO @@ -2238,24 +2251,6 @@ endif !$OMP ENDDO -if (numerics_integrationMode < 2) then ! in stiffness calculation mode we do not need to do the state integration again, since this is not influenced by a small perturbation in F - ! --- STATE JUMP --- - - !$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)) then - crystallite_todo(g,i,e) = crystallite_stateJump(g,i,e) - if (.not. crystallite_todo(g,i,e) .and. .not. crystallite_localPlasticity(g,i,e)) then ! if broken non-local... - !$OMP CRITICAL (checkTodo) - crystallite_todo = crystallite_todo .and. crystallite_localPlasticity ! ...all non-locals skipped - !$OMP END CRITICAL (checkTodo) - endif - endif - enddo; enddo; enddo - !$OMP ENDDO -endif - - ! --- SET CONVERGENCE FLAG --- !$OMP DO @@ -2923,10 +2918,9 @@ LpLoop: do endif #ifndef _OPENMP - if (iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt & + if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & .and. ((e == debug_e .and. i == debug_i .and. g == debug_g) & - .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt) & - .and. numerics_integrationMode == 1_pInt) then + .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then write(6,'(a,i3)') '<< CRYST >> iteration ', NiterationStress write(6,*) write(6,'(a,/,3(12x,3(e20.7,1x)/))') '<< CRYST >> Lp_constitutive', math_transpose33(Lp_constitutive) @@ -3120,8 +3114,7 @@ crystallite_integrateStress = .true. #ifndef _OPENMP if (iand(debug_level(debug_crystallite),debug_levelExtensive) /= 0_pInt & .and. ((e == debug_e .and. i == debug_i .and. g == debug_g) & - .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt) & - .and. numerics_integrationMode == 1_pInt) then + .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then write(6,'(a,/,3(12x,3(f12.7,1x)/))') '<< CRYST >> P / MPa',math_transpose33(crystallite_P(1:3,1:3,g,i,e))/1.0e6_pReal write(6,'(a,/,3(12x,3(f12.7,1x)/))') '<< CRYST >> Cauchy / MPa', & math_mul33x33(crystallite_P(1:3,1:3,g,i,e), math_transpose33(Fg_new)) / 1.0e6_pReal / math_det33(Fg_new)