consistency

This commit is contained in:
Sharan 2023-07-16 22:43:10 +02:00
parent 45dd387527
commit a1f797de3e
4 changed files with 29 additions and 17 deletions

View File

@ -142,9 +142,9 @@ subroutine grid_mechanical_FEM_init(num_grid)
num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100) num%itmax = num_grid_mech%get_asInt('N_iter_max',defaultVal=100)
if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)'
if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)'
if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P'
if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P'
if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max'
if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min'

View File

@ -138,8 +138,7 @@ subroutine grid_mechanical_spectral_basic_init(num_grid)
num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1) num%itmin = num_grid_mech%get_asInt ('N_iter_min',defaultVal=1)
num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100)
num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.)
num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.)
num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal)
num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal)
@ -147,9 +146,9 @@ subroutine grid_mechanical_spectral_basic_init(num_grid)
num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal) num%eps_stress_rtol = num_grid_mech%get_asReal('eps_rel_P', defaultVal=1.0e-3_pReal)
if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)'
if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)'
if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P'
if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P'
if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max'
if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min'

View File

@ -147,8 +147,7 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid)
num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict) num_grid_fft => num_grid%get_dict('FFT',defaultVal=emptyDict)
num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict) num_grid_mech => num_grid%get_dict('mechanical',defaultVal=emptyDict)
num%update_gamma = num_grid_fft%get_asBool ('update_gamma',defaultVal=.false.) num%update_gamma = num_grid_mech%get_asBool ('update_gamma',defaultVal=.false.)
num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal) num%eps_div_atol = num_grid_mech%get_asReal('eps_abs_div(P)', defaultVal=1.0e-4_pReal)
num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal) num%eps_div_rtol = num_grid_mech%get_asReal('eps_rel_div(P)', defaultVal=5.0e-4_pReal)
num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pReal) num%eps_curl_atol = num_grid_mech%get_asReal('eps_abs_curl(F)',defaultVal=1.0e-10_pReal)
@ -162,11 +161,11 @@ subroutine grid_mechanical_spectral_polarization_init(num_grid)
num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100) num%itmax = num_grid_mech%get_asInt ('N_iter_max',defaultVal=100)
if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)' if (num%eps_div_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_div(P)'
if (num%eps_div_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)' if (num%eps_div_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_div(P)'
if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)' if (num%eps_curl_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_curl(F)'
if (num%eps_curl_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)' if (num%eps_curl_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_curl(F)'
if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P' if (num%eps_stress_atol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_abs_P'
if (num%eps_stress_rtol < 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P' if (num%eps_stress_rtol <= 0.0_pReal) extmsg = trim(extmsg)//' eps_rel_P'
if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max' if (num%itmax < 1) extmsg = trim(extmsg)//' N_iter_max'
if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min' if (num%itmin > num%itmax .or. num%itmin < 1) extmsg = trim(extmsg)//' N_iter_min'
if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha' if (num%alpha <= 0.0_pReal .or. num%alpha > 2.0_pReal) extmsg = trim(extmsg)//' alpha'

View File

@ -100,12 +100,18 @@ module spectral_utilities
enum, bind(c); enumerator :: & enum, bind(c); enumerator :: &
DERIVATIVE_CONTINUOUS_ID, & DERIVATIVE_CONTINUOUS_ID, &
DERIVATIVE_CENTRAL_DIFF_ID, & DERIVATIVE_CENTRAL_DIFF_ID, &
DERIVATIVE_FWBW_DIFF_ID DERIVATIVE_FWBW_DIFF_ID, &
DIVERGENCE_CORRECTION_NONE_ID, &
DIVERGENCE_CORRECTION_SIZE_ID, &
DIVERGENCE_CORRECTION_SIZE_GRID_ID
end enum end enum
integer(kind(DERIVATIVE_CONTINUOUS_ID)) :: & integer(kind(DERIVATIVE_CONTINUOUS_ID)) :: &
spectral_derivative_ID spectral_derivative_ID
integer(kind(DIVERGENCE_CORRECTION_NONE_ID)) :: &
divergence_correction_ID
public :: & public :: &
spectral_utilities_init, & spectral_utilities_init, &
utilities_updateGamma, & utilities_updateGamma, &
@ -178,10 +184,18 @@ subroutine spectral_utilities_init()
wgt = real(product(cells),pREAL)**(-1) wgt = real(product(cells),pREAL)**(-1)
num%memory_efficient = num_grid_fft%get_asBool('memory_efficient', defaultVal=.true.) num%memory_efficient = num_grid_fft%get_asBool('memory_efficient', defaultVal=.true.)
num%divergence_correction = num_grid_fft%get_asInt('divergence_correction', defaultVal=2)
if (num%divergence_correction < 0 .or. num%divergence_correction > 2) & select case (num_grid_fft%get_asStr('divergence_correction',defaultVal='grid+size'))
call IO_error(301,ext_msg='divergence_correction') case ('none')
divergence_correction_ID = DIVERGENCE_CORRECTION_NONE_ID
case ('size')
divergence_correction_ID = DIVERGENCE_CORRECTION_SIZE_ID
case ('grid+size', 'size+grid')
divergence_correction_ID = DIVERGENCE_CORRECTION_SIZE_GRID_ID
case default
call IO_error(301,ext_msg=trim(num_grid_fft%get_asStr('divergence_correction')))
end select
select case (num_grid_fft%get_asStr('derivative',defaultVal='continuous')) select case (num_grid_fft%get_asStr('derivative',defaultVal='continuous'))
case ('continuous') case ('continuous')
@ -197,12 +211,12 @@ subroutine spectral_utilities_init()
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! scale dimension to calculate either uncorrected, dimension-independent, or dimension- and ! scale dimension to calculate either uncorrected, dimension-independent, or dimension- and
! resolution-independent divergence ! resolution-independent divergence
if (num%divergence_correction == 1) then if (divergence_correction_ID == DIVERGENCE_CORRECTION_NONE_ID) then
do j = 1, 3 do j = 1, 3
if (j /= minloc(geomSize,1) .and. j /= maxloc(geomSize,1)) & if (j /= minloc(geomSize,1) .and. j /= maxloc(geomSize,1)) &
scaledGeomSize = geomSize/geomSize(j) scaledGeomSize = geomSize/geomSize(j)
end do end do
elseif (num%divergence_correction == 2) then elseif (divergence_correction_ID == DIVERGENCE_CORRECTION_SIZE_GRID_ID) then
do j = 1, 3 do j = 1, 3
if ( j /= int(minloc(geomSize/real(cells,pREAL),1)) & if ( j /= int(minloc(geomSize/real(cells,pREAL),1)) &
.and. j /= int(maxloc(geomSize/real(cells,pREAL),1))) & .and. j /= int(maxloc(geomSize/real(cells,pREAL),1))) &