Mercurial > repos > public > sbplib
comparison +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 |
comparison
equal
deleted
inserted
replaced
1165:745ae0d134c9 | 1166:17bb3c46472c |
---|---|
1 function [D_scheme, D_flux, D_t, penalties_scheme, penalties_res] = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) | 1 function [D_scheme, D_coarse, D_flux, D_t, penalties_scheme, penalties_res] = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs) |
2 % DiffOps for solution vector | 2 % DiffOps for solution vector |
3 [D_scheme, penalties_scheme, ~] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs) | 3 [D_scheme, penalties_scheme, ~] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs); |
4 [D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, schemeOrder, schemeParams, opSet, BCs); | |
4 %% DiffOps for residual viscosity | 5 %% DiffOps for residual viscosity |
5 [D_t, penalties_res] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, residualOrder, schemeParams, opSet, BCs); | 6 [D_t, penalties_res] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, residualOrder, schemeParams, opSet, BCs); |
6 D_flux = @(v) -D_t(v); | 7 D_flux = @(v) -D_t(v); |
8 rvOperators = {} | |
7 end | 9 end |
10 | |
11 % TODO: Not clear if this is needed | |
12 % TODO: Only works for equidistant grids | |
13 function [D_coarse, penalties_coarse] = constructCoarserGridDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs) | |
14 m = g.m(); | |
15 lim = g.lim(); | |
16 m_coarse = (m-1)/2 + 1; | |
17 g_coarse = grid.equidistant(m_coarse, lim{1}); | |
18 [D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g_coarse, schemeOrder, schemeParams, opSet, BCs); | |
19 x = g.x{1}; | |
20 x_coarse = x(1:2:end); | |
21 % TODO: Fix interpolation | |
22 D_coarse = @(v) interp1(x_coarse,D_coarse(v(1:2:end)),x,'spline'); | |
23 end |