Mercurial > repos > public > sbplib
annotate +rv/+diffops/constructDiffOpsMultiGrid.m @ 1172:9dd10dcff128 feature/rv
Dont return penalty terms from operators on coarse grid. One can use the penalty terms constructed for the fine grid
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 28 Jun 2019 13:22:03 +0200 |
parents | 393ed30866a1 |
children | 270611e08398 |
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: Only works for equidistant grids |
1172
9dd10dcff128
Dont return penalty terms from operators on coarse grid. One can use the penalty terms constructed for the fine grid
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1171
diff
changeset
|
18 function D_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
|
19 m = g.m(); |
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
20 lim = g.lim(); |
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
21 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
|
22 g_coarse = grid.equidistant(m_coarse, lim{1}); |
1172
9dd10dcff128
Dont return penalty terms from operators on coarse grid. One can use the penalty terms constructed for the fine grid
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1171
diff
changeset
|
23 D_coarse = rv.diffops.constructFluxDiffOpWithClosures(scheme, g_coarse, 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
|
24 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
|
25 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
|
26 % TODO: Fix interpolation |
66c0fbbc406f
Make constructDiffOps return a struct with the operators
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1166
diff
changeset
|
27 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
|
28 end |