Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOpsMultiGrid.m @ 1171:393ed30866a1 feature/rv
Actually return coarse grid operators from constructDiffOpsMultiGrid
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 28 Jun 2019 13:18:58 +0200 |
parents | af3c4eb0cbbd |
children | 9dd10dcff128 |
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 |
1171
393ed30866a1
Actually return coarse grid operators from constructDiffOpsMultiGrid
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1168
diff
changeset
|
5 D_coarse = rv.diffops.constructCoarserGridDiffOp(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,... |
1168
af3c4eb0cbbd
Add method for constructing diffops to multistage approach of computing the residual viscosity. Differentiate between constructDiffOpsMultiGrid and constructDiffOpsMultiStage
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1167
diff
changeset
|
10 'D_coarse', D_coarse,... |
1167
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 |