Skip to content

Commit e6484e1

Browse files
committed
Merge branch 'mech_grid_FEM-interation-counting' into 'development'
proper iteration counting in grid FEM See merge request damask/DAMASK!989
2 parents c84c705 + ab26b43 commit e6484e1

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/grid/grid_mech_FEM.f90

+10-11
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,9 @@ function grid_mechanical_FEM_solution(incInfoIn) result(solution)
312312
PetscErrorCode :: err_PETSc
313313
SNESConvergedReason :: reason
314314

315+
315316
incInfo = incInfoIn
316317

317-
!--------------------------------------------------------------------------------------------------
318-
! update stiffness (and gamma operator)
319318
S = utilities_maskedCompliance(params%rotation_BC,params%stress_mask,C_volAvg)
320319

321320
call SNESsolve(SNES_mech,PETSC_NULL_VEC,u_PETSc,err_PETSc)
@@ -411,7 +410,7 @@ end subroutine grid_mechanical_FEM_forward
411410

412411

413412
!--------------------------------------------------------------------------------------------------
414-
!> @brief Update coordinates
413+
!> @brief Update coordinates.
415414
!--------------------------------------------------------------------------------------------------
416415
subroutine grid_mechanical_FEM_updateCoords()
417416

@@ -421,7 +420,7 @@ end subroutine grid_mechanical_FEM_updateCoords
421420

422421

423422
!--------------------------------------------------------------------------------------------------
424-
!> @brief Write current solver and constitutive data for restart to file
423+
!> @brief Write current solver and constitutive data for restart to file.
425424
!--------------------------------------------------------------------------------------------------
426425
subroutine grid_mechanical_FEM_restartWrite()
427426

@@ -486,6 +485,7 @@ subroutine converged(snes_local,PETScIter,devNull1,devNull2,fnorm,reason,dummy,e
486485
divTol, &
487486
BCTol
488487

488+
489489
err_div = fnorm*sqrt(wgt)*geomSize(1)/scaledGeomSize(1)/detJ
490490
divTol = max(maxval(abs(P_av))*num%eps_div_rtol, num%eps_div_atol)
491491
BCTol = max(maxval(abs(P_av))*num%eps_stress_rtol, num%eps_stress_atol)
@@ -512,7 +512,7 @@ end subroutine converged
512512

513513

514514
!--------------------------------------------------------------------------------------------------
515-
!> @brief forms the residual vector
515+
!> @brief Form the residual vector.
516516
!--------------------------------------------------------------------------------------------------
517517
subroutine formResidual(da_local,x_local, &
518518
f_local,dummy,err_PETSc)
@@ -524,26 +524,25 @@ subroutine formResidual(da_local,x_local, &
524524

525525
real(pREAL), pointer,dimension(:,:,:,:) :: x_scal, r
526526
real(pREAL), dimension(8,3) :: x_elem, f_elem
527-
PetscInt :: i, ii, j, jj, k, kk, ctr, ce
528-
PetscInt :: &
529-
PETScIter, &
530-
nfuncs
527+
PetscInt :: i, ii, j, jj, k, kk, ctr, ce, &
528+
PETScIter, nfuncs
531529
integer(MPI_INTEGER_KIND) :: err_MPI
532530
real(pREAL), dimension(3,3,3,3) :: devNull
533531

532+
534533
call SNESGetNumberFunctionEvals(SNES_mech,nfuncs,err_PETSc)
535534
CHKERRQ(err_PETSc)
536535
call SNESGetIterationNumber(SNES_mech,PETScIter,err_PETSc)
537536
CHKERRQ(err_PETSc)
538537

539538

540-
if (nfuncs == 0 .and. PETScIter == 0) totalIter = -1 ! new increment
539+
if (nfuncs == 0 .and. PETScIter == 0) totalIter = 0 ! new increment
541540

542541
!--------------------------------------------------------------------------------------------------
543542
! begin of new iteration
544543
newIteration: if (totalIter <= PETScIter) then
545544
totalIter = totalIter + 1
546-
print'(1x,a,3(a,i0))', trim(incInfo), ' @ Iteration ', num%itmin, '',totalIter+1, '', num%itmax
545+
print'(1x,a,3(a,i0))', trim(incInfo), ' @ Iteration ', num%itmin, '',totalIter, '', num%itmax
547546
if (any(dNeq(params%rotation_BC%asQuaternion(), real([1.0, 0.0, 0.0, 0.0],pREAL)))) &
548547
print'(/,1x,a,/,2(3(f12.7,1x)/),3(f12.7,1x))', &
549548
'deformation gradient aim (lab) =', transpose(params%rotation_BC%rotate(F_aim,active=.true.))

0 commit comments

Comments
 (0)