Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.42 KB | None | 0 0
  1. % J2 plasticity material subroutine with isotropic hardening.
  2. function [sv, C] = get_stress(sv, Ce, H, deps)
  3.     % sv is a structure w/ two fields
  4.     % sv.sig is a 4x1 vector of the stress components  [sxx, syy, sxy, szz].
  5.     % sv.k is the current value of the yield stress.
  6.    
  7.     % Compute trial stress (Ce is given an extra row to update szz).
  8.     sv.sig = sv.sig + [Ce; Ce(1,2), Ce(1,2), 0]*deps;
  9.     % Compute pressure and deviatoric stress.
  10.     p = -(sv.sig(1) + sv.sig(2) + sv.sig(4))/3.0;
  11.     s_tr = sv.sig + p*[1;1;0;1];
  12.  
  13.     % Deviatoric stress norm; include sxy twice due to voigt notation.
  14.     a = norm([s_tr; s_tr(3)]);
  15.     if a < sv.k,
  16.         C = Ce;
  17.     else
  18.         % Solve for plastic increment.
  19.         nhat = s_tr/a;
  20.         mu = Ce(3,3);
  21.         dlambda = (a-sv.k) / (2.0*mu+H);
  22.  
  23.         % Conversion from engineering strain.
  24.         s = diag([2,2,1,2]);
  25.         % Update stress and yield strength.
  26.         sv.sig = sv.sig - s*mu*dlambda*nhat;
  27.         sv.k = sv.k + H*dlambda;        
  28.        
  29.         assert(abs(nhat(1)+nhat(2)+nhat(4)) < 1e-14, 'nhat not deviatoric');
  30.        
  31.         NN = nhat(1:3)*nhat(1:3)';
  32.         s = s(1:3,1:3);
  33.         % Compute algorithmic tangent modulus.        
  34.         Cep = Ce - s*mu*NN / (1.0+H/(2.0*mu));
  35.         gamma = s*mu*dlambda/a;
  36.         D = eye(3) - [1;1;0]*[1,1,0]/3.0 - NN;
  37.         C = Cep - s*mu*gamma*D;
  38.         %C = Ce;
  39.     end    
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement