diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index 94d9c52e7..b58274a74 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -402,7 +402,7 @@ module subroutine plastic_dislotungsten_results(ph,group) associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) - outputsLoop: do ou = 1,size(prm%output) + do ou = 1,size(prm%output) select case(trim(prm%output(ou))) @@ -423,7 +423,7 @@ module subroutine plastic_dislotungsten_results(ph,group) 'threshold stress for slip','Pa') end select - enddo outputsLoop + enddo end associate diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index f1c9b0332..7c77ca3a0 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -30,6 +30,8 @@ submodule(phase:plastic) kinehardening nonSchmidActive = .false. character(len=pStringLen), allocatable, dimension(:) :: & output + character(len=:), allocatable, dimension(:) :: & + systems_sl end type tParameters type :: tKinehardeningState @@ -40,7 +42,6 @@ submodule(phase:plastic) kinehardening gamma, & !< accumulated (absolute) shear gamma_0, & !< accumulated shear at last switch of stress sense sgn_gamma !< sense of acting shear stress (-1 or +1) - end type tKinehardeningState !-------------------------------------------------------------------------------------------------- @@ -113,6 +114,7 @@ module function plastic_kinehardening_init() result(myPlasticity) N_sl = pl%get_as1dInt('N_sl',defaultVal=emptyIntArray) prm%sum_N_sl = sum(abs(N_sl)) slipActive: if (prm%sum_N_sl > 0) then + prm%systems_sl = lattice_labels_slip(N_sl,phase_lattice(ph)) prm%P = lattice_SchmidMatrix_slip(N_sl,phase_lattice(ph),phase_cOverA(ph)) if (phase_lattice(ph) == 'cI') then @@ -351,31 +353,37 @@ module subroutine plastic_kinehardening_results(ph,group) integer, intent(in) :: ph character(len=*), intent(in) :: group - integer :: o + integer :: ou + associate(prm => param(ph), stt => state(ph)) - outputsLoop: do o = 1,size(prm%output) - select case(trim(prm%output(o))) - case ('xi') - if(prm%sum_N_sl>0) call results_writeDataset(stt%xi,group,trim(prm%output(o)), & - 'resistance against plastic slip','Pa') - case ('chi') - if(prm%sum_N_sl>0) call results_writeDataset(stt%chi,group,trim(prm%output(o)), & - 'back stress','Pa') - case ('sgn(gamma)') - if(prm%sum_N_sl>0) call results_writeDataset(int(stt%sgn_gamma),group,trim(prm%output(o)), & - 'sense of shear','1') - case ('chi_0') - if(prm%sum_N_sl>0) call results_writeDataset(stt%chi_0,group,trim(prm%output(o)), & - 'back stress at last switch of stress sense','Pa') - case ('gamma_0') - if(prm%sum_N_sl>0) call results_writeDataset(stt%gamma_0,group,trim(prm%output(o)), & - 'plastic shear at last switch of stress sense','1') - case ('gamma') - if(prm%sum_N_sl>0) call results_writeDataset(stt%gamma,group,trim(prm%output(o)), & - 'plastic shear','1') - end select - enddo outputsLoop + + do ou = 1,size(prm%output) + + 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') + case ('chi') + call results_writePhaseState(stt%chi,group,trim(prm%output(ou)),prm%systems_sl, & + 'back stress','Pa') + case ('sgn(gamma)') + call results_writePhaseState(int(stt%sgn_gamma),group,trim(prm%output(ou)),prm%systems_sl, & + 'sense of shear','1') + 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') + 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') + case ('gamma') + call results_writePhaseState(stt%gamma,group,trim(prm%output(ou)),prm%systems_sl, & + 'plastic shear','1') + end select + + enddo + end associate end subroutine plastic_kinehardening_results diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index 863d115a4..47cb1a0d8 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -1474,62 +1474,62 @@ module subroutine plastic_nonlocal_results(ph,group) do ou = 1,size(prm%output) - select case(trim(prm%output(ou))) + 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²') - 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²') - 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²') - 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²') - case('rho_d_ed') - call results_writePhaseState(stt%rho_dip_edg,group,trim(prm%output(ou)), prm%systems_sl, & - 'edge dipole density','1/m²') - 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²') - 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²') - 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²') - 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²') - case('rho_d_sc') - call results_writePhaseState(stt%rho_dip_scr,group,trim(prm%output(ou)), prm%systems_sl, & - 'screw dipole density','1/m²') - case('rho_f') - call results_writePhaseState(stt%rho_forest,group,trim(prm%output(ou)), prm%systems_sl, & - 'forest density','1/m²') - case('v_ed_pos') - call results_writePhaseState(stt%v_edg_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive edge velocity','m/s') - case('v_ed_neg') - call results_writePhaseState(stt%v_edg_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative edge velocity','m/s') - case('v_sc_pos') - call results_writePhaseState(stt%v_scr_pos,group,trim(prm%output(ou)), prm%systems_sl, & - 'positive srew velocity','m/s') - case('v_sc_neg') - call results_writePhaseState(stt%v_scr_neg,group,trim(prm%output(ou)), prm%systems_sl, & - 'negative screw velocity','m/s') - case('gamma') - call results_writePhaseState(stt%gamma,group,trim(prm%output(ou)), prm%systems_sl, & - 'plastic shear','1') - case('tau_pass') - call results_writePhaseState(dst%tau_pass,group,trim(prm%output(ou)), prm%systems_sl, & - 'passing stress for slip','Pa') - end select + 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²') + 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²') + 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²') + 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²') + case('rho_d_ed') + call results_writePhaseState(stt%rho_dip_edg,group,trim(prm%output(ou)), prm%systems_sl, & + 'edge dipole density','1/m²') + 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²') + 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²') + 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²') + 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²') + case('rho_d_sc') + call results_writePhaseState(stt%rho_dip_scr,group,trim(prm%output(ou)), prm%systems_sl, & + 'screw dipole density','1/m²') + case('rho_f') + call results_writePhaseState(stt%rho_forest,group,trim(prm%output(ou)), prm%systems_sl, & + 'forest density','1/m²') + case('v_ed_pos') + call results_writePhaseState(stt%v_edg_pos,group,trim(prm%output(ou)), prm%systems_sl, & + 'positive edge velocity','m/s') + case('v_ed_neg') + call results_writePhaseState(stt%v_edg_neg,group,trim(prm%output(ou)), prm%systems_sl, & + 'negative edge velocity','m/s') + case('v_sc_pos') + call results_writePhaseState(stt%v_scr_pos,group,trim(prm%output(ou)), prm%systems_sl, & + 'positive srew velocity','m/s') + case('v_sc_neg') + call results_writePhaseState(stt%v_scr_neg,group,trim(prm%output(ou)), prm%systems_sl, & + 'negative screw velocity','m/s') + case('gamma') + call results_writePhaseState(stt%gamma,group,trim(prm%output(ou)), prm%systems_sl, & + 'plastic shear','1') + case('tau_pass') + call results_writePhaseState(dst%tau_pass,group,trim(prm%output(ou)), prm%systems_sl, & + 'passing stress for slip','Pa') + end select - enddo + enddo end associate diff --git a/src/results.f90 b/src/results.f90 index 79745a2f3..970175712 100644 --- a/src/results.f90 +++ b/src/results.f90 @@ -33,6 +33,11 @@ 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 @@ -361,7 +366,7 @@ end subroutine results_writeVectorDataset_real !-------------------------------------------------------------------------------------------------- !> @brief Store real vector dataset with associated metadata for slip !-------------------------------------------------------------------------------------------------- -subroutine results_writePhaseState(dataset,group,label,systems,description,SIunit) +subroutine results_writePhaseState_real(dataset,group,label,systems,description,SIunit) character(len=*), intent(in) :: label,group,description,SIunit real(pReal), intent(in), dimension(:,:) :: dataset @@ -370,7 +375,7 @@ subroutine results_writePhaseState(dataset,group,label,systems,description,SIuni integer(HID_T) :: groupHandle - if (size(systems)*size(dataset,2) == 0 ) return !ToDo: maybe use for other results_write (not sure about scalar) + 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) @@ -378,7 +383,30 @@ subroutine results_writePhaseState(dataset,group,label,systems,description,SIuni call HDF5_addAttribute(resultsFile,'systems',systems,group//'/'//label) call HDF5_closeGroup(groupHandle) -end subroutine results_writePhaseState +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 !--------------------------------------------------------------------------------------------------