From bc4b79a3a28d64da8231ff8a9426d5438c353b92 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 4 Apr 2019 10:04:44 +0200 Subject: [PATCH] writing results out credits to Vitesh --- src/constitutive.f90 | 41 +++++++++++++---------- src/plastic_disloUCLA.f90 | 4 +-- src/plastic_dislotwin.f90 | 54 ++++++++++++++++++++++++------ src/plastic_kinematichardening.f90 | 2 +- src/plastic_nonlocal.f90 | 2 +- src/plastic_phenopowerlaw.f90 | 1 + 6 files changed, 72 insertions(+), 32 deletions(-) diff --git a/src/constitutive.f90 b/src/constitutive.f90 index c6978915f..ada022e37 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -1109,35 +1109,42 @@ subroutine constitutive_results() plastic_nonlocal_results implicit none - integer :: p - call HDF5_closeGroup(results_addGroup('current/phase')) - do p=1,size(config_name_phase) - call HDF5_closeGroup(results_addGroup('current/phase/'//trim(config_name_phase(p)))) + integer :: p + character(len=256) :: group + character(len=16) :: i + + call HDF5_closeGroup(results_addGroup('current/constitutive')) + + do p=1,size(config_name_phase) + write(i,('(i2.2)')) p ! allow 99 groups + group = trim('current/constitutive')//'/'//trim(i)//'_'//trim(config_name_phase(p)) + call HDF5_closeGroup(results_addGroup(group)) + group = trim(group)//'/'//'plastic' + + call HDF5_closeGroup(results_addGroup(group)) select case(material_phase_plasticity_type(p)) case(PLASTICITY_ISOTROPIC_ID) - call plastic_isotropic_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) + call plastic_isotropic_results(phase_plasticityInstance(p),group) case(PLASTICITY_PHENOPOWERLAW_ID) - call plastic_phenopowerlaw_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) + call plastic_phenopowerlaw_results(phase_plasticityInstance(p),group) - case(PLASTICITY_KINEHARDENING_ID) - call plastic_kinehardening_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) + case(PLASTICITY_KINEHARDENING_ID) + call plastic_kinehardening_results(phase_plasticityInstance(p),group) - case(PLASTICITY_DISLOTWIN_ID) - call plastic_dislotwin_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) + case(PLASTICITY_DISLOTWIN_ID) + call plastic_dislotwin_results(phase_plasticityInstance(p),group) - case(PLASTICITY_DISLOUCLA_ID) - call plastic_disloUCLA_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) + case(PLASTICITY_DISLOUCLA_ID) + call plastic_disloUCLA_results(phase_plasticityInstance(p),group) - case(PLASTICITY_NONLOCAL_ID) - call plastic_nonlocal_results(phase_plasticityInstance(p),'current/phase/'//trim(config_name_phase(p))) - + case(PLASTICITY_NONLOCAL_ID) + call plastic_nonlocal_results(phase_plasticityInstance(p),group) end select - enddo - + enddo #endif diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 99444421b..4fb83a6ce 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -574,10 +574,10 @@ subroutine plastic_disloUCLA_results(instance,group) select case(prm%outputID(o)) case (rho_mob_ID) call results_writeDataset(group,stt%rho_mob,'rho_mob',& - 'mobile dislocation density','1/m^2') + 'mobile dislocation density','1/m²') case (rho_dip_ID) call results_writeDataset(group,stt%rho_dip,'rho_dip',& - 'dislocation dipole density''1/m^2') + 'dislocation dipole density''1/m²') case (dot_gamma_sl_ID) call results_writeDataset(group,stt%gamma_sl,'dot_gamma_sl',& 'plastic slip','1') diff --git a/src/plastic_dislotwin.f90 b/src/plastic_dislotwin.f90 index cb13265b4..1ad6f9763 100644 --- a/src/plastic_dislotwin.f90 +++ b/src/plastic_dislotwin.f90 @@ -148,7 +148,7 @@ module plastic_dislotwin type(tDislotwinState), allocatable, dimension(:), private :: & dotState, & state - type(tDislotwinMicrostructure), allocatable, dimension(:), private :: microstructure + type(tDislotwinMicrostructure), allocatable, dimension(:), private :: dependentState public :: & plastic_dislotwin_init, & @@ -241,14 +241,14 @@ subroutine plastic_dislotwin_init allocate(param(Ninstance)) allocate(state(Ninstance)) allocate(dotState(Ninstance)) - allocate(microstructure(Ninstance)) + allocate(dependentState(Ninstance)) do p = 1, size(phase_plasticity) if (phase_plasticity(p) /= PLASTICITY_DISLOTWIN_ID) cycle associate(prm => param(phase_plasticityInstance(p)), & dot => dotState(phase_plasticityInstance(p)), & stt => state(phase_plasticityInstance(p)), & - dst => microstructure(phase_plasticityInstance(p)), & + dst => dependentState(phase_plasticityInstance(p)), & config => config_phase(p)) prm%aTol_rho = config%getFloat('atol_rho', defaultVal=0.0_pReal) @@ -801,7 +801,7 @@ subroutine plastic_dislotwin_dotState(Mp,T,instance,of) dot_gamma_tr associate(prm => param(instance), stt => state(instance), & - dot => dotstate(instance), dst => microstructure(instance)) + dot => dotstate(instance), dst => dependentState(instance)) f_unrotated = 1.0_pReal & - sum(stt%f_tw(1:prm%sum_N_tw,of)) & @@ -897,7 +897,7 @@ subroutine plastic_dislotwin_dependentState(T,instance,of) associate(prm => param(instance),& stt => state(instance),& - dst => microstructure(instance)) + dst => dependentState(instance)) sumf_twin = sum(stt%f_tw(1:prm%sum_N_tw,of)) sumf_trans = sum(stt%f_tr(1:prm%sum_N_tr,of)) @@ -1002,7 +1002,7 @@ function plastic_dislotwin_postResults(Mp,T,instance,of) result(postResults) integer :: & o,c,j - associate(prm => param(instance), stt => state(instance), dst => microstructure(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) c = 0 @@ -1063,7 +1063,7 @@ end function plastic_dislotwin_postResults !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- subroutine plastic_dislotwin_results(instance,group) -#if defined(PETSc) || defined(DAMASKHDF5) +#if defined(PETSc) || defined(DAMASK_HDF5) use results implicit none @@ -1071,12 +1071,44 @@ subroutine plastic_dislotwin_results(instance,group) character(len=*) :: group integer :: o - associate(prm => param(instance), stt => state(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) outputsLoop: do o = 1,size(prm%outputID) select case(prm%outputID(o)) + + case (rho_mob_ID) + call results_writeDataset(group,stt%rho_mob,'rho_mob',& + 'mobile dislocation density','1/m²') + case (rho_dip_ID) + call results_writeDataset(group,stt%rho_dip,'rho_dip',& + 'dislocation dipole density''1/m²') + case (dot_gamma_sl_ID) + call results_writeDataset(group,stt%gamma_sl,'dot_gamma_sl',& + 'plastic slip','1') + case (Lambda_sl_ID) + call results_writeDataset(group,dst%Lambda_sl,'Lambda_sl',& + 'mean free path for slip','m') + case (threshold_stress_slip_ID) + call results_writeDataset(group,dst%tau_pass,'tau_pass',& + 'passing stress for slip','Pa') + + case (f_tw_ID) + call results_writeDataset(group,stt%f_tw,'f_tw',& + 'twinned volume fraction','m³/m³') + case (Lambda_tw_ID) + call results_writeDataset(group,dst%Lambda_tw,'Lambda_tw',& + 'mean free path for twinning','m') + case (tau_hat_tw_ID) + call results_writeDataset(group,dst%tau_hat_tw,'tau_hat_tw',& + 'threshold stress for twinnin','Pa') + + case (f_tr_ID) + call results_writeDataset(group,stt%f_tr,'f_tr',& + 'martensite volume fraction','m³/m³') + end select enddo outputsLoop end associate + #else integer, intent(in) :: instance character(len=*) :: group @@ -1130,7 +1162,7 @@ pure subroutine kinetics_slip(Mp,T,instance,of, & tau_eff !< effective resolved stress integer :: i - associate(prm => param(instance), stt => state(instance), dst => microstructure(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) do i = 1, prm%sum_N_sl tau(i) = math_mul33xx33(Mp,prm%P_sl(1:3,1:3,i)) @@ -1203,7 +1235,7 @@ pure subroutine kinetics_twin(Mp,T,dot_gamma_sl,instance,of,& integer :: i,s1,s2 - associate(prm => param(instance), stt => state(instance), dst => microstructure(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) do i = 1, prm%sum_N_tw tau(i) = math_mul33xx33(Mp,prm%P_tw(1:3,1:3,i)) @@ -1275,7 +1307,7 @@ pure subroutine kinetics_trans(Mp,T,dot_gamma_sl,instance,of,& integer :: i,s1,s2 - associate(prm => param(instance), stt => state(instance), dst => microstructure(instance)) + associate(prm => param(instance), stt => state(instance), dst => dependentState(instance)) do i = 1, prm%sum_N_tr tau(i) = math_mul33xx33(Mp,prm%P_tr(1:3,1:3,i)) diff --git a/src/plastic_kinematichardening.f90 b/src/plastic_kinematichardening.f90 index 0a4a6b3bc..fa92be298 100644 --- a/src/plastic_kinematichardening.f90 +++ b/src/plastic_kinematichardening.f90 @@ -550,7 +550,7 @@ end function plastic_kinehardening_postResults !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- subroutine plastic_kinehardening_results(instance,group) -#if defined(PETSc) || defined(DAMASKHDF5) +#if defined(PETSc) || defined(DAMASK_HDF5) use results implicit none diff --git a/src/plastic_nonlocal.f90 b/src/plastic_nonlocal.f90 index f5f48ed11..0eec39ba1 100644 --- a/src/plastic_nonlocal.f90 +++ b/src/plastic_nonlocal.f90 @@ -2402,7 +2402,7 @@ end function getRho !> @brief writes results to HDF5 output file !-------------------------------------------------------------------------------------------------- subroutine plastic_nonlocal_results(instance,group) -#if defined(PETSc) || defined(DAMASKHDF5) +#if defined(PETSc) || defined(DAMASK_HDF5) use results implicit none diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index c2a4843f2..de84fb12d 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -575,6 +575,7 @@ subroutine plastic_phenopowerlaw_results(instance,group) associate(prm => param(instance), stt => state(instance)) outputsLoop: do o = 1,size(prm%outputID) select case(prm%outputID(o)) + case (resistance_slip_ID) call results_writeDataset(group,stt%xi_slip, 'xi_slip', & 'resistance against plastic slip','Pa')