Skip to content

An unstructured solver for the Euler equations on a 2D grid, prototyped in Python

License

Notifications You must be signed in to change notification settings

LukeMcCulloch/PyCFD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyCFD

An unstructured solver for the Euler equations on a 2D grid, prototyped in Python.

  1. LSQ gradient reconstruction
  2. Roe approximate Riemmann solver for the flux
  3. Cell centered.
  4. Tri and quad meshes shown

Requirements

  1. NumPy
  2. matplotlib
  3. weakref

Optional

  1. memory_profile
  2. paraview for viewing vtk output files

Unstructured mesh physics reconstruction

LSQ gradient stencil at the cell colored in green

Testing

The implemenatation is pretty well finished, but I am expanding it. Right now, the explicity steady solver is known to work well for the cylinder and airfoil test cases. You can also run the "System2D.py" file and get plots showing small tri and quad grids. The solver treats all meshes as unstructured by design. The point of this exercise is to go through the motions of implementing an unstructrued Euler solver before "doing the real thing" in C++.

Here are some shock diffraction (supersonic flow over a backward facing step) plots made with the solver:

AirfoilDensity AirfoilDensity AirfoilDensity AirfoilDensity

And here's a sample result of flow over an airfoil:

AirfoilDensity AirfoilDensity AirfoilDensity AirfoilDensity

Update: need to update the initial vortex:

StrongVortex

Here are plots of density and pressure, done with two different methods of interpolating unstructured data to a cartesian grid for plotting. Not sure which is better just yet.

DensityPress

Hmm... That was for a tri-mesh. Here is the same on a quad mesh:

StrongVortex

DensityPress

Basic Mesh Plots in Python

# Quad Mesh

LSQ gradient stencil at the cell colored in green

Normals, centroids, face centers, edges, and vertices shown.

# Tri mesh

LSQ gradient stencil at the cell colored in green

Normals, centroids, face centers, edges, and vertices shown.

Cheers,

Luke

About

An unstructured solver for the Euler equations on a 2D grid, prototyped in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages