time | calls | line |
---|
| | 1 | function [XP, YP, XU, YU, XV, YV, dx, dy] = meshdomain(app, xlim, ylim)
|
| | 2 | % function [XP, YP, XU, YU, XV, YV, dx, dy] = meshdomain(app, xlim, ylim)
|
| | 3 | %
|
| | 4 | % This function meshes the domain.
|
| | 5 | %
|
| | 6 | % INPUTS:
|
| | 7 | % app: The application data-structure. Should contain the fields
|
| | 8 | % Nx and Ny for the number of x and y control volumes.
|
| | 9 | % xlim: Array giving the limits of the domain in the x-direction.
|
| | 10 | % xlim = [min(x), max(x)]
|
| | 11 | % ylim: Array giving the limits of the domain in the y-direction.
|
| | 12 | % ylim = [min(y), max(y)]
|
| | 13 | %
|
| | 14 | % OUTPUTS:
|
| | 15 | % XP: X-coordinate matrix for the Pressure/Tracer grid
|
| | 16 | % YP: Y-coordinate matrix for the Pressure/Tracer grid
|
| | 17 | % XU: X-coordinate matrix for the u-velocity grid
|
| | 18 | % YU: Y-coordinate matrix for the u-velocity grid
|
| | 19 | % XV: X-coordinate matrix for the v-velocity grid
|
| | 20 | % YV: Y-coordinate matrix for the v-velocity grid
|
| | 21 | % dx: Control volume size in the x-direction
|
| | 22 | % dy: Control volume size in the y-direction
|
| | 23 | %
|
| | 24 | % Written by: Matt Ueckermann
|
| | 25 |
|
| 1 | 26 | dx = abs(xlim(2) - xlim(1))./(app.Nx);
|
| 1 | 27 | dy = abs(ylim(2) - ylim(1))./(app.Ny);
|
| | 28 |
|
| 1 | 29 | xp = linspace(xlim(1) + dx / 2, xlim(2) - dx / 2, app.Nx);
|
< 0.01 | 1 | 30 | yp = fliplr(linspace(ylim(1) + dy / 2, ylim(2) - dy / 2, app.Ny));
|
| 1 | 31 | xu = linspace(xlim(1) + dx, xlim(2) - dx, app.Nx - 1);
|
| 1 | 32 | yu = fliplr(linspace(ylim(1) + dy / 2, ylim(2) - dy / 2, app.Ny));
|
| 1 | 33 | xv = linspace(xlim(1) + dx / 2, xlim(2) - dx / 2, app.Nx);
|
| 1 | 34 | yv = fliplr(linspace(ylim(1) + dy, ylim(2) - dy, app.Ny - 1));
|
| | 35 |
|
< 0.01 | 1 | 36 | [XP YP] = meshgrid(xp, yp);
|
< 0.01 | 1 | 37 | [XU YU] = meshgrid(xu, yu);
|
| 1 | 38 | [XV YV] = meshgrid(xv, yv);
|