ppmpy.grid module#
A 1D finite-volume grid class
- class FVGrid(nx, ng, *, xmin=0.0, xmax=1.0)[source]#
Bases:
object
The main finite-volume grid class for holding our fluid state.
- Parameters:
nx (int) – number of zones on the grid.
ng (int) – number of ghost cells on each end of the grid.
xmin (float, optional) – minimum x-coordinate.
xmax (float, optional) – maximum x-coordinate.
- coarsen(fdata)[source]#
coarsen an array fine defined on this grid down to a grid with 1/2 the number of zones (but the same number of ghost cells.
- Parameters:
fdata (ndarray) – The data defined on this FVGrid object.
- Returns:
FVGrid – The coarse grid object.
ndarray – The coarsened data on the coarse grid.
- draw(*, lo_index=None, hi_index=None, stretch=1)[source]#
Draw a finite volume representation of the grid and return the figure and axis objects
- Parameters:
lo_index (int) – 0-based zone index to start the grid plot.
hi_index (int) – 0-based zone index to end the grid plot.
stretch (float) – factor by which to stretch the vertical axis
- Return type:
- ghost_fill(atmp, *, bc_left_type='outflow', bc_right_type='outflow')[source]#
fill all ghost cells with zero-gradient boundary conditions.
- Parameters:
atmp (ndarray) – the array of data defined on the FVGrid to fill ghost cells in
bc_left_type (string) – boundary condition type on the left edge of the domain.
bc_right_type (string) – boundary condition type on the left edge of the domain.
- class GridPlot(*, fig=None, ax=None, lo_index=None, hi_index=None)[source]#
Bases:
object
a container to hold info about the grid figure
- Parameters:
fig (matplotlib.pyplot.Figure) – the figure object.
ax (matplotlib.pyplot.Axes) – the axis object.
lo_index (int, optional) – the 0-based zone index for the left edge of the plot.
hi_index (int, optional) – the 0-based zone index for the right edge of the plot.