https://github.com/jnywong/convect-py
Welcome! Here is my Python code to simulate 2D linear or nonlinear convection in a Cartesian box.
https://github.com/jnywong/convect-py
Last synced: about 2 months ago
JSON representation
Welcome! Here is my Python code to simulate 2D linear or nonlinear convection in a Cartesian box.
- Host: GitHub
- URL: https://github.com/jnywong/convect-py
- Owner: jnywong
- Created: 2022-05-11T09:48:31.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-11T11:57:40.000Z (almost 3 years ago)
- Last Synced: 2025-02-14T14:18:23.874Z (4 months ago)
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://opensource.org/licenses/MIT)
# convect-py
Welcome! Here is my Python code to simulate 2D convection in a Cartesian box. Theory and methods used can be found in [Introduction to Modeling Convection in Planets and Stars: Magnetic Field, Density Stratification, Rotation](https://press.princeton.edu/books/hardcover/9780691141725/introduction-to-modeling-convection-in-planets-and-stars).
## Getting Started
### Pre-requisites
- [Python](https://www.python.org/)## Package structure
```
convect-py
docs/
scripts/
convect_nonlinear.py
src/
data_utils.py
postprocess.py
routines.py
LICENSE.md
README.md
```## Examples
### Nonlinear convection
1. Open `scripts/convect_nonlinear.py`
2. Specify input parameters
```
# Inputs
nz = 101 # no. of vertical gridpoints
nn = 50 # no. of Fourier modes (excluding zeroth mode)
a = 3 # L/D aspect ratio
Ra = 1e6 # Rayleigh number
Pr = 0.5 # Prandtl number
dt = 3e-6 # timestep size
nt = 1e4 # no. of timesteps
nout = 1e2 # save output every nout timesteps
initOn = 1 # initialise run, otherwise load existing data
saveDir = "/Users/wongj/Documents/convect-out/2021-09-03" # save directory
```
3. Run script from terminal using `python /convect-jl/src/convect_nonlinear.py` (or from IPython using `%run /convect-jl/src/convect_nonlinear.py)`## Authors
* [**Jenny Wong**](https://jnywong.github.io/) - *University of Birmingham*
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
:tada: