Mercurial > repos > public > sbplib
annotate +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 |
rev | line source |
---|---|
1336
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
1 % Returns the 1D periodic grid where the last grid point at x_r |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
2 % is omitted (it is the same as the the first grid point at x_l) |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
3 function [x,h] = get_periodic_grid(x_l,x_r,m) |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
4 L = x_r-x_l; |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
5 h = L/m; |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
6 x = linspace(x_l,x_r,m+1)'; |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
7 x = x(1:end-1); |
0666629aa183
Add methods for creating grids with different grid point distributions for each coordinate direction, and also supports constructing periodic grids
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
8 end |