From 593fa24badc0206f20152bf0a35378722f19eb8f Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Sat, 23 Mar 2019 06:52:26 +0100 Subject: [PATCH] remove global variables --- src/DAMASK_grid.f90 | 19 ++++++++++++++----- src/config.f90 | 4 ++-- src/numerics.f90 | 4 ---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/DAMASK_grid.f90 b/src/DAMASK_grid.f90 index 496bfd0de..4d4b9c449 100644 --- a/src/DAMASK_grid.f90 +++ b/src/DAMASK_grid.f90 @@ -31,6 +31,8 @@ program DAMASK_spectral IO_lc, & IO_intOut, & IO_warning + use config, only: & + config_numerics use debug, only: & debug_level, & debug_spectral, & @@ -50,7 +52,6 @@ program DAMASK_spectral worldsize, & stagItMax, & maxCutBack, & - spectral_solver, & continueCalculation use homogenization, only: & materialpoint_sizeResults, & @@ -73,6 +74,7 @@ program DAMASK_spectral FIELD_DAMAGE_ID use grid_mech_spectral_basic use grid_mech_spectral_polarisation + use grid_mech_FEM use grid_damage_spectral use grid_thermal_spectral use results @@ -165,21 +167,28 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! assign mechanics solver depending on selected type - select case (spectral_solver) - case (GRID_MECH_SPECTRAL_BASIC_LABEL) + select case (trim(config_numerics%getString('spectral_solver',defaultVal='basic'))) + case ('basic') mech_init => grid_mech_spectral_basic_init mech_forward => grid_mech_spectral_basic_forward mech_solution => grid_mech_spectral_basic_solution - case (GRID_MECH_SPECTRAL_POLARISATION_LABEL) + case ('polarisation') if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0) & call IO_warning(42_pInt, ext_msg='debug Divergence') mech_init => grid_mech_spectral_polarisation_init mech_forward => grid_mech_spectral_polarisation_forward 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 - 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 diff --git a/src/config.f90 b/src/config.f90 index 65f9f8fad..2fb947a00 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -608,7 +608,7 @@ character(len=65536) function getString(this,key,defaultVal,raw) implicit none class(tPartitionedStringList), target, intent(in) :: this character(len=*), intent(in) :: key - character(len=65536), intent(in), optional :: defaultVal + character(len=*), intent(in), optional :: defaultVal logical, intent(in), optional :: raw type(tPartitionedStringList), pointer :: item logical :: found, & @@ -622,7 +622,7 @@ character(len=65536) function getString(this,key,defaultVal,raw) found = present(defaultVal) if (found) then 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 item => this diff --git a/src/numerics.f90 b/src/numerics.f90 index bbe4f856c..15d1def91 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -92,7 +92,6 @@ module numerics 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 character(len=64), protected, public :: & - spectral_solver = 'basic', & !< spectral solution method spectral_derivative = 'continuous' !< spectral spatial derivative method character(len=1024), protected, public :: & petsc_defaultOptions = '-mech_snes_type ngmres & @@ -344,8 +343,6 @@ subroutine numerics_init update_gamma = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('petsc_options') petsc_options = trim(line(chunkPos(4):)) - case ('spectralsolver','myspectralsolver') - spectral_solver = IO_lc(IO_stringValue(line,chunkPos,2_pInt)) case ('err_curl_tolabs') err_curl_tolAbs = IO_floatValue(line,chunkPos,2_pInt) 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)') ' polarAlpha: ',polarAlpha 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) #endif