simplified

This commit is contained in:
Martin Diehl 2020-09-12 15:56:59 +02:00
parent 7b414454f0
commit 3f9e9a120a
1 changed files with 12 additions and 26 deletions

View File

@ -29,8 +29,7 @@ module config
worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only) worldrank = 0, & !< MPI worldrank (/=0 for MPI simulations only)
worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only) worldsize = 1 !< MPI worldsize (/=1 for MPI simulations only)
integer(4), protected, public :: & integer(4), protected, public :: &
DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive
public :: & public :: &
config_init, & config_init, &
@ -49,7 +48,6 @@ subroutine config_init
call parse_numerics call parse_numerics
call parse_debug call parse_debug
end subroutine config_init end subroutine config_init
@ -59,7 +57,7 @@ end subroutine config_init
subroutine parse_material subroutine parse_material
logical :: fileExists logical :: fileExists
character(len=:), allocatable :: fname,flow character(len=:), allocatable :: fname
fname = getSolverJobName()//'.yaml' fname = getSolverJobName()//'.yaml'
inquire(file=fname,exist=fileExists) inquire(file=fname,exist=fileExists)
@ -68,10 +66,8 @@ subroutine parse_material
inquire(file=fname,exist=fileExists) inquire(file=fname,exist=fileExists)
if(.not. fileExists) call IO_error(100,ext_msg=fname) if(.not. fileExists) call IO_error(100,ext_msg=fname)
endif endif
write(6,*) 'reading '//fname; flush(6)
write(6,'(/,a)') ' reading '//fname; flush(6) material_root => parse_flow(to_flow(IO_read(fname)))
flow = to_flow(IO_read(fname))
material_root => parse_flow(flow)
end subroutine parse_material end subroutine parse_material
@ -82,11 +78,9 @@ end subroutine parse_material
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine parse_numerics subroutine parse_numerics
!$ integer :: gotDAMASK_NUM_THREADS = 1
integer :: ierr
character(len=:), allocatable :: &
numerics_inFlow
logical :: fexist logical :: fexist
integer :: ierr
!$ integer :: gotDAMASK_NUM_THREADS = 1
!$ character(len=6) DAMASK_NumThreadsString ! environment variable DAMASK_NUM_THREADS !$ character(len=6) DAMASK_NumThreadsString ! environment variable DAMASK_NUM_THREADS
#ifdef PETSc #ifdef PETSc
@ -106,12 +100,9 @@ subroutine parse_numerics
numerics_root => emptyDict numerics_root => emptyDict
inquire(file='numerics.yaml', exist=fexist) inquire(file='numerics.yaml', exist=fexist)
if (fexist) then if (fexist) then
write(6,'(a,/)') ' using values from config.yaml file' write(6,*) 'reading numerics.yaml'; flush(6)
flush(6) numerics_root => parse_flow(to_flow(IO_read('numerics.yaml')))
numerics_inFlow = to_flow(IO_read('numerics.yaml'))
numerics_root => parse_flow(numerics_inFlow)
endif endif
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -126,18 +117,13 @@ end subroutine parse_numerics
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine parse_debug subroutine parse_debug
character(len=:), allocatable :: debug_inFlow
logical :: fexist logical :: fexist
#ifdef DEBUG
write(6,'(a)') achar(27)//'[31m <<<+- DEBUG version -+>>>'//achar(27)//'[0m'
#endif
debug_root => emptyDict debug_root => emptyDict
inquire(file='debug.yaml', exist=fexist) inquire(file='debug.yaml', exist=fexist)
fileExists: if (fexist) then fileExists: if (fexist) then
debug_inFlow = to_flow(IO_read('debug.yaml')) write(6,*) 'reading debug.yaml'; flush(6)
debug_root => parse_flow(debug_inFlow) debug_root => parse_flow(to_flow(IO_read('debug.yaml')))
endif fileExists endif fileExists
end subroutine parse_debug end subroutine parse_debug
@ -148,8 +134,8 @@ end subroutine parse_debug
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine config_deallocate subroutine config_deallocate
deallocate(material_root) !ToDo: deallocation of numerics and debug (slightly different for optional files) deallocate(material_root) !ToDo: deallocation of numerics debug (optional)
end subroutine config_deallocate end subroutine config_deallocate
end module config end module config