checked convergence reporting for AL and BasicPETSc, seems to be ok now.

This commit is contained in:
Martin Diehl 2013-07-08 15:48:13 +00:00
parent 0fa9f7dc22
commit 4407edd802
5 changed files with 37 additions and 46 deletions

View File

@ -139,8 +139,6 @@ subroutine AL_init(temperature)
grid, & grid, &
geomSize, & geomSize, &
wgt wgt
use numerics, only: &
petsc_options
use mesh, only: & use mesh, only: &
mesh_ipCoordinates, & mesh_ipCoordinates, &
mesh_deformedCoordsFFT mesh_deformedCoordsFFT
@ -312,7 +310,7 @@ use mesh, only: &
! PETSc Data ! PETSc Data
PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_tau PetscScalar, dimension(:,:,:,:), pointer :: xx_psc, F, F_tau
PetscErrorCode :: ierr PetscErrorCode :: ierr
SNESConvergedReason ::reason SNESConvergedReason :: reason
incInfo = incInfoIn incInfo = incInfoIn
@ -331,10 +329,10 @@ use mesh, only: &
call IO_write_jobBinaryFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file call IO_write_jobBinaryFile(777,'F_lastInc',size(F_lastInc)) ! writing F_lastInc field to file
write (777,rec=1) F_lastInc write (777,rec=1) F_lastInc
close (777) close (777)
call IO_write_jobBinaryFile(777,'F_tau',size(F_tau)) ! writing deformation gradient field to file call IO_write_jobBinaryFile(777,'F_tau',size(F_tau)) ! writing deformation gradient field to file
write (777,rec=1) F_tau write (777,rec=1) F_tau
close (777) close (777)
call IO_write_jobBinaryFile(777,'F_tau_lastInc',size(F_tau_lastInc)) ! writing F_lastInc field to file call IO_write_jobBinaryFile(777,'F_tau_lastInc',size(F_tau_lastInc)) ! writing F_lastInc field to file
write (777,rec=1) F_tau_lastInc write (777,rec=1) F_tau_lastInc
close (777) close (777)
call IO_write_jobBinaryFile(777,'F_aimDot',size(F_aimDot)) call IO_write_jobBinaryFile(777,'F_aimDot',size(F_aimDot))
@ -418,7 +416,7 @@ use mesh, only: &
AL_solution%iterationsNeeded = itmax AL_solution%iterationsNeeded = itmax
else else
AL_solution%converged = .true. AL_solution%converged = .true.
AL_solution%iterationsNeeded = reportIter - 1_pInt AL_solution%iterationsNeeded = reportIter
endif endif
end function AL_solution end function AL_solution
@ -457,8 +455,6 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr)
materialpoint_dPdF materialpoint_dPdF
implicit none implicit none
integer(pInt), save :: callNo = 3_pInt
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! strange syntax in the next line because otherwise macros expand beyond 132 character limit ! strange syntax in the next line because otherwise macros expand beyond 132 character limit
DMDALocalInfo, dimension(& DMDALocalInfo, dimension(&
@ -497,11 +493,11 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! report begin of new iteration ! report begin of new iteration
if (iter == 0 .and. callNo>2) then if (iter == 0 .and. nfuncs == 0) then ! new increment
callNo = 0_pInt reportIter = -1_pInt
reportIter = 0_pInt
endif endif
if (callNo == 0 .or. mod(callNo,2) == 1_pInt) then if (reportIter <= iter) then ! new iteration
reportIter = reportIter + 1_pInt
write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), &
' @ Iteration ', itmin, '≤',reportIter, '≤', itmax ' @ Iteration ', itmin, '≤',reportIter, '≤', itmax
if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) &
@ -510,9 +506,7 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr)
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', &
math_transpose33(F_aim) math_transpose33(F_aim)
flush(6) flush(6)
reportIter = reportIter + 1_pInt
endif endif
callNo = callNo +1_pInt
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! !

View File

