pyro.lm_atm package#
The pyro solver for low Mach number atmospheric flow. This implements as second-order approximate projection method. The general flow is:
create the limited slopes of rho, u and v (in both directions)
get the advective velocities through a piecewise linear Godunov method
enforce the divergence constraint on the velocities through a projection (the MAC projection)
predict rho to edges and do the conservative update
recompute the interface states using the new advective velocity
update U in time to get the provisional velocity field
project the final velocity to enforce the divergence constraint.
The projections are done using multigrid
Subpackages#
Submodules#
pyro.lm_atm.LM_atm_interface module#
- pyro.lm_atm.LM_atm_interface.get_interface_states(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y, source)[source]#
Compute the unsplit predictions of u and v on both the x- and y-interfaces. This includes the transverse terms.
Note that the
gradp_x
,gradp_y
should have any coefficients already included (e.g. \(\beta_0/\rho\))- Parameters:
- ngint
The number of ghost cells
- dx, dyfloat
The cell spacings
- dtfloat
The timestep
- u, vndarray
x-velocity and y-velocity
- ldelta_ux, ldelta_uy: ndarray
Limited slopes of the x-velocity in the x and y directions
- ldelta_vx, ldelta_vy: ndarray
Limited slopes of the y-velocity in the x and y directions
- gradp_x, gradp_yndarray
Pressure gradients in the x and y directions
- sourcendarray
Source terms
- Returns:
- outndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray
unsplit predictions of u and v on both the x- and y-interfaces
- pyro.lm_atm.LM_atm_interface.is_asymmetric(ng, nodal, s)[source]#
Is the left half of s asymmetric to the right half?
- Parameters:
- ngint
The number of ghost cells
- nodal: bool
Is the data nodal?
- sndarray
The array to be compared
- Returns:
- outint
Is it asymmetric? (1 = yes, 0 = no)
- pyro.lm_atm.LM_atm_interface.is_asymmetric_pair(ng, nodal, sl, sr)[source]#
Are sl and sr asymmetric about an axis parallel with the y-axis in the center of domain the x-direction?
- Parameters:
- ngint
The number of ghost cells
- nodal: bool
Is the data nodal?
- sl, srndarray
The two arrays to be compared
- Returns:
- outint
Are they asymmetric? (1 = yes, 0 = no)
- pyro.lm_atm.LM_atm_interface.is_symmetric(ng, nodal, s)[source]#
Is the left half of s the mirror image of the right half?
- Parameters:
- ngint
The number of ghost cells
- nodal: bool
Is the data nodal?
- sndarray
The array to be compared
- Returns:
- outint
Is it symmetric? (1 = yes, 0 = no)
- pyro.lm_atm.LM_atm_interface.is_symmetric_pair(ng, nodal, sl, sr)[source]#
Are sl and sr symmetric about an axis parallel with the y-axis in the center of domain the x-direction?
- Parameters:
- ngint
The number of ghost cells
- nodal: bool
Is the data nodal?
- sl, srndarray
The two arrays to be compared
- Returns:
- outint
Are they symmetric? (1 = yes, 0 = no)
- pyro.lm_atm.LM_atm_interface.mac_vels(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y, source)[source]#
Calculate the MAC velocities in the x and y directions.
- Parameters:
- ngint
The number of ghost cells
- dx, dyfloat
The cell spacings
- dtfloat
The timestep
- u, vndarray
x-velocity and y-velocity
- ldelta_ux, ldelta_uy: ndarray
Limited slopes of the x-velocity in the x and y directions
- ldelta_vx, ldelta_vy: ndarray
Limited slopes of the y-velocity in the x and y directions
- gradp_x, gradp_yndarray
Pressure gradients in the x and y directions
- sourcendarray
Source terms
- Returns:
- outndarray, ndarray
MAC velocities in the x and y directions
- pyro.lm_atm.LM_atm_interface.rho_states(ng, dx, dy, dt, rho, u_MAC, v_MAC, ldelta_rx, ldelta_ry)[source]#
This predicts rho to the interfaces. We use the MAC velocities to do the upwinding
- Parameters:
- ngint
The number of ghost cells
- dx, dyfloat
The cell spacings
- rhondarray
density
- u_MAC, v_MACndarray
MAC velocities in the x and y directions
- ldelta_rx, ldelta_ry: ndarray
Limited slopes of the density in the x and y directions
- Returns:
- outndarray, ndarray
rho predicted to the interfaces
- pyro.lm_atm.LM_atm_interface.riemann(ng, q_l, q_r)[source]#
Solve the Burger’s Riemann problem given the input left and right states and return the state on the interface.
This uses the expressions from Almgren, Bell, and Szymczak 1996.
- Parameters:
- ngint
The number of ghost cells
- q_l, q_rndarray
left and right states
- Returns:
- outndarray
Interface state
- pyro.lm_atm.LM_atm_interface.riemann_and_upwind(ng, q_l, q_r)[source]#
First solve the Riemann problem given q_l and q_r to give the velocity on the interface and: use this velocity to upwind to determine the state (q_l, q_r, or a mix) on the interface).
This differs from upwind, above, in that we don’t take in a velocity to upwind with).
- Parameters:
- ngint
The number of ghost cells
- q_l, q_rndarray
left and right states
- Returns:
- outndarray
Upwinded state
- pyro.lm_atm.LM_atm_interface.states(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y, source, u_MAC, v_MAC)[source]#
This is similar to
mac_vels
, but it predicts the interface states of both u and v on both interfaces, using the MAC velocities to do the upwinding.- Parameters:
- ngint
The number of ghost cells
- dx, dyfloat
The cell spacings
- dtfloat
The timestep
- u, vndarray
x-velocity and y-velocity
- ldelta_ux, ldelta_uy: ndarray
Limited slopes of the x-velocity in the x and y directions
- ldelta_vx, ldelta_vy: ndarray
Limited slopes of the y-velocity in the x and y directions
- sourcendarray
Source terms
- gradp_x, gradp_yndarray
Pressure gradients in the x and y directions
- u_MAC, v_MACndarray
MAC velocities in the x and y directions
- Returns:
- outndarray, ndarray, ndarray, ndarray
x and y velocities predicted to the interfaces
- pyro.lm_atm.LM_atm_interface.upwind(ng, q_l, q_r, s)[source]#
upwind the left and right states based on the specified input velocity, s. The resulting interface state is q_int
- Parameters:
- ngint
The number of ghost cells
- q_l, q_rndarray
left and right states
- sndarray
velocity
- Returns:
- q_intndarray
Upwinded state
pyro.lm_atm.simulation module#
- class pyro.lm_atm.simulation.Simulation(solver_name, problem_name, problem_func, rp, *, problem_finalize_func=None, problem_source_func=None, timers=None)[source]#
Bases:
NullSimulation
- initialize()[source]#
Initialize the grid and variables for low Mach atmospheric flow and set the initial conditions for the chosen problem.
- method_compute_timestep()[source]#
The timestep() function computes the advective timestep (CFL) constraint. The CFL constraint says that information cannot propagate further than one zone per timestep.
We use the driver.cfl parameter to control what fraction of the CFL step we actually take.