Mercurial > repos > public > sbplib
comparison +scheme/Euler1d.m @ 91:2102af217134
Added inflow bc for rho
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 30 Nov 2015 15:23:09 +0100 |
parents | 80948a4084f3 |
children | ed7c7d651428 |
comparison
equal
deleted
inserted
replaced
89:53fe4b64f65e | 91:2102af217134 |
---|---|
168 closure = obj.boundary_condition_wall(boundary); | 168 closure = obj.boundary_condition_wall(boundary); |
169 case 'inflow' | 169 case 'inflow' |
170 closure = obj.boundary_condition_inflow(boundary,varargin{:}); | 170 closure = obj.boundary_condition_inflow(boundary,varargin{:}); |
171 case 'outflow' | 171 case 'outflow' |
172 closure = obj.boundary_condition_outflow(boundary,varargin{:}); | 172 closure = obj.boundary_condition_outflow(boundary,varargin{:}); |
173 case 'outflow_rho' | 173 case 'inflow_rho' |
174 closure = obj.boundary_condition_inflow_rho(boundary,varargin{:}); | |
175 case 'outflow_rho' | |
174 closure = obj.boundary_condition_outflow_rho(boundary,varargin{:}); | 176 closure = obj.boundary_condition_outflow_rho(boundary,varargin{:}); |
175 case 'char' | 177 case 'char' |
176 closure = obj.boundary_condition_char(boundary,varargin{:}); | 178 closure = obj.boundary_condition_char(boundary,varargin{:}); |
177 otherwise | 179 otherwise |
178 error('Unsupported bc type: %s', type); | 180 error('Unsupported bc type: %s', type); |
313 g = @(t)[p_data(t)]; | 315 g = @(t)[p_data(t)]; |
314 | 316 |
315 | 317 |
316 closure = boundary_condition_L(obj, boundary, L, g, p_in); | 318 closure = boundary_condition_L(obj, boundary, L, g, p_in); |
317 | 319 |
320 end | |
321 | |
322 function closure = boundary_condition_inflow_rho(obj, boundary, rho_data, v_data) | |
323 [~,~,s] = obj.get_boundary_ops(boundary); | |
324 | |
325 switch s | |
326 case -1 | |
327 p_in = [1 2]; | |
328 case 1 | |
329 p_in = [1 3]; | |
330 end | |
331 | |
332 a = obj.gamma - 1; | |
333 L = @(rho,~,~)[ | |
334 0 1/rho 0; | |
335 1 0 0; | |
336 ]; | |
337 g = @(t)[ | |
338 v_data(t); | |
339 rho_data(t); | |
340 ]; | |
341 | |
342 closure = boundary_condition_L(obj, boundary, L, g, p_in); | |
318 end | 343 end |
319 | 344 |
320 function closure = boundary_condition_outflow_rho(obj, boundary, rho_data) | 345 function closure = boundary_condition_outflow_rho(obj, boundary, rho_data) |
321 [~,~,s] = obj.get_boundary_ops(boundary); | 346 [~,~,s] = obj.get_boundary_ops(boundary); |
322 | 347 |