https://github.com/barbagroup/cfdpython

A sequence of Jupyter notebooks featuring the "12 Steps to Navier-Stokes" http://lorenabarba.com/

https://github.com/barbagroup/cfdpython

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    5 of 12 committers (41.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.7%) to scientific vocabulary

Keywords

cfd fluid-dynamics jupyter-notebook navier-stokes-equations python

Keywords from Contributors

aerodynamics fluid-mechanics computational-fluid-dynamics immersed-boundary-method nvidia-amgx petsc
Last synced: 6 months ago · JSON representation

Repository

A sequence of Jupyter notebooks featuring the "12 Steps to Navier-Stokes" http://lorenabarba.com/

Basic Info
  • Host: GitHub
  • Owner: barbagroup
  • License: other
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage:
  • Size: 23.7 MB
Statistics
  • Stars: 3,685
  • Watchers: 267
  • Forks: 1,236
  • Open Issues: 27
  • Releases: 1
Topics
cfd fluid-dynamics jupyter-notebook navier-stokes-equations python
Created about 12 years ago · Last pushed almost 2 years ago
Metadata Files
Readme License

README.md

CFD Python

Please cite as: Barba, Lorena A., and Forsyth, Gilbert F. (2018). CFD Python: the 12 steps to Navier-Stokes equations. Journal of Open Source Education, 1(9), 21, https://doi.org/10.21105/jose.00021

DOI

CFD Python, a.k.a. the 12 steps to Navier-Stokes, is a practical module for learning the foundations of Computational Fluid Dynamics (CFD) by coding solutions to the basic partial differential equations that describe the physics of fluid flow. The module was part of a course taught by Prof. Lorena Barba between 2009 and 2013 in the Mechanical Engineering department at Boston University (Prof. Barba since moved to the George Washington University).

The module assumes only basic programming knowledge (in any language) and some background in partial differential equations and fluid mechanics. The "steps" were inspired by ideas of Dr. Rio Yokota, who was a post-doc in Prof. Barba's lab until 2011, and the lessons were refined by Prof. Barba and her students over several semesters teaching the CFD course. We wrote this set of Jupyter notebooks in 2013 to teach an intensive two-day course in Mendoza, Argentina.

Guiding students through these steps (without skipping any!), they learn many valuable lessons. The incremental nature of the exercises means they get a sense of achievement at the end of each assignment, and they feel they are learning with low effort. As they progress, they naturally practice code re-use and they incrementally learn programming and plotting techniques. As they analyze their results, they learn about numerical diffusion, accuracy and convergence. In about four weeks of a regularly scheduled course, they become moderately proficient programmers and are motivated to start discussing more theoretical matters.

How to use this module

In a regular-session university course, students can complete the CFD Python lessons in 4 to 5 weeks. As an intensive tutorial, the module can be completed in two or three full days, depending on the learner's prior experience. The lessons can also be used for self study. In all cases, learners should follow along the worked examples in each lesson by re-typing the code in a fresh Jupyter notebook, maybe taking original notes as they try things out.

Lessons

Launch an interactive session with this module using the Binder service: Binder

Steps 1–4 are in one spatial dimension. Steps 5–10 are in two dimensions (2D). Steps 11–12 solve the Navier-Stokes equation in 2D. Three "bonus" notebooks cover the CFL condition for numerical stability, array operations with NumPy, and defining functions in Python.

  • Quick Python Intro —For Python novices, this lesson introduces the numerical libraries (NumPy and Matplotlib), Python variables, use of whitespace, and slicing arrays.
  • Step 1 —Linear convection with a step-function initial condition (IC) and appropriate boundary conditions (BCs).
  • Step 2 —With the same IC/BCs, nonlinear convection.
  • CFL Condition —Exploring numerical stability and the Courant-Friedrichs-Lewy (CFL) condition.
  • Step 3 —With the same IC/BCs, diffusion only.
  • Step 4 —Burgers’ equation, with a saw-tooth IC and periodic BCs (with an introduction to Sympy).
  • Array Operations with NumPy
  • Step 5 —Linear convection in 2D with a square-function IC and appropriate BCs.
  • Step 6 —With the same IC/BCs, nonlinear convection in 2D.
  • Step 7 —With the same IC/BCs, diffusion in 2D.
  • Step 8 —Burgers’ equation in 2D
  • Defining Functions in Python
  • Step 9 —Laplace equation with zero IC and both Neumann and Dirichlet BCs.
  • Step 10 —Poisson equation in 2D.
  • Step 11 —Solves the Navier-Stokes equation for 2D cavity flow.
  • Step 12 —Solves the Navier-Stokes equation for 2D channel flow.

