Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOps.m @ 1190:79618b58b0a0 feature/rv
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 08 Jul 2019 15:12:19 +0200 |
parents | ecc605453733 |
children | 881afc40a3d2 |
rev | line source |
---|---|
1178
e3d8f24b2c1c
Add wrapper function calling constructDiffOps* for a specified RV method
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 function diffOpsStruct = constructDiffOps(method, varargin) |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
2 switch method |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
3 case {'standard'} |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
4 diffOpsStruct = diffOpsStandard(varargin{:}); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
5 case {'bdf','backwards-difference-formula'} |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
6 diffOpsStruct = diffOpsBdf(varargin{:}); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
7 case {'ms','multi-stage'} |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
8 diffOpsStruct = diffOpsMultiStage(varargin{:}); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
9 case {'mg1','multi-grid1'} |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
10 diffOpsStruct = diffOpsMultiGrid1(varargin{:}); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
11 case {'mg2','multi-grid2'} |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
12 diffOpsStruct = diffOpsMultiGrid2(varargin{:}); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
13 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
14 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
15 |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
16 function diffOpsStruct = diffOpsStandard(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
17 % DiffOps for stabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
18 [D_scheme, penalties_scheme, D_t] = rv.diffops.constructSchemeDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
19 %% DiffOps for residual viscosity |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
20 D_flux = rv.diffops.constructFluxDiffOps(scheme, g, residualOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
21 D_flux = @(v) -D_flux(v); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
22 diffOpsStruct = struct('D_scheme', D_scheme,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
23 'D_flux', D_flux,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
24 'D_t', D_t,... |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
25 'penalties_scheme', {penalties_scheme}); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
26 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
27 |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
28 function diffOpsStruct = diffOpsBdf(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
29 %% DiffOps for solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
30 [D_scheme, penalties_scheme] = rv.diffops.constructSchemeDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
31 %% DiffOps for residual viscosity |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
32 D_flux = rv.diffops.constructFluxDiffOps(scheme, g, residualOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
33 D_flux = @(v) -D_flux(v); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
34 diffOpsStruct = struct('D_scheme', D_scheme,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
35 'D_flux', D_flux,... |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
36 'penalties_scheme', {penalties_scheme}); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
37 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
38 |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
39 % TODO: Remove? |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
40 function diffOpsStruct = diffOpsMultiStage(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
41 % DiffOps for stabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
42 [D_scheme, penalties_scheme] = rv.diffops.constructSchemeDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
43 % DiffOp for unstabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
44 [D_unstable, closures] = rv.diffops.constructFluxDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
45 D_unstable = rv.diffops.addClosuresToDiffOp(D_unstable, closures); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
46 %% DiffOps for residual viscosity |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
47 D_t = rv.diffops.constructFluxDiffOps(scheme, g, residualOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
48 D_flux = @(v) -D_t(v); |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
49 % TODO: Use residual penalties as well here? |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
50 diffOpsStruct = struct('D_scheme', D_scheme,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
51 'D_unstable', D_unstable,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
52 'D_flux', D_flux,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
53 'D_t', D_t,... |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
54 'penalties_scheme', {penalties_scheme}); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
55 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
56 |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
57 function diffOpsStruct = diffOpsMultiGrid1(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
58 % DiffOps for stabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
59 [D_scheme, penalties_scheme, D_f] = rv.diffops.constructSchemeDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
60 % DiffOp for unstabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
61 D_coarse = coarserGridDiffOpWithClosures(scheme, g, residualOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
62 %% DiffOps for residual viscosity |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
63 D_flux = rv.diffops.constructFluxDiffOps(scheme, g, residualOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
64 D_flux = @(v) -D_flux(v); |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
65 D_t = @(v) D_f(v); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
66 % TODO: Use residual penalties as well here? |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
67 diffOpsStruct = struct('D_scheme', D_scheme,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
68 'D_coarse', D_coarse,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
69 'D_flux', D_flux,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
70 'D_t', D_t,... |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
71 'penalties_scheme', {penalties_scheme}); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
72 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
73 |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
74 function diffOpsStruct = diffOpsMultiGrid2(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
75 % DiffOps for stabilized solution vector |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
76 [D_scheme, penalties_scheme] = rv.diffops.constructSchemeDiffOps(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
77 % TODO: What orders to use here? |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
78 D_coarse = coarserGridDiffOp(scheme, g, residualOrder, schemeParams, opSet, BCs); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
79 %% DiffOps for residual viscosity |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
80 D_flux = rv.diffops.constructFluxDiffOps(scheme, g, schemeOrder , schemeParams, opSet, BCs); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
81 D_flux = @(v) -D_flux(v); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
82 D_t = @(v) D_coarse(v); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
83 diffOpsStruct = struct('D_scheme', D_scheme,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
84 'D_flux', D_flux,... |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
85 'D_t', D_t,... |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
86 'penalties_scheme', {penalties_scheme}); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
87 end |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
88 %% Multigrid functions: |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
89 % TODO: Implement properly. |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
90 function v_c = coarse_v(g, g_c, v) |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
91 V = grid.funcToMatrix(g,v); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
92 v_c = reshape(V(1:2:end,1:2:end)',g_c.N(),1); |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
93 end |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
94 |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
95 % Note: Only works for equidistant grids. |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
96 % TODO: Change from using matlabs interp to using proper interpolation operators.. |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
97 function D_c = coarserGridDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs) |
1184
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
98 m = g.m(); |
ecc605453733
Move specialized constructDiffOps* into constructDiffOps.m. Add multigrid RV using the standard RungekuttaRV time stepper
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1178
diff
changeset
|
99 lim = g.lim(); |
1190
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
100 m_c = (m-1)/2 + 1; |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
101 switch g.D() |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
102 case 1 |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
103 g_c = grid.equidistant(m_c, lim{1}); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
104 D_c = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
105 x = g.x{1}; |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
106 x_c = x(1:2:end); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
107 D_c = @(v) interp1(x_c,D_c(v(1:2:end)),x,'spline'); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
108 case 2 |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
109 g_c = grid.equidistant(m_c, lim{1}, lim{2}); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
110 D_c = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
111 D_c = @(v) reshape(interp2(grid.funcToMatrix(g_c,D_c(coarse_v(g,g_c,v))),'spline')',g.N(),1); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
112 end |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
113 end |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
114 |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
115 function D_c = coarserGridDiffOpWithClosures(scheme, g, schemeOrder, schemeParams, opSet, BCs) |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
116 m = g.m(); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
117 lim = g.lim(); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
118 m_c = (m-1)/2 + 1; |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
119 switch g.D() |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
120 case 1 |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
121 g_c = grid.equidistant(m_c, lim{1}); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
122 [D_c, closures] = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
123 D_c = rv.diffops.addClosuresToDiffOp(D_c, closures); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
124 x = g.x{1}; |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
125 x_c = x(1:2:end); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
126 D_c = @(v) interp1(x_c,D_c(v(1:2:end)),x,'spline'); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
127 case 2 |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
128 g_c = grid.equidistant(m_c, lim{1}, lim{2}); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
129 [D_c, closures] = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
130 D_c = rv.diffops.addClosuresToDiffOp(D_c, closures); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
131 D_c = @(v) reshape(interp2(grid.funcToMatrix(g_c,D_c(coarse_v(g,g_c,v))),'spline')',g.N(),1); |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
132 end |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
133 end |
79618b58b0a0
Refactor constructDiffops and remove closures from some of the diffops used to compute the residual.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1184
diff
changeset
|
134 |