comparison +scheme/Schrodinger.m @ 1108:5ec23b9bf360 feature/laplace_curvilinear_test

Merge with default
author Martin Almquist <malmquist@stanford.edu>
date Wed, 10 Apr 2019 11:00:27 -0700
parents 0c504a21432d
children
comparison
equal deleted inserted replaced
1087:867307f4d80f 1108:5ec23b9bf360
112 112
113 % Returns the boundary operator op for the boundary specified by the string boundary. 113 % Returns the boundary operator op for the boundary specified by the string boundary.
114 % op -- string or a cell array of strings 114 % op -- string or a cell array of strings
115 % boundary -- string 115 % boundary -- string
116 function varargout = getBoundaryOperator(obj, op, boundary) 116 function varargout = getBoundaryOperator(obj, op, boundary)
117 assertIsMember(boundary, {'l', 'r'})
117 118
118 if ~iscell(op) 119 if ~iscell(op)
119 op = {op}; 120 op = {op};
120 end 121 end
121 122
125 switch boundary 126 switch boundary
126 case 'l' 127 case 'l'
127 e = obj.e_l; 128 e = obj.e_l;
128 case 'r' 129 case 'r'
129 e = obj.e_r; 130 e = obj.e_r;
130 otherwise
131 error('No such boundary: boundary = %s',boundary);
132 end 131 end
133 varargout{i} = e; 132 varargout{i} = e;
134 133
135 case 'd' 134 case 'd'
136 switch boundary 135 switch boundary
137 case 'l' 136 case 'l'
138 d = obj.d1_l; 137 d = obj.d1_l;
139 case 'r' 138 case 'r'
140 d = obj.d1_r; 139 d = obj.d1_r;
141 otherwise
142 error('No such boundary: boundary = %s',boundary);
143 end 140 end
144 varargout{i} = d; 141 varargout{i} = d;
145 end 142 end
146 end 143 end
147 end 144 end
148 145
146 % Returns square boundary quadrature matrix, of dimension
147 % corresponding to the number of boundary points
148 %
149 % boundary -- string
150 % Note: for 1d diffOps, the boundary quadrature is the scalar 1.
151 function H_b = getBoundaryQuadrature(obj, boundary)
152 assertIsMember(boundary, {'l', 'r'})
153
154 H_b = 1;
155 end
156
149 % Returns the boundary sign. The right boundary is considered the positive boundary 157 % Returns the boundary sign. The right boundary is considered the positive boundary
150 % boundary -- string 158 % boundary -- string
151 function s = getBoundarySign(obj, boundary) 159 function s = getBoundarySign(obj, boundary)
160 assertIsMember(boundary, {'l', 'r'})
161
152 switch boundary 162 switch boundary
153 case {'r'} 163 case {'r'}
154 s = 1; 164 s = 1;
155 case {'l'} 165 case {'l'}
156 s = -1; 166 s = -1;
157 otherwise
158 error('No such boundary: boundary = %s',boundary);
159 end 167 end
160 end 168 end
161 169
162 function N = size(obj) 170 function N = size(obj)
163 N = obj.m; 171 N = obj.m;
164 end 172 end
165 173
166 end 174 end
167
168 methods(Static)
169 % Calculates the matrcis need for the inteface coupling between boundary bound_u of scheme schm_u
170 % and bound_v of scheme schm_v.
171 % [uu, uv, vv, vu] = inteface_couplong(A,'r',B,'l')
172 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v)
173 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v);
174 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u);
175 end
176 end
177 end 175 end