Mercurial > repos > public > sbplib
annotate +scheme/Utux2d.m @ 1022:234c1c02ea39 feature/advectionRV
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 07 Jan 2019 12:06:06 +0100 |
parents | cc61dde120cd |
children | ac80bedc8df7 |
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 | 2 properties |
3 m % Number of points in each direction, possibly a vector | |
4 h % Grid spacing | |
5 grid % Grid | |
6 order % Order accuracy for the approximation | |
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 | 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 | 11 |
12 H % Discrete norm | |
595 | 13 H_x, H_y % Norms in the x and y directions |
14 Hi, Hx, Hy, Hxi, Hyi % Kroneckered norms | |
591 | 15 |
16 % Derivatives | |
17 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
|
18 |
1019
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
19 % Dissipation Operators |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
20 DissOpx, DissOpy |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
21 |
591 | 22 % Boundary operators |
23 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
|
24 |
591 | 25 D % Total discrete operator |
26 end | |
27 | |
28 | |
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 methods |
1021
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
30 function obj = Utux2d(g ,order, opSet, a, fluxSplitting) |
905
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
31 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
32 default_arg('a',1/sqrt(2)*[1, 1]); |
591 | 33 default_arg('opSet',@sbp.D2Standard); |
1021
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
34 default_arg('fluxSplitting',[]); |
743
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
35 |
948
3dd7f87c9a1b
Use assertType(...) instead of assert(isa(...))
Jonatan Werpers <jonatan@werpers.com>
parents:
942
diff
changeset
|
36 assertType(g, 'grid.Cartesian'); |
743
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
37 if iscell(a) |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
38 a1 = grid.evalOn(g, a{1}); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
39 a2 = grid.evalOn(g, a{2}); |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
40 a = {spdiag(a1), spdiag(a2)}; |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
41 else |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
42 a = {a(1), a(2)}; |
f4595f14d696
Change schemes to work for special coefficients.
Martin Almquist <malmquist@stanford.edu>
parents:
666
diff
changeset
|
43 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
|
44 |
591 | 45 m = g.size(); |
46 m_x = m(1); | |
47 m_y = m(2); | |
48 m_tot = g.N(); | |
49 | |
595 | 50 xlim = {g.x{1}(1), g.x{1}(end)}; |
51 ylim = {g.x{2}(1), g.x{2}(end)}; | |
591 | 52 obj.grid = g; |
53 | |
54 % Operator sets | |
55 ops_x = opSet(m_x, xlim, order); | |
56 ops_y = opSet(m_y, ylim, order); | |
57 Ix = speye(m_x); | |
58 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
|
59 |
591 | 60 % Norms |
61 Hx = ops_x.H; | |
62 Hy = ops_y.H; | |
63 Hxi = ops_x.HI; | |
64 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
|
65 |
595 | 66 obj.H_x = Hx; |
67 obj.H_y = Hy; | |
591 | 68 obj.H = kron(Hx,Hy); |
69 obj.Hi = kron(Hxi,Hyi); | |
70 obj.Hx = kron(Hx,Iy); | |
71 obj.Hy = kron(Ix,Hy); | |
72 obj.Hxi = kron(Hxi,Iy); | |
73 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
|
74 |
591 | 75 % Derivatives |
1019
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
76 if (isequal(opSet,@sbp.D1Upwind)) |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
77 Dx = (ops_x.Dp + ops_x.Dm)/2; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
78 Dy = (ops_y.Dp + ops_y.Dm)/2; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
79 DissOpx = (ops_x.Dm - ops_x.Dp)/2; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
80 DissOpy = (ops_y.Dm - ops_y.Dp)/2; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
81 obj.Dx = kron(Dx,Iy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
82 obj.Dy = kron(Ix,Dy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
83 obj.DissOpx = kron(DissOpx,Iy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
84 obj.DissOpy = kron(Ix,DissOpy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
85 else |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
86 Dx = ops_x.D1; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
87 Dy = ops_y.D1; |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
88 obj.Dx = kron(Dx,Iy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
89 obj.Dy = kron(Ix,Dy); |
f029b97dbc72
Support upwind opSet in Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
950
diff
changeset
|
90 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
|
91 |
591 | 92 % Boundary operators |
93 obj.e_w = kr(ops_x.e_l, Iy); | |
94 obj.e_e = kr(ops_x.e_r, Iy); | |
95 obj.e_s = kr(Ix, ops_y.e_l); | |
96 obj.e_n = kr(Ix, ops_y.e_r); | |
97 | |
98 obj.m = m; | |
99 obj.h = [ops_x.h ops_y.h]; | |
100 obj.order = order; | |
595 | 101 obj.a = a; |
1021
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
102 |
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
103 if (isequal(opSet,@sbp.D1Upwind)) |
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
104 obj.D = -(a{1}*obj.Dx + a{2}*obj.Dy + fluxSplitting{1}*obj.DissOpx + fluxSplitting{2}*obj.DissOpy); |
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
105 else |
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
106 obj.D = -(a{1}*obj.Dx + a{2}*obj.Dy); |
cc61dde120cd
Add upwind dissipation to the operator inside Utux2d
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1019
diff
changeset
|
107 end |
591 | 108 end |
109 % Closure functions return the opertors applied to the own domain to close the boundary | |
110 % Penalty functions return the opertors to force the solution. In the case of an interface it returns the operator applied to the other doamin. | |
111 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'. | |
1022
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
112 % type is a string specifying the type of boundary condition if there are several. %TBD Remove type here? Only dirichlet applicable? |
591 | 113 % data is a function returning the data that should be applied at the boundary. |
114 % neighbour_scheme is an instance of Scheme that should be interfaced to. | |
115 % neighbour_boundary is a string specifying which boundary to interface to. | |
116 function [closure, penalty] = boundary_condition(obj,boundary,type) | |
117 default_arg('type','dirichlet'); | |
1022
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
118 sigma_left = -1; % Scalar penalty parameter for left boundaries |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
119 sigma_right = 1; % Scalar penalty parameter for right boundaries |
591 | 120 switch boundary |
121 case {'w','W','west','West'} | |
1022
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
122 % Can only specify boundary condition where there is inflow |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
123 % Extract positive part of a{1} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
124 a_pos = obj.a{1}; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
125 a_pos(a_pos < 0) = 0; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
126 tau = sigma_left*a_pos*obj.e_w*obj.H_y; |
591 | 127 closure = obj.Hi*tau*obj.e_w'; |
128 case {'s','S','south','South'} | |
1022
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
129 % Can only specify boundary condition where there is inflow |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
130 % Extract positive part of a{2} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
131 a_pos = obj.a{2}; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
132 a_pos(a_pos < 0) = 0; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
133 tau = sigma_left*a_pos*obj.e_s*obj.H_x; |
591 | 134 closure = obj.Hi*tau*obj.e_s'; |
1022
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
135 case {'e','E','east','East'} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
136 % Can only specify boundary condition where there is inflow |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
137 % Extract negative part of a{1} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
138 a_neg = obj.a{1}; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
139 a_neg(a_neg > 0) = 0; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
140 tau = sigma_right*a_neg*obj.e_e*obj.H_y; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
141 closure = obj.Hi*tau*obj.e_e'; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
142 case {'n','N','north','North'} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
143 % Can only specify boundary condition where there is inflow |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
144 % Extract negative part of a{2} |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
145 a_neg = obj.a{2}; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
146 a_neg(a_neg > 0) = 0; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
147 tau = sigma_right*a_neg*obj.e_n*obj.H_x; |
234c1c02ea39
Add dirichlet bc for north and south boundary and handle cases where the wave speed changes in sign.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1021
diff
changeset
|
148 closure = obj.Hi*tau*obj.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
|
149 end |
591 | 150 penalty = -obj.Hi*tau; |
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
|
151 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
|
152 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
153 % 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
|
154 % 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
|
155 % -- 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
|
156 % % Default: 'upwind'. Other: 'centered' |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
157 % -- interpolation: type of interpolation, default 'none' |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
158 % -- 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
|
159 % Default {0,0} gives zero damping. |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
160 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
|
161 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
162 defaultType.couplingType = 'upwind'; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
163 defaultType.interpolation = 'none'; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
164 defaultType.interpolationDamping = {0,0}; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
165 default_struct('type', defaultType); |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
166 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
167 switch type.interpolation |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
168 case {'none', ''} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
169 [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
|
170 case {'op','OP'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
171 [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
|
172 otherwise |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
173 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
|
174 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
|
175 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
|
176 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
177 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
|
178 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
|
179 |
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
|
180 % Get neighbour boundary operator |
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 switch neighbour_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
|
182 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
|
183 e_neighbour = neighbour_scheme.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
|
184 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
|
185 e_neighbour = neighbour_scheme.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
|
186 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
|
187 e_neighbour = neighbour_scheme.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
|
188 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
|
189 e_neighbour = neighbour_scheme.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
|
190 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
|
191 |
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
|
192 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
|
193 |
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
|
194 % 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
|
195 case 'upwind' |
605
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
196 sigma_ds = -1; %"Downstream" penalty |
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
197 sigma_us = 0; %"Upstream" penalty |
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
198 |
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
|
199 % 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
|
200 case 'centered' |
605
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
201 sigma_ds = -1/2; %"Downstream" penalty |
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
202 sigma_us = 1/2; %"Upstream" penalty |
0f9d20dbb7ce
Add centered interface coupling in addition to upwind
Martin Almquist <malmquist@stanford.edu>
parents:
595
diff
changeset
|
203 |
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
|
204 otherwise |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
205 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
|
206 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
|
207 |
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 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 end |
610
b7b3c11fab4d
Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents:
605
diff
changeset
|
226 |
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
|
227 end |
610
b7b3c11fab4d
Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents:
605
diff
changeset
|
228 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
229 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
|
230 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
231 % 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
|
232 default_field(type, 'interpOpSet', @sbp.InterpOpsOP); |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
233 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
234 interpOpSet = type.interpOpSet; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
235 couplingType = type.couplingType; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
236 interpolationDamping = type.interpolationDamping; |
610
b7b3c11fab4d
Add interpolation to scheme
Martin Almquist <malmquist@stanford.edu>
parents:
605
diff
changeset
|
237 |
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
|
238 % Get neighbour boundary operator |
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 switch neighbour_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
|
240 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
|
241 e_neighbour = neighbour_scheme.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
|
242 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
|
243 e_neighbour = neighbour_scheme.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
|
244 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
|
245 e_neighbour = neighbour_scheme.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
|
246 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
|
247 e_neighbour = neighbour_scheme.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
|
248 end |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
249 |
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
|
250 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
|
251 |
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
|
252 % 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
|
253 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
|
254 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
|
255 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
|
256 |
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
|
257 % 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
|
258 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
|
259 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
|
260 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
|
261 |
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
|
262 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
|
263 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
|
264 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
|
265 |
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
|
266 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
|
267 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
|
268 |
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
|
269 % 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
|
270 % 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
|
271 % 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
|
272 switch boundary |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
273 case {'w','e'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
274 m_u = obj.m(2); |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
275 case {'s','n'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
276 m_u = obj.m(1); |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
277 end |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
278 m_v = size(e_neighbour, 2); |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
279 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
280 % Build interpolation operators |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
281 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
|
282 Iu2v = intOps.Iu2v; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
283 Iv2u = intOps.Iv2u; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
284 |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
285 I_local2neighbour_ds = intOps.Iu2v.bad; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
286 I_local2neighbour_us = intOps.Iu2v.good; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
287 I_neighbour2local_ds = intOps.Iv2u.good; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
288 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
|
289 |
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
|
290 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
|
291 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
|
292 |
2d85f17a8aec
Add possibility for damping terms at interpolation interface.
Martin Almquist <malmquist@stanford.edu>
parents:
610
diff
changeset
|
293 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
294 switch boundary |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
295 case {'w','W','west','West'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
296 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
|
297 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
|
298 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
|
299 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
300 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
|
301 *obj.e_w*obj.H_y; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
302 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
|
303 case {'e','E','east','East'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
308 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
|
309 *obj.e_e*obj.H_y; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
310 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
|
311 case {'s','S','south','South'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
316 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
|
317 *obj.e_s*obj.H_x; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
318 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
|
319 case {'n','N','north','North'} |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 |
942
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
324 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
|
325 *obj.e_n*obj.H_x; |
35701c85e356
Make Utux2D work with new interface type etc.
Martin Almquist <malmquist@stanford.edu>
parents:
914
diff
changeset
|
326 closure = closure + obj.Hi*beta*I_back_forth_us*obj.e_n' - obj.Hi*beta*obj.e_n'; |
591 | 327 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
|
328 |
459eeb99130f
Include type as (optional) input parameter in the interface method of all schemes.
Martin Almquist <malmquist@stanford.edu>
parents:
743
diff
changeset
|
329 |
591 | 330 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
|
331 |
591 | 332 function N = size(obj) |
333 N = obj.m; | |
334 end | |
335 | |
336 end | |
337 | |
338 methods(Static) | |
339 % Calculates the matrices needed for the inteface coupling between boundary bound_u of scheme schm_u | |
340 % and bound_v of scheme schm_v. | |
341 % [uu, uv, vv, vu] = inteface_coupling(A,'r',B,'l') | |
342 function [uu, uv, vv, vu] = interface_coupling(schm_u,bound_u,schm_v,bound_v) | |
343 [uu,uv] = schm_u.interface(bound_u,schm_v,bound_v); | |
344 [vv,vu] = schm_v.interface(bound_v,schm_u,bound_u); | |
345 end | |
346 end | |
347 end |