Mercurial > repos > public > sbplib
diff +scheme/Utux.m @ 1197:433c89bf19e0 feature/rv
Merge with default
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 07 Aug 2019 15:23:42 +0200 |
parents | 8a9393084b30 0c504a21432d |
children |
line wrap: on
line diff
--- a/+scheme/Utux.m Wed Aug 07 13:28:21 2019 +0200 +++ b/+scheme/Utux.m Wed Aug 07 15:23:42 2019 +0200 @@ -68,26 +68,23 @@ % neighbour_boundary is a string specifying which boundary to interface to. function [closure, penalty] = boundary_condition(obj,boundary,type) default_arg('type','dirichlet'); - sigma_left = -1; % Scalar penalty parameter for left boundary - sigma_right = 1; % Scalar penalty parameter for right boundary + s = obj.getBoundarySign(boundary); + e = obj.getBoundaryOperator('e', boundary); switch boundary % Can only specify boundary condition where there is inflow % Extract the postivie resp. negative part of a, for the left % resp. right boundary, and set other values of a to zero. % Then the closure will effectively only contribute to inflow boundaries - case {'l','L','left','Left'} + case {'l'} a_inflow = obj.a; a_inflow(a_inflow < 0) = 0; - tau = sigma_left*a_inflow*obj.e_l; - closure = obj.Hi*tau*obj.e_l'; - case {'r','R','right','Right'} + case {'r'} a_inflow = obj.a; a_inflow(a_inflow > 0) = 0; - tau = sigma_right*a_inflow*obj.e_r; - closure = obj.Hi*tau*obj.e_r'; end + tau = s*a_inflow*e; + closure = obj.Hi*tau*e'; penalty = -obj.Hi*tau; - end function [closure, penalty] = interface(obj, boundary, neighbour_scheme, neighbour_boundary, type) @@ -105,19 +102,43 @@ end + % Returns the boundary sign. The right boundary is considered the positive boundary + % boundary -- string + function s = getBoundarySign(obj, boundary) + assertIsMember(boundary, {'l', 'r'}) + + switch boundary + case {'r'} + s = 1; + case {'l'} + s = -1; + end + end + + % Returns the boundary operator op for the boundary specified by the string boundary. + % op -- string + % boundary -- string + function o = getBoundaryOperator(obj, op, boundary) + assertIsMember(op, {'e'}) + assertIsMember(boundary, {'l', 'r'}) + + o = obj.([op, '_', boundary]); + end + + % Returns square boundary quadrature matrix, of dimension + % corresponding to the number of boundary points + % + % boundary -- string + % Note: for 1d diffOps, the boundary quadrature is the scalar 1. + function H_b = getBoundaryQuadrature(obj, boundary) + assertIsMember(boundary, {'l', 'r'}) + + H_b = 1; + end + function N = size(obj) N = obj.m; end end - - methods(Static) - % Calculates the matrices needed for the inteface coupling between boundary bound_u of scheme schm_u - % and bound_v of scheme schm_v. - % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l') - function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v) - [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v); - [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); - end - end -end \ No newline at end of file +end