write orientation as plain array, not derived type

This commit is contained in:
Martin Diehl 2020-12-06 08:32:45 +01:00
parent 171d642dbd
commit 000de75617
3 changed files with 14 additions and 10 deletions

View File

@ -46,7 +46,7 @@ class Result:
self.version_major = f.attrs['DADF5_version_major']
self.version_minor = f.attrs['DADF5_version_minor']
if self.version_major != 0 or not 7 <= self.version_minor <= 10:
if self.version_major != 0 or not 7 <= self.version_minor <= 11:
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
self.structured = 'grid' in f['geometry'].attrs.keys() or \
@ -790,7 +790,10 @@ class Result:
lattice = {'fcc':'cF','bcc':'cI','hex':'hP'}[q['meta']['Lattice']]
except KeyError:
lattice = q['meta']['Lattice']
o = Orientation(rotation = (rfn.structured_to_unstructured(q['data'])),lattice=lattice)
try:
o = Orientation(rotation = (rfn.structured_to_unstructured(q['data'])),lattice=lattice)
except ValueError:
o = Orientation(rotation = q['data'],lattice=lattice)
return {
'data': np.uint8(o.IPF_color(l)*255),

View File

@ -734,9 +734,9 @@ end function crystallite_push33ToRef
subroutine crystallite_results
integer :: p,o
real(pReal), allocatable, dimension(:,:,:) :: selected_tensors
type(rotation), allocatable, dimension(:) :: selected_rotations
character(len=:), allocatable :: group,structureLabel
real(pReal), allocatable, dimension(:,:,:) :: selected_tensors
real(pReal), allocatable, dimension(:,:) :: selected_rotations
character(len=:), allocatable :: group,structureLabel
do p=1,size(material_name_phase)
group = trim('current/phase')//'/'//trim(material_name_phase(p))//'/mechanics'
@ -794,7 +794,8 @@ subroutine crystallite_results
end select
selected_rotations = select_rotations(crystallite_orientation,p)
call results_writeDataset(group,selected_rotations,output_constituent(p)%label(o),&
'crystal orientation as quaternion',structureLabel)
'crystal orientation as quaternion')
call results_addAttribute('Lattice',structureLabel,group//'/'//output_constituent(p)%label(o))
end select
enddo
enddo
@ -835,10 +836,10 @@ subroutine crystallite_results
integer, intent(in) :: instance
type(rotation), dimension(:,:,:), intent(in) :: dataset
type(rotation), allocatable, dimension(:) :: select_rotations
real(pReal), allocatable, dimension(:,:) :: select_rotations
integer :: e,i,c,j
allocate(select_rotations(count(material_phaseAt==instance)*homogenization_maxNconstituents*discretization_nIPs))
allocate(select_rotations(4,count(material_phaseAt==instance)*homogenization_maxNconstituents*discretization_nIPs))
j=0
do e = 1, size(material_phaseAt,2)
@ -846,7 +847,7 @@ subroutine crystallite_results
do c = 1, size(material_phaseAt,1) !ToDo: this needs to be changed for varying Ngrains
if (material_phaseAt(c,e) == instance) then
j = j + 1
select_rotations(j) = dataset(c,i,e)
select_rotations(1:4,j) = dataset(c,i,e)%asQuaternion()
endif
enddo
enddo

View File

@ -74,7 +74,7 @@ subroutine results_init(restart)
if(.not. restart) then
resultsFile = HDF5_openFile(trim(getSolverJobName())//'.hdf5','w',.true.)
call results_addAttribute('DADF5_version_major',0)
call results_addAttribute('DADF5_version_minor',10)
call results_addAttribute('DADF5_version_minor',11)
call results_addAttribute('DAMASK_version',DAMASKVERSION)
call get_command(commandLine)
call results_addAttribute('Call',trim(commandLine))