Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOps.m @ 1224:5271c4670733 feature/rv
Use fine-to-coarse interpolation operators in coarse grid flux discretization
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 06 Nov 2019 14:51:33 +0100 |
parents | 881afc40a3d2 |
children |
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{:}); |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
11 case {'mg','mg2','multi-grid2'} % Default multigrid diffops |
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
|
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 |
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
|
88 |
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
|
89 % 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
|
90 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
|
91 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
|
92 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
|
93 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
|
94 switch g.D() |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
95 case 1 |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
96 interpOps = sbp.InterpOpsOP(m_c, m, schemeOrder, schemeOrder); |
1224
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
97 IC2F = interpOps.Iu2v.good; |
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
98 IF2C = interpOps.Iv2u.good; |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
99 g_c = grid.equidistant(m_c, lim{1}); |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
100 D_c = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
1224
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
101 D_c = @(v) IC2F*D_c(IF2C*v); |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
102 case 2 |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
103 interpOps_x = sbp.InterpOpsOP(m_c(1), m(1), schemeOrder, schemeOrder); |
1224
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
104 I_xC2F = interpOps_x.Iu2v.good; |
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
105 I_xF2C = interpOps_x.Iv2u.good; |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
106 interpOps_y = sbp.InterpOpsOP(m_c(2), m(2), schemeOrder, schemeOrder); |
1224
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
107 I_yC2F = interpOps_y.Iu2v.good; |
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
108 I_yF2C = interpOps_y.Iv2u.good; |
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
109 IC2F = kron(I_xC2F,I_yC2F); |
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
110 IF2C = kron(I_xF2C,I_yF2C); |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
111 g_c = grid.equidistant(m_c, lim{1}, lim{2}); |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
112 ind = grid.funcToMatrix(g, 1:g.N()); |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
113 ind_c = reshape(ind(1:2:end,1:2:end)',g_c.N(),1); |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
114 D_c = rv.diffops.constructFluxDiffOps(scheme, g_c, schemeOrder, schemeParams, opSet, BCs); |
1224
5271c4670733
Use fine-to-coarse interpolation operators in coarse grid flux discretization
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1191
diff
changeset
|
115 D_c = @(v) IC2F*D_c(IF2C*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
|
116 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
|
117 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
|
118 |
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 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 [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
|
127 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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 g_c = grid.equidistant(m_c, lim{1}, lim{2}); |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
133 ind = grid.funcToMatrix(g, 1:g.N()); |
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
134 ind_c = reshape(ind(1:2:end,1:2:end)',g_c.N(),1); |
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
|
135 [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
|
136 D_c = rv.diffops.addClosuresToDiffOp(D_c, closures); |
1191
881afc40a3d2
Change to use the interpolation operators in sbplib
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1190
diff
changeset
|
137 D_c = @(v) reshape(interp2(grid.funcToMatrix(g_c,D_c(v(ind_c))),'spline')',g.N(),1); |
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
|
138 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
|
139 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
|
140 |