Mercurial > repos > public > sbplib
changeset 1072:6468a5f6ec79 feature/grids/LaplaceSquared
Merge with default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 12 Feb 2019 17:12:42 +0100 |
parents | 92cb03e64ca4 (diff) c7b619cf5e34 (current diff) |
children | 95113a592421 |
files | +sbp/+implementations/intOpAWW_orders_2to2_ratio2to1.m +sbp/+implementations/intOpAWW_orders_2to2_ratio_2to1_accC2F1_accF2C2.m +sbp/+implementations/intOpAWW_orders_2to2_ratio_2to1_accC2F2_accF2C1.m +sbp/+implementations/intOpAWW_orders_4to4_ratio2to1.m +sbp/+implementations/intOpAWW_orders_4to4_ratio_2to1_accC2F2_accF2C3.m +sbp/+implementations/intOpAWW_orders_4to4_ratio_2to1_accC2F3_accF2C2.m +sbp/+implementations/intOpAWW_orders_6to6_ratio2to1.m +sbp/+implementations/intOpAWW_orders_6to6_ratio_2to1_accC2F3_accF2C4.m +sbp/+implementations/intOpAWW_orders_6to6_ratio_2to1_accC2F4_accF2C3.m +sbp/+implementations/intOpAWW_orders_8to8_ratio2to1.m +sbp/+implementations/intOpAWW_orders_8to8_ratio_2to1_accC2F4_accF2C5.m +sbp/+implementations/intOpAWW_orders_8to8_ratio_2to1_accC2F5_accF2C4.m +sbp/InterpAWW.m +sbp/InterpMC.m +scheme/Beam2d.m +scheme/TODO.txt +scheme/Wave.m +scheme/Wave2dCurve.m +scheme/error1d.m +scheme/error2d.m +scheme/errorMax.m +scheme/errorRelative.m +scheme/errorSbp.m +scheme/errorVector.m +time/+cdiff/cdiff.m |
diffstat | 1 files changed, 105 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+multiblock/LaplaceSquared.m Tue Feb 12 17:12:42 2019 +0100 @@ -0,0 +1,105 @@ +classdef LaplaceSquared < scheme.Scheme + properties + grid + order + laplaceDiffOp + + D + H + Hi + + a,b + end + + methods + % Discretisation of a*nabla*b*nabla + function obj = LaplaceSquared(g, order, a, b, opGen) + default_arg('order', 4); + default_arg('a', 1); + default_arg('b', 1); + default_arg('opGen', @sbp.D4Variable); + + if isscalar(a) + a = grid.evalOn(g, a); + end + + if isscalar(b) + b = grid.evalOn(g, b); + end + + obj.grid = g; + obj.order = order; + obj.a = a; + obj.b = b; + + obj.laplaceDiffOp = multiblock.Laplace(g, order, 1, 1, opGen); + + obj.H = obj.laplaceDiffOp.H; + obj.Hi = spdiag(1./diag(obj.H)); + + A = spdiag(a); + B = spdiag(b); + + D_laplace = obj.laplaceDiffOp.D; + obj.D = A*D_laplace*B*D_laplace; + end + + function s = size(obj) + s = size(obj.laplaceDiffOp); + end + + function op = getBoundaryOperator(obj, opName, boundary) + switch opName + case 'e' + op = getBoundaryOperator(obj.laplaceDiffOp, 'e', boundary); + case 'd1' + op = getBoundaryOperator(obj.laplaceDiffOp, 'd', boundary); + case 'd2' + e = getBoundaryOperator(obj.laplaceDiffOp, 'e', boundary); + op = (e'*obj.laplaceDiffOp.D)'; + case 'd3' + d1 = getBoundaryOperator(obj.laplaceDiffOp, 'd', boundary); + op = (d1'*spdiag(obj.b)*obj.laplaceDiffOp.D)'; + end + end + + function op = getBoundaryQuadrature(obj, boundary) + op = getBoundaryQuadrature(obj.laplaceDiffOp, boundary); + end + + function [closure, penalty] = boundary_condition(obj,boundary,type) % TODO: Change name to boundaryCondition + switch type + case 'e' + error('Bc of type ''e'' not implemented') + case 'd1' + error('Bc of type ''d1'' not implemented') + case 'd2' + e = obj.getBoundaryOperator('e', boundary); + d1 = obj.getBoundaryOperator('d1', boundary); + d2 = obj.getBoundaryOperator('d2', boundary); + H_b = obj.getBoundaryQuadrature(boundary); + + A = spdiag(obj.a); + B_b = spdiag(e'*obj.b); + + tau = obj.Hi*A*d1*B_b*H_b; + closure = tau*d2'; + penalty = -tau; + case 'd3' + e = obj.getBoundaryOperator('e', boundary); + d3 = obj.getBoundaryOperator('d1', boundary); + H_b = obj.getBoundaryQuadrature(boundary); + + A = spdiag(obj.a); + + tau = -obj.Hi*A*e*H_b; + closure = tau*d3'; + penalty = -tau; + end + end + + function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary) + error('Not implemented') + end + end +end \ No newline at end of file