Skip to content

Commit

Permalink
Merge branch 'open-atmos:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Caastlefox authored Nov 23, 2024
2 parents 9d72556 + a8f04f7 commit 23508be
Show file tree
Hide file tree
Showing 9 changed files with 942 additions and 229 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/tests+pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
needs: [nojit_and_codecov, pylint, pdoc, precommit, zenodo_json]
strategy:
matrix:
platform: [ubuntu-latest, macos-12, macos-14, windows-latest]
platform: [ubuntu-latest, macos-13, macos-14, windows-latest]
python-version: ["3.9", "3.12"]
exclude:
- platform: macos-14
Expand Down Expand Up @@ -168,15 +168,15 @@ jobs:
needs: [pylint, precommit]
strategy:
matrix:
platform: [ubuntu-latest, macos-12, macos-14, windows-latest]
platform: [ubuntu-latest, macos-13, macos-14, windows-latest]
python-version: ["3.9", "3.12"]
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
fetch-depth: 0

- uses: actions/[email protected]
with:
Expand All @@ -195,6 +195,8 @@ jobs:
sudo make install
cd ../../../
rm -rf libmpdataxx
- uses: julia-actions/setup-julia@v2
- run: julia --version

# https://github.com/numba/numba/issues/6350#issuecomment-728174860
- if: matrix.platform == 'ubuntu-latest'
Expand Down Expand Up @@ -267,13 +269,15 @@ jobs:
cd ..
- if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@unstable/v1
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
attestations: false
repository_url: https://test.pypi.org/legacy/
packages-dir: ${{ matrix.package-dir }}/dist

- if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@unstable/v1
uses: pypa/gh-action-pypi-publish@release/v1.12
with:
attestations: false
packages-dir: ${{ matrix.package-dir }}/dist

32 changes: 7 additions & 25 deletions docs/markdown/pympdata_landing.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ with arguments suiting the problem at hand, e.g.:

<details>
<summary>Julia code (click to expand)</summary>

```Julia
using Pkg
Pkg.add("PyCall")
Expand All @@ -83,16 +82,12 @@ options = Options(n_iters=2)

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Options = py.importlib.import_module('PyMPDATA').Options;
options = Options(pyargs('n_iters', 2));
```
</details>

<details open>
<summary>Python code (click to expand)</summary>

<details>
<summary>Rust code (click to expand)</summary>
```Rust
Expand All @@ -106,6 +101,8 @@ fn main() -> PyResult<()> {
```
</details>

<details open>
<summary>Python code (click to expand)</summary>
```Python
from PyMPDATA import Options
options = Options(n_iters=2)
Expand All @@ -130,7 +127,6 @@ The schematic of the employed grid/domain layout in two dimensions is given belo

<details>
<summary>Python code (click to expand)</summary>

```Python
import numpy as np
from matplotlib import pyplot
Expand Down Expand Up @@ -189,7 +185,6 @@ conditions and with an initial Gaussian signal in the scalar field

<details>
<summary>Julia code (click to expand)</summary>

```Julia
ScalarField = pyimport("PyMPDATA").ScalarField
VectorField = pyimport("PyMPDATA").VectorField
Expand All @@ -214,9 +209,9 @@ advector = VectorField(
)
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
ScalarField = py.importlib.import_module('PyMPDATA').ScalarField;
VectorField = py.importlib.import_module('PyMPDATA').VectorField;
Expand Down Expand Up @@ -290,7 +285,6 @@ data = (np.full((nx + 1, ny), Cx), np.full((nx, ny + 1), Cy))

<details open>
<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import ScalarField
from PyMPDATA import VectorField
Expand Down Expand Up @@ -338,7 +332,6 @@ When instantiating the [``Stepper``](https://open-atmos.github.io/PyMPDATA/PyMPD
of either supplying just the number of dimensions or specialising the stepper for a given grid:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
Stepper = pyimport("PyMPDATA").Stepper

Expand All @@ -347,7 +340,6 @@ stepper = Stepper(options=options, n_dims=2)
</details>
<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Stepper = py.importlib.import_module('PyMPDATA').Stepper;
Expand All @@ -361,7 +353,6 @@ stepper = Stepper(pyargs(...

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let n_dims: i32 = 2;
let stepper_arg = PyDict::new_bound(py);
Expand All @@ -371,7 +362,6 @@ let _ = PyDictMethods::set_item(&stepper_arg, "n_dims", &n_dims);
</details>

<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import Stepper

Expand All @@ -381,14 +371,13 @@ stepper = Stepper(options=options, n_dims=2)
or
<details>
<summary>Julia code (click to expand)</summary>

```Julia
stepper = Stepper(options=options, grid=(nx, ny))
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
stepper = Stepper(pyargs(...
'options', options, ...
Expand All @@ -399,7 +388,6 @@ stepper = Stepper(pyargs(...

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let _stepper_arg_alternative = vec![("options", &options), ("grid", &PyTuple::new_bound(py, nx_ny).into_any())].into_py_dict_bound(py);
let stepper_ = py.import_bound("PyMPDATA")?.getattr("Stepper")?;
Expand All @@ -409,7 +397,6 @@ stepper = Stepper(pyargs(...

<details open>
<summary>Python code (click to expand)</summary>

```Python
stepper = Stepper(options=options, grid=(nx, ny))
```
Expand Down Expand Up @@ -463,17 +450,16 @@ Continuing with the above code snippets, instantiating
a solver and making 75 integration steps looks as follows:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
Solver = pyimport("PyMPDATA").Solver
solver = Solver(stepper=stepper, advectee=advectee, advector=advector)
solver.advance(n_steps=75)
state = solver.advectee.get()
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
Solver = py.importlib.import_module('PyMPDATA').Solver;
solver = Solver(pyargs('stepper', stepper, 'advectee', advectee, 'advector', advector));
Expand All @@ -484,7 +470,6 @@ state = solver.advectee.get();

<details>
<summary>Rust code (click to expand)</summary>

```Rust
let solver_ = py.import_bound("PyMPDATA")?.getattr("Solver")?;
let solver = solver_.call((), Some(&vec![("stepper", stepper), ("advectee", advectee), ("advector", advector)].into_py_dict_bound(py)))?;
Expand All @@ -499,7 +484,6 @@ state = solver.advectee.get();

<details open>
<summary>Python code (click to expand)</summary>

```Python
from PyMPDATA import Solver

Expand All @@ -513,7 +497,6 @@ state = solver.advectee.get()
Now let's plot the results using `matplotlib` roughly as in Fig.&nbsp;5 in [Arabas et al. 2014](https://doi.org/10.3233/SPR-140379):
<details>
<summary>Python code (click to expand)</summary>

```Python
def plot(psi, zlim, norm=None):
xi, yi = np.indices(psi.shape)
Expand Down Expand Up @@ -558,21 +541,20 @@ interactive debugging, one way of enabling it is by setting the
following environment variable before importing PyMPDATA:
<details>
<summary>Julia code (click to expand)</summary>

```Julia
ENV["NUMBA_DISABLE_JIT"] = "1"
```
</details>

<details>
<summary>Matlab code (click to expand)</summary>

```Matlab
setenv('NUMBA_DISABLE_JIT', '1');
```
</details>

<details open>
<summary>Python code (click to expand)</summary>

```Python
import os
os.environ["NUMBA_DISABLE_JIT"] = "1"
Expand Down
Loading

0 comments on commit 23508be

Please sign in to comment.