include origin do DADF5

requires updat of file version
This commit is contained in:
Martin Diehl 2019-12-13 09:08:48 +01:00
parent ee56b82c8a
commit 63fc125398
4 changed files with 37 additions and 14 deletions

View File

@ -37,7 +37,7 @@ class DADF5():
self.version_major = f.attrs['DADF5-major'] self.version_major = f.attrs['DADF5-major']
self.version_minor = f.attrs['DADF5-minor'] self.version_minor = f.attrs['DADF5-minor']
if self.version_major != 0 or not 2 <= self.version_minor <= 4: if self.version_major != 0 or not 2 <= self.version_minor <= 5:
raise TypeError('Unsupported DADF5 version {} '.format(f.attrs['DADF5-version'])) raise TypeError('Unsupported DADF5 version {} '.format(f.attrs['DADF5-version']))
self.structured = 'grid' in f['geometry'].attrs.keys() self.structured = 'grid' in f['geometry'].attrs.keys()
@ -45,6 +45,9 @@ class DADF5():
if self.structured: if self.structured:
self.grid = f['geometry'].attrs['grid'] self.grid = f['geometry'].attrs['grid']
self.size = f['geometry'].attrs['size'] self.size = f['geometry'].attrs['size']
if self.version_major == 0 and self.version_minor >= 5:
self.origin = f['geometry'].attrs['origin']
r=re.compile('inc[0-9]+') r=re.compile('inc[0-9]+')
increments_unsorted = {int(i[3:]):i for i in f.keys() if r.match(i)} increments_unsorted = {int(i[3:]):i for i in f.keys() if r.match(i)}

View File

@ -14,10 +14,10 @@ module CPFEM2
use material use material
use lattice use lattice
use IO use IO
use HDF5
use DAMASK_interface use DAMASK_interface
use results use results
use discretization use discretization
use HDF5
use HDF5_utilities use HDF5_utilities
use homogenization use homogenization
use constitutive use constitutive

View File

@ -27,9 +27,8 @@ module mesh_grid
integer, public, protected :: & integer, public, protected :: &
grid3, & !< (local) grid in 3rd direction grid3, & !< (local) grid in 3rd direction
grid3Offset !< (local) grid offset in 3rd direction grid3Offset !< (local) grid offset in 3rd direction
real(pReal), dimension(3), public, protected :: & real(pReal), dimension(3), public, protected :: &
geomSize geomSize !< (global) physical size
real(pReal), public, protected :: & real(pReal), public, protected :: &
size3, & !< (local) size in 3rd direction size3, & !< (local) size in 3rd direction
size3offset !< (local) size offset in 3rd direction size3offset !< (local) size offset in 3rd direction
@ -49,7 +48,8 @@ subroutine mesh_init(ip,el)
include 'fftw3-mpi.f03' include 'fftw3-mpi.f03'
real(pReal), dimension(3) :: & real(pReal), dimension(3) :: &
mySize !< domain size of this process mySize, & !< domain size of this process
origin !< (global) distance to origin
integer, dimension(3) :: & integer, dimension(3) :: &
myGrid !< domain grid of this process myGrid !< domain grid of this process
@ -61,9 +61,9 @@ subroutine mesh_init(ip,el)
integer(C_INTPTR_T) :: & integer(C_INTPTR_T) :: &
devNull, z, z_offset devNull, z, z_offset
write(6,'(/,a)') ' <<<+- mesh_grid init -+>>>' write(6,'(/,a)') ' <<<+- mesh_grid init -+>>>'; flush(6)
call readGeom(grid,geomSize,microstructureAt,homogenizationAt) call readGeom(grid,geomSize,origin,microstructureAt,homogenizationAt)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! grid solver specific quantities ! grid solver specific quantities
@ -106,6 +106,7 @@ subroutine mesh_init(ip,el)
call results_closeGroup(results_addGroup('geometry')) call results_closeGroup(results_addGroup('geometry'))
call results_addAttribute('grid', grid, 'geometry') call results_addAttribute('grid', grid, 'geometry')
call results_addAttribute('size', geomSize,'geometry') call results_addAttribute('size', geomSize,'geometry')
call results_addAttribute('origin',origin, 'geometry')
call results_closeJobFile call results_closeJobFile
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -129,10 +130,13 @@ end subroutine mesh_init
!> @details important variables have an implicit "save" attribute. Therefore, this function is !> @details important variables have an implicit "save" attribute. Therefore, this function is
! supposed to be called only once! ! supposed to be called only once!
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine readGeom(grid,geomSize,microstructure,homogenization) subroutine readGeom(grid,geomSize,origin,microstructure,homogenization)
integer, dimension(3), intent(out) :: grid ! grid (for all processes!) integer, dimension(3), intent(out) :: &
real(pReal), dimension(3), intent(out) :: geomSize ! size (for all processes!) grid ! grid (for all processes!)
real(pReal), dimension(3), intent(out) :: &
geomSize, & ! size (for all processes!)
origin ! origin (for all processes!)
integer, dimension(:), intent(out), allocatable :: & integer, dimension(:), intent(out), allocatable :: &
microstructure, & microstructure, &
homogenization homogenization
@ -181,6 +185,7 @@ subroutine readGeom(grid,geomSize,microstructure,homogenization)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! read and interprete header ! read and interprete header
origin = 0.0_pReal
l = 0 l = 0
do while (l < headerLength .and. startPos < len(rawData)) do while (l < headerLength .and. startPos < len(rawData))
endPos = startPos + index(rawData(startPos:),new_line('')) - 1 endPos = startPos + index(rawData(startPos:),new_line('')) - 1
@ -221,8 +226,23 @@ subroutine readGeom(grid,geomSize,microstructure,homogenization)
enddo enddo
endif endif
case ('origin')
if (chunkPos(1) > 6) then
do j = 2,6,2
select case (IO_lc(IO_stringValue(line,chunkPos,j)))
case('x')
origin(1) = IO_floatValue(line,chunkPos,j+1)
case('y')
origin(2) = IO_floatValue(line,chunkPos,j+1)
case('z')
origin(3) = IO_floatValue(line,chunkPos,j+1)
end select
enddo
endif
case ('homogenization') case ('homogenization')
if (chunkPos(1) > 1) h = IO_intValue(line,chunkPos,2) if (chunkPos(1) > 1) h = IO_intValue(line,chunkPos,2)
end select end select
enddo enddo

View File

@ -70,7 +70,7 @@ subroutine results_init
resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.) resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.)
call HDF5_addAttribute(resultsFile,'DADF5_version_major',0) call HDF5_addAttribute(resultsFile,'DADF5_version_major',0)
call HDF5_addAttribute(resultsFile,'DADF5_version_minor',4) call HDF5_addAttribute(resultsFile,'DADF5_version_minor',5)
call HDF5_addAttribute(resultsFile,'DAMASK_version',DAMASKVERSION) call HDF5_addAttribute(resultsFile,'DAMASK_version',DAMASKVERSION)
call get_command(commandLine) call get_command(commandLine)
call HDF5_addAttribute(resultsFile,'call',trim(commandLine)) call HDF5_addAttribute(resultsFile,'call',trim(commandLine))