@ -127,9 +127,7 @@ subroutine basicPETSc_init(temperature)
Utilities_updateGamma, & Utilities_updateGamma, &
grid, & grid, &
wgt, & wgt, &
geomSize geomSize
use numerics, only: &
petsc_options
use mesh, only: & use mesh, only: &
mesh_ipCoordinates, & mesh_ipCoordinates, &
mesh_deformedCoordsFFT mesh_deformedCoordsFFT
@ -182,7 +180,7 @@ subroutine basicPETSc_init(temperature)
call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! get the data out of PETSc to work with call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! get the data out of PETSc to work with
if (restartInc == 1_pInt) then ! no deformation (no restart) if (restartInc == 1_pInt) then ! no deformation (no restart)
F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid(3)) ! initialize to identity F_lastInc = spread(spread(spread(math_I3,3,grid(1)),4,grid(2)),5,grid(3)) ! initialize to identity
F = reshape(F_lastInc,[9,grid(1),grid(2),grid(3)]) F = reshape(F_lastInc,[9,grid(1),grid(2),grid(3)])
elseif (restartInc > 1_pInt) then ! using old values from file elseif (restartInc > 1_pInt) then ! using old values from file
if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) & if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) &
@ -361,7 +359,7 @@ type(tSolutionState) function basicPETSc_solution( &
basicPETSC_solution%iterationsNeeded = itmax basicPETSC_solution%iterationsNeeded = itmax
else else
basicPETSC_solution%converged = .true. basicPETSC_solution%converged = .true.
basicPETSC_solution%iterationsNeeded = reportIter - 1_pInt basicPETSC_solution%iterationsNeeded = reportIter
endif endif
end function BasicPETSc_solution end function BasicPETSc_solution
@ -405,18 +403,17 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
nfuncs nfuncs
PetscObject :: dummy PetscObject :: dummy
PetscErrorCode :: ierr PetscErrorCode :: ierr
integer(pInt), save :: callNo = 3_pInt
call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr)
call SNESGetIterationNumber(snes,iter,ierr); CHKERRQ(ierr) call SNESGetIterationNumber(snes,iter,ierr); CHKERRQ(ierr)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! report begin of new iteration ! report begin of new iteration
if (iter == 0 .and. callNo>2) then if (iter == 0 .and. nfuncs == 0) then ! new increment
callNo = 0_pInt reportIter = -1_pInt
reportIter = 0_pInt
endif endif
if (callNo == 0 .or. mod(callNo,2) == 1_pInt) then if (reportIter <= iter) then ! new iteration
reportIter = reportIter + 1_pInt
write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), &
' @ Iteration ', itmin, '≤',reportIter, '≤', itmax ' @ Iteration ', itmin, '≤',reportIter, '≤', itmax
if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) &
@ -425,9 +422,7 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr)
write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', &
math_transpose33(F_aim) math_transpose33(F_aim)
flush(6) flush(6)
reportIter = reportIter + 1_pInt
endif endif
callNo = callNo +1_pInt
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! evaluate constitutive response ! evaluate constitutive response

View File