Dependencies

To use these lessons, you need Python 3, and the standard stack of scientific Python: NumPy, Matplotlib, SciPy, Sympy. And of course, you need Jupyter—an interactive computational environment that runs on a web browser.

This mini-course is built as a set of Jupyter notebooks containing the written materials and worked-out solutions on Python code. To work with the material, we recommend that you start each lesson with a fresh new notebook, and follow along, typing each line of code (don't copy-and-paste!), and exploring by changing parameters and seeing what happens.

Installing via Anaconda
We *highly* recommend that you install the [Anaconda Python Distribution](http://docs.continuum.io/anaconda/install). It will make your life so much easier. You can download and install Anaconda on Windows, OSX and Linux. After installing, to ensure that your packages are up to date, run the following commands in a terminal: ```Bash conda update conda conda update jupyter numpy sympy scipy matplotlib ``` If you prefer Miniconda (a mini version of Anaconda that saves you disk space), install all the necessary libraries to follow this course by running the following commands in a terminal: ```Bash conda update conda conda install jupyter conda install numpy scipy sympy matplotlib ```
Without Anaconda
If you already have Python installed on your machine, you can install Jupyter using pip: ```Bash pip install jupyter ``` Please also make sure that you have the necessary libraries installed by running ```Bash pip install numpy scipy sympy matplotlib ```

How to contribute to CFD Python

We accept contributions via pull request—in fact, several users have already submitted pull requests making corrections or small improvements. You can also open an issue if you find a bug, or have a suggestion.

Copyright and License

(c) 2017 Lorena A. Barba, Gilbert F. Forsyth. All content is under Creative Commons Attribution CC-BY 4.0, and all code is under BSD-3 clause (previously under MIT, and changed on March 8, 2018).

We are happy if you re-use the content in any way!

License License: CC BY 4.0

Owner

  • Name: Barba group
  • Login: barbagroup
  • Kind: organization
  • Location: Washington, DC

GitHub Events

Total
  • Issues event: 3
  • Watch event: 354
  • Issue comment event: 2
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Fork event: 73
Last Year
  • Issues event: 3
  • Watch event: 354
  • Issue comment event: 2
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Fork event: 73

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 217
  • Total Committers: 12
  • Avg Commits per committer: 18.083
  • Development Distribution Score (DDS): 0.465
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Gil Forsyth g****h@g****m 116
Lorena Barba l****a@b****u 49
Lorena A. Barba l****a@g****u 37
mesnardo m****o@g****u 4
Pete Bachant p****t@g****m 4
jazzalin j****n@g****m 1
Tingyu Wang v****g@g****m 1
Santiago Castro s****0@h****m 1
Chhi'med Kunzang c****g@g****m 1
!link s****k@g****m 1
Piotr Mitros p****s@m****u 1
Gil Forsyth g****h@g****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 52
  • Total pull requests: 41
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 34
  • Total pull request authors: 24
  • Average comments per issue: 1.98
  • Average comments per pull request: 1.1
  • Merged pull requests: 21
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 2
  • Pull requests: 0
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: N/A
  • Issue authors: 2
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gforsyth (9)
  • petebachant (4)
  • labarba (3)
  • Bob-McCrory (2)
  • nicoguaro (2)
  • Beramos (2)
  • fidle (2)
  • c0smas (2)
  • peterparity (1)
  • afterburner34 (1)
  • piyueh (1)
  • reidginoza (1)
  • GonzaloSaez (1)
  • mesnardo (1)
  • sajjadintel (1)
Pull Request Authors
  • gforsyth (9)
  • petebachant (5)
  • mesnardo (4)
  • rohany (2)
  • nauaneed (2)
  • dependabot[bot] (2)
  • tkoyama010 (1)
  • ghost (1)
  • pmitros (1)
  • oddsun (1)
  • crmccreary (1)
  • ggruszczynski (1)
  • HolyGeneralK (1)
  • michaeldavidjohnson (1)
  • Uttkarsh99 (1)
Top Labels
Issue Labels
bug (4) enhancement (3) typo (1) question (1) evergreen (1)
Pull Request Labels
dependencies (2)

Dependencies

requirements.txt pypi
  • ipywidgets ==7.2.1
  • jupyter ==1.0.0
  • matplotlib ==2.2.2
  • numpy ==1.14.3
  • scipy ==1.1.0
  • sympy ==1.1.1