Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOpsMultiGrid.m @ 1167:66c0fbbc406f feature/rv
Make constructDiffOps return a struct with the operators
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Fri, 28 Jun 2019 12:53:47 +0200 |
| parents | 17bb3c46472c |
| children | af3c4eb0cbbd |
| rev | line source |
|---|---|
|
1167
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
1 function diffOpsStruct = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
2 % DiffOps for stabilized solution vector |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
3 [D_scheme, penalties_scheme] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
4 % DiffOp for unstabilized solution vector |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
5 D_unstable = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
|
1163
65a577db5ca0
Move all functions in constructDiffOps to subpackage and refactor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
6 %% DiffOps for residual viscosity |
|
65a577db5ca0
Move all functions in constructDiffOps to subpackage and refactor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 [D_t, penalties_res] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, residualOrder, schemeParams, opSet, BCs); |
|
65a577db5ca0
Move all functions in constructDiffOps to subpackage and refactor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 D_flux = @(v) -D_t(v); |
|
1167
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
9 diffOpsStruct = struct('D_scheme', D_scheme,... |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
10 'D_unstable', D_unstable,... |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
11 'D_flux', D_flux,... |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
12 'D_t', D_t,... |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
13 'penalties_scheme', penalties_scheme,... |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
14 'penalties_res', penalties_res); |
|
1166
17bb3c46472c
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1163
diff
changeset
|
15 end |
|
17bb3c46472c
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1163
diff
changeset
|
16 |
|
17bb3c46472c
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1163
diff
changeset
|
17 % TODO: Not clear if this is needed |
|
17bb3c46472c
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1163
diff
changeset
|
18 % TODO: Only works for equidistant grids |
|
17bb3c46472c
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1163
diff
changeset
|
19 function [D_coarse, penalties_coarse] = constructCoarserGridDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs) |
|
1167
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
20 m = g.m(); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
21 lim = g.lim(); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
22 m_coarse = (m-1)/2 + 1; |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
23 g_coarse = grid.equidistant(m_coarse, lim{1}); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
24 [D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g_coarse, schemeOrder, schemeParams, opSet, BCs); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
25 x = g.x{1}; |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
26 x_coarse = x(1:2:end); |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
27 % TODO: Fix interpolation |
|
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
28 D_coarse = @(v) interp1(x_coarse,D_coarse(v(1:2:end)),x,'spline'); |
|
1163
65a577db5ca0
Move all functions in constructDiffOps to subpackage and refactor
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
29 end |
