Mercurial > repos > public > sbplib
annotate +scheme/Beam.m @ 240:46256fffa329 feature/beams
Added some stuff for default structs. Improved interface for beam.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 03 Aug 2016 12:30:27 +0200 |
parents | ba56e0d621f2 |
children | f4306afd6849 |
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 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
9 H % Discrete norm |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
10 Hi |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
11 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
12 e_l, e_r |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
13 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
|
14 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
|
15 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
|
16 gamm |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
17 delt |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
18 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
19 opt |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
20 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
21 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
22 methods |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
23 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
|
24 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
|
25 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
26 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 |
236
8592358a3935
Beam: Added tuning as a parameter to contructor.
Jonatan Werpers <jonatan@werpers.com>
parents:
235
diff
changeset
|
35 |
232
443b14ea705b
scheme.Beam: changes to possibly better operators.
Jonatan Werpers <jonatan@werpers.com>
parents:
224
diff
changeset
|
36 % default_arg('opsGen', @sbp.Higher); |
443b14ea705b
scheme.Beam: changes to possibly better operators.
Jonatan Werpers <jonatan@werpers.com>
parents:
224
diff
changeset
|
37 default_arg('opsGen', @sbp.HigherCompatibleVariable); % Supposed to be better |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
38 |
176
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
39 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
|
40 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
|
41 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
42 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
43 obj.grid = grid; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
44 obj.order = order; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
45 obj.alpha = alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
46 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
47 m = grid.m; |
176
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
48 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
|
49 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
50 ops = opsGen(m, h, order); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
51 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
52 I = speye(m); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
53 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
54 D4 = sparse(ops.derivatives.D4); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
55 obj.H = sparse(ops.norms.H); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
56 obj.Hi = sparse(ops.norms.HI); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
57 obj.e_l = sparse(ops.boundary.e_1); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
58 obj.e_r = sparse(ops.boundary.e_m); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
59 obj.d1_l = sparse(ops.boundary.S_1); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
60 obj.d1_r = sparse(ops.boundary.S_m); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
61 obj.d2_l = sparse(ops.boundary.S2_1); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
62 obj.d2_r = sparse(ops.boundary.S2_m); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
63 obj.d3_l = sparse(ops.boundary.S3_1); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
64 obj.d3_r = sparse(ops.boundary.S3_m); |
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 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
68 alphaII = ops.borrowing.N.S2/2; |
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; |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
73 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
|
74 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
75 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
76 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
77 % 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
|
78 % 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
|
79 % 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
|
80 % 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
|
81 % 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
|
82 % 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
|
83 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
|
84 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
|
85 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
86 [e, d1, d2, d3, s] = obj.get_boundary_ops(boundary); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
87 gamm = obj.gamm; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
88 delt = obj.delt; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
89 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
90 switch type |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
91 case {'dn'} % Dirichlet-neumann boundary condition |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
92 alpha = obj.alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
93 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
94 % 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
|
95 % tuning = 2; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
96 tuning = 1.1; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
97 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
98 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
|
99 tau4 = s*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 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
|
102 sig3 = -s*alpha; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
103 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
104 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
|
105 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
|
106 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
107 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
|
108 |
223
96dedf892910
Fixed sign error in beam BC penalties.
Jonatan Werpers <jonatan@werpers.com>
parents:
220
diff
changeset
|
109 penalty{1} = -obj.Hi*tau; |
96dedf892910
Fixed sign error in beam BC penalties.
Jonatan Werpers <jonatan@werpers.com>
parents:
220
diff
changeset
|
110 penalty{2} = -obj.Hi*sig; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
111 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
|
112 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
|
113 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
114 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
115 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
116 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
117 % 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
|
118 % v denotes the solution in the neighbour domain |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
119 [e_u,d1_u,d2_u,d3_u,s_u] = obj.get_boundary_ops(boundary); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
120 [e_v,d1_v,d2_v,d3_v,s_v] = neighbour_scheme.get_boundary_ops(neighbour_boundary); |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
121 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
122 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
123 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
|
124 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
|
125 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
126 switch boundary |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
127 case 'l' |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
128 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
|
129 case 'r' |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
130 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
|
131 end |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
132 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
133 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
134 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
|
135 gamm_u = obj.gamm; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
136 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
|
137 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
138 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
|
139 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
|
140 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
141 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
|
142 |
240
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
143 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
|
144 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
|
145 else |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
146 tau1 = interface_opt.tau; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
147 sig2 = interface_opt.sig; |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
148 end |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
149 |
46256fffa329
Added some stuff for default structs. Improved interface for beam.
Jonatan Werpers <jonatan@werpers.com>
parents:
239
diff
changeset
|
150 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
|
151 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
|
152 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
|
153 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
|
154 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 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
|
159 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
160 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
|
161 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
|
162 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
163 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
164 % Returns the boundary ops and sign for the boundary specified by the string boundary. |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
165 % The right boundary is considered the positive boundary |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
166 function [e, d1, d2, d3, s] = get_boundary_ops(obj,boundary) |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
167 switch boundary |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
168 case 'l' |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
169 e = obj.e_l; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
170 d1 = obj.d1_l; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
171 d2 = obj.d2_l; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
172 d3 = obj.d3_l; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
173 s = -1; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
174 case 'r' |
176
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
175 e = obj.e_r; |
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
176 d1 = obj.d1_r; |
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
177 d2 = obj.d2_r; |
d095b5396103
Fixed some bugs in Beam schemes.
Jonatan Werpers <jonatan@werpers.com>
parents:
175
diff
changeset
|
178 d3 = obj.d3_r; |
175
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
179 s = 1; |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
180 otherwise |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
181 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
|
182 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
183 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
184 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
185 function N = size(obj) |
224
05304d7792dc
Fixed type in scheme.Beam
Jonatan Werpers <jonatan@werpers.com>
parents:
223
diff
changeset
|
186 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
|
187 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
188 |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
189 end |
8f22829b69d0
Added and upgraded schemes for the beam equation in 1d and 2d.
Jonatan Werpers <jonatan@werpers.com>
parents:
diff
changeset
|
190 end |