annotate +scheme/Utux2d.m @ 1198:2924b3a9b921 feature/d2_compatible

Add OpSet for fully compatible D2Variable, created from regular D2Variable by replacing d1 by first row of D1. Formal reduction by one order of accuracy at the boundary point.
author Martin Almquist <malmquist@stanford.edu>
date Fri, 16 Aug 2019 14:30:28 -0700
parents 84200bbae101
children 433c89bf19e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
950
cab047de7f5d Rename *2D schemes to *2d
Jonatan Werpers <jonatan@werpers.com>
parents: 948
diff changeset
1 classdef Utux2d < scheme.Scheme
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
2 properties
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
3 m % Number of points in each direction, possibly a vector
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
4 h % Grid spacing
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
5 grid % Grid
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
6 order % Order accuracy for the approximation
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
7 v0 % Initial data
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
8
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
9 a % Wave speed a = [a1, a2];
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
10 % Can either be a constant vector or a cell array of function handles.
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
11
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
12 H % Discrete norm
595
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
13 H_x, H_y % Norms in the x and y directions
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms
1048
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
15 H_w, H_e, H_s, H_n % Boundary quadratures
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
16
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
17 % Derivatives
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
18 Dx, Dy
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
19
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
20 % Boundary operators
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
21 e_w, e_e, e_s, e_n
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
22
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
23 D % Total discrete operator
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
24 end
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
25
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
26
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
27 methods
950
cab047de7f5d Rename *2D schemes to *2d
Jonatan Werpers <jonatan@werpers.com>
parents: 948
diff changeset
28 function obj = Utux2d(g ,order, opSet, a)
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
29
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
30 default_arg('a',1/sqrt(2)*[1, 1]);
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
31 default_arg('opSet',@sbp.D2Standard);
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
32
948
3dd7f87c9a1b Use assertType(...) instead of assert(isa(...))
Jonatan Werpers <jonatan@werpers.com>
parents: 942
diff changeset
33 assertType(g, 'grid.Cartesian');
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
34 if iscell(a)
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
35 a1 = grid.evalOn(g, a{1});
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
36 a2 = grid.evalOn(g, a{2});
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
37 a = {spdiag(a1), spdiag(a2)};
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
38 else
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
39 a = {a(1), a(2)};
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
40 end
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
41
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
42 m = g.size();
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
43 m_x = m(1);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
44 m_y = m(2);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
45 m_tot = g.N();
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
46
595
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
47 xlim = {g.x{1}(1), g.x{1}(end)};
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
48 ylim = {g.x{2}(1), g.x{2}(end)};
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
49 obj.grid = g;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
50
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
51 % Operator sets
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
52 ops_x = opSet(m_x, xlim, order);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
53 ops_y = opSet(m_y, ylim, order);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
54 Ix = speye(m_x);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
55 Iy = speye(m_y);
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
56
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
57 % Norms
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
58 Hx = ops_x.H;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
59 Hy = ops_y.H;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
60 Hxi = ops_x.HI;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
61 Hyi = ops_y.HI;
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
62
1048
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
63 obj.H_w = Hy;
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
64 obj.H_e = Hy;
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
65 obj.H_s = Hx;
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
66 obj.H_n = Hx;
595
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
67 obj.H_x = Hx;
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
68 obj.H_y = Hy;
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
69 obj.H = kron(Hx,Hy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
70 obj.Hi = kron(Hxi,Hyi);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
71 obj.Hx = kron(Hx,Iy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
72 obj.Hy = kron(Ix,Hy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
73 obj.Hxi = kron(Hxi,Iy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
74 obj.Hyi = kron(Ix,Hyi);
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
75
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
76 % Derivatives
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
77 Dx = ops_x.D1;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
78 Dy = ops_y.D1;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
79 obj.Dx = kron(Dx,Iy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
80 obj.Dy = kron(Ix,Dy);
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
81
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
82 % Boundary operators
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
83 obj.e_w = kr(ops_x.e_l, Iy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
84 obj.e_e = kr(ops_x.e_r, Iy);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
85 obj.e_s = kr(Ix, ops_y.e_l);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
86 obj.e_n = kr(Ix, ops_y.e_r);
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
87
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
88 obj.m = m;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
89 obj.h = [ops_x.h ops_y.h];
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
90 obj.order = order;
595
2a2f34778ded Make Utux2D work
Martin Almquist <malmquist@stanford.edu>
parents: 591
diff changeset
91 obj.a = a;
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
92 obj.D = -(a{1}*obj.Dx + a{2}*obj.Dy);
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
93
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
94 end
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
95 % Closure functions return the opertors applied to the own domain to close the boundary
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
96 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
97 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
98 % type is a string specifying the type of boundary condition if there are several.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
99 % data is a function returning the data that should be applied at the boundary.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
100 % neighbour_scheme is an instance of Scheme that should be interfaced to.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
101 % neighbour_boundary is a string specifying which boundary to interface to.
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
102 function [closure, penalty] = boundary_condition(obj,boundary,type)
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
103 default_arg('type','dirichlet');
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
104
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
105 sigma = -1; % Scalar penalty parameter
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
106 switch boundary
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
107 case {'w','W','west','West'}
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
108 tau = sigma*obj.a{1}*obj.e_w*obj.H_y;
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
109 closure = obj.Hi*tau*obj.e_w';
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
110
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
111 case {'s','S','south','South'}
743
f4595f14d696 Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents: 666
diff changeset
112 tau = sigma*obj.a{2}*obj.e_s*obj.H_x;
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
113 closure = obj.Hi*tau*obj.e_s';
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
114 end
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
115 penalty = -obj.Hi*tau;
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
116
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
117 end
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
118
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
119 % type Struct that specifies the interface coupling.
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
120 % Fields:
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
121 % -- couplingType String, type of interface coupling
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
122 % % Default: 'upwind'. Other: 'centered'
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
123 % -- interpolation: type of interpolation, default 'none'
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
124 % -- interpolationDamping: damping on upstream and downstream sides, when using interpolation.
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
125 % Default {0,0} gives zero damping.
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
126 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary,type)
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
127
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
128 defaultType.couplingType = 'upwind';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
129 defaultType.interpolation = 'none';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
130 defaultType.interpolationDamping = {0,0};
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
131 default_struct('type', defaultType);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
132
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
133 switch type.interpolation
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
134 case {'none', ''}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
135 [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
136 case {'op','OP'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
137 [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
138 otherwise
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
139 error('Unknown type of interpolation: %s ', type.interpolation);
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
140 end
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
141 end
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
142
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
143 function [closure, penalty] = interfaceStandard(obj,boundary,neighbour_scheme,neighbour_boundary,type)
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
144 couplingType = type.couplingType;
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
145
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
146 % Get neighbour boundary operator
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
147 e_neighbour = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
148
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
149 switch couplingType
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
150
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
151 % Upwind coupling (energy dissipation)
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
152 case 'upwind'
605
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
153 sigma_ds = -1; %"Downstream" penalty
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
154 sigma_us = 0; %"Upstream" penalty
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
155
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
156 % Energy-preserving coupling (no energy dissipation)
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
157 case 'centered'
605
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
158 sigma_ds = -1/2; %"Downstream" penalty
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
159 sigma_us = 1/2; %"Upstream" penalty
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
160
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
161 otherwise
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
162 error(['Interface coupling type ' couplingType ' is not available.'])
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
163 end
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
164
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
165 switch boundary
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
166 case {'w','W','west','West'}
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
167 tau = sigma_ds*obj.a{1}*obj.e_w*obj.H_y;
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
168 closure = obj.Hi*tau*obj.e_w';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
169 penalty = -obj.Hi*tau*e_neighbour';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
170 case {'e','E','east','East'}
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
171 tau = sigma_us*obj.a{1}*obj.e_e*obj.H_y;
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
172 closure = obj.Hi*tau*obj.e_e';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
173 penalty = -obj.Hi*tau*e_neighbour';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
174 case {'s','S','south','South'}
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
175 tau = sigma_ds*obj.a{2}*obj.e_s*obj.H_x;
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
176 closure = obj.Hi*tau*obj.e_s';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
177 penalty = -obj.Hi*tau*e_neighbour';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
178 case {'n','N','north','North'}
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
179 tau = sigma_us*obj.a{2}*obj.e_n*obj.H_x;
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
180 closure = obj.Hi*tau*obj.e_n';
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
181 penalty = -obj.Hi*tau*e_neighbour';
605
0f9d20dbb7ce Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents: 595
diff changeset
182 end
610
b7b3c11fab4d Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents: 605
diff changeset
183
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
184 end
610
b7b3c11fab4d Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents: 605
diff changeset
185
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
186 function [closure, penalty] = interfaceNonConforming(obj,boundary,neighbour_scheme,neighbour_boundary,type)
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
187
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
188 % User can request special interpolation operators by specifying type.interpOpSet
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
189 default_field(type, 'interpOpSet', @sbp.InterpOpsOP);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
190
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
191 interpOpSet = type.interpOpSet;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
192 couplingType = type.couplingType;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
193 interpolationDamping = type.interpolationDamping;
610
b7b3c11fab4d Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents: 605
diff changeset
194
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
195 % Get neighbour boundary operator
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
196 e_neighbour = neighbour_scheme.getBoundaryOperator('e', neighbour_boundary);
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
197
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
198 switch couplingType
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
199
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
200 % Upwind coupling (energy dissipation)
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
201 case 'upwind'
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
202 sigma_ds = -1; %"Downstream" penalty
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
203 sigma_us = 0; %"Upstream" penalty
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
204
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
205 % Energy-preserving coupling (no energy dissipation)
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
206 case 'centered'
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
207 sigma_ds = -1/2; %"Downstream" penalty
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
208 sigma_us = 1/2; %"Upstream" penalty
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
209
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
210 otherwise
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
211 error(['Interface coupling type ' couplingType ' is not available.'])
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
212 end
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
213
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
214 int_damp_us = interpolationDamping{1};
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
215 int_damp_ds = interpolationDamping{2};
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
216
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
217 % u denotes the solution in the own domain
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
218 % v denotes the solution in the neighbour domain
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
219 % Find the number of grid points along the interface
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
220 switch boundary
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
221 case {'w','e'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
222 m_u = obj.m(2);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
223 case {'s','n'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
224 m_u = obj.m(1);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
225 end
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
226 m_v = size(e_neighbour, 2);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
227
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
228 % Build interpolation operators
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
229 intOps = interpOpSet(m_u, m_v, obj.order, neighbour_scheme.order);
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
230 Iu2v = intOps.Iu2v;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
231 Iv2u = intOps.Iv2u;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
232
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
233 I_local2neighbour_ds = intOps.Iu2v.bad;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
234 I_local2neighbour_us = intOps.Iu2v.good;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
235 I_neighbour2local_ds = intOps.Iv2u.good;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
236 I_neighbour2local_us = intOps.Iv2u.bad;
914
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
237
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
238 I_back_forth_us = I_neighbour2local_us*I_local2neighbour_us;
50cafc4b9e40 Make default_field overwrite if field exists but is empty. Refactor interface method in Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 910
diff changeset
239 I_back_forth_ds = I_neighbour2local_ds*I_local2neighbour_ds;
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
240
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
241
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
242 switch boundary
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
243 case {'w','W','west','West'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
244 tau = sigma_ds*obj.a{1}*obj.e_w*obj.H_y;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
245 closure = obj.Hi*tau*obj.e_w';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
246 penalty = -obj.Hi*tau*I_neighbour2local_ds*e_neighbour';
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
247
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
248 beta = int_damp_ds*obj.a{1}...
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
249 *obj.e_w*obj.H_y;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
250 closure = closure + obj.Hi*beta*I_back_forth_ds*obj.e_w' - obj.Hi*beta*obj.e_w';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
251 case {'e','E','east','East'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
252 tau = sigma_us*obj.a{1}*obj.e_e*obj.H_y;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
253 closure = obj.Hi*tau*obj.e_e';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
254 penalty = -obj.Hi*tau*I_neighbour2local_us*e_neighbour';
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
255
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
256 beta = int_damp_us*obj.a{1}...
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
257 *obj.e_e*obj.H_y;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
258 closure = closure + obj.Hi*beta*I_back_forth_us*obj.e_e' - obj.Hi*beta*obj.e_e';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
259 case {'s','S','south','South'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
260 tau = sigma_ds*obj.a{2}*obj.e_s*obj.H_x;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
261 closure = obj.Hi*tau*obj.e_s';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
262 penalty = -obj.Hi*tau*I_neighbour2local_ds*e_neighbour';
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
263
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
264 beta = int_damp_ds*obj.a{2}...
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
265 *obj.e_s*obj.H_x;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
266 closure = closure + obj.Hi*beta*I_back_forth_ds*obj.e_s' - obj.Hi*beta*obj.e_s';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
267 case {'n','N','north','North'}
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
268 tau = sigma_us*obj.a{2}*obj.e_n*obj.H_x;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
269 closure = obj.Hi*tau*obj.e_n';
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
270 penalty = -obj.Hi*tau*I_neighbour2local_us*e_neighbour';
666
2d85f17a8aec Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents: 610
diff changeset
271
942
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
272 beta = int_damp_us*obj.a{2}...
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
273 *obj.e_n*obj.H_x;
35701c85e356 Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents: 914
diff changeset
274 closure = closure + obj.Hi*beta*I_back_forth_us*obj.e_n' - obj.Hi*beta*obj.e_n';
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
275 end
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
276
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
277
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
278 end
905
459eeb99130f Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents: 743
diff changeset
279
1048
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
280 % Returns the boundary operator op for the boundary specified by the string boundary.
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
281 % op -- string
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
282 % boundary -- string
1048
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
283 function o = getBoundaryOperator(obj, op, boundary)
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
284 assertIsMember(op, {'e'})
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
285 assertIsMember(boundary, {'w', 'e', 's', 'n'})
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
286
1048
adbb80e60b10 Clean up Elastic2dVariable (partially), Utux, and Utux2d.
Martin Almquist <malmquist@stanford.edu>
parents: 1044
diff changeset
287 o = obj.([op, '_', boundary]);
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
288 end
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
289
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
290 % Returns square boundary quadrature matrix, of dimension
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
291 % corresponding to the number of boundary points
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
292 %
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
293 % boundary -- string
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
294 function H_b = getBoundaryQuadrature(obj, boundary)
1042
8d73fcdb07a5 Add asserts to boundary identifier inputs
Jonatan Werpers <jonatan@werpers.com>
parents: 997
diff changeset
295 assertIsMember(boundary, {'w', 'e', 's', 'n'})
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
296
1051
84200bbae101 Bugfix: add missing brackets in getBoundaryQuadrature in LaplCurv and Utux2d
Martin Almquist <malmquist@stanford.edu>
parents: 1048
diff changeset
297 H_b = obj.(['H_', boundary]);
997
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
298 end
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 950
diff changeset
299
591
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
300 function N = size(obj)
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
301 N = obj.m;
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
302 end
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
303
39554f2de783 Add Utux2D scheme
Martin Almquist <martin.almquist@it.uu.se>
parents:
diff changeset
304 end
1043
c12b84fe9b00 Remove static method `interface_coupling` that shouldn't have existed in the first place
Jonatan Werpers <jonatan@werpers.com>
parents: 950
diff changeset
305 end