GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - python-hydro/hydro_examples: Simple one-dimensional examples of various hydrodynamics techniques

BranchesTags
Open more actions menu

Latest commit

 

History

191 Commits
191 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
advection
advection
 
 
basic_numerics
basic_numerics
 
 
burgers
burgers
 
 
compressible
compressible
 
 
diffusion
diffusion
 
 
elliptic
elliptic
 
 
finite-volume
finite-volume
 
 
incompressible
incompressible
 
 
multigrid
multigrid
 
 
multiphysics
multiphysics
 
 
parallel
parallel
 
 
.codespell-ignore-words
.codespell-ignore-words
 
 
.codespellrc
.codespellrc
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

hydro_examples

Simple one-dimensional examples of various hydrodynamics techniques

This is a collection of simple python codes (+ a few Fortran ones) that demonstrate some basic techniques used in hydrodynamics codes. All the codes are standalone -- there are no interdependencies.

These codes go together with the lecture notes at:

https://open-astrophysics-bookshelf.github.io/numerical_exercises/

and with the pyro2 code:

https://github.com/python-hydro/pyro2

  • advection/

    • advection.py: a 1-d second-order linear advection solver with a wide range of limiters.

    • fdadvect_implicit.py: a 1-d first-order implicit finite-difference linear advection solver using periodic boundary conditions.

    • fdadvect.py: a 1-d first-order explicit finite-difference linear advection solver using upwinded differencing.

    • fv_mol.py: a 1-d method-of-lines second-order accurate advection solver.

    • Fortran/:

      • advect.f90: a Fortran implementation of second-order linear advection. This version does piecewise constant, piecewise linear, and piecewise parabolic (PPM) reconstruction.
  • basic-numerics

    • orbit-converge.py (and orbit.py): a demonstration of the convergence of different ODE integration methods for the problem of Earth orbiting around the Sun.
  • burgers/

    • burgers.py: a 1-d second-order solver for the inviscid Burgers’ equation, with initial conditions corresponding to a shock and a rarefaction.
  • compressible/

    • euler.ipynb: a SymPy IPython notebook that derives the eigenvalues and eigenvectors for the Euler equations.

    • riemann-phase.py: a simple script that plots the Hugoniot curves for a compressible Riemann problem (assuming a gamma-law gas)

  • diffusion/

    • diffusion-explicit.py: solve the constant-diffusivity diffusion equation explicitly. The method is first-order accurate in time, but second- order in space. A Gaussian profile is diffused--the analytic solution is also a Gaussian.

    • diffusion-implicit.py: solve the constant-diffusivity diffusion equation implicitly. Crank-Nicolson time-discretization is used, resulting in a second-order method. A Gaussian profile is diffused.

  • elliptic/

    • poisson_fft.py: an FFT solver for a 2-d Poisson problem with periodic boundaries.
  • finite-volume/

    • conservative-interpolation.ipynb: an IPython notebook that illustrates how to derive high-order conservative interpolants for finite-volume data.
  • incompressible/

    • project.py: a simple example of using a projection to recover a divergence-free velocity field.
  • multigrid/

    • mg_converge.py: a convergence test of the multigrid solver. A Poisson problem is solved at various resolutions and compared to the exact solution. This demonstrates second-order accuracy.

    • mg_test.py: a simple driver for the multigrid solver. This sets up and solves a Poisson problem and plots the behavior of the solution as a function of V-cycle number.

    • multigrid.py: a multigrid class for cell-centered data. This implements pure V-cycles. A square domain with 2 N zones (N a positive integer) is required.

    • patch1d.py: a class for 1-d cell-centered data that lives on a grid. This manages the data, handles boundary conditions, and provides routines for prolongation and restriction to other grids.

  • multiphysics/

    • burgersvisc.py: solve the viscous Burgers equation. The advective terms are treated explicitly with a second-order accurate method. The diffusive term is solved using an implicit Crank-Nicolson discretiza- tion. The overall coupling is second-order accurate.

    • diffusion-reaction.py: solve a diffusion-reaction equation that propagates a diffusive reacting front (flame). A simple reaction term is modeled. The diffusion is solved using a second-order Crank-Nicolson discretization. The reactions are evolved using the VODE ODE solver (via SciPy). The two processes are coupled together using Strang-splitting to be second-order accurate in time.

  • parallel/

    • relax-mpi.f90: a simple example of pure relaxiation using domain decomposition + message passing (through MPI) to implement smoothing in a parallel fashion.

    • relax-omp.f90: a simple example of pure relaxation using OpenMP to parallelize the loops using shared-memory.

About

Simple one-dimensional examples of various hydrodynamics techniques

Topics

advectionburgersdiffusionfinite-volumefinite-volume-methodshydrodynamicsmultigridpdepython

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

128 stars

Watchers

9 watching

Forks

71 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.