Mercurial > repos > public > sbplib
comparison +scheme/Euler1d.m @ 100:ce4eecbcb915
Made char BC in euler more robust.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 04 Dec 2015 16:35:30 +0100 |
parents | 5c41941b9e5e |
children | f5ed7ff58115 |
comparison
equal
deleted
inserted
replaced
96:19d0c9325a3e | 100:ce4eecbcb915 |
---|---|
281 c = obj.c(q_s); | 281 c = obj.c(q_s); |
282 | 282 |
283 Lambda = [u, u+c, u-c]; | 283 Lambda = [u, u+c, u-c]; |
284 | 284 |
285 p_in = find(s*Lambda < 0); | 285 p_in = find(s*Lambda < 0); |
286 p_ot = find(s*Lambda >= 0); | 286 p_ot = 1:3; |
287 p_ot(p_in) = []; | |
287 p = [p_in p_ot]; | 288 p = [p_in p_ot]; |
288 pt(p) = 1:length(p); | 289 pt(p) = 1:length(p); |
289 | 290 |
290 T = obj.T(q_s); | 291 T = obj.T(q_s); |
291 | 292 |
394 end | 395 end |
395 | 396 |
396 % Set wall boundary condition v = 0. | 397 % Set wall boundary condition v = 0. |
397 function closure = boundary_condition_wall(obj,boundary) | 398 function closure = boundary_condition_wall(obj,boundary) |
398 [e_s,e_S,s] = obj.get_boundary_ops(boundary); | 399 [e_s,e_S,s] = obj.get_boundary_ops(boundary); |
399 | |
400 % v = 0 corresponds to | |
401 % L = [0 1 0]; | |
402 % g = 0 | |
403 % | |
404 % Tp = | |
405 % R = -(u-c)/(u+c) | |
406 | |
407 % tau = alpha * (u+c) | |
408 % (alpha+1)(u+c) + 1/4* alpha^2|u-c| <= 0 | |
409 % 4*(alpha+1)(u+c) + alpha^2|u-c| <= 0 | |
410 % 4 * (alpha+1)(u+c) + alpha^2|u| + alpha^2*c <= 0 | |
411 % |u|*(sgn(u)*4 + sgn(u)*4*alpha + alpha^2) + c*(4 + 4alpha + alpha^2) <= 0 | |
412 % |u|*(alpha^2 + 4*sgn(u)*alpha + 4*sgn(u)) + c*(alpha+2)^2 <= 0 | |
413 % |u|*[(alpha + 2*sgn(u))^2 - 4*(sgn(u)-1)] + c*(alpha+2)^2 <= 0 | |
414 | |
415 | |
416 % om vi låtsas att u = 0: | |
417 % (alpha+1)c + 1/4 * alpha^2*c <= 0 | |
418 % alpha^2 + 4*alpha +4 <= 0 | |
419 % (alpha + 2)^2 <= 0 | |
420 % alpha = -2 gives tau = -2*c; | |
421 | |
422 | 400 |
423 % Vill vi sätta penalty på karateristikan som är nära noll också eller vill | 401 % Vill vi sätta penalty på karateristikan som är nära noll också eller vill |
424 % vi låta den vara fri? | 402 % vi låta den vara fri? |
425 | 403 |
426 | 404 |