remove global variables

This commit is contained in:
Martin Diehl 2019-03-23 06:52:26 +01:00
parent 798c5bb633
commit 593fa24bad
3 changed files with 16 additions and 11 deletions

View File

@ -31,6 +31,8 @@ program DAMASK_spectral
IO_lc, & IO_lc, &
IO_intOut, & IO_intOut, &
IO_warning IO_warning
use config, only: &
config_numerics
use debug, only: & use debug, only: &
debug_level, & debug_level, &
debug_spectral, & debug_spectral, &
@ -50,7 +52,6 @@ program DAMASK_spectral
worldsize, & worldsize, &
stagItMax, & stagItMax, &
maxCutBack, & maxCutBack, &
spectral_solver, &
continueCalculation continueCalculation
use homogenization, only: & use homogenization, only: &
materialpoint_sizeResults, & materialpoint_sizeResults, &
@ -73,6 +74,7 @@ program DAMASK_spectral
FIELD_DAMAGE_ID FIELD_DAMAGE_ID
use grid_mech_spectral_basic use grid_mech_spectral_basic
use grid_mech_spectral_polarisation use grid_mech_spectral_polarisation
use grid_mech_FEM
use grid_damage_spectral use grid_damage_spectral
use grid_thermal_spectral use grid_thermal_spectral
use results use results
@ -165,21 +167,28 @@ program DAMASK_spectral
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! assign mechanics solver depending on selected type ! assign mechanics solver depending on selected type
select case (spectral_solver) select case (trim(config_numerics%getString('spectral_solver',defaultVal='basic')))
case (GRID_MECH_SPECTRAL_BASIC_LABEL) case ('basic')
mech_init => grid_mech_spectral_basic_init mech_init => grid_mech_spectral_basic_init
mech_forward => grid_mech_spectral_basic_forward mech_forward => grid_mech_spectral_basic_forward
mech_solution => grid_mech_spectral_basic_solution mech_solution => grid_mech_spectral_basic_solution
case (GRID_MECH_SPECTRAL_POLARISATION_LABEL) case ('polarisation')
if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) & if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) &
call IO_warning(42_pInt, ext_msg='debug Divergence') call IO_warning(42_pInt, ext_msg='debug Divergence')
mech_init => grid_mech_spectral_polarisation_init mech_init => grid_mech_spectral_polarisation_init
mech_forward => grid_mech_spectral_polarisation_forward mech_forward => grid_mech_spectral_polarisation_forward
mech_solution => grid_mech_spectral_polarisation_solution mech_solution => grid_mech_spectral_polarisation_solution
case ('fem')
if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) &
call IO_warning(42_pInt, ext_msg='debug Divergence')
mech_init => grid_mech_FEM_init
mech_forward => grid_mech_FEM_forward
mech_solution => grid_mech_FEM_solution
case default case default
call IO_error(error_ID = 891_pInt, ext_msg = trim(spectral_solver)) call IO_error(error_ID = 891_pInt, ext_msg = config_numerics%getString('spectral_solver'))
end select end select

View File

@ -608,7 +608,7 @@ character(len=65536) function getString(this,key,defaultVal,raw)
implicit none implicit none
class(tPartitionedStringList), target, intent(in) :: this class(tPartitionedStringList), target, intent(in) :: this
character(len=*), intent(in) :: key character(len=*), intent(in) :: key
character(len=65536), intent(in), optional :: defaultVal character(len=*), intent(in), optional :: defaultVal
logical, intent(in), optional :: raw logical, intent(in), optional :: raw
type(tPartitionedStringList), pointer :: item type(tPartitionedStringList), pointer :: item
logical :: found, & logical :: found, &
@ -622,7 +622,7 @@ character(len=65536) function getString(this,key,defaultVal,raw)
found = present(defaultVal) found = present(defaultVal)
if (found) then if (found) then
getString = trim(defaultVal) getString = trim(defaultVal)
if (len_trim(getString) /= len_trim(defaultVal)) call IO_error(0,ext_msg='getString') !if (len_trim(getString) /= len_trim(defaultVal)) call IO_error(0,ext_msg='getString')
endif endif
item => this item => this

View File

@ -92,7 +92,6 @@ module numerics
character(len=64), private :: & character(len=64), private :: &
fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag
character(len=64), protected, public :: & character(len=64), protected, public :: &
spectral_solver = 'basic', & !< spectral solution method
spectral_derivative = 'continuous' !< spectral spatial derivative method spectral_derivative = 'continuous' !< spectral spatial derivative method
character(len=1024), protected, public :: & character(len=1024), protected, public :: &
petsc_defaultOptions = '-mech_snes_type ngmres & petsc_defaultOptions = '-mech_snes_type ngmres &
@ -344,8 +343,6 @@ subroutine numerics_init
update_gamma = IO_intValue(line,chunkPos,2_pInt) > 0_pInt 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 ('spectralsolver','myspectralsolver')
spectral_solver = IO_lc(IO_stringValue(line,chunkPos,2_pInt))
case ('err_curl_tolabs') case ('err_curl_tolabs')
err_curl_tolAbs = IO_floatValue(line,chunkPos,2_pInt) err_curl_tolAbs = IO_floatValue(line,chunkPos,2_pInt)
case ('err_curl_tolrel') case ('err_curl_tolrel')
@ -499,7 +496,6 @@ subroutine numerics_init
write(6,'(a24,1x,es8.1)') ' err_curl_tolRel: ',err_curl_tolRel write(6,'(a24,1x,es8.1)') ' err_curl_tolRel: ',err_curl_tolRel
write(6,'(a24,1x,es8.1)') ' polarAlpha: ',polarAlpha write(6,'(a24,1x,es8.1)') ' polarAlpha: ',polarAlpha
write(6,'(a24,1x,es8.1)') ' polarBeta: ',polarBeta write(6,'(a24,1x,es8.1)') ' polarBeta: ',polarBeta
write(6,'(a24,1x,a)') ' spectral solver: ',trim(spectral_solver)
write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options) write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options)
#endif #endif