Mercurial > repos > public > sbplib
annotate +rv/constructDiffOps.m @ 1223:9fddc8749445 rv_diffOp_test
Closing branch
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 05 Aug 2019 10:48:37 +0200 |
parents | 0c906f7ab8bf |
children |
rev | line source |
---|---|
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
1 function [D_rv, D_flux, DvDt, solutionPenalties, residualPenalties] = constructDiffOps(scheme, g, order, schemeParams, opSet, BCs) |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
2 %% DiffOps for solution vector |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
3 [D, solutionPenalties] = constructTotalFluxDiffOp(scheme, g, order, schemeParams, opSet, BCs); |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
4 D2 = constructSymmetricD2Operator(g, order, opSet); |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
5 |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
6 if isa(D, 'function_handle') |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
7 D_rv = @(v,viscosity)(D(v) + D2(viscosity))*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
8 [D_flux, residualPenalties] = constructTotalFluxDiffOp(scheme, g, max(order-2,2), schemeParams, opSet, BCs); |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
9 D_flux = @(v) -D_flux(v)*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
10 DvDt = @(v)D(v)*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
11 else |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
12 D_rv = @(v,viscosity)(D + D2(viscosity))*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
13 [D_flux, residualPenalties] = constructTotalFluxDiffOp(scheme, g, max(order-2,2), schemeParams, opSet, BCs); |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
14 D_flux = @(v) -D_flux*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
15 DvDt = @(v)D*v; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
16 end |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
17 |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
18 %% DiffOps for residual viscosity |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
19 |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
20 % DiffOp for flux in residual viscosity. Due to sign conventions of the implemnted schemes, we need to |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
21 % change the sign. |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
22 |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
23 % DiffOp for time derivative in residual viscosity |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
24 |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
25 end |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
26 |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
27 function [D, penalties] = constructTotalFluxDiffOp(scheme, g, order, schemeParams, opSet, BCs) |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
28 diffOp = scheme(g, order, schemeParams{:}, opSet); |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
29 if isa(diffOp.D, 'function_handle') |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
30 [D, penalties] = addClosuresToDiffOpFunction(diffOp, BCs); |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
31 else |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
32 [D, penalties] = addClosuresToDiffOp(diffOp, BCs); |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
33 end |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
34 end |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
35 |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
36 function [D, penalties] = addClosuresToDiffOp(diffOp, BCs) |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
37 penalties = cell(size(BCs)); |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
38 D = diffOp.D; |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
39 for i = 1:size(BCs,1) |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
40 for j = 1:size(BCs,2) |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
41 [closure, penalties{i,j}] = diffOp.boundary_condition(BCs{i,j}.boundary, BCs{i,j}.type); |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
42 D = D + closure; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
43 end |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
44 end |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
45 |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
46 end |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
47 |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
48 function [D, penalties] = addClosuresToDiffOpFunction(diffOp, BCs) |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
49 penalties = cell(size(BCs)); |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
50 D = diffOp.D; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
51 for i = 1:size(BCs,1) |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
52 for j = 1:size(BCs,2) |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
53 [closure, penalties{i,j}] = diffOp.boundary_condition(BCs{i,j}.boundary, BCs{i,j}.type); |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
54 D = @(v) D(v) + closure(v); |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
55 end |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
56 end |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
57 |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
58 end |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
59 |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
60 function D2 = constructSymmetricD2Operator(g, order, opSet) |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
61 m = g.size(); |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
62 ops = cell(g.D(),1); |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
63 I = cell(g.D(),1); |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
64 for i = 1:g.D() |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
65 lim = {g.x{i}(1), g.x{i}(end)}; |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
66 ops{i} = opSet(m(i), lim, order); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
67 I{i} = speye(m(i)); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
68 end |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
69 |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
70 switch g.D() |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
71 case 1 |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
72 e_r = ops{1}.e_r; |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
73 e_l = ops{1}.e_l; |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
74 Hi = ops{1}.HI; |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
75 B = e_r*e_r' - e_l*e_l'; |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
76 if isequal(opSet,@sbp.D1Upwind) |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
77 Dm = ops{1}.Dm; |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
78 Dp = ops{1}.Dp; |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
79 HiB = Hi*B; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
80 D2 = @(viscosity) Dm*spdiag(viscosity)*Dp-HiB*spdiag(viscosity)*Dp; |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
81 else |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
82 D2 = @(viscosity)ops{1}.D2(viscosity); |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
83 end |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
84 case 2 |
1037
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
85 % TODO: |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
86 % Currently only implemented for upwind operators. |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
87 % Remove this part once the time-dependent D2 operator is implemented for other opSets |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
88 % or if it is decided that it should only be supported for upwind operators. |
2d7ba44340d0
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1026
diff
changeset
|
89 assert(isequal(opSet,@sbp.D1Upwind)) |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
90 e_e = kron(ops{1}.e_r,I{2}); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
91 e_w = kron(ops{1}.e_l,I{2}); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
92 Dm_x = kron(ops{1}.Dm,I{2}); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
93 Dp_x = kron(ops{1}.Dp,I{2}); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
94 H_x = kron(ops{1}.HI,I{2}); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
95 B_x = e_e*e_e' - e_w*e_w'; |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
96 H_xB = H_x*B_x; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
97 D2_x = @(viscosity) (Dm_x*spdiag(viscosity)-H_xB*spdiag(viscosity))*Dp_x; |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
98 |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
99 e_n = kron(I{1},ops{2}.e_r); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
100 e_s = kron(I{1},ops{2}.e_l); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
101 Dm_y = kron(I{1},ops{2}.Dm); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
102 Dp_y = kron(I{1},ops{2}.Dp); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
103 H_y = kron(I{1},ops{2}.HI); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
104 B_y = e_n*e_n' - e_s*e_s'; |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
105 H_yB = H_y*B_y; |
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
106 D2_y = @(viscosity) (Dm_y*spdiag(viscosity)-H_yB*spdiag(viscosity))*Dp_y; |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
107 D2 = @(viscosity)D2_x(viscosity) + D2_y(viscosity); |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
108 otherwise |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
109 error('3D not yet implemented') |
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
110 end |
1221
0c906f7ab8bf
Attempt to reduce unnessecary operations when using the RV diffOps. Does not seem to improve efficiency at this stage.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1146
diff
changeset
|
111 D2 = @(viscosity) D2(viscosity); |
1020
5359a61cb4d9
Add utility for constructing the operators used by a discretization emplying RV-stabilization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
112 end |