From eee455c0d35c287c1005ab8ca7f869d50725460a Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 18 Nov 2021 12:46:37 +0100 Subject: [PATCH] polishing --- src/phase_mechanical_elastic.f90 | 53 +++++++++++-------- ...phase_mechanical_plastic_dislotungsten.f90 | 3 +- src/phase_mechanical_plastic_dislotwin.f90 | 6 +-- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/phase_mechanical_elastic.f90 b/src/phase_mechanical_elastic.f90 index 66b941d0a..9c9a159a0 100644 --- a/src/phase_mechanical_elastic.f90 +++ b/src/phase_mechanical_elastic.f90 @@ -2,12 +2,12 @@ submodule(phase:mechanical) elastic type :: tParameters real(pReal) :: & - C_11, & - C_12, & - C_13, & - C_33, & - C_44, & - C_66 + C_11 = 0.0_pReal, & + C_12 = 0.0_pReal, & + C_13 = 0.0_pReal, & + C_33 = 0.0_pReal, & + C_44 = 0.0_pReal, & + C_66 = 0.0_pReal end type tParameters type(tParameters), allocatable, dimension(:) :: param @@ -15,7 +15,7 @@ submodule(phase:mechanical) elastic contains !-------------------------------------------------------------------------------------------------- -!> @brief Initialize elasticity +!> @brief Initialize elasticity. !-------------------------------------------------------------------------------------------------- module subroutine elastic_init(phases) @@ -45,24 +45,24 @@ module subroutine elastic_init(phases) associate(prm => param(ph)) - prm%C_11 = elastic%get_asFloat('C_11') - prm%C_12 = elastic%get_asFloat('C_12') - prm%C_44 = elastic%get_asFloat('C_44') + prm%C_11 = elastic%get_asFloat('C_11') + prm%C_12 = elastic%get_asFloat('C_12') + prm%C_44 = elastic%get_asFloat('C_44') if (any(phase_lattice(ph) == ['hP','tI'])) then - prm%C_13 = elastic%get_asFloat('C_13') - prm%C_33 = elastic%get_asFloat('C_33') + prm%C_13 = elastic%get_asFloat('C_13') + prm%C_33 = elastic%get_asFloat('C_33') end if - if (phase_lattice(ph) == 'tI') prm%C_66 = elastic%get_asFloat('C_66') + if (phase_lattice(ph) == 'tI') prm%C_66 = elastic%get_asFloat('C_66') end associate end do end subroutine elastic_init + !-------------------------------------------------------------------------------------------------- -!> @brief returns 6x6 elasticity tensor -! internal function call to return dynamic values of the elasticity tensor +!> @brief Return 6x6 elasticity tensor. !-------------------------------------------------------------------------------------------------- function get_C66(ph,en) @@ -71,6 +71,7 @@ function get_C66(ph,en) en real(pReal), dimension(6,6) :: get_C66 + associate(prm => param(ph)) get_C66 = 0.0_pReal get_C66(1,1) = prm%C_11 @@ -81,18 +82,18 @@ function get_C66(ph,en) get_C66(1,3) = prm%C_13 get_C66(3,3) = prm%C_33 end if - - if (phase_lattice(ph) == 'tI') & - get_C66(6,6) = prm%C_66 - + + if (phase_lattice(ph) == 'tI') get_C66(6,6) = prm%C_66 + get_C66 = lattice_symmetrize_C66(get_C66,phase_lattice(ph)) end associate end function get_C66 + !-------------------------------------------------------------------------------------------------- -!> @brief returns 6x6 elasticity tensor in Voigt notation +!> @brief Return 6x6 elasticity tensor. !-------------------------------------------------------------------------------------------------- module function elastic_C66(ph,en) result(C66) @@ -100,7 +101,9 @@ module function elastic_C66(ph,en) result(C66) ph, & en real(pReal), dimension(6,6) :: & - C66 + C66 + + associate(prm => param(ph)) C66 = get_C66(ph,en) @@ -110,8 +113,9 @@ module function elastic_C66(ph,en) result(C66) end function elastic_C66 + !-------------------------------------------------------------------------------------------------- -!> @brief returns value of shear modulus +!> @brief Return shear modulus. !-------------------------------------------------------------------------------------------------- module function elastic_mu(ph,en) result(mu) @@ -121,12 +125,13 @@ module function elastic_mu(ph,en) result(mu) real(pReal) :: & mu + mu = lattice_equivalent_mu(get_C66(ph,en),'voigt') end function elastic_mu !-------------------------------------------------------------------------------------------------- -!> @brief returns value of poisson ratio +!> @brief Return Poisson ratio. !-------------------------------------------------------------------------------------------------- module function elastic_nu(ph,en) result(nu) @@ -136,6 +141,7 @@ module function elastic_nu(ph,en) result(nu) real(pReal) :: & nu + nu = lattice_equivalent_nu(get_C66(ph,en),'voigt') end function elastic_nu @@ -190,6 +196,7 @@ module function phase_homogenizedC(ph,en) result(C) real(pReal), dimension(6,6) :: C integer, intent(in) :: ph, en + plasticType: select case (phase_plasticity(ph)) case (PLASTICITY_DISLOTWIN_ID) plasticType C = plastic_dislotwin_homogenizedC(ph,en) diff --git a/src/phase_mechanical_plastic_dislotungsten.f90 b/src/phase_mechanical_plastic_dislotungsten.f90 index f4ddaf7b1..102e009fe 100644 --- a/src/phase_mechanical_plastic_dislotungsten.f90 +++ b/src/phase_mechanical_plastic_dislotungsten.f90 @@ -372,8 +372,7 @@ module subroutine dislotungsten_dependentState(ph,en) real(pReal), dimension(param(ph)%sum_N_sl) :: & Lambda_sl_inv - real(pReal) :: & - mu + associate(prm => param(ph), stt => state(ph), dst => dependentState(ph)) diff --git a/src/phase_mechanical_plastic_dislotwin.f90 b/src/phase_mechanical_plastic_dislotwin.f90 index ea3ee84fc..62119c819 100644 --- a/src/phase_mechanical_plastic_dislotwin.f90 +++ b/src/phase_mechanical_plastic_dislotwin.f90 @@ -791,12 +791,10 @@ module subroutine dislotwin_dependentState(T,ph,en) dst%V_tr(:,en) = (PI/4.0_pReal)*prm%t_tr*dst%Lambda_tr(:,en)**2.0_pReal - x0 = mu*prm%b_tw**2.0_pReal/(Gamma*8.0_pReal*PI)*(2.0_pReal+nu)/& - (1.0_pReal-nu) ! ToDo: In the paper, this is the Burgers vector for slip + x0 = mu*prm%b_tw**2.0_pReal/(Gamma*8.0_pReal*PI)*(2.0_pReal+nu)/(1.0_pReal-nu) ! ToDo: In the paper, this is the Burgers vector for slip dst%tau_r_tw(:,en) = mu*prm%b_tw/(2.0_pReal*PI)*(1.0_pReal/(x0+prm%x_c_tw)+cos(pi/3.0_pReal)/x0) - x0 = mu*prm%b_tr**2.0_pReal/(Gamma*8.0_pReal*PI)*(2.0_pReal+nu)/& - (1.0_pReal-nu) ! ToDo: In the paper, this is the Burgers vector for slip + x0 = mu*prm%b_tr**2.0_pReal/(Gamma*8.0_pReal*PI)*(2.0_pReal+nu)/(1.0_pReal-nu) ! ToDo: In the paper, this is the Burgers vector for slip dst%tau_r_tr(:,en) = mu*prm%b_tr/(2.0_pReal*PI)*(1.0_pReal/(x0+prm%x_c_tr)+cos(pi/3.0_pReal)/x0) end associate