Mercurial > repos > public > sbplib
annotate +scheme/Beam.m @ 1085:49c0b8c7330a feature/laplace_curvilinear_test
Clean up Dirichlet BC code in LaplaceCurvilinearNew.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 29 Mar 2019 14:24:39 -0700 |
parents | 2b1b944deae1 |
children | 8d73fcdb07a5 |
rev | line source |
---|---|
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
1 classdef Beam < scheme.Scheme |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
2 properties |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
3 order % Order accuracy for the approximation |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
4 grid |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
5 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
6 D % non-stabalized scheme operator |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
7 alpha |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
8 |
242 | 9 h |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
10 H % Discrete norm |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
11 Hi |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
12 |
328
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
13 e_l, e_r |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
14 d1_l, d1_r |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
15 d2_l, d2_r |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
16 d3_l, d3_r |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
17 gamm |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
18 delt |
242 | 19 alphaII |
20 alphaIII | |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
21 |
944
a35ed1d124d3
Change from opts to type in a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
22 opt % TODO: Get rid of this and use the interface type instead |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
23 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
24 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
25 methods |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
26 function obj = Beam(grid, order, alpha, opsGen, opt) |
236
8592358a3935
Beam: Added tuning as a parameter to contructor.
Jonatan Werpers <jonatan@werpers.com>
parents:
235
diff
changeset
|
27 default_arg('alpha', -1); |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
28 |
328
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
29 % default_arg('opsGen', @sbp.D4); |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
30 default_arg('opsGen', @sbp.D4Variable); % Supposed to be better |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
31 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
32 opt_default.interface_l.tuning = 1.1; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
33 opt_default.interface_l.tau = []; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
34 opt_default.interface_l.sig = []; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
35 opt_default.interface_r.tuning = 1.1; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
36 opt_default.interface_r.tau = []; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
37 opt_default.interface_r.sig = []; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
38 default_struct('opt', opt_default); |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
39 |
176
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
40 if ~isa(grid, 'grid.Cartesian') || grid.D() ~= 1 |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
41 error('Grid must be 1d cartesian'); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
42 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
43 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
44 obj.grid = grid; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
45 obj.order = order; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
46 obj.alpha = alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
47 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
48 m = grid.m; |
176
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
49 h = grid.scaling(); |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
50 |
328
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
51 x_lim = {grid.x{1}(1), grid.x{1}(end)}; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
52 ops = opsGen(m, x_lim, order); |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
53 |
328
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
54 D4 = ops.D4; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
55 obj.H = ops.H; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
56 obj.Hi = ops.HI; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
57 obj.e_l = ops.e_l; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
58 obj.e_r = ops.e_r; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
59 obj.d1_l = ops.d1_l; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
60 obj.d1_r = ops.d1_r; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
61 obj.d2_l = ops.d2_l; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
62 obj.d2_r = ops.d2_r; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
63 obj.d3_l = ops.d3_l; |
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
64 obj.d3_r = ops.d3_r; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
65 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
66 obj.D = alpha*D4; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
67 |
328
31d6698c1edf
Clean up and fixing of new operators
Jonatan Werpers <jonatan@werpers.com>
parents:
245
diff
changeset
|
68 alphaII = ops.borrowing.N.S2/2; |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
69 alphaIII = ops.borrowing.N.S3/2; |
239
ba56e0d621f2
Beam: Added ability to pick alphaII and alphaIII to control tau and sigma.
Jonatan Werpers <jonatan@werpers.com>
parents:
236
diff
changeset
|
70 |
ba56e0d621f2
Beam: Added ability to pick alphaII and alphaIII to control tau and sigma.
Jonatan Werpers <jonatan@werpers.com>
parents:
236
diff
changeset
|
71 obj.gamm = h*alphaII; |
ba56e0d621f2
Beam: Added ability to pick alphaII and alphaIII to control tau and sigma.
Jonatan Werpers <jonatan@werpers.com>
parents:
236
diff
changeset
|
72 obj.delt = h^3*alphaIII; |
242 | 73 obj.alphaII = alphaII; |
74 obj.alphaIII = alphaIII; | |
75 obj.h = h; | |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
76 obj.opt = opt; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
77 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
78 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
79 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
80 % Closure functions return the opertors applied to the own doamin to close the boundary |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
81 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
82 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
83 % type is a string specifying the type of boundary condition if there are several. |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
84 % neighbour_scheme is an instance of Scheme that should be interfaced to. |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
85 % neighbour_boundary is a string specifying which boundary to interface to. |
220
5df8d20281fe
Made scheme boundary_condition return a cell array of penalties if there are several of them.
Jonatan Werpers <jonatan@werpers.com>
parents:
176
diff
changeset
|
86 function [closure, penalty] = boundary_condition(obj,boundary,type) |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
87 default_arg('type','dn'); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
88 |
998
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
89 [e, d1, d2, d3] = obj.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, boundary); |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
90 s = obj.getBoundarySign(boundary); |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
91 gamm = obj.gamm; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
92 delt = obj.delt; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
93 |
545 | 94 |
95 % TODO: Can this be simplifed? Can I handle conditions on u on its own, u_x on its own ... | |
96 | |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
97 switch type |
339
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
98 case {'dn', 'clamped'} % Dirichlet-neumann boundary condition |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
99 alpha = obj.alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
100 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
101 % tau1 < -alpha^2/gamma |
220
5df8d20281fe
Made scheme boundary_condition return a cell array of penalties if there are several of them.
Jonatan Werpers <jonatan@werpers.com>
parents:
176
diff
changeset
|
102 % tuning = 2; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
103 tuning = 1.1; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
104 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
105 tau1 = tuning * alpha/delt; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
106 tau4 = s*alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
107 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
108 sig2 = tuning * alpha/gamm; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
109 sig3 = -s*alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
110 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
111 tau = tau1*e+tau4*d3; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
112 sig = sig2*d1+sig3*d2; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
113 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
114 closure = obj.Hi*(tau*e' + sig*d1'); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
115 |
223
96dedf892910
Fixed sign error in beam BC penalties.
Jonatan Werpers <jonatan@werpers.com>
parents:
220
diff
changeset
|
116 penalty{1} = -obj.Hi*tau; |
96dedf892910
Fixed sign error in beam BC penalties.
Jonatan Werpers <jonatan@werpers.com>
parents:
220
diff
changeset
|
117 penalty{2} = -obj.Hi*sig; |
339
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
118 |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
119 |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
120 case {'free'} |
340
25ae8333ce2b
scheme.Beam: Fixed stability of free bc.
Jonatan Werpers <jonatan@werpers.com>
parents:
339
diff
changeset
|
121 a = obj.alpha; |
339
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
122 |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
123 tau = s*a*d1; |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
124 sig = -s*a*e; |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
125 |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
126 closure = obj.Hi*(tau*d2' + sig*d3'); |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
127 penalty{1} = -obj.Hi*tau; |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
128 penalty{1} = -obj.Hi*sig; |
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
129 |
617
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
130 case 'e' |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
131 alpha = obj.alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
132 tuning = 1.1; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
133 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
134 tau1 = tuning * alpha/delt; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
135 tau4 = s*alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
136 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
137 tau = tau1*e+tau4*d3; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
138 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
139 closure = obj.Hi*tau*e'; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
140 penalty = -obj.Hi*tau; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
141 case 'd1' |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
142 alpha = obj.alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
143 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
144 tuning = 1.1; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
145 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
146 sig2 = tuning * alpha/gamm; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
147 sig3 = -s*alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
148 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
149 sig = sig2*d1+sig3*d2; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
150 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
151 closure = obj.Hi*sig*d1'; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
152 penalty = -obj.Hi*sig; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
153 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
154 case 'd2' |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
155 a = obj.alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
156 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
157 tau = s*a*d1; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
158 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
159 closure = obj.Hi*tau*d2'; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
160 penalty = -obj.Hi*tau; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
161 case 'd3' |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
162 a = obj.alpha; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
163 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
164 sig = -s*a*e; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
165 |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
166 closure = obj.Hi*sig*d3'; |
4ced7d47bd1f
Beam: Add ability to set one BC at a time
Jonatan Werpers <jonatan@werpers.com>
parents:
545
diff
changeset
|
167 penalty = -obj.Hi*sig; |
339
3135e13ae509
Implemented free BC. Not tested yet.
Jonatan Werpers <jonatan@werpers.com>
parents:
329
diff
changeset
|
168 |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
169 otherwise % Unknown, boundary condition |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
170 error('No such boundary condition: type = %s',type); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
171 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
172 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
173 |
944
a35ed1d124d3
Change from opts to type in a few schemes
Jonatan Werpers <jonatan@werpers.com>
parents:
910
diff
changeset
|
174 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary, type) |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
175 % u denotes the solution in the own domain |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
176 % v denotes the solution in the neighbour domain |
998
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
177 [e_u, d1_u, d2_u, d3_u] = obj.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, boundary); |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
178 s_u = obj.getBoundarySign(boundary); |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
179 |
998
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
180 [e_v, d1_v, d2_v, d3_v] = neighbour_scheme.getBoundaryOperator({'e', 'd1', 'd2', 'd3'}, neighbour_boundary); |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
181 s_v = neighbour_scheme.getBoundarySign(neighbour_boundary); |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
182 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
183 alpha_u = obj.alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
184 alpha_v = neighbour_scheme.alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
185 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
186 switch boundary |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
187 case 'l' |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
188 interface_opt = obj.opt.interface_l; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
189 case 'r' |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
190 interface_opt = obj.opt.interface_r; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
191 end |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
192 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
193 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
194 if isempty(interface_opt.tau) && isempty(interface_opt.sig) |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
195 gamm_u = obj.gamm; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
196 delt_u = obj.delt; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
197 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
198 gamm_v = neighbour_scheme.gamm; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
199 delt_v = neighbour_scheme.delt; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
200 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
201 tuning = interface_opt.tuning; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
202 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
203 tau1 = ((alpha_u/2)/delt_u + (alpha_v/2)/delt_v)/2*tuning; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
204 sig2 = ((alpha_u/2)/gamm_u + (alpha_v/2)/gamm_v)/2*tuning; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
205 else |
242 | 206 h_u = obj.h; |
207 h_v = neighbour_scheme.h; | |
208 | |
209 switch neighbour_boundary | |
210 case 'l' | |
211 neighbour_interface_opt = neighbour_scheme.opt.interface_l; | |
212 case 'r' | |
213 neighbour_interface_opt = neighbour_scheme.opt.interface_r; | |
214 end | |
215 | |
216 tau_u = interface_opt.tau; | |
217 sig_u = interface_opt.sig; | |
218 tau_v = neighbour_interface_opt.tau; | |
219 sig_v = neighbour_interface_opt.sig; | |
220 | |
221 tau1 = tau_u/h_u^3 + tau_v/h_v^3; | |
222 sig2 = sig_u/h_u + sig_v/h_v; | |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
223 end |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
224 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
225 tau4 = s_u*alpha_u/2; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
226 sig3 = -s_u*alpha_u/2; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
227 phi2 = s_u*1/2; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
228 psi1 = -s_u*1/2; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
229 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
230 tau = tau1*e_u + tau4*d3_u; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
231 sig = sig2*d1_u + sig3*d2_u ; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
232 phi = phi2*d1_u ; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
233 psi = psi1*e_u ; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
234 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
235 closure = obj.Hi*(tau*e_u' + sig*d1_u' + phi*alpha_u*d2_u' + psi*alpha_u*d3_u'); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
236 penalty = -obj.Hi*(tau*e_v' + sig*d1_v' + phi*alpha_v*d2_v' + psi*alpha_v*d3_v'); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
237 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
238 |
998
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
239 % Returns the boundary operator op for the boundary specified by the string boundary. |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
240 % op -- string or a cell array of strings |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
241 % boundary -- string |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
242 function varargout = getBoundaryOperator(obj, op, boundary) |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
243 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
244 if ~ismember(boundary, {'l', 'r'}) |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
245 error('No such boundary: boundary = %s',boundary); |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
246 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
247 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
248 if ~iscell(op) |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
249 op = {op}; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
250 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
251 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
252 for i = 1:numel(op) |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
253 switch op{i} |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
254 case 'e' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
255 switch boundary |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
256 case 'l' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
257 e = obj.e_l; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
258 case 'r' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
259 e = obj.e_r; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
260 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
261 varargout{i} = e; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
262 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
263 case 'd1' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
264 switch boundary |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
265 case 'l' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
266 d1 = obj.d1_l; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
267 case 'r' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
268 d1 = obj.d1_r; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
269 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
270 varargout{i} = d1; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
271 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
272 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
273 case 'd2' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
274 switch boundary |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
275 case 'l' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
276 d2 = obj.d2_l; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
277 case 'r' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
278 d2 = obj.d2_r; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
279 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
280 varargout{i} = d2; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
281 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
282 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
283 case 'd3' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
284 switch boundary |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
285 case 'l' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
286 d3 = obj.d3_l; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
287 case 'r' |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
288 d3 = obj.d3_r; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
289 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
290 varargout{i} = d3; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
291 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
292 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
293 end |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
294 |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
295 % Returns the boundary sign. The right boundary is considered the positive boundary |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
296 % boundary -- string |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
297 function s = getBoundarySign(obj, boundary) |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
298 switch boundary |
998
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
299 case {'r'} |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
300 s = 1; |
2b1b944deae1
Add getBoundaryOperator to all 1d schemes. Did not add getBoundaryQuadrature because it doesnt make sense in 1d (?)
Martin Almquist <malmquist@stanford.edu>
parents:
944
diff
changeset
|
301 case {'l'} |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
302 s = -1; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
303 otherwise |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
304 error('No such boundary: boundary = %s',boundary); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
305 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
306 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
307 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
308 function N = size(obj) |
224
05304d7792dc
Fixed type in scheme.Beam
Jonatan Werpers <jonatan@werpers.com>
parents:
223
diff
changeset
|
309 N = obj.grid.N; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
310 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
311 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
312 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
313 end |