changeset 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 745ae0d134c9
children 66c0fbbc406f
files +rv/+diffops/constructDiffOpsMultiGrid.m
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
diff -r 745ae0d134c9 -r 17bb3c46472c +rv/+diffops/constructDiffOpsMultiGrid.m
--- a/+rv/+diffops/constructDiffOpsMultiGrid.m	Thu Jun 27 17:14:30 2019 +0200
+++ b/+rv/+diffops/constructDiffOpsMultiGrid.m	Thu Jun 27 17:15:11 2019 +0200
@@ -1,7 +1,23 @@
-function [D_scheme, D_flux, D_t, penalties_scheme, penalties_res] = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs)
+function [D_scheme, D_coarse, D_flux, D_t, penalties_scheme, penalties_res] = constructDiffOpsMultiGrid(scheme, g, schemeOrder, residualOrder, schemeParams, opSet, BCs)
     % DiffOps for solution vector
-    [D_scheme, penalties_scheme, ~] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs)
+    [D_scheme, penalties_scheme, ~] = rv.diffops.constructSchemeDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs);
+    [D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, schemeOrder, schemeParams, opSet, BCs);
     %% DiffOps for residual viscosity
     [D_t, penalties_res] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g, residualOrder, schemeParams, opSet, BCs);
     D_flux = @(v) -D_t(v);
+    rvOperators = {}
+end
+
+% TODO: Not clear if this is needed
+% TODO: Only works for equidistant grids
+function [D_coarse, penalties_coarse] = constructCoarserGridDiffOp(scheme, g, schemeOrder, schemeParams, opSet, BCs)
+	m = g.m();
+	lim = g.lim();
+	m_coarse = (m-1)/2 + 1;
+	g_coarse = grid.equidistant(m_coarse, lim{1});
+	[D_coarse, penalties_coarse] = rv.diffops.constructFluxDiffOpWithClosures(scheme, g_coarse, schemeOrder, schemeParams, opSet, BCs);
+	x = g.x{1};
+	x_coarse = x(1:2:end);
+	% TODO: Fix interpolation
+	D_coarse = @(v) interp1(x_coarse,D_coarse(v(1:2:end)),x,'spline');
 end
\ No newline at end of file