changed handling of non-converged BVP solution: By default, exit if no solution is found to prevent "user errors"

Removed ambiguous "regridMode" keyword which was used to trigger this behavior in favor of  "continueCalculation", Set this to 1 to get back old behavior, e.g. report non-converged increments.
This commit is contained in:
Martin Diehl 2014-03-31 10:04:11 +00:00
parent 7b27606000
commit 84ce6e429a
3 changed files with 19 additions and 14 deletions

View File

@ -49,7 +49,7 @@ program DAMASK_spectral_Driver
use numerics, only: &
maxCutBack, &
mySpectralSolver, &
regridMode
continueCalculation
use homogenization, only: &
materialpoint_sizeResults, &
materialpoint_results
@ -505,12 +505,14 @@ program DAMASK_spectral_Driver
time = time - timeinc ! rewind time
timeIncOld = timeinc
timeinc = timeinc/2.0_pReal
elseif (solres%termIll) then ! material point model cannot find a solution
if(regridMode > 0_pInt) call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! regrid requested (mode 1 or 2)
call IO_error(850_pInt) ! no regrid (give up)
else
if(regridMode == 2_pInt) call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! regrid also if BVP solver do not converge
guess = .true. ! continue from non-converged solution and start guessing after accepted (sub)inc
elseif (solres%termIll) then ! material point model cannot find a solution, exit in any casy
call IO_warning(850_pInt)
call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written (e.g. for regridding)
elseif (continueCalculation == 1_pInt) then
guess = .true. ! accept non converged BVP solution
else ! default behavior, exit if spectral solver does not converge
call IO_warning(850_pInt)
call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written (e.g. for regridding) ! continue from non-converged solution and start guessing after accepted (sub)inc
endif
else
guess = .true. ! start guessing after first converged (sub)inc
@ -570,6 +572,7 @@ program DAMASK_spectral_Driver
real(notConvergedCounter + convergedCounter,pReal)*100.0_pReal, &
' %) increments converged!'
close(resUnit)
close(statUnit)
if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged
call quit(0_pInt) ! no complains ;)
@ -602,7 +605,7 @@ subroutine quit(stop_id)
dateAndTime(7)
if (stop_id == 0_pInt) stop 0 ! normal termination
if (stop_id < 0_pInt) then ! trigger regridding
write(0,'(a,i6)') 'restart at ', stop_id*(-1_pInt)
write(0,'(a,i6)') 'restart information available at ', stop_id*(-1_pInt)
stop 2
endif
if (stop_id == 3_pInt) stop 3 ! not all incs converged

View File

@ -1587,8 +1587,6 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg)
msg = 'not a rotation defined for loadcase rotation'
case (847_pInt)
msg = 'update of gamma operator not possible when pre-calculated'
case (850_pInt)
msg = 'max number of cut back exceeded'
case (880_pInt)
msg = 'mismatch of microstructure count and a*b*c in geom file'
case (890_pInt)
@ -1713,6 +1711,8 @@ subroutine IO_warning(warning_ID,el,ip,g,ext_msg)
msg = 'polar decomposition failed'
case (700_pInt)
msg = 'unknown crystal symmetry'
case (850_pInt)
msg = 'max number of cut back exceeded, terminating'
case default
msg = 'unknown warning number'
end select

View File

@ -90,7 +90,7 @@ module numerics
itmax = 250_pInt, & !< maximum number of iterations
itmin = 2_pInt, & !< minimum number of iterations
maxCutBack = 3_pInt, & !< max number of cut backs
regridMode = 0_pInt, & !< 0: no regrid; 1: regrid if DAMASK doesn't converge; 2: regrid if DAMASK or BVP Solver doesn't converge
continueCalculation = 0_pInt, & !< 0: exit if BVP solver does not converge, 1: continue calculation if BVP solver does not converge
divergence_correction = 2_pInt !< correct divergence calculation in fourier space 0: no correction, 1: size scaled to 1, 2: size scaled to Npoints
logical, protected, public :: &
memory_efficient = .true., & !< for fast execution (pre calculation of gamma_hat), Default .true.: do not precalculate
@ -276,8 +276,8 @@ subroutine numerics_init
itmin = IO_intValue(line,positions,2_pInt)
case ('maxcutback')
maxCutBack = IO_intValue(line,positions,2_pInt)
case ('regridmode')
regridMode = IO_intValue(line,positions,2_pInt)
case ('continuecalculation')
continueCalculation = IO_intValue(line,positions,2_pInt)
case ('memory_efficient')
memory_efficient = IO_intValue(line,positions,2_pInt) > 0_pInt
case ('fftw_timelimit')
@ -406,7 +406,7 @@ subroutine numerics_init
write(6,'(a24,1x,i8)') ' itmax: ',itmax
write(6,'(a24,1x,i8)') ' itmin: ',itmin
write(6,'(a24,1x,i8)') ' maxCutBack: ',maxCutBack
write(6,'(a24,1x,i8)') ' regridMode: ',regridMode
write(6,'(a24,1x,i8)') ' continueCalculation: ',continueCalculation
write(6,'(a24,1x,L8)') ' memory_efficient: ',memory_efficient
write(6,'(a24,1x,i8)') ' divergence_correction: ',divergence_correction
write(6,'(a24,1x,a)') ' myfilter: ',trim(myfilter)
@ -474,6 +474,8 @@ subroutine numerics_init
#ifdef Spectral
if (itmax <= 1_pInt) call IO_error(301_pInt,ext_msg='itmax')
if (itmin > itmax .or. itmin < 1_pInt) call IO_error(301_pInt,ext_msg='itmin')
if (continueCalculation /= 0_pInt .and. &
continueCalculation /= 1_pInt) call IO_error(301_pInt,ext_msg='continueCalculation')
if (divergence_correction < 0_pInt .or. &
divergence_correction > 2_pInt) call IO_error(301_pInt,ext_msg='divergence_correction')
if (maxCutBack < 0_pInt) call IO_error(301_pInt,ext_msg='maxCutBack')