Skip to main content

Solve the Euler Equations for inviscid compressible flow in 1D.

Project description

EulerFlow

Description

Solve the Euler (Compressible, inviscid Navier Stokes) equations in cartesian, cylindrical, and spherical coordinates in python. Validation is done through the self-similar to the solution, described as the Taylor-Von Neumann-Sedov solution.

Numerical Methods for the Euler Solution

Example

Import Libraries

For this simple example, we're going to use SedovBlast, which handles setting up the dimensionless problem. Using SI units to solve the Euler equations slows down the problem significanly and leads to numerical instability. It utilizes the Jameson-Shmidt-Turkel finite volume scheme for spatial discretization and scipy.integrate.solve_ivp for the time integration. The boundary conditions at the origin are reflective and transmissive at the exit. Unit tests have shown that the wave transmits easily through the end and that the wave reflects at the origin.

from EulerFlow import SedovBlast

Set Up Blast Scenario

LenScale__m = 1    # length scale of the problem
DomainLen__m = 10   # size of the domain
PAmb__Pa = 101325   # ambient air pressure
PExpl__Pa = 20*PAmb__Pa # Explosive pressure
RExpl__m = 3        # radius of explosion
tFin__s  = 0.010    # final simulation time
rhoAmb__kgpm3=1.225 # ambient air density
orders = 2          # order of solution

We look at a blast solition over the domain 0 to 10 meters. We scale the parameters by 1 meter, but values 1-10 are acceptable. We set the ambient pressure and density to STP: PAmb__Pa=101325 and rhoAmb__kgpm3=1.225. The Explosion is centered at the origin at t=0, and has a radius of 3 meters. We allow the solution to solve for 10 miliseconds, and set order=2 (spherical coordinates). order=0 indicates cartesian coordinates, and order=1 indicates cylindrical coordinates.

Run Simulation

SedovBlast converts the SI coordinates, time, and thermodynamic parameters into dimensionless units. SedovBlast.solve() takes the argument of method, which is the time integration scheme for scipy.integrate.solve_ivp. The solution should converge in a few seconds.

Blast = SedovBlast(LenScale__m, DomainLen__m, RExpl__m, PExpl__Pa, tFin__s,
                P0__Pa=PAmb__Pa, rho0__kgpm3=rhoAmb__kgpm3, order=orders)
Blast.solve(method='RK45')

Analyze Results

We can then view the fields as density plots or at discrete times.

Blast.dispFields()      ## density plots of the field
Blast.plotDiscTimes()   ## plott at discrete times

Taylor-Von Neumann-Sedov Analytical Solution

To-Do

Other goals I have with this project:

  • solve the euler equation with other flux integration schemes (Roe, etc)
  • simple PDEs as unit tests such as the wave and diffusion equation
  • Basset-Oseen equation (transient, compressible, particle-laden flow)
  • Coupled Euler equations with combustion
  • Full Navier-Stokes equations
  • quasi-1D Euler, with cross-sectional area variation
  • etc

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyflowsolver-0.3.1.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

PyFlowSolver-0.3.1-py3-none-any.whl (46.2 kB view details)

Uploaded Python 3

File details

Details for the file pyflowsolver-0.3.1.tar.gz.

File metadata

  • Download URL: pyflowsolver-0.3.1.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pyflowsolver-0.3.1.tar.gz
Algorithm Hash digest
SHA256 1d862dc701e197afa6b38462cf47a5856008773a832630ba5a921275d039fe58
MD5 1b68879b5b0ae4c46c9b092462b1bb98
BLAKE2b-256 72e07067490899f2b2c76a0b3201707e2d9fd183e8321bb1686b411c20deb46e

See more details on using hashes here.

File details

Details for the file PyFlowSolver-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: PyFlowSolver-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 46.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for PyFlowSolver-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5163a25458219bd567c67e1116731f6871dea6c993f53f8a33c15e2d9e6a87f
MD5 4b019fcc71012450fe09696d0af17c7e
BLAKE2b-256 8ea4b657c3dd7db56c47e92c9dac1d93c254e6a4b543c7ce0c1c1db3102e5cc5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page