better define variables close to their usage
This commit is contained in:
parent
321c3f16a6
commit
ce2cb16921
|
@ -823,8 +823,6 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg)
|
||||||
msg = 'microstructure count mismatch'
|
msg = 'microstructure count mismatch'
|
||||||
case (846_pInt)
|
case (846_pInt)
|
||||||
msg = 'rotation for load case rotation ill-defined (R:RT != I)'
|
msg = 'rotation for load case rotation ill-defined (R:RT != I)'
|
||||||
case (847_pInt)
|
|
||||||
msg = 'update of gamma operator not possible when pre-calculated'
|
|
||||||
case (880_pInt)
|
case (880_pInt)
|
||||||
msg = 'mismatch of microstructure count and a*b*c in geom file'
|
msg = 'mismatch of microstructure count and a*b*c in geom file'
|
||||||
case (891_pInt)
|
case (891_pInt)
|
||||||
|
|
|
@ -23,6 +23,13 @@ module grid_mech_spectral_basic
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! derived types
|
! derived types
|
||||||
type(tSolutionParams), private :: params
|
type(tSolutionParams), private :: params
|
||||||
|
|
||||||
|
type, private :: tNumerics
|
||||||
|
logical :: &
|
||||||
|
update_gamma !< update gamma operator with current stiffness
|
||||||
|
end type tNumerics
|
||||||
|
|
||||||
|
type(tNumerics) :: num ! numerics parameters. Better name?
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! PETSc data
|
! PETSc data
|
||||||
|
@ -79,6 +86,8 @@ subroutine grid_mech_spectral_basic_init
|
||||||
IO_open_jobFile_binary
|
IO_open_jobFile_binary
|
||||||
use FEsolving, only: &
|
use FEsolving, only: &
|
||||||
restartInc
|
restartInc
|
||||||
|
use config, only :&
|
||||||
|
config_numerics
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
worldrank, &
|
worldrank, &
|
||||||
worldsize, &
|
worldsize, &
|
||||||
|
@ -117,6 +126,8 @@ subroutine grid_mech_spectral_basic_init
|
||||||
|
|
||||||
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity 66:31–45, 2015'
|
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity 66:31–45, 2015'
|
||||||
write(6,'(a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
write(6,'(a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
||||||
|
|
||||||
|
num%update_gamma = config_numerics%getInt('update_gamma',defaultVal=0) > 0
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! set default and user defined options for PETSc
|
! set default and user defined options for PETSc
|
||||||
|
@ -209,8 +220,6 @@ end subroutine grid_mech_spectral_basic_init
|
||||||
!> @brief solution for the basic scheme with internal iterations
|
!> @brief solution for the basic scheme with internal iterations
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function grid_mech_spectral_basic_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) result(solution)
|
function grid_mech_spectral_basic_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) result(solution)
|
||||||
use numerics, only: &
|
|
||||||
update_gamma
|
|
||||||
use spectral_utilities, only: &
|
use spectral_utilities, only: &
|
||||||
tBoundaryCondition, &
|
tBoundaryCondition, &
|
||||||
utilities_maskedCompliance, &
|
utilities_maskedCompliance, &
|
||||||
|
@ -243,7 +252,7 @@ function grid_mech_spectral_basic_solution(incInfoIn,timeinc,timeinc_old,stress_
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! update stiffness (and gamma operator)
|
! update stiffness (and gamma operator)
|
||||||
S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
||||||
if (update_gamma) call Utilities_updateGamma(C_minMaxAvg,restartWrite)
|
if (num%update_gamma) call Utilities_updateGamma(C_minMaxAvg,restartWrite)
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! set module wide available data
|
! set module wide available data
|
||||||
|
|
|
@ -22,8 +22,15 @@ module grid_mech_spectral_polarisation
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! derived types
|
! derived types
|
||||||
type(tSolutionParams), private :: params
|
type(tSolutionParams), private :: params
|
||||||
|
|
||||||
|
type, private :: tNumerics
|
||||||
|
logical :: &
|
||||||
|
update_gamma !< update gamma operator with current stiffness
|
||||||
|
end type tNumerics
|
||||||
|
|
||||||
|
type(tNumerics) :: num ! numerics parameters. Better name?
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! PETSc data
|
! PETSc data
|
||||||
DM, private :: da
|
DM, private :: da
|
||||||
|
@ -85,6 +92,8 @@ subroutine grid_mech_spectral_polarisation_init
|
||||||
IO_open_jobFile_binary
|
IO_open_jobFile_binary
|
||||||
use FEsolving, only: &
|
use FEsolving, only: &
|
||||||
restartInc
|
restartInc
|
||||||
|
use config, only :&
|
||||||
|
config_numerics
|
||||||
use numerics, only: &
|
use numerics, only: &
|
||||||
worldrank, &
|
worldrank, &
|
||||||
worldsize, &
|
worldsize, &
|
||||||
|
@ -94,9 +103,9 @@ subroutine grid_mech_spectral_polarisation_init
|
||||||
use DAMASK_interface, only: &
|
use DAMASK_interface, only: &
|
||||||
getSolverJobName
|
getSolverJobName
|
||||||
use spectral_utilities, only: &
|
use spectral_utilities, only: &
|
||||||
utilities_constitutiveResponse, &
|
utilities_constitutiveResponse, &
|
||||||
utilities_updateGamma, &
|
utilities_updateGamma, &
|
||||||
utilities_updateIPcoords, &
|
utilities_updateIPcoords, &
|
||||||
wgt
|
wgt
|
||||||
use mesh, only: &
|
use mesh, only: &
|
||||||
grid, &
|
grid, &
|
||||||
|
@ -122,6 +131,8 @@ subroutine grid_mech_spectral_polarisation_init
|
||||||
|
|
||||||
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity 66:31–45, 2015'
|
write(6,'(/,a)') ' Shanthraj et al., International Journal of Plasticity 66:31–45, 2015'
|
||||||
write(6,'(a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
write(6,'(a)') ' https://doi.org/10.1016/j.ijplas.2014.02.006'
|
||||||
|
|
||||||
|
num%update_gamma = config_numerics%getInt('update_gamma',defaultVal=0) > 0
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! set default and user defined options for PETSc
|
! set default and user defined options for PETSc
|
||||||
|
@ -226,8 +237,6 @@ end subroutine grid_mech_spectral_polarisation_init
|
||||||
!> @brief solution for the Polarisation scheme with internal iterations
|
!> @brief solution for the Polarisation scheme with internal iterations
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function grid_mech_spectral_polarisation_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) result(solution)
|
function grid_mech_spectral_polarisation_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) result(solution)
|
||||||
use numerics, only: &
|
|
||||||
update_gamma
|
|
||||||
use math, only: &
|
use math, only: &
|
||||||
math_invSym3333
|
math_invSym3333
|
||||||
use spectral_utilities, only: &
|
use spectral_utilities, only: &
|
||||||
|
@ -262,7 +271,7 @@ function grid_mech_spectral_polarisation_solution(incInfoIn,timeinc,timeinc_old,
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! update stiffness (and gamma operator)
|
! update stiffness (and gamma operator)
|
||||||
S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg)
|
||||||
if (update_gamma) then
|
if (num%update_gamma) then
|
||||||
call utilities_updateGamma(C_minMaxAvg,restartWrite)
|
call utilities_updateGamma(C_minMaxAvg,restartWrite)
|
||||||
C_scale = C_minMaxAvg
|
C_scale = C_minMaxAvg
|
||||||
S_scale = math_invSym3333(C_minMaxAvg)
|
S_scale = math_invSym3333(C_minMaxAvg)
|
||||||
|
|
|
@ -94,9 +94,8 @@ module numerics
|
||||||
&-thermal_snes_type ngmres ', &
|
&-thermal_snes_type ngmres ', &
|
||||||
petsc_options = ''
|
petsc_options = ''
|
||||||
logical, protected, public :: &
|
logical, protected, public :: &
|
||||||
continueCalculation = .false., & !< false:exit if BVP solver does not converge, true: continue calculation despite BVP solver not converging
|
continueCalculation = .false. !< false:exit if BVP solver does not converge, true: continue calculation despite BVP solver not converging
|
||||||
memory_efficient = .true., & !< for fast execution (pre calculation of gamma_hat), Default .true.: do not precalculate
|
|
||||||
update_gamma = .false. !< update gamma operator with current stiffness, Default .false.: use initial stiffness
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
@ -321,8 +320,6 @@ subroutine numerics_init
|
||||||
err_stress_tolabs = IO_floatValue(line,chunkPos,2_pInt)
|
err_stress_tolabs = IO_floatValue(line,chunkPos,2_pInt)
|
||||||
case ('continuecalculation')
|
case ('continuecalculation')
|
||||||
continueCalculation = IO_intValue(line,chunkPos,2_pInt) > 0_pInt
|
continueCalculation = IO_intValue(line,chunkPos,2_pInt) > 0_pInt
|
||||||
case ('update_gamma')
|
|
||||||
update_gamma = IO_intValue(line,chunkPos,2_pInt) > 0_pInt
|
|
||||||
case ('petsc_options')
|
case ('petsc_options')
|
||||||
petsc_options = trim(line(chunkPos(4):))
|
petsc_options = trim(line(chunkPos(4):))
|
||||||
case ('err_curl_tolabs')
|
case ('err_curl_tolabs')
|
||||||
|
@ -432,7 +429,6 @@ subroutine numerics_init
|
||||||
! spectral parameters
|
! spectral parameters
|
||||||
#ifdef Grid
|
#ifdef Grid
|
||||||
write(6,'(a24,1x,L8)') ' continueCalculation: ',continueCalculation
|
write(6,'(a24,1x,L8)') ' continueCalculation: ',continueCalculation
|
||||||
write(6,'(a24,1x,L8,/)') ' update_gamma: ',update_gamma
|
|
||||||
write(6,'(a24,1x,es8.1)') ' err_stress_tolAbs: ',err_stress_tolAbs
|
write(6,'(a24,1x,es8.1)') ' err_stress_tolAbs: ',err_stress_tolAbs
|
||||||
write(6,'(a24,1x,es8.1)') ' err_stress_tolRel: ',err_stress_tolRel
|
write(6,'(a24,1x,es8.1)') ' err_stress_tolRel: ',err_stress_tolRel
|
||||||
write(6,'(a24,1x,es8.1)') ' err_div_tolAbs: ',err_div_tolAbs
|
write(6,'(a24,1x,es8.1)') ' err_div_tolAbs: ',err_div_tolAbs
|
||||||
|
@ -506,8 +502,6 @@ subroutine numerics_init
|
||||||
if (err_damage_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_damage_tolabs')
|
if (err_damage_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_damage_tolabs')
|
||||||
if (err_damage_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_damage_tolrel')
|
if (err_damage_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_damage_tolrel')
|
||||||
#ifdef Grid
|
#ifdef Grid
|
||||||
if (update_gamma .and. &
|
|
||||||
.not. memory_efficient) call IO_error(error_ID = 847_pInt)
|
|
||||||
if (err_stress_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolRel')
|
if (err_stress_tolrel <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolRel')
|
||||||
if (err_stress_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolAbs')
|
if (err_stress_tolabs <= 0.0_pReal) call IO_error(301_pInt,ext_msg='err_stress_tolAbs')
|
||||||
if (err_div_tolRel < 0.0_pReal) call IO_error(301_pInt,ext_msg='err_div_tolRel')
|
if (err_div_tolRel < 0.0_pReal) call IO_error(301_pInt,ext_msg='err_div_tolRel')
|
||||||
|
|
|
@ -104,16 +104,16 @@ module spectral_utilities
|
||||||
real(pReal) :: timeincOld
|
real(pReal) :: timeincOld
|
||||||
end type tSolutionParams
|
end type tSolutionParams
|
||||||
|
|
||||||
type, private :: tNumerics !< scales divergence/curl calculation: 0- no correction, 1- size scaled to 1, 2- size scaled to Npoints
|
type, private :: tNumerics
|
||||||
real(pReal) :: &
|
real(pReal) :: &
|
||||||
FFTW_timelimit !< timelimit for FFTW plan creation, see www.fftw.org
|
FFTW_timelimit !< timelimit for FFTW plan creation, see www.fftw.org
|
||||||
integer :: &
|
integer :: &
|
||||||
divergence_correction
|
divergence_correction !< scale divergence/curl calculation: [0: no correction, 1: size scaled to 1, 2: size scaled to Npoints]
|
||||||
logical :: &
|
logical :: &
|
||||||
memory_efficient
|
memory_efficient !< calculate gamma operator on the fly
|
||||||
character(len=pStringLen) :: &
|
character(len=pStringLen) :: &
|
||||||
spectral_derivative, &
|
spectral_derivative, & !< approximation used for derivatives in Fourier space
|
||||||
FFTW_plan_mode, &
|
FFTW_plan_mode, & !< FFTW plan mode, see www.fftw.org
|
||||||
PETSc_defaultOptions, &
|
PETSc_defaultOptions, &
|
||||||
PETSc_options
|
PETSc_options
|
||||||
end type tNumerics
|
end type tNumerics
|
||||||
|
@ -405,13 +405,13 @@ subroutine utilities_init
|
||||||
end subroutine utilities_init
|
end subroutine utilities_init
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
!> @brief updates reference stiffness and potentially precalculated gamma operator
|
!> @brief updates reference stiffness and potentially precalculated gamma operator
|
||||||
!> @details Sets the current reference stiffness to the stiffness given as an argument.
|
!> @details Sets the current reference stiffness to the stiffness given as an argument.
|
||||||
!> If the gamma operator is precalculated, it is calculated with this stiffness.
|
!> If the gamma operator is precalculated, it is calculated with this stiffness.
|
||||||
!> In case of an on-the-fly calculation, only the reference stiffness is updated.
|
!> In case of an on-the-fly calculation, only the reference stiffness is updated.
|
||||||
!> Also writes out the current reference stiffness for restart.
|
!> Also writes out the current reference stiffness for restart.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!---------------------------------------------------------------------------------------------------
|
||||||
subroutine utilities_updateGamma(C,saveReference)
|
subroutine utilities_updateGamma(C,saveReference)
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_open_jobFile_binary
|
IO_open_jobFile_binary
|
||||||
|
|
Loading…
Reference in New Issue