incompressible package

The pyro solver for incompressible flow. This implements as second-order approximate projection method. The general flow is:

  • create the limited slopes of 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)

  • 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

incompressible.incomp_interface module

incompressible.incomp_interface.get_interface_states(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y)[source]

Compute the unsplit predictions of u and v on both the x- and y-interfaces. This includes the transverse terms.

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

Returns
outndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray, ndarray

unsplit predictions of u and v on both the x- and y-interfaces

incompressible.incomp_interface.mac_vels(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y)[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

Returns
outndarray, ndarray

MAC velocities in the x and y directions

incompressible.incomp_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

incompressible.incomp_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

incompressible.incomp_interface.states(ng, dx, dy, dt, u, v, ldelta_ux, ldelta_vx, ldelta_uy, ldelta_vy, gradp_x, gradp_y, 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

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

incompressible.incomp_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
outndarray

Upwinded state

incompressible.simulation module

class incompressible.simulation.Simulation(solver_name, problem_name, rp, timers=None, data_class=<class 'mesh.patch.CellCenterData2d'>)[source]

Bases: simulation_null.NullSimulation

dovis()[source]

Do runtime visualization

evolve()[source]

Evolve the incompressible equations through one timestep.

initialize()[source]

Initialize the grid and variables for incompressible 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.

preevolve()[source]

preevolve is called before we being the timestepping loop. For the incompressible solver, this does an initial projection on the velocity field and then goes through the full evolution to get the value of phi. The fluid state (u, v) is then reset to values before this evolve.