diff +util/get_periodic_grid.m @ 1336:0666629aa183 feature/D2_boundary_opt

Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 13 May 2022 13:26:16 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+util/get_periodic_grid.m	Fri May 13 13:26:16 2022 +0200
@@ -0,0 +1,8 @@
+% Returns the 1D periodic grid where the last grid point at x_r
+% is omitted (it is the same as the the first grid point at x_l)
+function [x,h] = get_periodic_grid(x_l,x_r,m)
+    L = x_r-x_l;
+    h = L/m;
+    x = linspace(x_l,x_r,m+1)';
+    x = x(1:end-1);
+end
\ No newline at end of file