Mercurial > repos > public > sbplib
changeset 347:85c2fe06d551 feature/beams
Implemented characteristic form BC in Wave2dCurve.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 16 Nov 2016 16:16:44 -0800 |
parents | 33b2ef863519 |
children | 19495f126f06 |
files | +scheme/Wave2dCurve.m |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r 33b2ef863519 -r 85c2fe06d551 +scheme/Wave2dCurve.m --- a/+scheme/Wave2dCurve.m Wed Nov 16 16:15:53 2016 -0800 +++ b/+scheme/Wave2dCurve.m Wed Nov 16 16:16:44 2016 -0800 @@ -155,8 +155,9 @@ % data is a function returning the data that should be applied at the boundary. % neighbour_scheme is an instance of Scheme that should be interfaced to. % neighbour_boundary is a string specifying which boundary to interface to. - function [closure, penalty] = boundary_condition(obj,boundary,type) + function [closure, penalty] = boundary_condition(obj, boundary, type, parameter) default_arg('type','neumann'); + default_arg('parameter', []); [e, d_n, d_t, coeff_n, coeff_t, s, gamm, halfnorm_inv] = obj.get_boundary_ops(boundary); @@ -201,8 +202,23 @@ tau = c.^2 * obj.Ji*(tau1*e + tau2*d); closure = halfnorm_inv*tau*d'; - penalty = halfnorm_inv*tau; + penalty = -halfnorm_inv*tau; + + % Characteristic boundary condition + case {'characteristic', 'char', 'c'} + default_arg('parameter', 1); + beta = parameter; + c = obj.c; + a_n = spdiags(coeff_n,0,length(coeff_n),length(coeff_n)); + a_t = spdiags(coeff_t,0,length(coeff_t),length(coeff_t)); + d = s*(a_n * d_n' + a_t*d_t')'; % outward facing normal derivative + + tau = -c.^2 * 1/beta * obj.Ji*e; + + closure{1} = halfnorm_inv*tau*e'; + closure{2} = halfnorm_inv*tau*beta*d'; + penalty = -halfnorm_inv*tau; % Unknown, boundary condition otherwise