diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index b58274a74..76dc4adeb 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -407,20 +407,20 @@ module subroutine plastic_dislotungsten_results(ph,group) select case(trim(prm%output(ou))) case('rho_mob') - call results_writePhaseState(stt%rho_mob,group,trim(prm%output(ou)),prm%systems_sl, & - 'mobile dislocation density','1/m²') + call results_writeDataset(stt%rho_mob,group,trim(prm%output(ou)), & + 'mobile dislocation density','1/m²',prm%systems_sl) case('rho_dip') - call results_writePhaseState(stt%rho_dip,group,trim(prm%output(ou)),prm%systems_sl, & - 'dislocation dipole density','1/m²') + call results_writeDataset(stt%rho_dip,group,trim(prm%output(ou)), & + 'dislocation dipole density','1/m²',prm%systems_sl) case('gamma_sl') - call results_writePhaseState(stt%gamma_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'plastic shear','1') + call results_writeDataset(stt%gamma_sl,group,trim(prm%output(ou)), & + 'plastic shear','1',prm%systems_sl) case('Lambda_sl') - call results_writePhaseState(dst%Lambda_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'mean free path for slip','m') + call results_writeDataset(dst%Lambda_sl,group,trim(prm%output(ou)), & + 'mean free path for slip','m',prm%systems_sl) case('tau_pass') - call results_writePhaseState(dst%tau_pass,group,trim(prm%output(ou)),prm%systems_sl, & - 'threshold stress for slip','Pa') + call results_writeDataset(dst%tau_pass,group,trim(prm%output(ou)), & + 'threshold stress for slip','Pa',prm%systems_sl) end select enddo diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index 8aae77144..ac179d775 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -802,30 +802,30 @@ module subroutine plastic_dislotwin_results(ph,group) select case(trim(prm%output(ou))) case('rho_mob') - call results_writePhaseState(stt%rho_mob,group,trim(prm%output(ou)),prm%systems_sl, & - 'mobile dislocation density','1/m²') + call results_writeDataset(stt%rho_mob,group,trim(prm%output(ou)), & + 'mobile dislocation density','1/m²',prm%systems_sl) case('rho_dip') - call results_writePhaseState(stt%rho_dip,group,trim(prm%output(ou)),prm%systems_sl, & - 'dislocation dipole density','1/m²') + call results_writeDataset(stt%rho_dip,group,trim(prm%output(ou)), & + 'dislocation dipole density','1/m²',prm%systems_sl) case('gamma_sl') - call results_writePhaseState(stt%gamma_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'plastic shear','1') + call results_writeDataset(stt%gamma_sl,group,trim(prm%output(ou)), & + 'plastic shear','1',prm%systems_sl) case('Lambda_sl') - call results_writePhaseState(dst%Lambda_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'mean free path for slip','m') + call results_writeDataset(dst%Lambda_sl,group,trim(prm%output(ou)), & + 'mean free path for slip','m',prm%systems_sl) case('tau_pass') - call results_writePhaseState(dst%tau_pass,group,trim(prm%output(ou)),prm%systems_sl, & - 'passing stress for slip','Pa') + call results_writeDataset(dst%tau_pass,group,trim(prm%output(ou)), & + 'passing stress for slip','Pa',prm%systems_sl) case('f_tw') - call results_writePhaseState(stt%f_tw,group,trim(prm%output(ou)),prm%systems_tw, & - 'twinned volume fraction','m³/m³') + call results_writeDataset(stt%f_tw,group,trim(prm%output(ou)), & + 'twinned volume fraction','m³/m³',prm%systems_tw) case('Lambda_tw') - call results_writePhaseState(dst%Lambda_tw,group,trim(prm%output(ou)),prm%systems_tw, & - 'mean free path for twinning','m') + call results_writeDataset(dst%Lambda_tw,group,trim(prm%output(ou)), & + 'mean free path for twinning','m',prm%systems_tw) case('tau_hat_tw') - call results_writePhaseState(dst%tau_hat_tw,group,trim(prm%output(ou)),prm%systems_tw, & - 'threshold stress for twinning','Pa') + call results_writeDataset(dst%tau_hat_tw,group,trim(prm%output(ou)), & + 'threshold stress for twinning','Pa',prm%systems_tw) case('f_tr') if(prm%sum_N_tr>0) call results_writeDataset(stt%f_tr,group,trim(prm%output(ou)), & diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index 7c77ca3a0..276212576 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -363,23 +363,23 @@ module subroutine plastic_kinehardening_results(ph,group) select case(trim(prm%output(ou))) case ('xi') - call results_writePhaseState(stt%xi,group,trim(prm%output(ou)),prm%systems_sl, & - 'resistance against plastic slip','Pa') + call results_writeDataset(stt%xi,group,trim(prm%output(ou)), & + 'resistance against plastic slip','Pa',prm%systems_sl) case ('chi') - call results_writePhaseState(stt%chi,group,trim(prm%output(ou)),prm%systems_sl, & - 'back stress','Pa') + call results_writeDataset(stt%chi,group,trim(prm%output(ou)), & + 'back stress','Pa',prm%systems_sl) case ('sgn(gamma)') - call results_writePhaseState(int(stt%sgn_gamma),group,trim(prm%output(ou)),prm%systems_sl, & - 'sense of shear','1') + call results_writeDataset(int(stt%sgn_gamma),group,trim(prm%output(ou)), & + 'sense of shear','1',prm%systems_sl) case ('chi_0') - call results_writePhaseState(stt%chi_0,group,trim(prm%output(ou)),prm%systems_sl, & - 'back stress at last switch of stress sense','Pa') + call results_writeDataset(stt%chi_0,group,trim(prm%output(ou)), & + 'back stress at last switch of stress sense','Pa',prm%systems_sl) case ('gamma_0') - call results_writePhaseState(stt%gamma_0,group,trim(prm%output(ou)),prm%systems_sl, & - 'plastic shear at last switch of stress sense','1') + call results_writeDataset(stt%gamma_0,group,trim(prm%output(ou)), & + 'plastic shear at last switch of stress sense','1',prm%systems_sl) case ('gamma') - call results_writePhaseState(stt%gamma,group,trim(prm%output(ou)),prm%systems_sl, & - 'plastic shear','1') + call results_writeDataset(stt%gamma,group,trim(prm%output(ou)), & + 'plastic shear','1',prm%systems_sl) end select enddo diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 47cb1a0d8..1d22d35c2 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -1477,56 +1477,56 @@ module subroutine plastic_nonlocal_results(ph,group) select case(trim(prm%output(ou))) case('rho_u_ed_pos') - call results_writePhaseState(stt%rho_sgl_mob_edg_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive mobile edge density','1/m²') + call results_writeDataset(stt%rho_sgl_mob_edg_pos,group,trim(prm%output(ou)), & + 'positive mobile edge density','1/m²', prm%systems_sl) case('rho_b_ed_pos') - call results_writePhaseState(stt%rho_sgl_imm_edg_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive immobile edge density','1/m²') + call results_writeDataset(stt%rho_sgl_imm_edg_pos,group,trim(prm%output(ou)), & + 'positive immobile edge density','1/m²', prm%systems_sl) case('rho_u_ed_neg') - call results_writePhaseState(stt%rho_sgl_mob_edg_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative mobile edge density','1/m²') + call results_writeDataset(stt%rho_sgl_mob_edg_neg,group,trim(prm%output(ou)), & + 'negative mobile edge density','1/m²', prm%systems_sl) case('rho_b_ed_neg') - call results_writePhaseState(stt%rho_sgl_imm_edg_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative immobile edge density','1/m²') + call results_writeDataset(stt%rho_sgl_imm_edg_neg,group,trim(prm%output(ou)), & + 'negative immobile edge density','1/m²', prm%systems_sl) case('rho_d_ed') - call results_writePhaseState(stt%rho_dip_edg,group,trim(prm%output(ou)), prm%systems_sl, & - 'edge dipole density','1/m²') + call results_writeDataset(stt%rho_dip_edg,group,trim(prm%output(ou)), & + 'edge dipole density','1/m²', prm%systems_sl) case('rho_u_sc_pos') - call results_writePhaseState(stt%rho_sgl_mob_scr_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive mobile screw density','1/m²') + call results_writeDataset(stt%rho_sgl_mob_scr_pos,group,trim(prm%output(ou)), & + 'positive mobile screw density','1/m²', prm%systems_sl) case('rho_b_sc_pos') - call results_writePhaseState(stt%rho_sgl_imm_scr_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive immobile screw density','1/m²') + call results_writeDataset(stt%rho_sgl_imm_scr_pos,group,trim(prm%output(ou)), & + 'positive immobile screw density','1/m²', prm%systems_sl) case('rho_u_sc_neg') - call results_writePhaseState(stt%rho_sgl_mob_scr_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative mobile screw density','1/m²') + call results_writeDataset(stt%rho_sgl_mob_scr_neg,group,trim(prm%output(ou)), & + 'negative mobile screw density','1/m²', prm%systems_sl) case('rho_b_sc_neg') - call results_writePhaseState(stt%rho_sgl_imm_scr_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative immobile screw density','1/m²') + call results_writeDataset(stt%rho_sgl_imm_scr_neg,group,trim(prm%output(ou)), & + 'negative immobile screw density','1/m²', prm%systems_sl) case('rho_d_sc') - call results_writePhaseState(stt%rho_dip_scr,group,trim(prm%output(ou)), prm%systems_sl, & - 'screw dipole density','1/m²') + call results_writeDataset(stt%rho_dip_scr,group,trim(prm%output(ou)), & + 'screw dipole density','1/m²', prm%systems_sl) case('rho_f') - call results_writePhaseState(stt%rho_forest,group,trim(prm%output(ou)), prm%systems_sl, & - 'forest density','1/m²') + call results_writeDataset(stt%rho_forest,group,trim(prm%output(ou)), & + 'forest density','1/m²', prm%systems_sl) case('v_ed_pos') - call results_writePhaseState(stt%v_edg_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive edge velocity','m/s') + call results_writeDataset(stt%v_edg_pos,group,trim(prm%output(ou)), & + 'positive edge velocity','m/s', prm%systems_sl) case('v_ed_neg') - call results_writePhaseState(stt%v_edg_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative edge velocity','m/s') + call results_writeDataset(stt%v_edg_neg,group,trim(prm%output(ou)), & + 'negative edge velocity','m/s', prm%systems_sl) case('v_sc_pos') - call results_writePhaseState(stt%v_scr_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive srew velocity','m/s') + call results_writeDataset(stt%v_scr_pos,group,trim(prm%output(ou)), & + 'positive srew velocity','m/s', prm%systems_sl) case('v_sc_neg') - call results_writePhaseState(stt%v_scr_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative screw velocity','m/s') + call results_writeDataset(stt%v_scr_neg,group,trim(prm%output(ou)), & + 'negative screw velocity','m/s', prm%systems_sl) case('gamma') - call results_writePhaseState(stt%gamma,group,trim(prm%output(ou)), prm%systems_sl, & - 'plastic shear','1') + call results_writeDataset(stt%gamma,group,trim(prm%output(ou)), & + 'plastic shear','1', prm%systems_sl) case('tau_pass') - call results_writePhaseState(dst%tau_pass,group,trim(prm%output(ou)), prm%systems_sl, & - 'passing stress for slip','Pa') + call results_writeDataset(dst%tau_pass,group,trim(prm%output(ou)), & + 'passing stress for slip','Pa', prm%systems_sl) end select enddo diff --git a/src/phase_mechanical_plastic_phenopowerlaw.f90 b/src/phase_mechanical_plastic_phenopowerlaw.f90 index 4f66e5f18..51e347eb5 100644 --- a/src/phase_mechanical_plastic_phenopowerlaw.f90 +++ b/src/phase_mechanical_plastic_phenopowerlaw.f90 @@ -382,18 +382,18 @@ module subroutine plastic_phenopowerlaw_results(ph,group) select case(trim(prm%output(ou))) case('xi_sl') - call results_writePhaseState(stt%xi_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'resistance against plastic slip','Pa') + call results_writeDataset(stt%xi_sl,group,trim(prm%output(ou)), & + 'resistance against plastic slip','Pa',prm%systems_sl) case('gamma_sl') - call results_writePhaseState(stt%gamma_sl,group,trim(prm%output(ou)),prm%systems_sl, & - 'plastic shear','1') + call results_writeDataset(stt%gamma_sl,group,trim(prm%output(ou)), & + 'plastic shear','1',prm%systems_sl) case('xi_tw') - call results_writePhaseState(stt%xi_tw,group,trim(prm%output(ou)),prm%systems_tw, & - 'resistance against twinning','Pa') + call results_writeDataset(stt%xi_tw,group,trim(prm%output(ou)), & + 'resistance against twinning','Pa',prm%systems_tw) case('gamma_tw') - call results_writePhaseState(stt%gamma_tw,group,trim(prm%output(ou)),prm%systems_tw, & - 'twinning shear','1') + call results_writeDataset(stt%gamma_tw,group,trim(prm%output(ou)), & + 'twinning shear','1',prm%systems_tw) end select diff --git a/src/results.f90 b/src/results.f90 index ff300f37c..a5dccdaac 100644 --- a/src/results.f90 +++ b/src/results.f90 @@ -33,11 +33,6 @@ module results module procedure results_writeVectorDataset_int end interface results_writeDataset - interface results_writePhaseState - module procedure results_writePhaseState_real - module procedure results_writePhaseState_int - end interface results_writePhaseState - interface results_addAttribute module procedure results_addAttribute_str module procedure results_addAttribute_int @@ -59,7 +54,6 @@ module results results_closeGroup, & results_writeDataset, & results_writeDataset_str, & - results_writePhaseState, & results_setLink, & results_addAttribute, & results_removeLink, & @@ -385,69 +379,29 @@ end subroutine results_writeScalarDataset_real !-------------------------------------------------------------------------------------------------- !> @brief Store real vector dataset with associated metadata. !-------------------------------------------------------------------------------------------------- -subroutine results_writeVectorDataset_real(dataset,group,label,description,SIunit) +subroutine results_writeVectorDataset_real(dataset,group,label,description,SIunit,systems) character(len=*), intent(in) :: label,group,description character(len=*), intent(in), optional :: SIunit + character(len=*), intent(in), dimension(:), optional :: systems real(pReal), intent(in), dimension(:,:) :: dataset integer(HID_T) :: groupHandle + if (present(systems)) then + if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) + endif + groupHandle = results_openGroup(group) call HDF5_write(dataset,groupHandle,label) call executionStamp(group//'/'//label,description,SIunit) + if (present(systems)) call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) call HDF5_closeGroup(groupHandle) end subroutine results_writeVectorDataset_real -!-------------------------------------------------------------------------------------------------- -!> @brief Store real vector dataset with associated metadata for slip -!-------------------------------------------------------------------------------------------------- -subroutine results_writePhaseState_real(dataset,group,label,systems,description,SIunit) - - character(len=*), intent(in) :: label,group,description,SIunit - real(pReal), intent(in), dimension(:,:) :: dataset - character(len=*), intent(in), dimension(:) :: systems - - integer(HID_T) :: groupHandle - - - if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) - - groupHandle = results_openGroup(group) - call HDF5_write(dataset,groupHandle,label) - call executionStamp(group//'/'//label,description,SIunit) - call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) - call HDF5_closeGroup(groupHandle) - -end subroutine results_writePhaseState_real - - -!-------------------------------------------------------------------------------------------------- -!> @brief Store real vector dataset with associated metadata for slip -!-------------------------------------------------------------------------------------------------- -subroutine results_writePhaseState_int(dataset,group,label,systems,description,SIunit) - - character(len=*), intent(in) :: label,group,description,SIunit - integer, intent(in), dimension(:,:) :: dataset - character(len=*), intent(in), dimension(:) :: systems - - integer(HID_T) :: groupHandle - - - if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) - - groupHandle = results_openGroup(group) - call HDF5_write(dataset,groupHandle,label) - call executionStamp(group//'/'//label,description,SIunit) - call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) - call HDF5_closeGroup(groupHandle) - -end subroutine results_writePhaseState_int - - !-------------------------------------------------------------------------------------------------- !> @brief Store real tensor dataset with associated metadata. !> @details Data is transposed to compenstate transposed storage order. @@ -491,18 +445,24 @@ end subroutine results_writeTensorDataset_real !-------------------------------------------------------------------------------------------------- !> @brief Store integer vector dataset with associated metadata. !-------------------------------------------------------------------------------------------------- -subroutine results_writeVectorDataset_int(dataset,group,label,description,SIunit) +subroutine results_writeVectorDataset_int(dataset,group,label,description,SIunit,systems) character(len=*), intent(in) :: label,group,description character(len=*), intent(in), optional :: SIunit + character(len=*), intent(in), dimension(:), optional :: systems integer, intent(in), dimension(:,:) :: dataset integer(HID_T) :: groupHandle + if (present(systems)) then + if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe also implement for other results_write (not sure about scalar) + endif + groupHandle = results_openGroup(group) call HDF5_write(dataset,groupHandle,label) call executionStamp(group//'/'//label,description,SIunit) + if (present(systems)) call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) call HDF5_closeGroup(groupHandle) end subroutine results_writeVectorDataset_int