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

Submodules

incompressible.incomp_interface module

incompressible.incomp_interface.get_interface_states[source]

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

Parameters:
ng : int

The number of ghost cells

dx, dy : float

The cell spacings

dt : float

The timestep

u, v : ndarray

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_y : ndarray

Pressure gradients in the x and y directions

Returns:
out : ndarray, 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[source]

Calculate the MAC velocities in the x and y directions.

Parameters:
ng : int

The number of ghost cells

dx, dy : float

The cell spacings

dt : float

The timestep

u, v : ndarray

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_y : ndarray

Pressure gradients in the x and y directions

Returns:
out : ndarray, ndarray

MAC velocities in the x and y directions

incompressible.incomp_interface.riemann[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:
ng : int

The number of ghost cells

q_l, q_r : ndarray

left and right states

Returns:
out : ndarray

Interface state

incompressible.incomp_interface.riemann_and_upwind[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:
ng : int

The number of ghost cells

q_l, q_r : ndarray

left and right states

Returns:
out : ndarray

Upwinded state

incompressible.incomp_interface.states[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:
ng : int

The number of ghost cells

dx, dy : float

The cell spacings

dt : float

The timestep

u, v : ndarray

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_y : ndarray

Pressure gradients in the x and y directions

u_MAC, v_MAC : ndarray

MAC velocities in the x and y directions

Returns:
out : ndarray, ndarray, ndarray, ndarray

x and y velocities predicted to the interfaces

incompressible.incomp_interface.upwind[source]

upwind the left and right states based on the specified input velocity, s. The resulting interface state is q_int

Parameters:
ng : int

The number of ghost cells

q_l, q_r : ndarray

left and right states

s : ndarray

velocity

Returns:
out : ndarray

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.