@ -184,8 +184,10 @@ subroutine utilities_init()
debugRotation = iand(debug_level(debug_SPECTRAL),debug_SPECTRALROTATION) /= 0 debugRotation = iand(debug_level(debug_SPECTRAL),debug_SPECTRALROTATION) /= 0
debugPETSc = iand(debug_level(debug_SPECTRAL),debug_SPECTRALPETSC) /= 0 debugPETSc = iand(debug_level(debug_SPECTRAL),debug_SPECTRALPETSC) /= 0
#ifdef PETSc #ifdef PETSc
if(debugPETSc) write(6,'(/,a)') ' Initializing PETSc with debug options: ', trim(PETScDebug), & if(debugPETSc) write(6,'(3(/,a),/)') &
' add more using the PETSc_Options keyword in numerics.config ' ' Initializing PETSc with debug options: ', &
trim(PETScDebug), &
' add more using the PETSc_Options keyword in numerics.config '
flush(6) flush(6)
call PetscOptionsClear(ierr); CHKERRQ(ierr) call PetscOptionsClear(ierr); CHKERRQ(ierr)
if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr); CHKERRQ(ierr) if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr); CHKERRQ(ierr)
@ -871,10 +873,10 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,temperature,timeinc,&
P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P
if (debugRotation) & if (debugRotation) &
write(6,'(/,a,/,3(3(2x,f12.7,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',&
math_transpose33(P_av)/1.e6_pReal math_transpose33(P_av)/1.e6_pReal
P_av = math_rotate_forward33(P_av,rotation_BC) P_av = math_rotate_forward33(P_av,rotation_BC)
write(6,'(/,a,/,3(3(2x,f12.7,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',&
math_transpose33(P_av)/1.e6_pReal math_transpose33(P_av)/1.e6_pReal
end subroutine utilities_constitutiveResponse end subroutine utilities_constitutiveResponse
@ -949,10 +951,10 @@ real(pReal) function utilities_getFilter(k)
utilities_getFilter = 1.0_pReal utilities_getFilter = 1.0_pReal
select case (myfilter) select case (myfilter)
case ('none') !< default is already nothing (1.0_pReal) case ('none') ! default, no weighting
case ('cosine') !< cosine curve with 1 for avg and zero for highest freq case ('cosine') ! cosine curve with 1 for avg and zero for highest freq
utilities_getFilter = product(1.0_pReal + cos(PI*k*scaledGeomSize/grid))/8.0_pReal utilities_getFilter = product(1.0_pReal + cos(PI*k*scaledGeomSize/grid))/8.0_pReal
case ('gradient') !< cosine curve with 1 for avg and zero for highest freq case ('gradient') ! gradient, might need grid scaling as for cosine filter
utilities_getFilter = 1.0_pReal/(1.0_pReal + & utilities_getFilter = 1.0_pReal/(1.0_pReal + &
(k(1)*k(1) + k(2)*k(2) + k(3)*k(3))) (k(1)*k(1) + k(2)*k(2) + k(3)*k(3)))
case default case default

View File

@ -1321,10 +1321,10 @@ integer(pInt) function IO_countContinuousIntValues(myUnit)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief return integer list corrsponding to items in consecutive lines. !> @brief return integer list corrsponding to items in consecutive lines.
! First integer in array is counter !! First integer in array is counter
!> @details Marc: ints concatenated by "c" as last char, range of a "to" b, or named set !> @details Marc: ints concatenated by "c" as last char, range of a "to" b, or named set
! Abaqus: triplet of start,stop,inc or named set !! Abaqus: triplet of start,stop,inc or named set
! Spectral: ints concatenated range of a "to" b, multiple entries with a "of" b !! Spectral: ints concatenated range of a "to" b, multiple entries with a "of" b
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
function IO_continuousIntValues(myUnit,maxN,lookupName,lookupMap,lookupMaxN) function IO_continuousIntValues(myUnit,maxN,lookupName,lookupMap,lookupMaxN)

View File

@ -285,13 +285,13 @@ subroutine material_parseHomogenization(myFile,myPart)
do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart
line = IO_read(myFile) line = IO_read(myFile)
enddo enddo
if (echo) write(6,'(/,a)') trim(line) ! echo part header if (echo) write(6,'(/,1x,a)') trim(line) ! echo part header
do while (trim(line) /= '#EOF#') do while (trim(line) /= '#EOF#')
line = IO_read(myFile) line = IO_read(myFile)
if (IO_isBlank(line)) cycle ! skip empty lines if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (echo) write(6,'(a)') trim(line) ! echo back read lines if (echo) write(6,'(2x,a)') trim(line) ! echo back read lines
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
homogenization_name(section) = IO_getTag(line,'[',']') homogenization_name(section) = IO_getTag(line,'[',']')
@ -371,13 +371,13 @@ subroutine material_parseMicrostructure(myFile,myPart)
do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart
line = IO_read(myFile) line = IO_read(myFile)
enddo enddo
if (echo) write(6,'(/,a)') trim(line) ! echo part header if (echo) write(6,'(/,1x,a)') trim(line) ! echo part header
do while (trim(line) /= '#EOF#') do while (trim(line) /= '#EOF#')
line = IO_read(myFile) line = IO_read(myFile)
if (IO_isBlank(line)) cycle ! skip empty lines if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (echo) write(6,'(a)') trim(line) ! echo back read lines if (echo) write(6,'(2x,a)') trim(line) ! echo back read lines
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
constituent = 0_pInt constituent = 0_pInt
@ -450,13 +450,13 @@ subroutine material_parseCrystallite(myFile,myPart)
do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart
line = IO_read(myFile) line = IO_read(myFile)
enddo enddo
if (echo) write(6,'(/,a)') trim(line) ! echo part header if (echo) write(6,'(/,1x,a)') trim(line) ! echo part header
do while (trim(line) /= '#EOF#') do while (trim(line) /= '#EOF#')
line = IO_read(myFile) line = IO_read(myFile)
if (IO_isBlank(line)) cycle ! skip empty lines if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (echo) write(6,'(a)') trim(line) ! echo back read lines if (echo) write(6,'(2x,a)') trim(line) ! echo back read lines
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
crystallite_name(section) = IO_getTag(line,'[',']') crystallite_name(section) = IO_getTag(line,'[',']')
@ -519,13 +519,13 @@ subroutine material_parsePhase(myFile,myPart)
do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart
line = IO_read(myFile) line = IO_read(myFile)
enddo enddo
if (echo) write(6,'(/,a)') trim(line) ! echo part header if (echo) write(6,'(/,1x,a)') trim(line) ! echo part header
do while (trim(line) /= '#EOF#') do while (trim(line) /= '#EOF#')
line = IO_read(myFile) line = IO_read(myFile)
if (IO_isBlank(line)) cycle ! skip empty lines if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (echo) write(6,'(a)') trim(line) ! echo back read lines if (echo) write(6,'(2x,a)') trim(line) ! echo back read lines
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
phase_name(section) = IO_getTag(line,'[',']') phase_name(section) = IO_getTag(line,'[',']')
@ -621,13 +621,13 @@ subroutine material_parseTexture(myFile,myPart)
do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart do while (trim(line) /= '#EOF#' .and. IO_lc(IO_getTag(line,'<','>')) /= myPart) ! wind forward to myPart
line = IO_read(myFile) line = IO_read(myFile)
enddo enddo
if (echo) write(6,'(/,a)') trim(line) ! echo part header if (echo) write(6,'(/,1x,a)') trim(line) ! echo part header
do while (trim(line) /= '#EOF#') do while (trim(line) /= '#EOF#')
line = IO_read(myFile) line = IO_read(myFile)
if (IO_isBlank(line)) cycle ! skip empty lines if (IO_isBlank(line)) cycle ! skip empty lines
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
if (echo) write(6,'(a)') trim(line) ! echo back read lines if (echo) write(6,'(2x,a)') trim(line) ! echo back read lines
if (IO_getTag(line,'[',']') /= '') then ! next section if (IO_getTag(line,'[',']') /= '') then ! next section
section = section + 1_pInt section = section + 1_pInt
gauss = 0_pInt gauss = 0_pInt