From 28ebc8ef1a2a258497a4f3ac2438e760b1ea6b22 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Thu, 22 Jun 2023 14:43:55 -0400 Subject: [PATCH] inline math_expand for other constitutive laws --- src/phase_mechanical_plastic_isotropic.f90 | 5 +- ...phase_mechanical_plastic_kinehardening.f90 | 42 +++++------ src/phase_mechanical_plastic_none.f90 | 5 +- src/phase_mechanical_plastic_nonlocal.f90 | 69 ++++++++----------- 4 files changed, 55 insertions(+), 66 deletions(-) diff --git a/src/phase_mechanical_plastic_isotropic.f90 b/src/phase_mechanical_plastic_isotropic.f90 index eff65f9f3..be859dddb 100644 --- a/src/phase_mechanical_plastic_isotropic.f90 +++ b/src/phase_mechanical_plastic_isotropic.f90 @@ -82,13 +82,14 @@ module function plastic_isotropic_init() result(myPlasticity) do ph = 1, phases%length if (.not. myPlasticity(ph)) cycle - associate(prm => param(ph), stt => state(ph)) + associate(prm => param(ph), & + stt => state(ph)) phase => phases%get_dict(ph) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs diff --git a/src/phase_mechanical_plastic_kinehardening.f90 b/src/phase_mechanical_plastic_kinehardening.f90 index ad2543b83..0bebe3368 100644 --- a/src/phase_mechanical_plastic_kinehardening.f90 +++ b/src/phase_mechanical_plastic_kinehardening.f90 @@ -116,14 +116,15 @@ module function plastic_kinehardening_init() result(myPlasticity) do ph = 1, phases%length if (.not. myPlasticity(ph)) cycle - associate(prm => param(ph), stt => state(ph), dlt => deltaState(ph), & + associate(prm => param(ph), & + stt => state(ph), dlt => deltaState(ph), & idx_dot => indexDotState(ph)) phase => phases%get_dict(ph) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs @@ -150,28 +151,21 @@ module function plastic_kinehardening_init() result(myPlasticity) prm%P_nS_pos = prm%P prm%P_nS_neg = prm%P end if - prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & - phase_lattice(ph)) - - xi_0 = pl%get_as1dReal('xi_0', requiredSize=size(N_sl)) - prm%xi_inf = pl%get_as1dReal('xi_inf', requiredSize=size(N_sl)) - prm%chi_inf = pl%get_as1dReal('chi_inf', requiredSize=size(N_sl)) - prm%h_0_xi = pl%get_as1dReal('h_0_xi', requiredSize=size(N_sl)) - prm%h_0_chi = pl%get_as1dReal('h_0_chi', requiredSize=size(N_sl)) - prm%h_inf_xi = pl%get_as1dReal('h_inf_xi', requiredSize=size(N_sl)) - prm%h_inf_chi = pl%get_as1dReal('h_inf_chi', requiredSize=size(N_sl)) prm%dot_gamma_0 = pl%get_asReal('dot_gamma_0') prm%n = pl%get_asReal('n') - ! expand: family => system - xi_0 = math_expand(xi_0, N_sl) - prm%xi_inf = math_expand(prm%xi_inf, N_sl) - prm%chi_inf = math_expand(prm%chi_inf, N_sl) - prm%h_0_xi = math_expand(prm%h_0_xi, N_sl) - prm%h_0_chi = math_expand(prm%h_0_chi, N_sl) - prm%h_inf_xi = math_expand(prm%h_inf_xi, N_sl) - prm%h_inf_chi = math_expand(prm%h_inf_chi, N_sl) + prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dReal('h_sl-sl'), & + phase_lattice(ph)) + + xi_0 = math_expand(pl%get_as1dReal('xi_0', requiredSize=size(N_sl)),N_sl) + prm%xi_inf = math_expand(pl%get_as1dReal('xi_inf', requiredSize=size(N_sl)),N_sl) + prm%chi_inf = math_expand(pl%get_as1dReal('chi_inf', requiredSize=size(N_sl)),N_sl) + prm%h_0_xi = math_expand(pl%get_as1dReal('h_0_xi', requiredSize=size(N_sl)),N_sl) + prm%h_0_chi = math_expand(pl%get_as1dReal('h_0_chi', requiredSize=size(N_sl)),N_sl) + prm%h_inf_xi = math_expand(pl%get_as1dReal('h_inf_xi', requiredSize=size(N_sl)),N_sl) + prm%h_inf_chi = math_expand(pl%get_as1dReal('h_inf_chi', requiredSize=size(N_sl)),N_sl) + !-------------------------------------------------------------------------------------------------- ! sanity checks @@ -183,7 +177,13 @@ module function plastic_kinehardening_init() result(myPlasticity) else slipActive xi_0 = emptyRealArray - allocate(prm%xi_inf,prm%chi_inf,prm%h_0_xi,prm%h_inf_xi,prm%h_0_chi,prm%h_inf_chi,source=emptyRealArray) + allocate(prm%xi_inf, & + prm%chi_inf, & + prm%h_0_xi, & + prm%h_0_chi, & + prm%h_inf_xi, & + prm%h_inf_chi, & + source=emptyRealArray) allocate(prm%h_sl_sl(0,0)) end if slipActive diff --git a/src/phase_mechanical_plastic_none.f90 b/src/phase_mechanical_plastic_none.f90 index b79a61183..748e0579b 100644 --- a/src/phase_mechanical_plastic_none.f90 +++ b/src/phase_mechanical_plastic_none.f90 @@ -29,9 +29,12 @@ module function plastic_none_init() result(myPlasticity) phases => config_material%get_dict('phase') + do ph = 1, phases%length if (.not. myPlasticity(ph)) cycle - print'(a,i0,a)', ' phase ',ph + + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) + call phase_allocateState(plasticState(ph),count(material_ID_phase == ph),0,0,0) end do diff --git a/src/phase_mechanical_plastic_nonlocal.f90 b/src/phase_mechanical_plastic_nonlocal.f90 index d50f562ca..4e45066b5 100644 --- a/src/phase_mechanical_plastic_nonlocal.f90 +++ b/src/phase_mechanical_plastic_nonlocal.f90 @@ -92,17 +92,13 @@ submodule(phase:plastic) nonlocal mu, & nu real(pREAL), dimension(:), allocatable :: & - d_ed, & !< minimum stable edge dipole height - d_sc, & !< minimum stable screw dipole height - tau_Peierls_ed, & - tau_Peierls_sc, & i_sl, & !< mean free path prefactor for each b_sl !< absolute length of Burgers vector [m] real(pREAL), dimension(:,:), allocatable :: & slip_normal, & slip_direction, & slip_transverse, & - minDipoleHeight, & ! edge and screw + minDipoleHeight, & ! minimum stable dipole height edge and screw peierlsstress, & ! edge and screw h_sl_sl ,& !< coefficients for slip-slip interaction forestProjection_Edge, & !< matrix of forest projections of edge dislocations @@ -236,7 +232,7 @@ module function plastic_nonlocal_init() result(myPlasticity) mech => phase%get_dict('mechanical') pl => mech%get_dict('plastic') - print'(/,1x,a,i0,a)', 'phase ',ph,': '//phases%key(ph) + print'(/,1x,a,1x,i0,a)', 'phase',ph,': '//phases%key(ph) refs = config_listReferences(pl,indent=3) if (len(refs) > 0) print'(/,1x,a)', refs @@ -295,52 +291,41 @@ module function plastic_nonlocal_init() result(myPlasticity) ini%rho_d_ed_0 = pl%get_as1dReal('rho_d_ed_0', requiredSize=size(ini%N_sl)) ini%rho_d_sc_0 = pl%get_as1dReal('rho_d_sc_0', requiredSize=size(ini%N_sl)) - prm%i_sl = pl%get_as1dReal('i_sl', requiredSize=size(ini%N_sl)) - prm%b_sl = pl%get_as1dReal('b_sl', requiredSize=size(ini%N_sl)) + prm%i_sl = math_expand(pl%get_as1dReal('i_sl', requiredSize=size(ini%N_sl)),ini%N_sl) + prm%b_sl = math_expand(pl%get_as1dReal('b_sl', requiredSize=size(ini%N_sl)),ini%N_sl) - prm%i_sl = math_expand(prm%i_sl,ini%N_sl) - prm%b_sl = math_expand(prm%b_sl,ini%N_sl) - - prm%d_ed = pl%get_as1dReal('d_ed', requiredSize=size(ini%N_sl)) - prm%d_sc = pl%get_as1dReal('d_sc', requiredSize=size(ini%N_sl)) - prm%d_ed = math_expand(prm%d_ed,ini%N_sl) - prm%d_sc = math_expand(prm%d_sc,ini%N_sl) allocate(prm%minDipoleHeight(prm%sum_N_sl,2)) - prm%minDipoleHeight(:,1) = prm%d_ed - prm%minDipoleHeight(:,2) = prm%d_sc + prm%minDipoleHeight(:,1) = math_expand(pl%get_as1dReal('d_ed', requiredSize=size(ini%N_sl)),ini%N_sl) + prm%minDipoleHeight(:,2) = math_expand(pl%get_as1dReal('d_sc', requiredSize=size(ini%N_sl)),ini%N_sl) - prm%tau_Peierls_ed = pl%get_as1dReal('tau_Peierls_ed', requiredSize=size(ini%N_sl)) - prm%tau_Peierls_sc = pl%get_as1dReal('tau_Peierls_sc', requiredSize=size(ini%N_sl)) - prm%tau_Peierls_ed = math_expand(prm%tau_Peierls_ed,ini%N_sl) - prm%tau_Peierls_sc = math_expand(prm%tau_Peierls_sc,ini%N_sl) allocate(prm%peierlsstress(prm%sum_N_sl,2)) - prm%peierlsstress(:,1) = prm%tau_Peierls_ed - prm%peierlsstress(:,2) = prm%tau_Peierls_sc + prm%peierlsstress(:,1) = math_expand(pl%get_as1dReal('tau_Peierls_ed', requiredSize=size(ini%N_sl)),ini%N_sl) + prm%peierlsstress(:,2) = math_expand(pl%get_as1dReal('tau_Peierls_sc', requiredSize=size(ini%N_sl)),ini%N_sl) - prm%rho_significant = pl%get_asReal('rho_significant') - prm%rho_min = pl%get_asReal('rho_min', 0.0_pREAL) - prm%C_CFL = pl%get_asReal('C_CFL',defaultVal=2.0_pREAL) + prm%rho_significant = pl%get_asReal('rho_significant') + prm%rho_min = pl%get_asReal('rho_min', 0.0_pREAL) + prm%C_CFL = pl%get_asReal('C_CFL',defaultVal=2.0_pREAL) - prm%V_at = pl%get_asReal('V_at') - prm%D_0 = pl%get_asReal('D_0') - prm%Q_cl = pl%get_asReal('Q_cl') - prm%f_F = pl%get_asReal('f_F') - prm%f_ed = pl%get_asReal('f_ed') - prm%w = pl%get_asReal('w') - prm%Q_sol = pl%get_asReal('Q_sol') - prm%f_sol = pl%get_asReal('f_sol') - prm%c_sol = pl%get_asReal('c_sol') + prm%V_at = pl%get_asReal('V_at') + prm%D_0 = pl%get_asReal('D_0') + prm%Q_cl = pl%get_asReal('Q_cl') + prm%f_F = pl%get_asReal('f_F') + prm%f_ed = pl%get_asReal('f_ed') + prm%w = pl%get_asReal('w') + prm%Q_sol = pl%get_asReal('Q_sol') + prm%f_sol = pl%get_asReal('f_sol') + prm%c_sol = pl%get_asReal('c_sol') - prm%p = pl%get_asReal('p_sl') - prm%q = pl%get_asReal('q_sl') - prm%B = pl%get_asReal('B') - prm%nu_a = pl%get_asReal('nu_a') + prm%p = pl%get_asReal('p_sl') + prm%q = pl%get_asReal('q_sl') + prm%B = pl%get_asReal('B') + prm%nu_a = pl%get_asReal('nu_a') ! ToDo: discuss logic - ini%sigma_rho_u = pl%get_asReal('sigma_rho_u') - ini%random_rho_u = pl%get_asReal('random_rho_u',defaultVal= 0.0_pREAL) + ini%sigma_rho_u = pl%get_asReal('sigma_rho_u') + ini%random_rho_u = pl%get_asReal('random_rho_u',defaultVal= 0.0_pREAL) if (pl%contains('random_rho_u')) & - ini%random_rho_u_binning = pl%get_asReal('random_rho_u_binning',defaultVal=0.0_pREAL) !ToDo: useful default? + ini%random_rho_u_binning = pl%get_asReal('random_rho_u_binning',defaultVal=0.0_pREAL) !ToDo: useful default? ! if (rhoSglRandom(instance) < 0.0_pREAL) & ! if (rhoSglRandomBinning(instance) <= 0.0_pREAL) &