Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOpsMultiGrid.m @ 1166:17bb3c46472c feature/rv
Add function for constructing differential operator on coarser mesh. Not sure if it will be usefull tho.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 27 Jun 2019 17:15:11 +0200 |
parents | 65a577db5ca0 |
children | 66c0fbbc406f |
rev | line source |
---|---|
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
|
1 function [D_scheme, D_coarse, D_flux, D_t, penalties_scheme, penalties_res] = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, 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
|
2 % DiffOps for solution vector |
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
|
3 [D_scheme, penalties_scheme, ~] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
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
|
4 [D_coarse, penalties_coarse] = 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
|
5 %% 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
|
6 [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
|
7 D_flux = @(v) -D_t(v); |
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
|
8 rvOperators = {} |
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
|
9 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
|
10 |
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
|
11 % 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
|
12 % 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
|
13 function [D_coarse, penalties_coarse] = constructCoarserGridDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs) |
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
|
14 m = g.m(); |
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 lim = g.lim(); |
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 m_coarse = (m-1)/2 + 1; |
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 g_coarse = grid.equidistant(m_coarse, lim{1}); |
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 [D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g_coarse, schemeOrder, schemeParams, opSet, BCs); |
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 x = g.x{1}; |
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
|
20 x_coarse = x(1:2: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
|
21 % TODO: Fix interpolation |
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
|
22 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
|
23 end |