annotate +scheme/Heat2dCurvilinear.m @ 997:78db023a7fe3 feature/getBoundaryOp

Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
author Martin Almquist <malmquist@stanford.edu>
date Sat, 12 Jan 2019 11:57:50 -0800
parents 08f3ffe63f48
children 8d73fcdb07a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
1 classdef Heat2dCurvilinear < scheme.Scheme
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
2
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
3 % Discretizes the Laplacian with variable coefficent, curvilinear,
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: 742
diff changeset
4 % in the Heat equation way (i.e., the discretization matrix is not necessarily
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
5 % symmetric)
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: 742
diff changeset
6 % u_t = div * (kappa * grad u )
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
7 % opSet should be cell array of opSets, one per dimension. This
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
8 % is useful if we have periodic BC in one direction.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
9
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
10 properties
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
11 m % Number of points in each direction, possibly a vector
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
12 h % Grid spacing
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
13
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
14 grid
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
15 dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
16
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
17 order % Order of accuracy for the approximation
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
18
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
19 % Diagonal matrix for variable coefficients
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
20 KAPPA % Variable coefficient
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
21
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
22 D % Total operator
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
23 D1 % First derivatives
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
24
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
25 % Second derivatives
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
26 D2_kappa
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
27
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
28 H, Hi % Inner products
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
29 e_l, e_r
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
30 d1_l, d1_r % Normal derivatives at the boundary
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
31 alpha % Vector of borrowing constants
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: 742
diff changeset
32
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
33 % Boundary inner products
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: 742
diff changeset
34 H_boundary_l, H_boundary_r
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
35
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
36 % Metric coefficients
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
37 b % Cell matrix of size dim x dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
38 J, Ji
742
08f3ffe63f48 Add metric scale factors to properties in heat and elastic curvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 741
diff changeset
39 beta % Cell array of scale factors
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
40
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
41 % Numerical boundary flux operators
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
42 flux_l, flux_r
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
43
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
44 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
45
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
46 methods
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
47
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
48 function obj = Heat2dCurvilinear(g ,order, kappa_fun, opSet)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
49 default_arg('opSet',{@sbp.D2Variable, @sbp.D2Variable});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
50 default_arg('kappa_fun', @(x,y) 0*x+1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
51 dim = 2;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
52
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
53 kappa = grid.evalOn(g, kappa_fun);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
54 m = g.size();
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
55 m_tot = g.N();
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
56
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
57 % 1D operators
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
58 ops = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
59 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
60 ops{i} = opSet{i}(m(i), {0, 1}, order);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
61 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
62
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
63 I = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
64 D1 = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
65 D2 = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
66 H = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
67 Hi = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
68 e_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
69 e_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
70 d1_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
71 d1_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
72
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
73 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
74 I{i} = speye(m(i));
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
75 D1{i} = ops{i}.D1;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
76 D2{i} = ops{i}.D2;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
77 H{i} = ops{i}.H;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
78 Hi{i} = ops{i}.HI;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
79 e_l{i} = ops{i}.e_l;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
80 e_r{i} = ops{i}.e_r;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
81 d1_l{i} = ops{i}.d1_l;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
82 d1_r{i} = ops{i}.d1_r;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
83 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
84
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
85 %====== Assemble full operators ========
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
86 KAPPA = spdiag(kappa);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
87 obj.KAPPA = KAPPA;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
88
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
89 % Allocate
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
90 obj.D1 = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
91 obj.D2_kappa = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
92 obj.e_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
93 obj.e_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
94 obj.d1_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
95 obj.d1_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
96
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
97 % D1
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
98 obj.D1{1} = kron(D1{1},I{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
99 obj.D1{2} = kron(I{1},D1{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
100
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
101 % -- Metric coefficients ----
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
102 coords = g.points();
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
103 x = coords(:,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
104 y = coords(:,2);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
105
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
106 % Use non-periodic difference operators for metric even if opSet is periodic.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
107 xmax = max(ops{1}.x);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
108 ymax = max(ops{2}.x);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
109 opSetMetric{1} = sbp.D2Variable(m(1), {0, xmax}, order);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
110 opSetMetric{2} = sbp.D2Variable(m(2), {0, ymax}, order);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
111 D1Metric{1} = kron(opSetMetric{1}.D1, I{2});
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: 742
diff changeset
112 D1Metric{2} = kron(I{1}, opSetMetric{2}.D1);
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
113
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
114 x_xi = D1Metric{1}*x;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
115 x_eta = D1Metric{2}*x;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
116 y_xi = D1Metric{1}*y;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
117 y_eta = D1Metric{2}*y;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
118
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
119 J = x_xi.*y_eta - x_eta.*y_xi;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
120
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
121 b = cell(dim,dim);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
122 b{1,1} = y_eta./J;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
123 b{1,2} = -x_eta./J;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
124 b{2,1} = -y_xi./J;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
125 b{2,2} = x_xi./J;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
126
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
127 % Scale factors for boundary integrals
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
128 beta = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
129 beta{1} = sqrt(x_eta.^2 + y_eta.^2);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
130 beta{2} = sqrt(x_xi.^2 + y_xi.^2);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
131
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
132 J = spdiag(J);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
133 Ji = inv(J);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
134 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
135 beta{i} = spdiag(beta{i});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
136 for j = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
137 b{i,j} = spdiag(b{i,j});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
138 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
139 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
140 obj.J = J;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
141 obj.Ji = Ji;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
142 obj.b = b;
742
08f3ffe63f48 Add metric scale factors to properties in heat and elastic curvilinear
Martin Almquist <malmquist@stanford.edu>
parents: 741
diff changeset
143 obj.beta = beta;
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
144 %----------------------------
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
145
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
146 % Boundary operators
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
147 obj.e_l{1} = kron(e_l{1},I{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
148 obj.e_l{2} = kron(I{1},e_l{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
149 obj.e_r{1} = kron(e_r{1},I{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
150 obj.e_r{2} = kron(I{1},e_r{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
151
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
152 obj.d1_l{1} = kron(d1_l{1},I{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
153 obj.d1_l{2} = kron(I{1},d1_l{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
154 obj.d1_r{1} = kron(d1_r{1},I{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
155 obj.d1_r{2} = kron(I{1},d1_r{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
156
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
157 % D2 coefficients
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
158 kappa_coeff = cell(dim,dim);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
159 for j = 1:dim
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: 742
diff changeset
160 obj.D2_kappa{j} = sparse(m_tot,m_tot);
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
161 kappa_coeff{j} = sparse(m_tot,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
162 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
163 kappa_coeff{j} = kappa_coeff{j} + b{i,j}*J*b{i,j}*kappa;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
164 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
165 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
166 ind = grid.funcToMatrix(g, 1:m_tot);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
167
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
168 % x-dir
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
169 j = 1;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
170 for col = 1:m(2)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
171 D_kappa = D2{1}(kappa_coeff{j}(ind(:,col)));
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
172
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
173 p = ind(:,col);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
174 obj.D2_kappa{j}(p,p) = D_kappa;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
175 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
176
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
177 % y-dir
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
178 j = 2;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
179 for row = 1:m(1)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
180 D_kappa = D2{2}(kappa_coeff{j}(ind(row,:)));
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
181
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
182 p = ind(row,:);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
183 obj.D2_kappa{j}(p,p) = D_kappa;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
184 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
185
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
186 % Quadratures
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
187 obj.H = kron(H{1},H{2});
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
188 obj.Hi = inv(obj.H);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
189 obj.H_boundary_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
190 obj.H_boundary_l{1} = obj.e_l{1}'*beta{1}*obj.e_l{1}*H{2};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
191 obj.H_boundary_l{2} = obj.e_l{2}'*beta{2}*obj.e_l{2}*H{1};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
192 obj.H_boundary_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
193 obj.H_boundary_r{1} = obj.e_r{1}'*beta{1}*obj.e_r{1}*H{2};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
194 obj.H_boundary_r{2} = obj.e_r{2}'*beta{2}*obj.e_r{2}*H{1};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
195
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
196 %=== Differentiation matrix D (without SAT) ===
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
197 D2_kappa = obj.D2_kappa;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
198 D1 = obj.D1;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
199 D = sparse(m_tot,m_tot);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
200
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
201 d = @kroneckerDelta; % Kronecker delta
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
202 db = @(i,j) 1-d(i,j); % Logical not of Kronecker delta
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
203
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
204 % 2nd derivatives
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
205 for j = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
206 D = D + Ji*D2_kappa{j};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
207 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
208
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
209 % Mixed terms
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
210 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
211 for j = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
212 for k = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
213 D = D + db(i,j)*Ji*D1{j}*b{i,j}*J*KAPPA*b{i,k}*D1{k};
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
214 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
215 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
216 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
217 obj.D = D;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
218 %=========================================%
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
219
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
220 % Normal flux operators for BC.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
221 flux_l = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
222 flux_r = cell(dim,1);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
223
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
224 d1_l = obj.d1_l;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
225 d1_r = obj.d1_r;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
226 e_l = obj.e_l;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
227 e_r = obj.e_r;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
228
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
229 % Loop over boundaries
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
230 for j = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
231 flux_l{j} = sparse(m_tot,m_tot);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
232 flux_r{j} = sparse(m_tot,m_tot);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
233
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
234 % Loop over dummy index
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
235 for i = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
236 % Loop over dummy index
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
237 for k = 1:dim
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
238 flux_l{j} = flux_l{j} ...
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
239 - beta{j}\b{i,j}*J*KAPPA*b{i,k}*( d(j,k)*e_l{k}*d1_l{k}' + db(j,k)*D1{k} );
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
240
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
241 flux_r{j} = flux_r{j} ...
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
242 + beta{j}\b{i,j}*J*KAPPA*b{i,k}*( d(j,k)*e_r{k}*d1_r{k}' + db(j,k)*D1{k} );
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
243 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
244
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
245 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
246 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
247 obj.flux_l = flux_l;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
248 obj.flux_r = flux_r;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
249
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
250 % Misc.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
251 obj.m = m;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
252 obj.h = g.scaling();
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
253 obj.order = order;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
254 obj.grid = g;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
255 obj.dim = dim;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
256 obj.alpha = [ops{1}.borrowing.M.d1, ops{2}.borrowing.M.d1];
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
257
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
258 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
259
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
260
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
261 % Closure functions return the operators applied to the own domain to close the boundary
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
262 % Penalty functions return the operators to force the solution. In the case of an interface it returns the operator applied to the other doamin.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
263 % boundary is a string specifying the boundary e.g. 'l','r' or 'e','w','n','s'.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
264 % type is a string specifying the type of boundary condition.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
265 % data is a function returning the data that should be applied at the boundary.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
266 % neighbour_scheme is an instance of Scheme that should be interfaced to.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
267 % neighbour_boundary is a string specifying which boundary to interface to.
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
268 function [closure, penalty] = boundary_condition(obj, boundary, type, symmetric, tuning)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
269 default_arg('type','Neumann');
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
270 default_arg('symmetric', false);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
271 default_arg('tuning',1.2);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
272
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: 742
diff changeset
273 % nj: outward unit normal component.
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
274 % nj = -1 for west, south, bottom boundaries
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
275 % nj = 1 for east, north, top boundaries
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: 742
diff changeset
276 nj = obj.getBoundarySign(boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
277
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
278 Hi = obj.Hi;
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
279 [e, flux] = obj.getBoundaryOperator({'e', 'flux'}, boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
280 H_gamma = obj.getBoundaryQuadrature(boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
281 alpha = obj.getBoundaryBorrowing(boundary);
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
282
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
283 Hi = obj.Hi;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
284 Ji = obj.Ji;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
285 KAPPA = obj.KAPPA;
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: 742
diff changeset
286 kappa_gamma = e'*KAPPA*e;
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
287
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
288 switch type
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
289
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
290 % Dirichlet boundary condition
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
291 case {'D','d','dirichlet','Dirichlet'}
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
292
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
293 if ~symmetric
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: 742
diff changeset
294 closure = -Ji*Hi*flux'*e*H_gamma*(e' );
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
295 penalty = Ji*Hi*flux'*e*H_gamma;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
296 else
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
297 closure = Ji*Hi*flux'*e*H_gamma*(e' )...
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: 742
diff changeset
298 -tuning*2/alpha*Ji*Hi*e*kappa_gamma*H_gamma*(e' ) ;
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
299 penalty = -Ji*Hi*flux'*e*H_gamma ...
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
300 +tuning*2/alpha*Ji*Hi*e*kappa_gamma*H_gamma;
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
301 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
302
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
303 % Normal flux boundary condition
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
304 case {'N','n','neumann','Neumann'}
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: 742
diff changeset
305 closure = -Ji*Hi*e*H_gamma*(e'*flux );
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
306 penalty = Ji*Hi*e*H_gamma;
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
307
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
308 % Unknown boundary condition
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
309 otherwise
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
310 error('No such boundary condition: type = %s',type);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
311 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
312 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
313
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
314 function [closure, penalty] = interface(obj,boundary,neighbour_scheme,neighbour_boundary)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
315 % u denotes the solution in the own domain
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
316 % v denotes the solution in the neighbour domain
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
317 error('Interface not implemented');
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
318 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
319
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: 742
diff changeset
320 % Returns the boundary operator op for the boundary specified by the string boundary.
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
321 % op -- string or a cell array of strings
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
322 % 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: 742
diff changeset
323 function varargout = getBoundaryOperator(obj, op, boundary)
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
324
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: 742
diff changeset
325 if ~iscell(op)
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
326 op = {op};
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
327 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
328
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: 742
diff changeset
329 for i = 1:numel(op)
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
330 switch op{i}
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
331 case 'e'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
332 switch boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
333 case 'w'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
334 e = obj.e_l{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
335 case 'e'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
336 e = obj.e_r{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
337 case 's'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
338 e = obj.e_l{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
339 case 'n'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
340 e = obj.e_r{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
341 otherwise
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
342 error('No such boundary: boundary = %s',boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
343 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: 742
diff changeset
344 varargout{i} = e;
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
345
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
346 case 'd'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
347 switch boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
348 case 'w'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
349 d = obj.d1_l{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
350 case 'e'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
351 d = obj.d1_r{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
352 case 's'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
353 d = obj.d1_l{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
354 case 'n'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
355 d = obj.d1_r{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
356 otherwise
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
357 error('No such boundary: boundary = %s',boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
358 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: 742
diff changeset
359 varargout{i} = d;
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
360
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
361 case 'flux'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
362 switch boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
363 case 'w'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
364 flux = obj.flux_l{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
365 case 'e'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
366 flux = obj.flux_r{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
367 case 's'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
368 flux = obj.flux_l{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
369 case 'n'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
370 flux = obj.flux_r{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
371 otherwise
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
372 error('No such boundary: boundary = %s',boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
373 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: 742
diff changeset
374 varargout{i} = flux;
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
375 end
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
376 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
377 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
378
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: 742
diff changeset
379 % 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: 742
diff changeset
380 % 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: 742
diff changeset
381 %
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
382 % 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: 742
diff changeset
383 function H_b = getBoundaryQuadrature(obj, boundary)
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
384
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
385 switch 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: 742
diff changeset
386 case 'w'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
387 H_b = obj.H_boundary_l{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
388 case 'e'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
389 H_b = obj.H_boundary_r{1};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
390 case 's'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
391 H_b = obj.H_boundary_l{2};
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
392 case 'n'
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
393 H_b = obj.H_boundary_r{2};
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
394 otherwise
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
395 error('No such boundary: boundary = %s',boundary);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
396 end
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: 742
diff changeset
397 end
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
398
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: 742
diff changeset
399 % Returns the boundary sign. The right boundary is considered the positive boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
400 % 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: 742
diff changeset
401 function s = getBoundarySign(obj, boundary)
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
402 switch boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
403 case {'e','n'}
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
404 s = 1;
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
405 case {'w','s'}
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
406 s = -1;
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
407 otherwise
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: 742
diff changeset
408 error('No such boundary: boundary = %s',boundary);
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
409 end
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: 742
diff changeset
410 end
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
411
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: 742
diff changeset
412 % Returns borrowing constant gamma*h
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
413 % 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: 742
diff changeset
414 function gamm = getBoundaryBorrowing(obj, boundary)
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
415 switch boundary
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
416 case {'w','e'}
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
417 gamm = obj.h(1)*obj.alpha(1);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
418 case {'s','n'}
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
419 gamm = obj.h(2)*obj.alpha(2);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
420 otherwise
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
421 error('No such boundary: boundary = %s',boundary);
78db023a7fe3 Add getBoundaryOperator method to all 2d schemes, except obsolete Wave2dCurve and ElastiCurve, which needs a big makeover.
Martin Almquist <malmquist@stanford.edu>
parents: 742
diff changeset
422 end
741
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
423 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
424
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
425 function N = size(obj)
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
426 N = prod(obj.m);
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
427 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
428 end
5a9acf282b34 Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff changeset
429 end