polishing
This commit is contained in:
parent
d4d29ff376
commit
d3f9e9f115
|
@ -320,7 +320,7 @@ program DAMASK_grid
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! doing initialization depending on active solvers
|
||||
call Utilities_init
|
||||
call spectral_Utilities_init
|
||||
do field = 1, nActiveFields
|
||||
select case (loadCases(1)%ID(field))
|
||||
case(FIELD_MECH_ID)
|
||||
|
|
|
@ -136,7 +136,7 @@ module spectral_utilities
|
|||
spectral_derivative_ID
|
||||
|
||||
public :: &
|
||||
utilities_init, &
|
||||
spectral_utilities_init, &
|
||||
utilities_updateGamma, &
|
||||
utilities_FFTtensorForward, &
|
||||
utilities_FFTtensorBackward, &
|
||||
|
@ -173,7 +173,7 @@ contains
|
|||
!> level chosen.
|
||||
!> Initializes FFTW.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine utilities_init
|
||||
subroutine spectral_utilities_init
|
||||
|
||||
PetscErrorCode :: ierr
|
||||
integer :: i, j, k, &
|
||||
|
@ -382,7 +382,7 @@ subroutine utilities_init
|
|||
allocate (gamma_hat(3,3,3,3,grid1Red,grid(2),grid3), source = cmplx(0.0_pReal,0.0_pReal,pReal))
|
||||
endif
|
||||
|
||||
end subroutine utilities_init
|
||||
end subroutine spectral_utilities_init
|
||||
|
||||
|
||||
!---------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -236,7 +236,7 @@ program DAMASK_mesh
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! doing initialization depending on active solvers
|
||||
call Utilities_init
|
||||
call FEM_Utilities_init
|
||||
do field = 1, nActiveFields
|
||||
select case (loadCases(1)%fieldBC(field)%ID)
|
||||
case(FIELD_MECH_ID)
|
||||
|
|
|
@ -85,7 +85,7 @@ module FEM_utilities
|
|||
end type tLoadCase
|
||||
|
||||
public :: &
|
||||
utilities_init, &
|
||||
FEM_utilities_init, &
|
||||
utilities_constitutiveResponse, &
|
||||
utilities_projectBCValues, &
|
||||
FIELD_MECH_ID, &
|
||||
|
@ -99,7 +99,7 @@ contains
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief allocates all neccessary fields, sets debug flags
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine utilities_init
|
||||
subroutine FEM_utilities_init
|
||||
|
||||
character(len=pStringLen) :: petsc_optionsOrder
|
||||
class(tNode), pointer :: &
|
||||
|
@ -141,7 +141,7 @@ subroutine utilities_init
|
|||
wgt = 1.0/real(mesh_maxNips*mesh_NcpElemsGlobal,pReal)
|
||||
|
||||
|
||||
end subroutine utilities_init
|
||||
end subroutine FEM_utilities_init
|
||||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
|
|
116
src/numerics.f90
116
src/numerics.f90
|
@ -4,10 +4,10 @@
|
|||
!> @brief Managing of parameters related to numerics
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
module numerics
|
||||
use prec
|
||||
use IO
|
||||
use YAML_types
|
||||
use YAML_parse
|
||||
use prec
|
||||
use IO
|
||||
use YAML_types
|
||||
use YAML_parse
|
||||
|
||||
#ifdef PETSc
|
||||
#include <petsc/finclude/petscsys.h>
|
||||
|
@ -15,38 +15,38 @@ module numerics
|
|||
#endif
|
||||
!$ use OMP_LIB
|
||||
|
||||
implicit none
|
||||
private
|
||||
implicit none
|
||||
private
|
||||
|
||||
class(tNode), pointer, public :: &
|
||||
numerics_root
|
||||
integer, protected, public :: &
|
||||
worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only)
|
||||
worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only)
|
||||
integer(4), protected, public :: &
|
||||
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
|
||||
class(tNode), pointer, public :: &
|
||||
numerics_root
|
||||
integer, protected, public :: &
|
||||
worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only)
|
||||
worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only)
|
||||
integer(4), protected, public :: &
|
||||
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! field parameters:
|
||||
integer, protected, public :: &
|
||||
itmax = 250, & !< maximum number of iterations
|
||||
itmin = 1 !< minimum number of iterations
|
||||
integer, protected, public :: &
|
||||
itmax = 250, & !< maximum number of iterations
|
||||
itmin = 1 !< minimum number of iterations
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! spectral parameters:
|
||||
#ifdef Grid
|
||||
character(len=pStringLen), protected, public :: &
|
||||
petsc_options = ''
|
||||
character(len=pStringLen), protected, public :: &
|
||||
petsc_options = ''
|
||||
#endif
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! Mesh parameters:
|
||||
#ifdef Mesh
|
||||
character(len=pStringLen), protected, public :: &
|
||||
petsc_options = ''
|
||||
character(len=pStringLen), protected, public :: &
|
||||
petsc_options = ''
|
||||
#endif
|
||||
|
||||
public :: numerics_init
|
||||
public :: numerics_init
|
||||
|
||||
contains
|
||||
|
||||
|
@ -56,22 +56,22 @@ contains
|
|||
! a sanity check
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine numerics_init
|
||||
|
||||
!$ integer :: gotDAMASK_NUM_THREADS = 1
|
||||
integer :: i, ierr
|
||||
character(len=:), allocatable :: &
|
||||
numerics_input, &
|
||||
numerics_inFlow, &
|
||||
key
|
||||
class (tNode), pointer :: &
|
||||
num_grid
|
||||
logical :: fexist
|
||||
integer :: i, ierr
|
||||
character(len=:), allocatable :: &
|
||||
numerics_input, &
|
||||
numerics_inFlow
|
||||
class (tNode), pointer :: &
|
||||
num_grid
|
||||
logical :: fexist
|
||||
!$ character(len=6) DAMASK_NumThreadsString ! environment variable DAMASK_NUM_THREADS
|
||||
|
||||
#ifdef PETSc
|
||||
call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr)
|
||||
call MPI_Comm_size(PETSC_COMM_WORLD,worldsize,ierr);CHKERRQ(ierr)
|
||||
call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr)
|
||||
call MPI_Comm_size(PETSC_COMM_WORLD,worldsize,ierr);CHKERRQ(ierr)
|
||||
#endif
|
||||
write(6,'(/,a)') ' <<<+- numerics init -+>>>'
|
||||
write(6,'(/,a)') ' <<<+- numerics init -+>>>'
|
||||
|
||||
!$ call GET_ENVIRONMENT_VARIABLE(NAME='DAMASK_NUM_THREADS',VALUE=DAMASK_NumThreadsString,STATUS=gotDAMASK_NUM_THREADS) ! get environment variable DAMASK_NUM_THREADS...
|
||||
!$ if(gotDAMASK_NUM_THREADS /= 0) then ! could not get number of threads, set it to 1
|
||||
|
@ -83,35 +83,27 @@ subroutine numerics_init
|
|||
!$ endif
|
||||
!$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution
|
||||
|
||||
numerics_root => emptyDict
|
||||
inquire(file='numerics.yaml', exist=fexist)
|
||||
numerics_root => emptyDict
|
||||
inquire(file='numerics.yaml', exist=fexist)
|
||||
|
||||
fileExists: if (fexist) then
|
||||
write(6,'(a,/)') ' using values from config file'
|
||||
flush(6)
|
||||
numerics_input = IO_read('numerics.yaml')
|
||||
numerics_inFlow = to_flow(numerics_input)
|
||||
numerics_root => parse_flow(numerics_inFlow,defaultVal=emptyDict)
|
||||
fileExists: if (fexist) then
|
||||
write(6,'(a,/)') ' using values from config file'
|
||||
flush(6)
|
||||
numerics_input = IO_read('numerics.yaml')
|
||||
numerics_inFlow = to_flow(numerics_input)
|
||||
numerics_root => parse_flow(numerics_inFlow,defaultVal=emptyDict)
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! spectral parameters
|
||||
num_grid => numerics_root%get('grid',defaultVal=emptyDict)
|
||||
do i=1,num_grid%length
|
||||
key = num_grid%getKey(i)
|
||||
select case(key)
|
||||
case ('itmax')
|
||||
itmax = num_grid%get_asInt(key)
|
||||
case ('itmin')
|
||||
itmin = num_grid%get_asInt(key)
|
||||
! grid parameters
|
||||
num_grid => numerics_root%get('grid',defaultVal=emptyDict)
|
||||
itmax = num_grid%get_asInt('itmax',defaultVal=250)
|
||||
itmin = num_grid%get_asInt('itmin',defaultVal=1)
|
||||
#ifdef PETSC
|
||||
case ('petsc_options')
|
||||
petsc_options = num_grid%get_asString(key)
|
||||
petsc_options = num_grid%get_asString('petsc_options',defaultVal = '')
|
||||
#endif
|
||||
endselect
|
||||
enddo
|
||||
else fileExists
|
||||
write(6,'(a,/)') ' using standard values'
|
||||
flush(6)
|
||||
endif fileExists
|
||||
else fileExists
|
||||
write(6,'(a,/)') ' using standard values'
|
||||
flush(6)
|
||||
endif fileExists
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! openMP parameter
|
||||
|
@ -119,18 +111,18 @@ subroutine numerics_init
|
|||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! field parameters
|
||||
write(6,'(a24,1x,i8)') ' itmax: ',itmax
|
||||
write(6,'(a24,1x,i8)') ' itmin: ',itmin
|
||||
write(6,'(a24,1x,i8)') ' itmax: ',itmax
|
||||
write(6,'(a24,1x,i8)') ' itmin: ',itmin
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
#ifdef PETSC
|
||||
write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_options)
|
||||
write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_options)
|
||||
#endif
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
! sanity checks
|
||||
if (itmax <= 1) call IO_error(301,ext_msg='itmax')
|
||||
if (itmin > itmax .or. itmin < 1) call IO_error(301,ext_msg='itmin')
|
||||
if (itmax <= 1) call IO_error(301,ext_msg='itmax')
|
||||
if (itmin > itmax .or. itmin < 1) call IO_error(301,ext_msg='itmin')
|
||||
|
||||
end subroutine numerics_init
|
||||
|
||||
|
|
Loading…
Reference in New Issue