Mercurial > repos > public > sbplib
annotate +scheme/Heat2dCurvilinear.m @ 1031:2ef20d00b386 feature/advectionRV
For easier comparison, return both the first order and residual viscosity when evaluating the residual. Add the first order and residual viscosity to the state of the RungekuttaRV time steppers
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 17 Jan 2019 10:25:06 +0100 |
parents | 08f3ffe63f48 |
children | 78db023a7fe3 |
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, |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
4 % in the Heat equation way (i.e., the discretization matrix is not necessarily |
5a9acf282b34
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) |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
6 % u_t = div * (kappa * grad u ) |
5a9acf282b34
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 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
32 |
5a9acf282b34
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 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
34 H_boundary_l, H_boundary_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
|
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}); |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
112 D1Metric{2} = kron(I{1}, opSetMetric{2}.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
|
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 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
160 obj.D2_kappa{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
|
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 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
273 % j is the coordinate direction of 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
|
274 % nj: outward unit normal component. |
5a9acf282b34
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 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
|
276 % nj = 1 for east, north, top 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
|
277 [j, nj] = obj.get_boundary_number(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
|
278 switch nj |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
279 case 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
|
280 e = obj.e_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
|
281 flux = obj.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
|
282 H_gamma = obj.H_boundary_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
|
283 case -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
|
284 e = obj.e_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
|
285 flux = obj.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
|
286 H_gamma = obj.H_boundary_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
|
287 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
|
288 |
5a9acf282b34
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 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
|
290 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
|
291 KAPPA = obj.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
|
292 kappa_gamma = e'*KAPPA*e; |
5a9acf282b34
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 h = obj.h(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
|
294 alpha = h*obj.alpha(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
|
295 |
5a9acf282b34
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 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
|
297 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
298 % 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
|
299 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
|
300 |
5a9acf282b34
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 if ~symmetric |
5a9acf282b34
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 closure = -Ji*Hi*flux'*e*H_gamma*(e' ); |
5a9acf282b34
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 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
|
304 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
|
305 closure = Ji*Hi*flux'*e*H_gamma*(e' )... |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
306 -tuning*2/alpha*Ji*Hi*e*kappa_gamma*H_gamma*(e' ) ; |
5a9acf282b34
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 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
|
308 +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
|
309 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
|
310 |
5a9acf282b34
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 % 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
|
312 case {'N','n','neumann','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
|
313 closure = -Ji*Hi*e*H_gamma*(e'*flux ); |
5a9acf282b34
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 penalty = Ji*Hi*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
|
315 |
5a9acf282b34
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 % 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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
322 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
|
323 % 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
|
324 % 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
|
325 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
|
326 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
|
327 |
5a9acf282b34
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 % Returns the coordinate number and outward normal component for the boundary specified by the string 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
|
329 function [j, nj] = get_boundary_number(obj, 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
|
330 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
331 switch 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
|
332 case {'w','W','west','West', 'e', 'E', 'east', 'East'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
333 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
|
334 case {'s','S','south','South', 'n', 'N', 'north', 'North'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
335 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
|
336 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
|
337 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
|
338 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
|
339 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
340 switch 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
|
341 case {'w','W','west','West','s','S','south','South'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
342 nj = -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
|
343 case {'e', 'E', 'east', 'East','n', 'N', 'north', 'North'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
344 nj = 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
|
345 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
|
346 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
|
347 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
348 % Returns the coordinate number and outward normal component for the boundary specified by the string 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
|
349 function [return_op] = get_boundary_operator(obj, op, 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
|
350 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
351 switch 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
|
352 case {'w','W','west','West', 'e', 'E', 'east', 'East'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
353 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
|
354 case {'s','S','south','South', 'n', 'N', 'north', 'North'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
355 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
|
356 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
|
357 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
|
358 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
|
359 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
360 switch op |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
361 case 'e' |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
362 switch 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
|
363 case {'w','W','west','West','s','S','south','South'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
364 return_op = obj.e_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
|
365 case {'e', 'E', 'east', 'East','n', 'N', 'north', 'North'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
366 return_op = obj.e_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
|
367 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
|
368 case '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
|
369 switch 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
|
370 case {'w','W','west','West','s','S','south','South'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
371 return_op = obj.d1_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
|
372 case {'e', 'E', 'east', 'East','n', 'N', 'north', 'North'} |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
373 return_op = obj.d1_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
|
374 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
|
375 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
|
376 error(['No such operator: operatr = ' op]); |
5a9acf282b34
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 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
379 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
|
380 |
5a9acf282b34
Add scheme Heat2Dcurvilinear. Neumann and Dirichlet seem to work. Only tested for stretched Cartesian grids though.
Martin Almquist <malmquist@stanford.edu>
parents:
diff
changeset
|
381 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
|
382 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
|
383 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
|
384 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
|
385 end |