Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This package evaluates Copson's solution for the free expansion of an ideal gas (γ = 5/3, P = k ρ5/3) into vacuum. For x < 0 the initial conditions are zero velocity and constant sound speed. There is a surface layer for the range 0 < x < h. In the surface layer the sound speed goes smoothly to zero as described by a cubic function for x(3c/2). The slope at x=0, called alpha, and at x=h, called beta, fully specify the cubic. Alpha and beta must be in the triangle with corners (α, β) = (-1,-1), (0, -5/3), (0, -3) for the solution to have no shocks and be valid. To initialize the surface layer you need to solve a cubic equation for the sound speed given the value of x. A routine is provided to do this.

The solution for the characteristics (r and s) are given along with a routine to evaluate the which r and s characteristics go through any (x,t) location. From the values of r and s any physical quantity can be calculated. For example, velocity is v = r - s, soundc speed c = (r + s)/3, density is ρ = [3 ⁄ (5k)]3/2c3 = (15k)-3/2(r+s)3, internal energy e = (9 ⁄10) c2 = 0.1 (r+s)2, and pressure is P = k-3⁄2(3 ⁄ 5)5⁄2 c5 = (15)-5⁄2 k-3⁄2 (r+s)5.

Getting Started

Clone the git repository to a convenient location. You can copy the module to your Python site-packages directory if you want it globally accessible.

A draft copy of the journal article describing the solution, Modeling the Free Expansion of an Ideal Gas without Shocks, is included.


The Python scripts load NumPy and SciPy. The plotting script,, also uses the Matplotlib module to create the plots.

Running the example

In the directory containing the three python files you can generate plots of the characteristics for the cases (α=-1/3, β=-17/9), (α=0, β=-5/3), and (α=0, β=-3) by this command


Test script

The script tests the case of (α=-1/3, β=-17/9). The first set of tests looks at the region near the free surface where s < 0. The values of x and t are solved for using the general expressions of r and s and then using the factored form that avoids dividing by small numbers. The factored form is only valid when s < 0. The factored form is used when appropriate in the general solutions for x and t.

The second set of tests check that the routines can calculate r and s given a point x and t. For t = 0.5 the test checks for points near the free surface where numerical problems can occur with the unfactored equations.



Please read for details on our code of conduct, and the process for submitting pull requests to us.


  • Robert Managan - Initial work - Managan

See also the list of contributors who participated in this project.


This project is licensed under the BSD-3 License - see the file for details

Unlimited Open Source - BSD 3-clause Distribution LLNL-CODE-802401

SPDX usage

Individual files contain SPDX tags instead of the full license text. This enables machine processing of license information based on the SPDX License Identifiers that are available here:

Files that are licensed as BSD 3-Clause contain the following text in the license header:

SPDX-License-Identifier: (BSD-3-Clause)


Evaluate Copson's solution for the expansion of an ideal gas into vacuum








No releases published


No packages published