some hdf5 related functions added
This commit is contained in:
parent
babde13c6a
commit
c712f30635
84
code/IO.f90
84
code/IO.f90
|
@ -83,6 +83,7 @@ module IO
|
||||||
#ifdef HDF
|
#ifdef HDF
|
||||||
public:: HDF5_mappingConstitutive, &
|
public:: HDF5_mappingConstitutive, &
|
||||||
HDF5_mappingHomogenization, &
|
HDF5_mappingHomogenization, &
|
||||||
|
HDF5_mappingCells, &
|
||||||
HDF5_closeJobFile
|
HDF5_closeJobFile
|
||||||
#endif
|
#endif
|
||||||
contains
|
contains
|
||||||
|
@ -2274,5 +2275,88 @@ subroutine HDF5_mappingHomogenization(mapping)
|
||||||
|
|
||||||
end subroutine HDF5_mappingHomogenization
|
end subroutine HDF5_mappingHomogenization
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief adds the unique cell to node mapping
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine HDF5_mappingCells(mapping)
|
||||||
|
use hdf5
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
integer(pInt), intent(in), dimension(:) :: mapping
|
||||||
|
|
||||||
|
integer :: hdf5err, Nnodes
|
||||||
|
integer(HID_T) :: mapping_id, dset_id, space_id
|
||||||
|
|
||||||
|
Nnodes=size(mapping,1)
|
||||||
|
mapping_ID = HDF5_openGroup("mapping")
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! create dataspace
|
||||||
|
call h5screate_simple_f(1, int([Nnodes],HSIZE_T), space_id, hdf5err, &
|
||||||
|
int([Nnodes],HSIZE_T))
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! create Dataset
|
||||||
|
call h5dcreate_f(mapping_id, "Cell",H5T_NATIVE_INTEGER, space_id, dset_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! write data by fields in the datatype. Fields order is not important.
|
||||||
|
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, mapping, int([Nnodes],HSIZE_T), hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells: h5dwrite_f instance_id')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!close types, dataspaces
|
||||||
|
call h5dclose_f(dset_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingConstitutive: h5dclose_f')
|
||||||
|
call h5sclose_f(space_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingConstitutive: h5sclose_f')
|
||||||
|
call HDF5_closeGroup(mapping_ID)
|
||||||
|
|
||||||
|
end subroutine HDF5_mappingCells
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!> @brief adds the unique cell to node mapping
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
subroutine HDF5_mappingCells(mapping)
|
||||||
|
use hdf5
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
integer(pInt), intent(in), dimension(:) :: mapping
|
||||||
|
|
||||||
|
integer :: hdf5err, Nnodes
|
||||||
|
integer(HID_T) :: mapping_id, dset_id, space_id
|
||||||
|
|
||||||
|
Nnodes=size(mapping,1)
|
||||||
|
mapping_ID = HDF5_openGroup("mapping")
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! create dataspace
|
||||||
|
call h5screate_simple_f(1, int([Nnodes],HSIZE_T), space_id, hdf5err, &
|
||||||
|
int([Nnodes],HSIZE_T))
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! create Dataset
|
||||||
|
call h5dcreate_f(mapping_id, "Cell",H5T_NATIVE_INTEGER, space_id, dset_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
! write data by fields in the datatype. Fields order is not important.
|
||||||
|
call h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, mapping, int([Nnodes],HSIZE_T), hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingCells: h5dwrite_f instance_id')
|
||||||
|
|
||||||
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
!close types, dataspaces
|
||||||
|
call h5dclose_f(dset_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingConstitutive: h5dclose_f')
|
||||||
|
call h5sclose_f(space_id, hdf5err)
|
||||||
|
if (hdf5err < 0) call IO_error(1_pInt,ext_msg='IO_mappingConstitutive: h5sclose_f')
|
||||||
|
call HDF5_closeGroup(mapping_ID)
|
||||||
|
|
||||||
|
end subroutine HDF5_mappingCells
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
end module IO
|
end module IO
|
||||||
|
|
|
@ -135,9 +135,7 @@ subroutine constitutive_init
|
||||||
character(len=64), dimension(:,:), pointer :: thisOutput
|
character(len=64), dimension(:,:), pointer :: thisOutput
|
||||||
character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready
|
character(len=32) :: outputName !< name of output, intermediate fix until HDF5 output is ready
|
||||||
logical :: knownPlasticity, nonlocalConstitutionPresent
|
logical :: knownPlasticity, nonlocalConstitutionPresent
|
||||||
#ifdef HDF
|
#ifdef HDF !< phase
|
||||||
integer(pInt) :: &
|
|
||||||
phase !< phase
|
|
||||||
integer(pInt), dimension(:,:,:), allocatable :: mappingConstitutive
|
integer(pInt), dimension(:,:,:), allocatable :: mappingConstitutive
|
||||||
integer(pInt), dimension(:,:,:), allocatable :: mappingCrystallite
|
integer(pInt), dimension(:,:,:), allocatable :: mappingCrystallite
|
||||||
integer(pInt), dimension(:), allocatable :: ConstitutivePosition
|
integer(pInt), dimension(:), allocatable :: ConstitutivePosition
|
||||||
|
|
|
@ -5076,6 +5076,9 @@ end subroutine mesh_build_FEdata
|
||||||
!> @brief writes out initial cell geometry
|
!> @brief writes out initial cell geometry
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine mesh_write_cellGeom
|
subroutine mesh_write_cellGeom
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use DAMASK_interface, only: &
|
use DAMASK_interface, only: &
|
||||||
getSolverJobName, &
|
getSolverJobName, &
|
||||||
getSolverWorkingDirectoryName
|
getSolverWorkingDirectoryName
|
||||||
|
@ -5086,7 +5089,10 @@ subroutine mesh_write_cellGeom
|
||||||
VTK_geo, &
|
VTK_geo, &
|
||||||
VTK_con, &
|
VTK_con, &
|
||||||
VTK_end
|
VTK_end
|
||||||
|
#ifdef HDF
|
||||||
|
use IO, only: &
|
||||||
|
HDF5_mappingCells
|
||||||
|
#endif
|
||||||
implicit none
|
implicit none
|
||||||
integer(I4P), dimension(1:mesh_Ncells) :: celltype
|
integer(I4P), dimension(1:mesh_Ncells) :: celltype
|
||||||
integer(I4P), dimension(mesh_Ncells*(1_pInt+FE_maxNcellnodesPerCell)) :: cellconnection
|
integer(I4P), dimension(mesh_Ncells*(1_pInt+FE_maxNcellnodesPerCell)) :: cellconnection
|
||||||
|
@ -5106,7 +5112,9 @@ subroutine mesh_write_cellGeom
|
||||||
j = j + FE_NcellnodesPerCell(c) + 1_pInt
|
j = j + FE_NcellnodesPerCell(c) + 1_pInt
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
#ifdef HDF
|
||||||
|
call HDF5_mappingCells(cellconnection(1:j))
|
||||||
|
#endif
|
||||||
error=VTK_ini(output_format = 'ASCII', &
|
error=VTK_ini(output_format = 'ASCII', &
|
||||||
title=trim(getSolverJobName())//' cell mesh', &
|
title=trim(getSolverJobName())//' cell mesh', &
|
||||||
filename = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'_ipbased.vtk', &
|
filename = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'_ipbased.vtk', &
|
||||||
|
|
Loading…
Reference in New Issue