don't read material.config during init
This commit is contained in:
parent
ced7da4d62
commit
9d2c60e943
|
@ -139,11 +139,11 @@ subroutine homogenization_init
|
||||||
! parse thermal from config file
|
! parse thermal from config file
|
||||||
call IO_checkAndRewind(FILEUNIT)
|
call IO_checkAndRewind(FILEUNIT)
|
||||||
if (any(thermal_type == THERMAL_isothermal_ID)) &
|
if (any(thermal_type == THERMAL_isothermal_ID)) &
|
||||||
call thermal_isothermal_init()
|
call thermal_isothermal_init
|
||||||
if (any(thermal_type == THERMAL_adiabatic_ID)) &
|
if (any(thermal_type == THERMAL_adiabatic_ID)) &
|
||||||
call thermal_adiabatic_init(FILEUNIT)
|
call thermal_adiabatic_init
|
||||||
if (any(thermal_type == THERMAL_conduction_ID)) &
|
if (any(thermal_type == THERMAL_conduction_ID)) &
|
||||||
call thermal_conduction_init(FILEUNIT)
|
call thermal_conduction_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! parse damage from config file
|
! parse damage from config file
|
||||||
|
|
|
@ -13,7 +13,6 @@ module thermal_adiabatic
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
||||||
thermal_adiabatic_sizePostResult !< size of each post result output
|
thermal_adiabatic_sizePostResult !< size of each post result output
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
||||||
thermal_adiabatic_output !< name of each post result output
|
thermal_adiabatic_output !< name of each post result output
|
||||||
|
|
||||||
|
@ -43,27 +42,15 @@ contains
|
||||||
!> @brief module initialization
|
!> @brief module initialization
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine thermal_adiabatic_init(fileUnit)
|
subroutine thermal_adiabatic_init
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
use, intrinsic :: iso_fortran_env, only: &
|
||||||
compiler_version, &
|
compiler_version, &
|
||||||
compiler_options
|
compiler_options
|
||||||
#endif
|
#endif
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_timeStamp, &
|
IO_timeStamp
|
||||||
IO_EOF
|
|
||||||
use config, only: &
|
|
||||||
material_partHomogenization
|
|
||||||
use material, only: &
|
use material, only: &
|
||||||
thermal_type, &
|
thermal_type, &
|
||||||
thermal_typeInstance, &
|
thermal_typeInstance, &
|
||||||
|
@ -77,17 +64,16 @@ subroutine thermal_adiabatic_init(fileUnit)
|
||||||
thermal_initialT, &
|
thermal_initialT, &
|
||||||
temperature, &
|
temperature, &
|
||||||
temperatureRate
|
temperatureRate
|
||||||
|
use config, only: &
|
||||||
|
material_partHomogenization, &
|
||||||
|
config_homogenization
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: fileUnit
|
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o,i
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o
|
|
||||||
integer(pInt) :: sizeState
|
integer(pInt) :: sizeState
|
||||||
integer(pInt) :: NofMyHomog
|
integer(pInt) :: NofMyHomog
|
||||||
character(len=65536) :: &
|
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
||||||
tag = '', &
|
character(len=65536), dimension(:), allocatable :: outputs
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_ADIABATIC_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_ADIABATIC_label//' init -+>>>'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
|
@ -102,47 +88,20 @@ subroutine thermal_adiabatic_init(fileUnit)
|
||||||
allocate(thermal_adiabatic_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
allocate(thermal_adiabatic_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
||||||
allocate(thermal_adiabatic_Noutput (maxNinstance), source=0_pInt)
|
allocate(thermal_adiabatic_Noutput (maxNinstance), source=0_pInt)
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (thermal_type(section) == THERMAL_adiabatic_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = thermal_typeInstance(section) ! which instance of my thermal is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('temperature')
|
|
||||||
thermal_adiabatic_Noutput(instance) = thermal_adiabatic_Noutput(instance) + 1_pInt
|
|
||||||
thermal_adiabatic_outputID(thermal_adiabatic_Noutput(instance),instance) = temperature_ID
|
|
||||||
thermal_adiabatic_output(thermal_adiabatic_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(thermal_type)
|
initializeInstances: do section = 1_pInt, size(thermal_type)
|
||||||
if (thermal_type(section) == THERMAL_adiabatic_ID) then
|
if (thermal_type(section) /= THERMAL_adiabatic_ID) cycle
|
||||||
NofMyHomog=count(material_homog==section)
|
NofMyHomog=count(material_homog==section)
|
||||||
instance = thermal_typeInstance(section)
|
instance = thermal_typeInstance(section)
|
||||||
|
outputs = config_homogenization(section)%getStrings('(output)',defaultVal=emptyStringArray)
|
||||||
|
do i=1_pInt, size(outputs)
|
||||||
|
select case(outputs(i))
|
||||||
|
case('temperature')
|
||||||
|
thermal_adiabatic_Noutput(instance) = thermal_adiabatic_Noutput(instance) + 1_pInt
|
||||||
|
thermal_adiabatic_outputID(thermal_adiabatic_Noutput(instance),instance) = temperature_ID
|
||||||
|
thermal_adiabatic_output(thermal_adiabatic_Noutput(instance),instance) = outputs(i)
|
||||||
|
end select
|
||||||
|
enddo
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! Determine size of postResults array
|
! Determine size of postResults array
|
||||||
|
@ -172,9 +131,8 @@ subroutine thermal_adiabatic_init(fileUnit)
|
||||||
deallocate(temperatureRate(section)%p)
|
deallocate(temperatureRate(section)%p)
|
||||||
allocate (temperatureRate(section)%p(NofMyHomog), source=0.0_pReal)
|
allocate (temperatureRate(section)%p(NofMyHomog), source=0.0_pReal)
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
enddo initializeInstances
|
enddo initializeInstances
|
||||||
|
|
||||||
end subroutine thermal_adiabatic_init
|
end subroutine thermal_adiabatic_init
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -13,7 +13,6 @@ module thermal_conduction
|
||||||
|
|
||||||
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
integer(pInt), dimension(:,:), allocatable, target, public :: &
|
||||||
thermal_conduction_sizePostResult !< size of each post result output
|
thermal_conduction_sizePostResult !< size of each post result output
|
||||||
|
|
||||||
character(len=64), dimension(:,:), allocatable, target, public :: &
|
character(len=64), dimension(:,:), allocatable, target, public :: &
|
||||||
thermal_conduction_output !< name of each post result output
|
thermal_conduction_output !< name of each post result output
|
||||||
|
|
||||||
|
@ -44,25 +43,15 @@ contains
|
||||||
!> @brief module initialization
|
!> @brief module initialization
|
||||||
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
!> @details reads in material parameters, allocates arrays, and does sanity checks
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine thermal_conduction_init(fileUnit)
|
subroutine thermal_conduction_init
|
||||||
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
#if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800
|
||||||
use, intrinsic :: iso_fortran_env, only: &
|
use, intrinsic :: iso_fortran_env, only: &
|
||||||
compiler_version, &
|
compiler_version, &
|
||||||
compiler_options
|
compiler_options
|
||||||
#endif
|
#endif
|
||||||
use IO, only: &
|
use IO, only: &
|
||||||
IO_read, &
|
|
||||||
IO_lc, &
|
|
||||||
IO_getTag, &
|
|
||||||
IO_isBlank, &
|
|
||||||
IO_stringPos, &
|
|
||||||
IO_stringValue, &
|
|
||||||
IO_floatValue, &
|
|
||||||
IO_intValue, &
|
|
||||||
IO_warning, &
|
|
||||||
IO_error, &
|
IO_error, &
|
||||||
IO_timeStamp, &
|
IO_timeStamp
|
||||||
IO_EOF
|
|
||||||
use material, only: &
|
use material, only: &
|
||||||
thermal_type, &
|
thermal_type, &
|
||||||
thermal_typeInstance, &
|
thermal_typeInstance, &
|
||||||
|
@ -77,18 +66,15 @@ subroutine thermal_conduction_init(fileUnit)
|
||||||
temperature, &
|
temperature, &
|
||||||
temperatureRate
|
temperatureRate
|
||||||
use config, only: &
|
use config, only: &
|
||||||
material_partHomogenization
|
material_partHomogenization, &
|
||||||
|
config_homogenization
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
integer(pInt), intent(in) :: fileUnit
|
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o,i
|
||||||
|
|
||||||
integer(pInt), allocatable, dimension(:) :: chunkPos
|
|
||||||
integer(pInt) :: maxNinstance,mySize=0_pInt,section,instance,o
|
|
||||||
integer(pInt) :: sizeState
|
integer(pInt) :: sizeState
|
||||||
integer(pInt) :: NofMyHomog
|
integer(pInt) :: NofMyHomog
|
||||||
character(len=65536) :: &
|
character(len=65536), dimension(0), parameter :: emptyStringArray = [character(len=65536)::]
|
||||||
tag = '', &
|
character(len=65536), dimension(:), allocatable :: outputs
|
||||||
line = ''
|
|
||||||
|
|
||||||
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_CONDUCTION_label//' init -+>>>'
|
write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_CONDUCTION_label//' init -+>>>'
|
||||||
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
write(6,'(a15,a)') ' Current time: ',IO_timeStamp()
|
||||||
|
@ -103,47 +89,20 @@ subroutine thermal_conduction_init(fileUnit)
|
||||||
allocate(thermal_conduction_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
allocate(thermal_conduction_outputID (maxval(homogenization_Noutput),maxNinstance),source=undefined_ID)
|
||||||
allocate(thermal_conduction_Noutput (maxNinstance), source=0_pInt)
|
allocate(thermal_conduction_Noutput (maxNinstance), source=0_pInt)
|
||||||
|
|
||||||
rewind(fileUnit)
|
|
||||||
section = 0_pInt
|
|
||||||
do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= material_partHomogenization)! wind forward to <homogenization>
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
parsingFile: do while (trim(line) /= IO_EOF) ! read through sections of homog part
|
|
||||||
line = IO_read(fileUnit)
|
|
||||||
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
||||||
if (IO_getTag(line,'<','>') /= '') then ! stop at next part
|
|
||||||
line = IO_read(fileUnit, .true.) ! reset IO_read
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
if (IO_getTag(line,'[',']') /= '') then ! next homog section
|
|
||||||
section = section + 1_pInt ! advance homog section counter
|
|
||||||
cycle ! skip to next line
|
|
||||||
endif
|
|
||||||
|
|
||||||
if (section > 0_pInt ) then; if (thermal_type(section) == THERMAL_conduction_ID) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran
|
|
||||||
|
|
||||||
instance = thermal_typeInstance(section) ! which instance of my thermal is present homog
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key
|
|
||||||
select case(tag)
|
|
||||||
case ('(output)')
|
|
||||||
select case(IO_lc(IO_stringValue(line,chunkPos,2_pInt)))
|
|
||||||
case ('temperature')
|
|
||||||
thermal_conduction_Noutput(instance) = thermal_conduction_Noutput(instance) + 1_pInt
|
|
||||||
thermal_conduction_outputID(thermal_conduction_Noutput(instance),instance) = temperature_ID
|
|
||||||
thermal_conduction_output(thermal_conduction_Noutput(instance),instance) = &
|
|
||||||
IO_lc(IO_stringValue(line,chunkPos,2_pInt))
|
|
||||||
end select
|
|
||||||
|
|
||||||
end select
|
|
||||||
endif; endif
|
|
||||||
enddo parsingFile
|
|
||||||
|
|
||||||
initializeInstances: do section = 1_pInt, size(thermal_type)
|
initializeInstances: do section = 1_pInt, size(thermal_type)
|
||||||
if (thermal_type(section) /= THERMAL_conduction_ID) cycle
|
if (thermal_type(section) /= THERMAL_conduction_ID) cycle
|
||||||
NofMyHomog=count(material_homog==section)
|
NofMyHomog=count(material_homog==section)
|
||||||
instance = thermal_typeInstance(section)
|
instance = thermal_typeInstance(section)
|
||||||
|
outputs = config_homogenization(section)%getStrings('(output)',defaultVal=emptyStringArray)
|
||||||
|
do i=1_pInt, size(outputs)
|
||||||
|
select case(outputs(i))
|
||||||
|
case('temperature')
|
||||||
|
thermal_conduction_Noutput(instance) = thermal_conduction_Noutput(instance) + 1_pInt
|
||||||
|
thermal_conduction_outputID(thermal_conduction_Noutput(instance),instance) = temperature_ID
|
||||||
|
thermal_conduction_output(thermal_conduction_Noutput(instance),instance) = outputs(i)
|
||||||
|
end select
|
||||||
|
enddo
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! Determine size of postResults array
|
! Determine size of postResults array
|
||||||
|
|
Loading…
Reference in New Issue