Professional Documents
Culture Documents
comp2DDM WithFluid
comp2DDM WithFluid
% comp2DDM_IterativeWithFluid.m
% This script couples a complementarity algorithm and the two dimensional
% displacement discontinuity method (DDM) to solve boundary value
% problems for isotropic, homogeneous, linear elastic solids containing
% fractures with user-defined frictional surface properties.
% --> Complementarity takes the form: f(Z)=M*Z+Q where f(Z)*Z=0 (e.g.
% Pang and Trinkle, 1996, Complementarity formulations and existence of
% solutions of dynamic multi-rigid-body contact problems with coulomb
% friction, Mathematical Programming, Springer).
% Complementarity script (pathlcp.m) and any other necessary files must
% reside in current directory.
% See http://pages.cs.wisc.edu/~ferris/path.html for more information.
% --> DDM is from Chap. 5 of Crouch and Starfield, 1983, Boundary Element
% Methods in Solid Mechanics, Unwin Hyman, London (abbreviated C&S).
% The number of elements making up each fracture and the element tip
% coordinates are stored in an Excel file comp2DDM_FluidTest.xls.
% Each fracture is digitized with regard to the (x,y)-global coordinate
% system such that Ne(i)+1 points define the tips of Ne(i) straight
% boundary elements making up fracture i.
% Code written by Ovunc (Uno) Mutlu (2006).
% Code modified by David D. Pollard (2007)
% Elizabeth (Libby) Ritz (2011)
% Michael Ferris & Libby Ritz (late 2012 - early 2013)
1
% Read rectangular array(s) of frictional strength, Sf, coefficients.
SF = xlsread('comp2DDM_FluidTest.xls','Sf');
% Read value of possible normal stresses to be added along open elements.
% If negative, SnnOpen can be a proxy for fluid pressure.
snnOpen = xlsread('comp2DDM_FluidTest.xls','SnnOpen');
% Parse paramters into column vector of length ne, omitting nans.
Mu = MU(isfinite(MU));
Sf = SF(isfinite(SF));
SnnOpen = snnOpen(isfinite(snnOpen));
if ne == 2 % For 2 elements transpose Mu and Sf to column vectors.
Mu = Mu'; Sf = Sf'; SnnOpen = SnnOpen';
end
2
% This is the convention of C&S, Figures 4.7, p. 60 and 5.6, p. 91.
Beta = atan2(Ypro,Xpro);
% Define square array where each row contains all the angles Beta.
BJ = repmat(Beta',ne,1);
% Define square array of local coordinates for the ith element midpoint
% with respect to an origin at the jth element midpoint and
% the Ox axis aligned with the jth element (Figure 4.7, C&S, p. 60).
% These are eqs. 4.6.2a and b of C&S, p. 60.
XB = (XI-XJ).*cos(BJ) + (YI-YJ).*sin(BJ);
YB = -(XI-XJ).*sin(BJ) + (YI-YJ).*cos(BJ);
% Define square array with inclinations of ith element with respect to jth.
% Gamma is ccw angle between local Ox for jth and Ox for ith elements.
Gamma = repmat(Beta,1,ne) - BJ;
% Calculate trigonometric functions of the angle Gamma for each element,
% which are also used to calculate the stress influence coefficients.
SG = sin(Gamma); CG = cos(Gamma); SG2 = SG.^2;
S2G = 2*SG.*CG; C2G = CG.^2 - SG2;
% Calculate the shear and normal stress influence coefficients for
% the midpoint of the ith element with respect to the orientation of
% the ith element plane.
% These are the stress components caused by unit shear and unit normal
% displacement discontinuities of the jth element.
% Sign conventions for element displacement discontinuity and stress
% are from C&S Figure 5.4, p. 87.
% The stress influence coefficients are from eqs. 5.6.2 of C&S, p. 93.
% The element self-effects are given by eqs. 5.6.4 of C&S, p. 93.
Ass = 2*sm*(-S2G.*FF4-C2G.*FF5-YB.*(S2G.*FF6-C2G.*FF7));
Asn = 2*sm*(-YB.*(C2G.*FF6+S2G.*FF7));
Ans = 2*sm*(2*SG2.*FF4+S2G.*FF5-YB.*(C2G.*FF6+S2G.*FF7));
Ann = 2*sm*(-FF5+YB.*(S2G.*FF6-C2G.*FF7));
% Regroup the four stress influence coefficient arrays to form
% a square array of size 2*ne by 2*ne such that the shear and
% normal stress components, Ss and Sn, on the ith element are related
% to the shear and normal displacement discontinuities, Ds and Dn,
% on the jth element as given by eqs 5.4.3 of C&S, p. 88.
3
% |Ss| = |Ass Asn||Ds|
% |Sn| |Ans Ann||Dn|
% The 3 remote stress components are resolved into shear stress, Ssr,
% and normal stress, Snr, acting on the plane of each element.
% These components are referred to the element local coordinates (s,n)
% where n is directed at angle beta + pi/2 to the global Ox axis and
% s is directed to the right w/re to n (Figure 4.7, C&S, p. 60).
% Calculate trigonometric functions of the angle beta for each element.
Sinb = Ypro./(2*H); Cosb = Xpro./(2*H); % sine and cosine beta
Sbcb = Sinb.*Cosb; % sine beta times cosine beta
Sinb2 = Sinb.^2; Cosb2 = Cosb.^2; % sine and cosine beta squared
% The transformation equations are 2.8.8c and 2.8.8b from C&S, p. 24.
Ssr = -(sxxr-syyr).*Sbcb + sxyr.*(Cosb2-Sinb2);
Snr = sxxr.*Sinb2 - 2*sxyr.*Sbcb + syyr.*Cosb2;
%% Complementarity formulation
% Reformulate as a complementarity problem.
% Scale factors to improve conditioning of MCP.
scaleDs = 1e-3; scaleDn = 1e-4;
% Calculate complementary equation.
M = [speye(ne) sparse(-[scaleDn*Asn scaleDs*Ass]) sparse(ne,3*ne); ...
sparse(ne,ne) sparse(-[scaleDn*Ann scaleDs*Ans]) speye(ne)
sparse(ne,2*ne); ...
sparse(ne,2*ne) speye(ne) sparse(ne,ne) speye(ne) -speye(ne); ...
sparse(ne,ne) speye(ne) sparse(ne,4*ne); ...
-speye(ne) sparse(ne,2*ne) -spdiags(Mu,0,ne,ne) sparse(ne,2*ne); ...
speye(ne) sparse(ne,2*ne) -spdiags(Mu,0,ne,ne) sparse(ne,2*ne)];
Q = [-Ssr; -Snr; zeros(2*ne,1); Sf; Sf];
lo = [-inf*ones(4*ne,1); zeros(2*ne,1)];
up = [inf*ones(3*ne,1); zeros(ne,1); inf*ones(2*ne,1)];
Z = [Ssr; zeros(2*ne,1); Snr; zeros(2*ne,1)];
% Run PATH.
Z=pathlcp(M,Q,lo,up,Z);
4
Dn(Dn>-toler) = 0;
open = find(Dn < 0);
nopen = length(open) - fopen;
end
5
% Calculate the stress components using eqs. 5.5.5 of C&S, p. 92.
SXX = SXX + 2*sm*Dxb*(2*cb*cb*FF4 + s2b*FF5 + YB.*(c2b*FF6-s2b*FF7))...
+2*sm*Dyb*(-FF5 + YB.*(s2b*FF6 + c2b*FF7));
SYY = SYY + 2*sm*Dxb*(2*sb*sb*FF4 - s2b*FF5 - YB.*(c2b*FF6-s2b*FF7))...
+2*sm*Dyb*(-FF5 - YB.*(s2b*FF6 + c2b*FF7));
SXY = SXY + 2*sm*Dxb*(s2b*FF4 - c2b*FF5 + YB.*(s2b*FF6+c2b*FF7))...
+2*sm*Dyb*(-YB.*(c2b*FF6 - s2b*FF7));
end
%% Additional calculations
% Calculate principal stresses, S1 and S2.
% Equations from Pollard and Fletcher, 2005, Fundamentals of Structural
% Geology, Cambridge University Press (abbreviated P&F)
% P&F page 220, equations 6.72.
S1 = 0.5*(SXX+SYY)+sqrt(0.25*(SXX-SYY).^2+SXY.^2);
S2 = 0.5*(SXX+SYY)-sqrt(0.25*(SXX-SYY).^2+SXY.^2);
%% Figures
%Plot vector arrows for displacements.
figure, hold on, axis equal tight
quiver(XG,YG,UX,UY, 'linewidth', 1.2),
plot(PX,PY,'k', 'linewidth', 2)
axis([Parm(7), Parm(9), Parm(10), Parm(12)])
title('displacement field'), xlabel('x/w'), ylabel('y/w')