1 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/results.f90"
4 # 1 "/home/damask_user/GitLabCI_Pipeline_4301/DAMASK/src/results.f90"
68 character(len=pStringLen) :: commandline
70 write(6,
'(/,a)')
' <<<+- results init -+>>>'
72 write(6,
'(/,a)')
' Diehl et al., Integrating Materials and Manufacturing Innovation 6(1):83–91, 2017'
73 write(6,
'(a)')
' https://doi.org/10.1007/s40192-017-0084-5'
79 call get_command(commandline)
113 integer,
intent(in) :: inc
114 real(preal),
intent(in) :: time
115 character(len=pStringLen) :: incchar
117 write(incchar,
'(i10)') inc
143 character(len=*),
intent(in) :: groupname
155 character(len=*),
intent(in) :: groupname
167 integer(HID_T),
intent(in) :: group_id
179 character(len=*),
intent(in) :: path, link
191 character(len=*),
intent(in) :: attrLabel, attrValue
192 character(len=*),
intent(in),
optional :: path
194 if (
present(path))
then
208 character(len=*),
intent(in) :: attrLabel
209 integer,
intent(in) :: attrValue
210 character(len=*),
intent(in),
optional :: path
212 if (
present(path))
then
226 character(len=*),
intent(in) :: attrLabel
227 real(pReal),
intent(in) :: attrValue
228 character(len=*),
intent(in),
optional :: path
230 if (
present(path))
then
244 character(len=*),
intent(in) :: attrLabel
245 integer,
intent(in),
dimension(:) :: attrValue
246 character(len=*),
intent(in),
optional :: path
248 if (
present(path))
then
262 character(len=*),
intent(in) :: attrLabel
263 real(pReal),
intent(in),
dimension(:) :: attrValue
264 character(len=*),
intent(in),
optional :: path
266 if (
present(path))
then
280 character(len=*),
intent(in) :: link
284 if (hdferr < 0)
call io_error(1,ext_msg =
'results_removeLink: h5ldelete_soft_f ('//trim(link)//
')')
294 character(len=*),
intent(in) :: label,group,description
295 character(len=*),
intent(in),
optional :: SIunit
296 real(pReal),
intent(inout),
dimension(:) :: dataset
298 integer(HID_T) :: groupHandle
303 call hdf5_write(grouphandle,dataset,label,.true.)
323 character(len=*),
intent(in) :: label,group,description
324 character(len=*),
intent(in),
optional :: SIunit
325 real(pReal),
intent(inout),
dimension(:,:) :: dataset
327 integer(HID_T) :: groupHandle
332 call hdf5_write(grouphandle,dataset,label,.true.)
353 character(len=*),
intent(in) :: label,group,description
354 character(len=*),
intent(in),
optional :: SIunit
355 logical,
intent(in),
optional :: transposed
356 real(pReal),
intent(in),
dimension(:,:,:) :: dataset
359 logical :: transposed_
360 integer(HID_T) :: groupHandle
361 real(pReal),
dimension(:,:,:),
allocatable :: dataset_transposed
364 if(
present(transposed))
then
365 transposed_ = transposed
371 if(
size(dataset,1) /=
size(dataset,2))
call io_error(0,ext_msg=
'transpose non-symmetric tensor')
372 allocate(dataset_transposed,mold=dataset)
373 do i=1,
size(dataset_transposed,3)
374 dataset_transposed(:,:,i) = transpose(dataset(:,:,i))
377 allocate(dataset_transposed,source=dataset)
383 call hdf5_write(grouphandle,dataset_transposed,label,.true.)
404 character(len=*),
intent(in) :: label,group,description
405 character(len=*),
intent(in),
optional :: SIunit
406 integer,
intent(inout),
dimension(:,:) :: dataset
408 integer(HID_T) :: groupHandle
413 call hdf5_write(grouphandle,dataset,label,.true.)
434 character(len=*),
intent(in) :: label,group,description
435 character(len=*),
intent(in),
optional :: SIunit
436 integer,
intent(inout),
dimension(:,:,:) :: dataset
438 integer(HID_T) :: groupHandle
443 call hdf5_write(grouphandle,dataset,label,.true.)
464 character(len=*),
intent(in) :: label,group,description
465 character(len=*),
intent(in),
optional :: lattice_structure
466 type(
rotation),
intent(inout),
dimension(:) :: dataset
468 integer(HID_T) :: groupHandle
473 call hdf5_write(grouphandle,dataset,label,.true.)
494 integer,
dimension(:,:),
intent(in) :: phaseat
495 integer,
dimension(:,:,:),
intent(in) :: memberatlocal
496 character(len=pStringLen),
dimension(:),
intent(in) :: label
498 integer,
dimension(size(memberAtLocal,1),size(memberAtLocal,2),size(memberAtLocal,3)) :: &
499 phaseatmaterialpoint, &
501 integer,
dimension(size(label),0:worldsize-1) :: memberoffset
502 integer,
dimension(0:worldsize-1) :: writesize
503 integer(HSIZE_T),
dimension(2) :: &
504 myshape, & !< shape of the dataset (this process)
509 loc_id, & !< identifier of group in file
510 dtype_id, & !< identifier of compound data type
511 name_id, & !< identifier of name (string) in compound data type
512 position_id, & !< identifier of position/index (integer) in compound data type
520 integer(SIZE_T) :: type_size_string, type_size_int
525 call h5tcopy_f(h5t_native_character, dt_id, ierr)
526 call h5tset_size_f(dt_id, int(len(label(1)),size_t), ierr)
527 call h5tget_size_f(dt_id, type_size_string, ierr)
529 call h5tget_size_f(h5t_native_integer, type_size_int, ierr)
531 call h5tcreate_f(h5t_compound_f, type_size_string + type_size_int, dtype_id, ierr)
532 call h5tinsert_f(dtype_id,
"Name", 0_size_t, dt_id,ierr)
533 call h5tinsert_f(dtype_id,
"Position", type_size_string, h5t_native_integer, ierr)
537 call h5tcreate_f(h5t_compound_f, type_size_string, name_id, ierr)
538 call h5tinsert_f(name_id,
"Name", 0_size_t, dt_id, ierr)
540 call h5tcreate_f(h5t_compound_f, type_size_int, position_id, ierr)
541 call h5tinsert_f(position_id,
"Position", 0_size_t, h5t_native_integer, ierr)
543 call h5tclose_f(dt_id, ierr)
547 call h5pcreate_f(h5p_dataset_xfer_f, plist_id, ierr)
550 memberoffset(i,
worldrank) = count(phaseat == i)*
size(memberatlocal,2)
553 writesize(
worldrank) =
size(memberatlocal(1,:,:))
558 call h5pset_dxpl_mpio_f(plist_id, h5fd_mpio_collective_f, ierr)
559 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5pset_dxpl_mpio_f')
561 call mpi_allreduce(mpi_in_place,writesize,
worldsize,mpi_int,mpi_sum,petsc_comm_world,ierr)
562 if (ierr /= 0)
call io_error(894,ext_msg=
'results_mapping_constituent: MPI_allreduce/writeSize')
564 call mpi_allreduce(mpi_in_place,memberoffset,
size(memberoffset),mpi_int,mpi_sum,petsc_comm_world,ierr)
565 if (ierr /= 0)
call io_error(894,ext_msg=
'results_mapping_constituent: MPI_allreduce/memberOffset')
568 myshape = int([
size(phaseat,1),writesize(
worldrank)], hsize_t)
569 myoffset = int([0,sum(writesize(0:
worldrank-1))], hsize_t)
570 totalshape = int([
size(phaseat,1),sum(writesize)], hsize_t)
574 call h5screate_simple_f(2,myshape,memspace_id,ierr,myshape)
575 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5screate_simple_f/memspace_id')
577 call h5screate_simple_f(2,totalshape,filespace_id,ierr,totalshape)
578 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5screate_simple_f/filespace_id')
580 call h5sselect_hyperslab_f(filespace_id, h5s_select_set_f, myoffset, myshape, ierr)
581 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5sselect_hyperslab_f')
585 do i = 1,
size(phaseatmaterialpoint,2)
586 phaseatmaterialpoint(:,i,:) = phaseat
591 do i = 1,
size(label)
592 where(phaseatmaterialpoint == i) memberatglobal = memberatlocal + sum(memberoffset(i,0:
worldrank-1)) -1
597 call h5pset_preserve_f(plist_id, .true., ierr)
600 call h5dcreate_f(loc_id,
'constituent', dtype_id, filespace_id, dset_id, ierr)
601 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5dcreate_f')
603 call h5dwrite_f(dset_id, name_id, reshape(label(pack(phaseatmaterialpoint,.true.)),myshape), &
604 myshape, ierr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
605 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5dwrite_f/name_id')
606 call h5dwrite_f(dset_id, position_id, reshape(pack(memberatglobal,.true.),myshape), &
607 myshape, ierr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
608 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_constituent: h5dwrite_f/position_id')
613 call h5pclose_f(plist_id, ierr)
614 call h5sclose_f(filespace_id, ierr)
615 call h5sclose_f(memspace_id, ierr)
616 call h5dclose_f(dset_id, ierr)
617 call h5tclose_f(dtype_id, ierr)
618 call h5tclose_f(name_id, ierr)
619 call h5tclose_f(position_id, ierr)
629 integer,
dimension(:),
intent(in) :: homogenizationat
630 integer,
dimension(:,:),
intent(in) :: memberatlocal
631 character(len=pStringLen),
dimension(:),
intent(in) :: label
633 integer,
dimension(size(memberAtLocal,1),size(memberAtLocal,2)) :: &
634 homogenizationatmaterialpoint, &
636 integer,
dimension(size(label),0:worldsize-1) :: memberoffset
637 integer,
dimension(0:worldsize-1) :: writesize
638 integer(HSIZE_T),
dimension(1) :: &
639 myshape, & !< shape of the dataset (this process)
644 loc_id, & !< identifier of group in file
645 dtype_id, & !< identifier of compound data type
646 name_id, & !< identifier of name (string) in compound data type
647 position_id, & !< identifier of position/index (integer) in compound data type
655 integer(SIZE_T) :: type_size_string, type_size_int
660 call h5tcopy_f(h5t_native_character, dt_id, ierr)
661 call h5tset_size_f(dt_id, int(len(label(1)),size_t), ierr)
662 call h5tget_size_f(dt_id, type_size_string, ierr)
664 call h5tget_size_f(h5t_native_integer, type_size_int, ierr)
666 call h5tcreate_f(h5t_compound_f, type_size_string + type_size_int, dtype_id, ierr)
667 call h5tinsert_f(dtype_id,
"Name", 0_size_t, dt_id,ierr)
668 call h5tinsert_f(dtype_id,
"Position", type_size_string, h5t_native_integer, ierr)
672 call h5tcreate_f(h5t_compound_f, type_size_string, name_id, ierr)
673 call h5tinsert_f(name_id,
"Name", 0_size_t, dt_id, ierr)
675 call h5tcreate_f(h5t_compound_f, type_size_int, position_id, ierr)
676 call h5tinsert_f(position_id,
"Position", 0_size_t, h5t_native_integer, ierr)
678 call h5tclose_f(dt_id, ierr)
682 call h5pcreate_f(h5p_dataset_xfer_f, plist_id, ierr)
685 memberoffset(i,
worldrank) = count(homogenizationat == i)*
size(memberatlocal,1)
688 writesize(
worldrank) =
size(memberatlocal)
693 call h5pset_dxpl_mpio_f(plist_id, h5fd_mpio_collective_f, ierr)
694 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5pset_dxpl_mpio_f')
696 call mpi_allreduce(mpi_in_place,writesize,
worldsize,mpi_int,mpi_sum,petsc_comm_world,ierr)
697 if (ierr /= 0)
call io_error(894,ext_msg=
'results_mapping_materialpoint: MPI_allreduce/writeSize')
699 call mpi_allreduce(mpi_in_place,memberoffset,
size(memberoffset),mpi_int,mpi_sum,petsc_comm_world,ierr)
700 if (ierr /= 0)
call io_error(894,ext_msg=
'results_mapping_materialpoint: MPI_allreduce/memberOffset')
703 myshape = int([writesize(
worldrank)], hsize_t)
704 myoffset = int([sum(writesize(0:
worldrank-1))], hsize_t)
705 totalshape = int([sum(writesize)], hsize_t)
709 call h5screate_simple_f(1,myshape,memspace_id,ierr,myshape)
710 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5screate_simple_f/memspace_id')
712 call h5screate_simple_f(1,totalshape,filespace_id,ierr,totalshape)
713 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5screate_simple_f/filespace_id')
715 call h5sselect_hyperslab_f(filespace_id, h5s_select_set_f, myoffset, myshape, ierr)
716 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5sselect_hyperslab_f')
720 do i = 1,
size(homogenizationatmaterialpoint,1)
721 homogenizationatmaterialpoint(i,:) = homogenizationat
726 do i = 1,
size(label)
727 where(homogenizationatmaterialpoint == i) memberatglobal = memberatlocal + sum(memberoffset(i,0:
worldrank-1)) - 1
732 call h5pset_preserve_f(plist_id, .true., ierr)
735 call h5dcreate_f(loc_id,
'materialpoint', dtype_id, filespace_id, dset_id, ierr)
736 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5dcreate_f')
738 call h5dwrite_f(dset_id, name_id, reshape(label(pack(homogenizationatmaterialpoint,.true.)),myshape), &
739 myshape, ierr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
740 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5dwrite_f/name_id')
741 call h5dwrite_f(dset_id, position_id, reshape(pack(memberatglobal,.true.),myshape), &
742 myshape, ierr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
743 if (ierr < 0)
call io_error(1,ext_msg=
'results_mapping_materialpoint: h5dwrite_f/position_id')
748 call h5pclose_f(plist_id, ierr)
749 call h5sclose_f(filespace_id, ierr)
750 call h5sclose_f(memspace_id, ierr)
751 call h5dclose_f(dset_id, ierr)
752 call h5tclose_f(dtype_id, ierr)
753 call h5tclose_f(name_id, ierr)
754 call h5tclose_f(position_id, ierr)