Mercurial > repos > public > sbplib
annotate +scheme/Elastic2dVariableAnisotropic.m @ 1203:25cadc69a589 feature/poroelastic
Update comments in Anisotropic
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Thu, 05 Sep 2019 17:10:58 -0700 |
parents | 31d7288d0653 |
children | 687515778437 |
rev | line source |
---|---|
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
1 classdef Elastic2dVariableAnisotropic < scheme.Scheme |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
2 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
3 % Discretizes the elastic wave equation: |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
4 % rho u_{i,tt} = dj C_{ijkl} dk u_j |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
5 % opSet should be cell array of opSets, one per dimension. This |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
6 % is useful if we have periodic BC in one direction. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
7 % Assumes fully compatible operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
8 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
9 properties |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
10 m % Number of points in each direction, possibly a vector |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
11 h % Grid spacing |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
12 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
13 grid |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
14 dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
15 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
16 order % Order of accuracy for the approximation |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
17 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
18 % Diagonal matrices for variable coefficients |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
19 RHO, RHOi, RHOi_kron % Density |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
20 C % Elastic stiffness tensor |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
21 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
22 D % Total operator |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
23 D1 % First derivatives |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
24 D2 % Second derivatives |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
25 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
26 % Boundary operators in cell format, used for BC |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
27 T_w, T_e, T_s, T_n |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
28 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
29 % Traction operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
30 tau_w, tau_e, tau_s, tau_n % Return vector field |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
31 tau1_w, tau1_e, tau1_s, tau1_n % Return scalar field |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
32 tau2_w, tau2_e, tau2_s, tau2_n % Return scalar field |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
33 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
34 % Inner products |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
35 H, Hi, Hi_kron, H_1D |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
36 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
37 % Boundary inner products (for scalar field) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
38 H_w, H_e, H_s, H_n |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
39 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
40 % Boundary restriction operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
41 e_w, e_e, e_s, e_n % Act on vector field, return vector field at boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
42 e1_w, e1_e, e1_s, e1_n % Act on vector field, return scalar field at boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
43 e2_w, e2_e, e2_s, e2_n % Act on vector field, return scalar field at boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
44 e_scalar_w, e_scalar_e, e_scalar_s, e_scalar_n; % Act on scalar field, return scalar field |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
45 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
46 % E{i}^T picks out component i |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
47 E |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
48 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
49 % Borrowing constants of the form gamma*h, where gamma is a dimensionless constant. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
50 h11 % First entry in norm matrix |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
51 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
52 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
53 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
54 methods |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
55 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
56 % The coefficients can either be function handles or grid functions |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
57 % optFlag -- if true, extra computations are performed, which may be helpful for optimization. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
58 function obj = Elastic2dVariableAnisotropic(g, order, rho, C, opSet, optFlag) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
59 default_arg('rho', @(x,y) 0*x+1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
60 default_arg('opSet',{@sbp.D2VariableCompatible, @sbp.D2VariableCompatible}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
61 default_arg('optFlag', false); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
62 dim = 2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
63 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
64 C_default = cell(dim,dim,dim,dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
65 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
66 for j = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
67 for k = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
68 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
69 C_default{i,j,k,l} = @(x,y) 0*x + 1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
70 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
71 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
72 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
73 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
74 default_arg('C', C_default); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
75 assert(isa(g, 'grid.Cartesian')) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
76 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
77 if isa(rho, 'function_handle') |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
78 rho = grid.evalOn(g, rho); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
79 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
80 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
81 C_mat = cell(dim,dim,dim,dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
82 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
83 for j = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
84 for k = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
85 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
86 if isa(C{i,j,k,l}, 'function_handle') |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
87 C{i,j,k,l} = grid.evalOn(g, C{i,j,k,l}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
88 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
89 C_mat{i,j,k,l} = spdiag(C{i,j,k,l}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
90 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
91 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
92 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
93 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
94 obj.C = C_mat; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
95 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
96 m = g.size(); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
97 m_tot = g.N(); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
98 lim = g.lim; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
99 if isempty(lim) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
100 x = g.x; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
101 lim = cell(length(x),1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
102 for i = 1:length(x) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
103 lim{i} = {min(x{i}), max(x{i})}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
104 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
105 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
106 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
107 % 1D operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
108 ops = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
109 h = zeros(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
110 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
111 ops{i} = opSet{i}(m(i), lim{i}, order); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
112 h(i) = ops{i}.h; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
113 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
114 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
115 % Borrowing constants |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
116 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
117 obj.h11{i} = h(i)*ops{i}.borrowing.H11; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
118 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
119 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
120 I = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
121 D1 = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
122 D2 = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
123 H = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
124 Hi = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
125 e_0 = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
126 e_m = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
127 d1_0 = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
128 d1_m = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
129 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
130 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
131 I{i} = speye(m(i)); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
132 D1{i} = ops{i}.D1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
133 D2{i} = ops{i}.D2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
134 H{i} = ops{i}.H; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
135 Hi{i} = ops{i}.HI; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
136 e_0{i} = ops{i}.e_l; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
137 e_m{i} = ops{i}.e_r; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
138 d1_0{i} = ops{i}.d1_l; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
139 d1_m{i} = ops{i}.d1_r; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
140 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
141 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
142 %====== Assemble full operators ======== |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
143 RHO = spdiag(rho); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
144 obj.RHO = RHO; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
145 obj.RHOi = inv(RHO); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
146 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
147 obj.D1 = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
148 obj.D2 = cell(dim,dim,dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
149 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
150 % D1 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
151 obj.D1{1} = kron(D1{1},I{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
152 obj.D1{2} = kron(I{1},D1{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
153 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
154 % Boundary restriction operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
155 e_l = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
156 e_r = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
157 e_l{1} = kron(e_0{1}, I{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
158 e_l{2} = kron(I{1}, e_0{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
159 e_r{1} = kron(e_m{1}, I{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
160 e_r{2} = kron(I{1}, e_m{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
161 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
162 e_scalar_w = e_l{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
163 e_scalar_e = e_r{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
164 e_scalar_s = e_l{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
165 e_scalar_n = e_r{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
166 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
167 I_dim = speye(dim, dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
168 e_w = kron(e_scalar_w, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
169 e_e = kron(e_scalar_e, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
170 e_s = kron(e_scalar_s, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
171 e_n = kron(e_scalar_n, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
172 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
173 % E{i}^T picks out component i. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
174 E = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
175 I = speye(m_tot,m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
176 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
177 e = sparse(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
178 e(i) = 1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
179 E{i} = kron(I,e); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
180 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
181 obj.E = E; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
182 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
183 e1_w = (e_scalar_w'*E{1}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
184 e1_e = (e_scalar_e'*E{1}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
185 e1_s = (e_scalar_s'*E{1}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
186 e1_n = (e_scalar_n'*E{1}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
187 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
188 e2_w = (e_scalar_w'*E{2}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
189 e2_e = (e_scalar_e'*E{2}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
190 e2_s = (e_scalar_s'*E{2}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
191 e2_n = (e_scalar_n'*E{2}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
192 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
193 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
194 % D2 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
195 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
196 for k = 2:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
197 for l = 2:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
198 obj.D2{i,k,l} = sparse(m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
199 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
200 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
201 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
202 ind = grid.funcToMatrix(g, 1:m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
203 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
204 k = 1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
205 for r = 1:m(2) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
206 p = ind(:,r); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
207 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
208 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
209 coeff = C{i,k,k,l}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
210 D_kk = D2{1}(coeff(p)); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
211 obj.D2{i,k,l}(p,p) = D_kk; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
212 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
213 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
214 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
215 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
216 k = 2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
217 for r = 1:m(1) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
218 p = ind(r,:); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
219 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
220 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
221 coeff = C{i,k,k,l}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
222 D_kk = D2{2}(coeff(p)); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
223 obj.D2{i,k,l}(p,p) = D_kk; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
224 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
225 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
226 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
227 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
228 % Quadratures |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
229 obj.H = kron(H{1},H{2}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
230 obj.Hi = inv(obj.H); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
231 obj.H_w = H{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
232 obj.H_e = H{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
233 obj.H_s = H{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
234 obj.H_n = H{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
235 obj.H_1D = {H{1}, H{2}}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
236 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
237 % Differentiation matrix D (without SAT) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
238 D2 = obj.D2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
239 D1 = obj.D1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
240 D = sparse(dim*m_tot,dim*m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
241 d = @kroneckerDelta; % Kronecker delta |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
242 db = @(i,j) 1-d(i,j); % Logical not of Kronecker delta |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
243 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
244 for j = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
245 for k = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
246 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
247 D = D + E{i}*inv(RHO)*( d(j,k)*D2{i,k,l}*E{l}' +... |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
248 db(j,k)*D1{j}*C_mat{i,j,k,l}*D1{k}*E{l}' ... |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
249 ); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
250 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
251 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
252 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
253 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
254 obj.D = D; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
255 %=========================================%' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
256 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
257 % Numerical traction operators for BC. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
258 % |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
259 % Formula at boundary j: % tau^{j}_i = sum_l T^{j}_{il} u_l |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
260 % |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
261 T_l = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
262 T_r = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
263 tau_l = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
264 tau_r = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
265 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
266 D1 = obj.D1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
267 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
268 % Boundary j |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
269 for j = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
270 T_l{j} = cell(dim,dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
271 T_r{j} = cell(dim,dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
272 tau_l{j} = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
273 tau_r{j} = cell(dim,1); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
274 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
275 [~, n_l] = size(e_l{j}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
276 [~, n_r] = size(e_r{j}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
277 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
278 % Traction component i |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
279 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
280 tau_l{j}{i} = sparse(dim*m_tot, n_l); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
281 tau_r{j}{i} = sparse(dim*m_tot, n_r); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
282 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
283 % Displacement component l |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
284 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
285 T_l{j}{i,l} = sparse(m_tot, n_l); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
286 T_r{j}{i,l} = sparse(m_tot, n_r); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
287 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
288 % Derivative direction k |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
289 for k = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
290 T_l{j}{i,l} = T_l{j}{i,l} ... |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
291 - (e_l{j}'*C_mat{i,j,k,l}*D1{k})'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
292 T_r{j}{i,l} = T_r{j}{i,l} ... |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
293 + (e_r{j}'*C_mat{i,j,k,l}*D1{k})'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
294 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
295 tau_l{j}{i} = tau_l{j}{i} + (T_l{j}{i,l}'*E{l}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
296 tau_r{j}{i} = tau_r{j}{i} + (T_r{j}{i,l}'*E{l}')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
297 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
298 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
299 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
300 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
301 % Traction tensors, T_ij |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
302 obj.T_w = T_l{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
303 obj.T_e = T_r{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
304 obj.T_s = T_l{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
305 obj.T_n = T_r{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
306 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
307 % Restriction operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
308 obj.e_w = e_w; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
309 obj.e_e = e_e; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
310 obj.e_s = e_s; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
311 obj.e_n = e_n; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
312 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
313 obj.e1_w = e1_w; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
314 obj.e1_e = e1_e; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
315 obj.e1_s = e1_s; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
316 obj.e1_n = e1_n; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
317 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
318 obj.e2_w = e2_w; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
319 obj.e2_e = e2_e; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
320 obj.e2_s = e2_s; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
321 obj.e2_n = e2_n; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
322 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
323 obj.e_scalar_w = e_scalar_w; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
324 obj.e_scalar_e = e_scalar_e; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
325 obj.e_scalar_s = e_scalar_s; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
326 obj.e_scalar_n = e_scalar_n; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
327 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
328 % First component of traction |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
329 obj.tau1_w = tau_l{1}{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
330 obj.tau1_e = tau_r{1}{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
331 obj.tau1_s = tau_l{2}{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
332 obj.tau1_n = tau_r{2}{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
333 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
334 % Second component of traction |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
335 obj.tau2_w = tau_l{1}{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
336 obj.tau2_e = tau_r{1}{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
337 obj.tau2_s = tau_l{2}{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
338 obj.tau2_n = tau_r{2}{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
339 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
340 % Traction vectors |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
341 obj.tau_w = (e_w'*e1_w*obj.tau1_w')' + (e_w'*e2_w*obj.tau2_w')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
342 obj.tau_e = (e_e'*e1_e*obj.tau1_e')' + (e_e'*e2_e*obj.tau2_e')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
343 obj.tau_s = (e_s'*e1_s*obj.tau1_s')' + (e_s'*e2_s*obj.tau2_s')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
344 obj.tau_n = (e_n'*e1_n*obj.tau1_n')' + (e_n'*e2_n*obj.tau2_n')'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
345 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
346 % Kroneckered norms and coefficients |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
347 obj.RHOi_kron = kron(obj.RHOi, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
348 obj.Hi_kron = kron(obj.Hi, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
349 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
350 % Misc. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
351 obj.m = m; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
352 obj.h = h; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
353 obj.order = order; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
354 obj.grid = g; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
355 obj.dim = dim; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
356 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
357 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
358 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
359 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
360 % Closure functions return the operators applied to the own domain to close the boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
361 % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
362 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
363 % bc is a cell array of component and bc type, e.g. {1, 'd'} for Dirichlet condition |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
364 % on the first component. Can also be e.g. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
365 % {'normal', 'd'} or {'tangential', 't'} for conditions on |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
366 % tangential/normal component. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
367 % data is a function returning the data that should be applied at the boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
368 % neighbour_scheme is an instance of Scheme that should be interfaced to. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
369 % neighbour_boundary is a string specifying which boundary to interface to. |
1203
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
370 |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
371 % For displacement bc: |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
372 % bc = {comp, 'd', dComps}, |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
373 % where |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
374 % dComps = vector of components with displacement BC. Default: 1:dim. |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
375 % In this way, we can specify one BC at a time even though the SATs depend on all BC. |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
376 function [closure, penalty] = boundary_condition(obj, boundary, bc, tuning) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
377 default_arg('tuning', 1.0); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
378 |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
379 assert( iscell(bc), 'The BC type must be a 2x1 or 3x1 cell array' ); |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
380 comp = bc{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
381 type = bc{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
382 if ischar(comp) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
383 comp = obj.getComponent(comp, boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
384 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
385 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
386 e = obj.getBoundaryOperatorForScalarField('e', boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
387 tau = obj.getBoundaryOperator(['tau' num2str(comp)], boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
388 T = obj.getBoundaryTractionOperator(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
389 h11 = obj.getBorrowing(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
390 H_gamma = obj.getBoundaryQuadratureForScalarField(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
391 nu = obj.getNormal(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
392 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
393 E = obj.E; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
394 Hi = obj.Hi; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
395 RHOi = obj.RHOi; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
396 C = obj.C; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
397 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
398 dim = obj.dim; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
399 m_tot = obj.grid.N(); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
400 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
401 % Preallocate |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
402 [~, col] = size(tau); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
403 closure = sparse(dim*m_tot, dim*m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
404 penalty = sparse(dim*m_tot, col); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
405 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
406 j = comp; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
407 switch type |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
408 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
409 % Dirichlet boundary condition |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
410 % OBS! Cannot yet set one component at a time unless one assumes Displacement for all components |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
411 case {'D','d','dirichlet','Dirichlet','displacement','Displacement'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
412 |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
413 if numel(bc) >= 3 |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
414 dComps = bc{3}; |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
415 else |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
416 dComps = 1:dim; |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
417 end |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
418 |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
419 % Loops over components that Dirichlet penalties end up on |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
420 % Y: symmetrizing part of penalty |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
421 % Z: symmetric part of penalty |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
422 % X = Y + Z. |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
423 |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
424 % Nonsymmetric part goes on all components to |
1203
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
425 % yield traction in discrete energy rate |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
426 for i = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
427 Y = T{j,i}'; |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
428 X = e*Y; |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
429 closure = closure + E{i}*RHOi*Hi*X'*e*H_gamma*(e'*E{j}' ); |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
430 penalty = penalty - E{i}*RHOi*Hi*X'*e*H_gamma; |
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
431 end |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
432 |
1203
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
433 % Symmetric part only required on components with displacement BC. |
25cadc69a589
Update comments in Anisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
1202
diff
changeset
|
434 % (Otherwise it's not symmetric.) |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
435 for i = dComps |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
436 Z = sparse(m_tot, m_tot); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
437 for l = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
438 for k = 1:dim |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
439 Z = Z + nu(l)*C{i,l,k,j}*nu(k); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
440 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
441 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
442 Z = -tuning*dim/h11*Z; |
1202
31d7288d0653
Make Anisotropic work for mixed displacement/traction BC at the same boundary.
Martin Almquist <malmquist@stanford.edu>
parents:
1201
diff
changeset
|
443 X = Z; |
1201
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
444 closure = closure + E{i}*RHOi*Hi*X'*e*H_gamma*(e'*E{j}' ); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
445 penalty = penalty - E{i}*RHOi*Hi*X'*e*H_gamma; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
446 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
447 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
448 % Free boundary condition |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
449 case {'F','f','Free','free','traction','Traction','t','T'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
450 closure = closure - E{j}*RHOi*Hi*e*H_gamma*tau'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
451 penalty = penalty + E{j}*RHOi*Hi*e*H_gamma; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
452 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
453 % Unknown boundary condition |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
454 otherwise |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
455 error('No such boundary condition: type = %s',type); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
456 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
457 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
458 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
459 % type Struct that specifies the interface coupling. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
460 % Fields: |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
461 % -- tuning: penalty strength, defaults to 1.2 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
462 % -- interpolation: type of interpolation, default 'none' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
463 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
464 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
465 defaultType.tuning = 1.2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
466 defaultType.interpolation = 'none'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
467 default_struct('type', defaultType); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
468 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
469 switch type.interpolation |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
470 case {'none', ''} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
471 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
472 case {'op','OP'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
473 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
474 otherwise |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
475 error('Unknown type of interpolation: %s ', type.interpolation); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
476 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
477 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
478 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
479 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
480 tuning = type.tuning; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
481 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
482 % u denotes the solution in the own domain |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
483 % v denotes the solution in the neighbour domain |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
484 % Operators without subscripts are from the own domain. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
485 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
486 % Get boundary operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
487 e = obj.getBoundaryOperator('e', boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
488 tau = obj.getBoundaryOperator('tau', boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
489 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
490 e_v = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
491 tau_v = neighbour_scheme.getBoundaryOperator('tau', neighbour_boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
492 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
493 H_gamma = obj.getBoundaryQuadrature(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
494 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
495 % Operators and quantities that correspond to the own domain only |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
496 Hi = obj.Hi_kron; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
497 RHOi = obj.RHOi_kron; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
498 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
499 % Penalty strength operators |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
500 alpha_u = 1/4*tuning*obj.getBoundaryOperator('alpha', boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
501 alpha_v = 1/4*tuning*neighbour_scheme.getBoundaryOperator('alpha', neighbour_boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
502 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
503 closure = -RHOi*Hi*e*H_gamma*(alpha_u' + alpha_v'*e_v*e'); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
504 penalty = RHOi*Hi*e*H_gamma*(alpha_u'*e*e_v' + alpha_v'); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
505 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
506 closure = closure - 1/2*RHOi*Hi*e*H_gamma*tau'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
507 penalty = penalty - 1/2*RHOi*Hi*e*H_gamma*tau_v'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
508 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
509 closure = closure + 1/2*RHOi*Hi*tau*H_gamma*e'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
510 penalty = penalty - 1/2*RHOi*Hi*tau*H_gamma*e_v'; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
511 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
512 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
513 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
514 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
515 error('Non-conforming interfaces not implemented yet.'); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
516 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
517 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
518 % Returns the component number that is the tangential/normal component |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
519 % at the specified boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
520 function comp = getComponent(obj, comp_str, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
521 assertIsMember(comp_str, {'normal', 'tangential'}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
522 assertIsMember(boundary, {'w', 'e', 's', 'n'}); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
523 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
524 switch boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
525 case {'w', 'e'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
526 switch comp_str |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
527 case 'normal' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
528 comp = 1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
529 case 'tangential' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
530 comp = 2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
531 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
532 case {'s', 'n'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
533 switch comp_str |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
534 case 'normal' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
535 comp = 2; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
536 case 'tangential' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
537 comp = 1; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
538 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
539 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
540 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
541 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
542 % Returns h11 for the boundary specified by the string boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
543 % op -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
544 function h11 = getBorrowing(obj, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
545 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
546 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
547 switch boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
548 case {'w','e'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
549 h11 = obj.h11{1}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
550 case {'s', 'n'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
551 h11 = obj.h11{2}; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
552 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
553 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
554 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
555 % Returns the outward unit normal vector for the boundary specified by the string boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
556 function nu = getNormal(obj, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
557 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
558 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
559 switch boundary |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
560 case 'w' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
561 nu = [-1,0]; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
562 case 'e' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
563 nu = [1,0]; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
564 case 's' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
565 nu = [0,-1]; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
566 case 'n' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
567 nu = [0,1]; |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
568 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
569 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
570 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
571 % Returns the boundary operator op for the boundary specified by the string boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
572 % op -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
573 function o = getBoundaryOperator(obj, op, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
574 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
575 assertIsMember(op, {'e', 'e1', 'e2', 'tau', 'tau1', 'tau2'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
576 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
577 switch op |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
578 case {'e', 'e1', 'e2', 'tau', 'tau1', 'tau2'} |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
579 o = obj.([op, '_', boundary]); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
580 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
581 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
582 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
583 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
584 % Returns the boundary operator op for the boundary specified by the string boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
585 % op -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
586 function o = getBoundaryOperatorForScalarField(obj, op, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
587 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
588 assertIsMember(op, {'e'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
589 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
590 switch op |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
591 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
592 case 'e' |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
593 o = obj.(['e_scalar', '_', boundary]); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
594 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
595 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
596 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
597 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
598 % Returns the boundary operator T_ij (cell format) for the boundary specified by the string boundary. |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
599 % Formula: tau_i = T_ij u_j |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
600 % op -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
601 function T = getBoundaryTractionOperator(obj, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
602 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
603 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
604 T = obj.(['T', '_', boundary]); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
605 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
606 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
607 % Returns square boundary quadrature matrix, of dimension |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
608 % corresponding to the number of boundary unknowns |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
609 % |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
610 % boundary -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
611 function H = getBoundaryQuadrature(obj, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
612 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
613 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
614 H = obj.getBoundaryQuadratureForScalarField(boundary); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
615 I_dim = speye(obj.dim, obj.dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
616 H = kron(H, I_dim); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
617 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
618 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
619 % Returns square boundary quadrature matrix, of dimension |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
620 % corresponding to the number of boundary grid points |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
621 % |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
622 % boundary -- string |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
623 function H_b = getBoundaryQuadratureForScalarField(obj, boundary) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
624 assertIsMember(boundary, {'w', 'e', 's', 'n'}) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
625 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
626 H_b = obj.(['H_', boundary]); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
627 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
628 |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
629 function N = size(obj) |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
630 N = obj.dim*prod(obj.m); |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
631 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
632 end |
8f4e79aa32ba
Add fully compatible D2Variable opSet and first implementation of ElasticAnisotropic
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
633 end |