function [stress sigma_plastic sigma_viscous mechanism] = stress_function_cellmat(Tg_0,T,Tg,eps_dot,eps) k_b = 1.38064852E-23; % Boltzmann Constant % ree-eyring data v = 2.5E-27; Q = 7.31E-19; eps_dot_0 = 10E56; % viscous flow data eta_0 = 2.788E6; C1 = 1.4; C2 = 17.3; T_Tg = T/Tg; % calculate stresses for each regime corresponding to eps_dot and T/Tg sigma_plastic = k_b*T_Tg*Tg_0/v*asinh(eps_dot/eps_dot_0*exp(Q/(k_b*T_Tg*(Tg_0)))); %no pressure dependency, can be added of course sigma_viscous = 3*eps_dot*eta_0*exp((-log(10)*C1*(T_Tg-1)/(C2/Tg_0 + T_Tg -1))); if T_Tg < 1 stress = sigma_plastic; mechanism = 1; elseif sigma_plastic <= sigma_viscous stress = sigma_plastic; mechanism = 1; elseif sigma_plastic > sigma_viscous stress = sigma_viscous; mechanism = 2; end