some more documentation, mainly on the exit codes
This commit is contained in:
parent
569ac2f2f6
commit
8f2e164fd2
|
@ -5,10 +5,15 @@
|
||||||
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!> @brief Driver controlling inner and outer load case looping of the various spectral solvers
|
!> @brief Driver controlling inner and outer load case looping of the various spectral solvers
|
||||||
|
!> @details doing cutbacking, forwarding in case of restart, reporting statistics, writing
|
||||||
|
!> results
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
program DAMASK_spectral_Driver
|
program DAMASK_spectral_Driver
|
||||||
use, intrinsic :: &
|
use, intrinsic :: &
|
||||||
iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment)
|
iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran >4.6 at the moment)
|
||||||
|
use prec, only: &
|
||||||
|
pInt, &
|
||||||
|
pReal
|
||||||
use DAMASK_interface, only: &
|
use DAMASK_interface, only: &
|
||||||
DAMASK_interface_init, &
|
DAMASK_interface_init, &
|
||||||
loadCaseFile, &
|
loadCaseFile, &
|
||||||
|
@ -16,9 +21,6 @@ program DAMASK_spectral_Driver
|
||||||
getSolverWorkingDirectoryName, &
|
getSolverWorkingDirectoryName, &
|
||||||
getSolverJobName, &
|
getSolverJobName, &
|
||||||
appendToOutFile
|
appendToOutFile
|
||||||
use prec, only: &
|
|
||||||
pInt, &
|
|
||||||
pReal
|
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_isBlank, &
|
IO_isBlank, &
|
||||||
IO_open_file, &
|
IO_open_file, &
|
||||||
|
@ -87,10 +89,10 @@ program DAMASK_spectral_Driver
|
||||||
integer(pInt), dimension(1_pInt + maxNchunks*2_pInt) :: positions ! this is longer than needed for geometry parsing
|
integer(pInt), dimension(1_pInt + maxNchunks*2_pInt) :: positions ! this is longer than needed for geometry parsing
|
||||||
|
|
||||||
integer(pInt) :: &
|
integer(pInt) :: &
|
||||||
N_l = 0_pInt, &
|
N_l = 0_pInt, & !< # of L specifiers found in load case file
|
||||||
N_t = 0_pInt, &
|
N_t = 0_pInt, & !< # of time indicators found in load case file
|
||||||
N_n = 0_pInt, &
|
N_n = 0_pInt, & !< # of increment specifiers found in load case file
|
||||||
N_Fdot = 0_pInt
|
N_Fdot = 0_pInt !< # of rate of F specifiers found in load case file
|
||||||
character(len=1024) :: &
|
character(len=1024) :: &
|
||||||
line
|
line
|
||||||
|
|
||||||
|
@ -130,9 +132,8 @@ program DAMASK_spectral_Driver
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! init DAMASK (all modules)
|
! init DAMASK (all modules)
|
||||||
call CPFEM_initAll(temperature = 300.0_pReal, element = 1_pInt, IP= 1_pInt)
|
call CPFEM_initAll(temperature = 300.0_pReal, element = 1_pInt, IP= 1_pInt)
|
||||||
write(6,'(a)') ''
|
write(6,'(/,a)') ' <<<+- DAMASK_spectral_driver init -+>>>'
|
||||||
write(6,'(a)') ' <<<+- DAMASK_spectral_driver init -+>>>'
|
write(6,'(a)') ' $Id$'
|
||||||
write(6,'(a)') ' $Id$'
|
|
||||||
#include "compilation_info.f90"
|
#include "compilation_info.f90"
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -144,16 +145,16 @@ program DAMASK_spectral_Driver
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
||||||
positions = IO_stringPos(line,maxNchunks)
|
positions = IO_stringPos(line,maxNchunks)
|
||||||
do i = 1_pInt, positions(1) ! reading compulsory parameters for loadcase
|
do i = 1_pInt, positions(1) ! reading compulsory parameters for loadcase
|
||||||
select case (IO_lc(IO_stringValue(line,positions,i)))
|
select case (IO_lc(IO_stringValue(line,positions,i)))
|
||||||
case('l','velocitygrad','velgrad','velocitygradient')
|
case('l','velocitygrad','velgrad','velocitygradient')
|
||||||
N_l = N_l + 1_pInt
|
N_l = N_l + 1_pInt
|
||||||
case('fdot','dotf')
|
case('fdot','dotf')
|
||||||
N_Fdot = N_Fdot + 1_pInt
|
N_Fdot = N_Fdot + 1_pInt
|
||||||
case('t','time','delta')
|
case('t','time','delta')
|
||||||
N_t = N_t + 1_pInt
|
N_t = N_t + 1_pInt
|
||||||
case('n','incs','increments','steps','logincs','logincrements','logsteps')
|
case('n','incs','increments','steps','logincs','logincrements','logsteps')
|
||||||
N_n = N_n + 1_pInt
|
N_n = N_n + 1_pInt
|
||||||
end select
|
end select
|
||||||
enddo ! count all identifiers to allocate memory and do sanity check
|
enddo ! count all identifiers to allocate memory and do sanity check
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
@ -212,7 +213,7 @@ program DAMASK_spectral_Driver
|
||||||
case('logincs','logincrements','logsteps') ! number of increments (switch to log time scaling)
|
case('logincs','logincrements','logsteps') ! number of increments (switch to log time scaling)
|
||||||
loadCases(currentLoadCase)%incs = IO_intValue(line,positions,i+1_pInt)
|
loadCases(currentLoadCase)%incs = IO_intValue(line,positions,i+1_pInt)
|
||||||
loadCases(currentLoadCase)%logscale = 1_pInt
|
loadCases(currentLoadCase)%logscale = 1_pInt
|
||||||
case('f','freq','frequency','outputfreq') ! frequency of result writings
|
case('freq','frequency','outputfreq') ! frequency of result writings
|
||||||
loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,positions,i+1_pInt)
|
loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,positions,i+1_pInt)
|
||||||
case('r','restart','restartwrite') ! frequency of writing restart information
|
case('r','restart','restartwrite') ! frequency of writing restart information
|
||||||
loadCases(currentLoadCase)%restartfrequency = &
|
loadCases(currentLoadCase)%restartfrequency = &
|
||||||
|
@ -345,6 +346,7 @@ program DAMASK_spectral_Driver
|
||||||
if (debugGeneral) write(6,'(/,a)') ' header of result file written out'
|
if (debugGeneral) write(6,'(/,a)') ' header of result file written out'
|
||||||
flush(6)
|
flush(6)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! loopping over loadcases
|
! loopping over loadcases
|
||||||
loadCaseLooping: do currentLoadCase = 1_pInt, size(loadCases)
|
loadCaseLooping: do currentLoadCase = 1_pInt, size(loadCases)
|
||||||
|
@ -384,11 +386,13 @@ program DAMASK_spectral_Driver
|
||||||
|
|
||||||
forwarding: if(totalIncsCounter >= restartInc) then
|
forwarding: if(totalIncsCounter >= restartInc) then
|
||||||
stepFraction = 0_pInt
|
stepFraction = 0_pInt
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! loop over sub incs
|
! loop over sub incs
|
||||||
subIncLooping: do while (stepFraction/subStepFactor**cutBackLevel <1_pInt)
|
subIncLooping: do while (stepFraction/subStepFactor**cutBackLevel <1_pInt)
|
||||||
time = time + timeinc ! forward time
|
time = time + timeinc ! forward time
|
||||||
stepFraction = stepFraction + 1_pInt
|
stepFraction = stepFraction + 1_pInt
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! report begin of new increment
|
! report begin of new increment
|
||||||
write(6,'(/,a)') ' ###########################################################################'
|
write(6,'(/,a)') ' ###########################################################################'
|
||||||
|
@ -434,6 +438,7 @@ program DAMASK_spectral_Driver
|
||||||
rotation_BC = loadCases(currentLoadCase)%rotation)
|
rotation_BC = loadCases(currentLoadCase)%rotation)
|
||||||
#endif
|
#endif
|
||||||
end select
|
end select
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! check solution
|
! check solution
|
||||||
cutBack = .False.
|
cutBack = .False.
|
||||||
|
@ -457,19 +462,19 @@ program DAMASK_spectral_Driver
|
||||||
guess = .true. ! start guessing after first converged (sub)inc
|
guess = .true. ! start guessing after first converged (sub)inc
|
||||||
endif
|
endif
|
||||||
if(guess) & ! write statistics about accepted solution
|
if(guess) & ! write statistics about accepted solution
|
||||||
write(statUnit,*) inc, time, cutBackLevel, solres%converged, solres%iterationsNeeded
|
write(statUnit,*) totalIncsCounter, time, cutBackLevel, &
|
||||||
|
solres%converged, solres%iterationsNeeded
|
||||||
enddo subIncLooping
|
enddo subIncLooping
|
||||||
cutBackLevel = max(0_pInt, cutBackLevel - 1_pInt) ! try half number of subincs next inc
|
cutBackLevel = max(0_pInt, cutBackLevel - 1_pInt) ! try half number of subincs next inc
|
||||||
if(solres%converged) then ! report converged inc
|
if(solres%converged) then ! report converged inc
|
||||||
convergedCounter = convergedCounter + 1_pInt
|
convergedCounter = convergedCounter + 1_pInt
|
||||||
write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',A)') &
|
write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') &
|
||||||
' increment ', totalIncsCounter, ' converged'
|
' increment ', totalIncsCounter, ' converged'
|
||||||
else
|
else
|
||||||
write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',A)') & ! report non-converged inc
|
write(6,'(/,a,'//IO_intOut(totalIncsCounter)//',a)') & ! report non-converged inc
|
||||||
' increment ', totalIncsCounter, ' NOT converged'
|
' increment ', totalIncsCounter, ' NOT converged'
|
||||||
notConvergedCounter = notConvergedCounter + 1_pInt
|
notConvergedCounter = notConvergedCounter + 1_pInt
|
||||||
endif
|
endif; flush(6)
|
||||||
flush(6)
|
|
||||||
|
|
||||||
if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0_pInt) then ! at output frequency
|
if (mod(inc,loadCases(currentLoadCase)%outputFrequency) == 0_pInt) then ! at output frequency
|
||||||
write(6,'(1/,a)') ' ... writing results to file ......................................'
|
write(6,'(1/,a)') ' ... writing results to file ......................................'
|
||||||
|
@ -502,7 +507,7 @@ program DAMASK_spectral_Driver
|
||||||
end select
|
end select
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! done report summary
|
! report summary of whole calculation
|
||||||
write(6,'(/,a)') ' ##################################################################'
|
write(6,'(/,a)') ' ##################################################################'
|
||||||
write(6,'(1x,i6.6,a,i6.6,a,f5.1,a)') convergedCounter, ' out of ', &
|
write(6,'(1x,i6.6,a,i6.6,a,f5.1,a)') convergedCounter, ' out of ', &
|
||||||
notConvergedCounter + convergedCounter, ' (', &
|
notConvergedCounter + convergedCounter, ' (', &
|
||||||
|
@ -515,10 +520,15 @@ program DAMASK_spectral_Driver
|
||||||
|
|
||||||
end program DAMASK_spectral_Driver
|
end program DAMASK_spectral_Driver
|
||||||
|
|
||||||
!********************************************************************
|
|
||||||
! quit subroutine to satisfy IO_error
|
!--------------------------------------------------------------------------------------------------
|
||||||
!
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
||||||
!********************************************************************
|
!> @brief quit subroutine to mimic behavior of FEM solvers
|
||||||
|
!> @details exits the Spectral solver and reports time and duration. Exit code 0 signals
|
||||||
|
!> everything went fine. Exit code 1 signals an error, message according to IO_error. Exit code
|
||||||
|
!> 2 signals request for regridding, increment of last saved restart information is written to
|
||||||
|
!> stderr. Exit code 3 signals no severe problems, but some increments did not converge
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine quit(stop_id)
|
subroutine quit(stop_id)
|
||||||
use prec, only: &
|
use prec, only: &
|
||||||
pInt
|
pInt
|
||||||
|
@ -540,6 +550,7 @@ subroutine quit(stop_id)
|
||||||
write(0,'(a,i6)') 'restart at ', stop_id*(-1_pInt)
|
write(0,'(a,i6)') 'restart at ', stop_id*(-1_pInt)
|
||||||
stop 2
|
stop 2
|
||||||
endif
|
endif
|
||||||
if (stop_id == 3_pInt) stop 3 ! not all steps converged
|
if (stop_id == 3_pInt) stop 3 ! not all incs converged
|
||||||
stop 1 ! error (message from IO_error)
|
stop 1 ! error (message from IO_error)
|
||||||
end subroutine
|
|
||||||
|
end subroutine quit
|
||||||
|
|
Loading…
Reference in New Issue