taking care of corner cases (e.g. restart)
adjusting tests to take care of new 'setup' group
This commit is contained in:
parent
a6f7e4f1a6
commit
044a048944
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit 7d48d8158c1b2c0ab8bdd1c5d2baa3d020ae006d
|
Subproject commit 9699f20f21f8a5f532c735a1aa9daeba395da94d
|
|
@ -1473,6 +1473,10 @@ subroutine HDF5_write_real7(dataset,loc_id,datasetName,parallel)
|
||||||
end subroutine HDF5_write_real7
|
end subroutine HDF5_write_real7
|
||||||
|
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief Write dataset of type string (scalar).
|
||||||
|
!> @details Not collective, must be called by one process at at time.
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine HDF5_write_str(dataset,loc_id,datasetName)
|
subroutine HDF5_write_str(dataset,loc_id,datasetName)
|
||||||
|
|
||||||
character(len=*), intent(in) :: dataset
|
character(len=*), intent(in) :: dataset
|
||||||
|
|
|
@ -128,19 +128,19 @@ function IO_read(fileName) result(fileContent)
|
||||||
inquire(file = fileName, size=fileLength)
|
inquire(file = fileName, size=fileLength)
|
||||||
open(newunit=fileUnit, file=fileName, access='stream',&
|
open(newunit=fileUnit, file=fileName, access='stream',&
|
||||||
status='old', position='rewind', action='read',iostat=myStat)
|
status='old', position='rewind', action='read',iostat=myStat)
|
||||||
if(myStat /= 0) call IO_error(100,ext_msg=trim(fileName))
|
if (myStat /= 0) call IO_error(100,ext_msg=trim(fileName))
|
||||||
allocate(character(len=fileLength)::fileContent)
|
allocate(character(len=fileLength)::fileContent)
|
||||||
if(fileLength==0) then
|
if (fileLength==0) then
|
||||||
close(fileUnit)
|
close(fileUnit)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
read(fileUnit,iostat=myStat) fileContent
|
read(fileUnit,iostat=myStat) fileContent
|
||||||
if(myStat /= 0) call IO_error(102,ext_msg=trim(fileName))
|
if (myStat /= 0) call IO_error(102,ext_msg=trim(fileName))
|
||||||
close(fileUnit)
|
close(fileUnit)
|
||||||
|
|
||||||
if (scan(fileContent(:index(fileContent,LF)),CR//LF) /= 0) fileContent = CRLF2LF(fileContent)
|
if (scan(fileContent(:index(fileContent,LF)),CR//LF) /= 0) fileContent = CRLF2LF(fileContent)
|
||||||
if(fileContent(fileLength:fileLength) /= IO_EOL) fileContent = fileContent//IO_EOL ! ensure EOL@EOF
|
if (fileContent(fileLength:fileLength) /= IO_EOL) fileContent = fileContent//IO_EOL ! ensure EOL@EOF
|
||||||
|
|
||||||
end function IO_read
|
end function IO_read
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ subroutine parse_material()
|
||||||
print*, 'reading material.yaml'; flush(IO_STDOUT)
|
print*, 'reading material.yaml'; flush(IO_STDOUT)
|
||||||
fileContent = IO_read('material.yaml')
|
fileContent = IO_read('material.yaml')
|
||||||
call results_openJobFile(parallel=.false.)
|
call results_openJobFile(parallel=.false.)
|
||||||
call results_writeDataset_str(fileContent,'setup','material.yaml','DAMASK main configuration')
|
call results_writeDataset_str(fileContent,'setup','material.yaml','main configuration')
|
||||||
call results_closeJobFile
|
call results_closeJobFile
|
||||||
endif
|
endif
|
||||||
call parallelization_bcast_str(fileContent)
|
call parallelization_bcast_str(fileContent)
|
||||||
|
|
|
@ -108,7 +108,7 @@ program DAMASK_grid
|
||||||
step_mech, &
|
step_mech, &
|
||||||
step_discretization
|
step_discretization
|
||||||
character(len=:), allocatable :: &
|
character(len=:), allocatable :: &
|
||||||
fileContent
|
fileContent, fname
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
! init DAMASK (all modules)
|
! init DAMASK (all modules)
|
||||||
|
@ -131,8 +131,10 @@ program DAMASK_grid
|
||||||
|
|
||||||
if (worldrank == 0) then
|
if (worldrank == 0) then
|
||||||
fileContent = IO_read(interface_loadFile)
|
fileContent = IO_read(interface_loadFile)
|
||||||
|
fname = interface_loadFile
|
||||||
|
if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:)
|
||||||
call results_openJobFile(parallel=.false.)
|
call results_openJobFile(parallel=.false.)
|
||||||
call results_writeDataset_str(fileContent,'setup',interface_loadFile,'load case definition (grid solver)')
|
call results_writeDataset_str(fileContent,'setup',fname,'load case definition (grid solver)')
|
||||||
call results_closeJobFile
|
call results_closeJobFile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ subroutine discretization_grid_init(restart)
|
||||||
integer, dimension(worldsize) :: &
|
integer, dimension(worldsize) :: &
|
||||||
displs, sendcounts
|
displs, sendcounts
|
||||||
character(len=:), allocatable :: &
|
character(len=:), allocatable :: &
|
||||||
fileContent
|
fileContent, fname
|
||||||
|
|
||||||
|
|
||||||
print'(/,a)', ' <<<+- discretization_grid init -+>>>'; flush(IO_STDOUT)
|
print'(/,a)', ' <<<+- discretization_grid init -+>>>'; flush(IO_STDOUT)
|
||||||
|
@ -78,8 +78,10 @@ subroutine discretization_grid_init(restart)
|
||||||
if(worldrank == 0) then
|
if(worldrank == 0) then
|
||||||
fileContent = IO_read(interface_geomFile)
|
fileContent = IO_read(interface_geomFile)
|
||||||
call readVTI(grid,geomSize,origin,materialAt_global,fileContent)
|
call readVTI(grid,geomSize,origin,materialAt_global,fileContent)
|
||||||
|
fname = interface_geomFile
|
||||||
|
if (scan(fname,'/') /= 0) fname = fname(scan(fname,'/',.true.)+1:)
|
||||||
call results_openJobFile(parallel=.false.)
|
call results_openJobFile(parallel=.false.)
|
||||||
call results_writeDataset_str(fileContent,'setup',interface_geomFile,'geometry definition (grid solver)')
|
call results_writeDataset_str(fileContent,'setup',fname,'geometry definition (grid solver)')
|
||||||
call results_closeJobFile
|
call results_closeJobFile
|
||||||
else
|
else
|
||||||
allocate(materialAt_global(0)) ! needed for IntelMPI
|
allocate(materialAt_global(0)) ! needed for IntelMPI
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ subroutine selfTest
|
||||||
error stop 'math_sym33to6/math_6toSym33'
|
error stop 'math_sym33to6/math_6toSym33'
|
||||||
|
|
||||||
call random_number(t66)
|
call random_number(t66)
|
||||||
if(any(dNeq(math_sym3333to66(math_66toSym3333(t66)),t66))) &
|
if(any(dNeq(math_sym3333to66(math_66toSym3333(t66)),t66,1.0e-15_pReal))) &
|
||||||
error stop 'math_sym3333to66/math_66toSym3333'
|
error stop 'math_sym3333to66/math_66toSym3333'
|
||||||
|
|
||||||
call random_number(v6)
|
call random_number(v6)
|
||||||
|
|
|
@ -89,6 +89,7 @@ end subroutine prec_init
|
||||||
! replaces "==" but for certain (relative) tolerance. Counterpart to dNeq
|
! replaces "==" but for certain (relative) tolerance. Counterpart to dNeq
|
||||||
! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
|
! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
|
||||||
! AlmostEqualRelative
|
! AlmostEqualRelative
|
||||||
|
! ToDo: Use 'spacing': https://gcc.gnu.org/onlinedocs/gfortran/SPACING.html#SPACING
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
logical elemental pure function dEq(a,b,tol)
|
logical elemental pure function dEq(a,b,tol)
|
||||||
|
|
||||||
|
|
|
@ -65,13 +65,17 @@ subroutine results_init(restart)
|
||||||
logical, intent(in) :: restart
|
logical, intent(in) :: restart
|
||||||
|
|
||||||
character(len=pPathLen) :: commandLine
|
character(len=pPathLen) :: commandLine
|
||||||
|
integer :: hdferr
|
||||||
|
integer(HID_T) :: group_id
|
||||||
|
character(len=:), allocatable :: date
|
||||||
|
|
||||||
|
|
||||||
print'(/,a)', ' <<<+- results init -+>>>'; flush(IO_STDOUT)
|
print'(/,a)', ' <<<+- results init -+>>>'; flush(IO_STDOUT)
|
||||||
|
|
||||||
print*, 'M. Diehl et al., Integrating Materials and Manufacturing Innovation 6(1):83–91, 2017'
|
print*, 'M. Diehl et al., Integrating Materials and Manufacturing Innovation 6(1):83–91, 2017'
|
||||||
print*, 'https://doi.org/10.1007/s40192-017-0084-5'//IO_EOL
|
print*, 'https://doi.org/10.1007/s40192-017-0084-5'//IO_EOL
|
||||||
|
|
||||||
if(.not. restart) then
|
if (.not. restart) then
|
||||||
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
|
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
|
||||||
call results_addAttribute('DADF5_version_major',0)
|
call results_addAttribute('DADF5_version_major',0)
|
||||||
call results_addAttribute('DADF5_version_minor',14)
|
call results_addAttribute('DADF5_version_minor',14)
|
||||||
|
@ -84,9 +88,20 @@ subroutine results_init(restart)
|
||||||
call results_addAttribute('description','mappings to place data in space','cell_to')
|
call results_addAttribute('description','mappings to place data in space','cell_to')
|
||||||
call results_closeGroup(results_addGroup('setup'))
|
call results_closeGroup(results_addGroup('setup'))
|
||||||
call results_addAttribute('description','input data used to run the simulation','setup')
|
call results_addAttribute('description','input data used to run the simulation','setup')
|
||||||
call results_closeJobFile
|
else
|
||||||
|
date = now()
|
||||||
|
call results_openJobFile
|
||||||
|
call get_command(commandLine)
|
||||||
|
call results_addAttribute('call (restart at '//date//')',trim(commandLine))
|
||||||
|
call h5gmove_f(resultsFile,'setup','tmp',hdferr)
|
||||||
|
call results_addAttribute('description','input data used to run the simulation (backup from restart at '//date//')','tmp')
|
||||||
|
call results_closeGroup(results_addGroup('setup'))
|
||||||
|
call results_addAttribute('description','input data used to run the simulation','setup')
|
||||||
|
call h5gmove_f(resultsFile,'tmp','setup/backup',hdferr)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call results_closeJobFile
|
||||||
|
|
||||||
end subroutine results_init
|
end subroutine results_init
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue