annotate +scheme/elasticShearVariable.m @ 663:b45ec2b28cc2 feature/poroelastic

First implementation of elastic shear operator with free boundary BC.
author Martin Almquist <malmquist@stanford.edu>
date Thu, 14 Dec 2017 13:54:20 -0800
parents
children 8e6dfd22fc59
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
663
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 classdef elasticShearVariable < scheme.Scheme
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2 properties
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 m % Number of points in each direction, possibly a vector
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
4 h % Grid spacing
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
6 grid
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8 order % Order accuracy for the approximation
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 a % Variable coefficient lambda of the operator
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11 rho % Density
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13 D % Total operator
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 D1 % First derivatives
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 D2 % Second derivatives
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16 H, Hi % Inner products
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 e_l, e_r
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18 d_l, d_r % Normal derivatives at the boundary
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 H_boundary % Boundary inner products
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22 methods
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 % Implements the shear part of the elastic wave equation, i.e.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24 % rho u_{i,tt} = d_i a d_j u_j + d_j a d_j u_i
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 % where a = lambda.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27 function obj = elasticShearVariable(g ,order, a_fun, rho_fun, opSet)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28 default_arg('opSet',@sbp.D2Variable);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 default_arg('a_fun', @(x,y) 0*x+1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30 default_arg('rho_fun', @(x,y) 0*x+1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31 dim = 2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
32
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33 assert(isa(g, 'grid.Cartesian'))
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
34
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35 a = grid.evalOn(g, a_fun);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
36 rho = grid.evalOn(g, rho_fun);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
37 m = g.size();
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
38 m_tot = g.N();
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
39
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
40 h = g.scaling();
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
41
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
42 % 1D operators
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
43 ops = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
44 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
45 ops{i} = opSet(m(i), {0, 1}, order);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
46 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
47
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
48 I = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
49 D1 = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
50 D2 = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
51 H = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
52 Hi = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
53 e_l = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
54 e_r = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
55 d1_l = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
56 d1_r = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
57
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
58 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
59 I{i} = speye{m(i));
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
60 D1{i} = ops{i}.D1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
61 D2{i} = ops{i}.D2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
62 H{i} = ops{i}.H;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
63 Hi{i} = ops{i}.HI;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
64 e_l{i} = ops{i}.e_l;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
65 e_r{i} = ops{i}.e_r;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
66 d1_l{i} = ops{i}.d1_l;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
67 d1_r{i} = ops{i}.d1_r;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
68 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
69
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
70 %====== Assemble full operators ========
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
71 A = spdiag(a);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
72 RHO = spdiag(rho);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
73
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
74 obj.D1 = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
75 obj.D2 = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
76 obj.e_l = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
77 obj.e_r = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
78 obj.d1_l = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
79 obj.d1_r = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
80
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
81 % D1
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
82 obj.D1{1} = kron{D1{1},I(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
83 obj.D1{2} = kron{I{1},D1(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
84
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
85 % Boundary operators
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
86 obj.e_l{1} = kron{e_l{1},I(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
87 obj.e_l{2} = kron{I{1},e_l(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
88 obj.e_r{1} = kron{e_r{1},I(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
89 obj.e_r{2} = kron{I{1},e_r(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
90
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
91 obj.d1_l{1} = kron{d1_l{1},I(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
92 obj.d1_l{2} = kron{I{1},d1_l(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
93 obj.d1_r{1} = kron{d1_r{1},I(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
94 obj.d1_r{2} = kron{I{1},d1_r(2)};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
95
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
96 % D2
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
97 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
98 obj.D2{i} = sparse(m_tot);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
99 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
100 ind = grid.funcToMatrix(g, 1:m_tot);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
101
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
102 for i = 1:m(2)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
103 D = D2{1}(a(ind(:,i)));
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
104 p = ind(:,i);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
105 obj.D2{1}(p,p) = D;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
106 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
107
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
108 for i = 1:m(1)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
109 D = D2{2}(a(ind(i,:)));
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
110 p = ind(i,:);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
111 obj.D2{2}(p,p) = D;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
112 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
113
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
114 % Quadratures
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
115 obj.H = kron(H{1},H{2});
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
116 obj.H_boundary = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
117 obj.H_boundary{1} = H{2};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
118 obj.H_boundary{2} = H{1};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
119
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
120 % Boundary coefficient matrices and quadratures
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
121 obj.A_boundary_l = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
122 obj.A_boundary_r = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
123 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
124 obj.A_boundary_l{i} = e_l{i}'*A*e_l{i};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
125 obj.A_boundary_r{i} = e_r{i}'*A*e_r{i};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
126 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
127
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
128 % E{i}^T picks out component i.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
129 E = cell(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
130 I = speye{mtot,mtot};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
131 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
132 e = sparse(dim,1);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
133 e(i) = 1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
134 E{i} = kron(e,I)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
135 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
136 obj.E = E;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
137
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
138 % Differentiation matrix D (without SAT)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
139 D = 0;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
140 d = @kroneckerDelta; % Kronecker delta
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
141 db = @(i,j) 1-dij(i,j); % Logical not of Kronecker delta
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
142 for i = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
143 for j = 1:dim
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
144 D = D + E{i}*inv(rho)*( d(i,j)*D2{i}*E{j}' +...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
145 db(i,j)*D1{j}*A*D1{i}*E{j}' + ...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
146 D2{j}*E{i}' ...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
147 );
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
148 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
149 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
150 obj.D = D;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
151 %=========================================%
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
152
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
153
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
154
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
155 % Misc.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
156 obj.m = m;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
157 obj.h = h;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
158 obj.order = order;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
159 obj.grid = g;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
160
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
161 obj.a = a;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
162 obj.b = b;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
163
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
164 % obj.gamm_u = h_u*ops_u.borrowing.M.d1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
165 % obj.gamm_v = h_v*ops_v.borrowing.M.d1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
166 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
167
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
168
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
169 % Closure functions return the operators applied to the own domain to close the boundary
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
170 % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
171 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
172 % type is a string specifying the type of boundary condition if there are several.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
173 % data is a function returning the data that should be applied at the boundary.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
174 % neighbour_scheme is an instance of Scheme that should be interfaced to.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
175 % neighbour_boundary is a string specifying which boundary to interface to.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
176 function [closure, penalty] = boundary_condition(obj, boundary, type, parameter)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
177 default_arg('type','free');
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
178 default_arg('parameter', []);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
179
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
180 delta = @kroneckerDelta; % Kronecker delta
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
181 delta_b = @(i,j) 1-dij(i,j); % Logical not of Kronecker delta
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
182
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
183 % j is the coordinate direction of the boundary
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
184 % nj: outward unit normal component.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
185 % nj = -1 for west, south, bottom boundaries
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
186 % nj = 1 for east, north, top boundaries
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
187 [j, nj] = obj.get_boundary_number(boundary);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
188 switch nj
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
189 case 1
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
190 e = obj.e_r;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
191 d = obj.d_r;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
192 case -1
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
193 e = obj.e_l;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
194 d = obj.d_l;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
195 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
196
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
197 E = obj.E;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
198 Hi = obj.Hi;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
199 H_gamma = obj.H_boundary{j};
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
200 A = obj.A;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
201
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
202 switch type
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
203 % Dirichlet boundary condition
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
204 case {'D','d','dirichlet'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
205 error('Dirichlet not implemented')
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
206 tuning = 1.2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
207 % tuning = 20.2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
208
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
209 b1 = gamm*obj.lambda./obj.a11.^2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
210 b2 = gamm*obj.lambda./obj.a22.^2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
211
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
212 tau1 = tuning * spdiag(-1./b1 - 1./b2);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
213 tau2 = 1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
214
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
215 tau = (tau1*e + tau2*d)*H_b;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
216
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
217 closure = obj.a*obj.Hi*tau*e';
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
218 penalty = -obj.a*obj.Hi*tau;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
219
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
220
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
221 % Free boundary condition
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
222 case {'F','f','Free','free'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
223 closure = 0;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
224 penalty = 0;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
225 % Loop over components
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
226 for i = 1:3
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
227 closure = closure + E{i}*(-sign)*Hi*e{j}*H_gamma*(...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
228 e{j}'*A*e{j}*d{j}'*E{i}' + ...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
229 delta(i,j)*e{j}'*A*e{i}*d{i}*E{j}' + ...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
230 delta_b(i,j)*A*D1{i}*E{j}' ...
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
231 );
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
232 penalty = penalty - E{i}*(-sign)*Hi*e{j}*H_gamma;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
233 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
234
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
235 % Unknown boundary condition
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
236 otherwise
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
237 error('No such boundary condition: type = %s',type);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
238 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
239 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
240
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
241 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
242 % u denotes the solution in the own domain
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
243 % v denotes the solution in the neighbour domain
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
244 tuning = 1.2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
245 % tuning = 20.2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
246 error('Interface not implemented');
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
247 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
248
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
249 % Ruturns the coordinate number and outward normal component for the boundary specified by the string boundary.
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
250 function [j, nj] = get_boundary_number(obj, boundary)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
251
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
252 switch boundary
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
253 case {'w','W','west','West', 'e', 'E', 'east', 'East'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
254 j = 1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
255 case {'s','S','south','South', 'n', 'N', 'north', 'North'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
256 j = 2;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
257 otherwise
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
258 error('No such boundary: boundary = %s',boundary);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
259 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
260
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
261 switch boundary
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
262 case {'w','W','west','West','s','S','south','South'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
263 nj = -1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
264 case {'e', 'E', 'east', 'East','n', 'N', 'north', 'North'}
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
265 nj = 1;
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
266 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
267 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
268
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
269 function N = size(obj)
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
270 N = prod(obj.m);
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
271 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
272 end
b45ec2b28cc2 First implementation of elastic shear operator with free boundary BC.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
273 end