Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
75060e4
Simplified Psydac installation
kvrigor Nov 27, 2024
c804362
CI: Simplified dependency installation
kvrigor Nov 27, 2024
f09510c
CI: Install Psdyac dependencies
kvrigor Nov 27, 2024
addbe4a
CI: matrix.os == 'ubuntu-latest' is unnecessary
kvrigor Nov 27, 2024
a8b34b8
Fixed jupyter-book complaints in references.bib
kvrigor Nov 27, 2024
51eea06
Removed machine-specific metadata embedded in .ipynb files
kvrigor Nov 27, 2024
e1e00e0
Updated Installation guide
kvrigor Nov 27, 2024
ee4171f
Improved the Installation guide
kvrigor Dec 4, 2024
4ceaead
Uploaded images used in the Installation guide
kvrigor Dec 4, 2024
9581dbb
Added missing newlines
kvrigor Feb 19, 2025
624140d
Added macos-15 test
kvrigor Feb 19, 2025
6f56d21
CI: Set default Fortran compiler
kvrigor Feb 19, 2025
c2f95ad
CI: Changed to another way of setting Fortran compiler
kvrigor Feb 19, 2025
b0efb86
CI: Downgrade to macOS 14
kvrigor Feb 19, 2025
b28f0ef
requirements.txt: removed [extra] identifier when installing psydac
kvrigor Feb 19, 2025
036d64e
CI: Enabled parallel builds with Make
kvrigor Feb 19, 2025
0997f1b
CI: Added setup python step and switched back to macos-15
kvrigor Feb 19, 2025
d2e7769
CI: Enabled SSH debugging
kvrigor Feb 19, 2025
49fa5c0
CI: Used upterm fork from owenthereal
kvrigor Feb 19, 2025
912b1f1
CI: Upterm not working for macOS; Tried explicitly setting gfortran
kvrigor Feb 19, 2025
b909589
CI: aliasing gfortran not working in macOS. Increased pip verbosity t…
kvrigor Feb 19, 2025
708440c
CI: Test pyccel on macOS
kvrigor Feb 19, 2025
fb472a8
CI: Try aliasing gfortran in macOS
kvrigor Feb 19, 2025
e03b098
CI: Create gfortran symlink in macos
kvrigor Feb 19, 2025
9aef593
CI: Fixed typo in 'Check gfortran version' step
kvrigor Feb 19, 2025
cd16f57
CI: Removed ineffective MAKEFLAGS and test pyccel step. Also only all…
kvrigor Feb 19, 2025
ac30ed9
Removed hardcoded author info
kvrigor Feb 19, 2025
5633e42
Removed newlines in .ipynb files which was introduced in the previous…
kvrigor Feb 19, 2025
eedd7ae
Updated README and added AUTHORS file
kvrigor Feb 25, 2025
bcca7e5
Wrapped jupyterbook build command via Makefile
kvrigor Feb 25, 2025
de48937
Added missing newlines in AUTHORS and Makefile
kvrigor Feb 26, 2025
3032cb9
AUTHORS.md -> AUTHORS
kvrigor Feb 26, 2025
1bdf216
intro.md: referred to list of authors as a footnote
kvrigor Feb 26, 2025
b0060ca
Added missing newlines
kvrigor Feb 26, 2025
dfba9c8
Added myself to AUTHORS
kvrigor Feb 26, 2025
0473381
README: Make a separate step for psydac installation so it could be s…
kvrigor Feb 27, 2025
5a9a302
Removed notebook metadata via nb-clean
kvrigor Mar 4, 2025
03ee341
Added a contributing section to README; added logs to Makefile steps
kvrigor Mar 4, 2025
c1685a4
README: Removed line breaks and simplified some sentences
kvrigor Mar 4, 2025
a66206f
install.md: Added separate step for Psydac installation
kvrigor Mar 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 66 additions & 22 deletions .github/workflows/deploy-book.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,85 @@
name: Build and Deploy Jupyter Book
name: Build IGA-Python Jupyter Book

on:
push:
branches:
- master
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
deploy-book:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-24.04
python-version: '3.12'

- os: macos-15
python-version: '3.12'

env:
FC: gfortran-14

name: ${{ matrix.os }} / Python ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: requirements.txt

- name: Install dependencies
- name: Install non-Python dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gfortran openmpi-bin libopenmpi-dev libhdf5-openmpi-dev
version: 1.0
execute_install_scripts: true

# When loading cached apt packages, the default MPI compiler isn't set.
# Workaround is to 'reinstall' openmpi-bin, which doesn't actually perform
# installation (since openmpi-bin already exists), but instead reruns
# `update-alternatives` which fixes the symlinks to mpicc/mpif90.
- name: Reconfigure non-Python dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
python -m pip install --upgrade pip
sudo apt-get update
sudo apt-get install gfortran
sudo apt-get install openmpi-bin libopenmpi-dev
sudo apt-get install libhdf5-openmpi-dev
git clone https://github.com/pyccel/psydac.git
cd psydac
python -m pip install -r requirements.txt
python -m pip install -r requirements_extra.txt --no-build-isolation
pip install .
pip install jupyter-book ghp-import sphinx_proof
python -m ipykernel install --user --name .iga-python --display-name "IGA-Python"
python -m ipykernel install --user --name v_psydac --display-name "Python (v_psydac)"
sudo apt-get install --reinstall openmpi-bin libhdf5-openmpi-dev

- name: Install non-Python dependencies on macOS
if: startsWith(matrix.os, 'macos')
run: |
brew install open-mpi hdf5-mpi libomp

- name: Check gfortran version
run: |
if [[ "${{ matrix.os }}" == *"macos"* ]]; then
# pyccel searches for a Fortran compiler exactly named 'gfortran'
# which the macos runner doesn't have. A simple workaround is to
# create a symlink named 'gfortran'.
FC_path=$(which $FC)
FC_dir=$(dirname ${FC_path})
ln -sv ${FC_path} ${FC_dir}/gfortran
fi
gfortran --version

- name: Install Jupyter Book and Psydac
run: |
pip install --upgrade pip
pip install -r requirements.txt

- name: Build Jupyter Book
run: jupyter-book build .
run: make docs

- name: Deploy to GitHub Pages
if: ${{ (github.ref == 'refs/heads/master') && startsWith(matrix.os, 'ubuntu') }}
run: ghp-import -n -p -f _build/html
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Ahmed Ratnani
Mohamed Jalal Maaouni
Paul Rigor

25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BUILD_DIR = ./_build
SRC_DIR = .

.PHONY: docs docs-strict clean clean-notebooks

docs:
@echo "Building IGA-Python docs..."
@jupyter-book build .
@echo "Done."

docs-strict:
@echo "Building IGA-Python docs with strict rules on..."
@jupyter-book build --warningiserror --nitpick --keep-going .
@echo "Done."

clean:
@echo "Removing previous IGA-Python build artifacts..."
@jupyter-book clean .
@echo "Done."

clean-notebooks:
@echo "Running 'nb-clean --remove-empty-cells --remove-all-notebook-metadata' on all '*.ipynb' files..."
@find . -type f -iname '*.ipynb' -exec nb-clean clean --remove-empty-cells --remove-all-notebook-metadata {} \+
@echo "Done."

71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,72 @@
# Welcome to IGA-Python

This project provides a tutorial for isogeometric analysis (IGA) using Python and the Psydac library (pyccel/psydac). The numerical examples can be consulted online at pyccel.github.io/IGA-Python, or run with JupyterNotebook on a personal computer.

## Editing and building IGA-Python locally

1. Clone this repository and then install the required dependencies.

```bash
git clone https://github.com/pyccel/IGA-Python.git
cd IGA-Python
IGA_PYTHON_DIR=$(pwd)

# Install dependencies on a virtual environment
python3 -m venv iga-python-env
source iga-python-env/bin/activate
pip3 install -r requirements_ntbk.txt
```

2. Install Psydac. Skip this step if Psydac is already installed.

```bash
# Modify these variables if you're using your own psydac fork/branch
PSYDAC_REMOTE="https://github.com/pyccel/psydac.git"
BRANCH="devel"

# Install psydac
pip install git+${PSYDAC_REMOTE}@${BRANCH}
```

3. Run or modify the desired Python notebooks (`*.ipynb`) and Markdown files (`*.md`). Check the [MyST syntax cheat sheet](https://jupyterbook.org/en/stable/reference/cheatsheet.html) for reference.

> [!NOTE]
> Before committing changes to git, the notebooks have to be cleaned first. See ["Committing your changes to git"](#committing-your-changes-to-git) for more information.

4. Build the docs by running `make` under the IGA-Python folder. This involves running all `*.ipynb` files in the background to make sure they are functional.

```bash
cd ${IGA_PYTHON_DIR}
make
```

5. View your changes on the browser.

```bash
open ${IGA_PYTHON_DIR}/_build/html/index.html
```

## Committing your changes to git

Running the Python notebooks embeds extra information like the name of virtual environment, Python version used, cell outputs, etc. The notebooks should be free of system- and runtime-specific information before committing them to source control. We suggest the following commit workflow:

1. Run [`nb-clean`](https://github.com/srstevenson/nb-clean) on the modified notebook/s. There are different ways to run this command:

```bash
# Clean a single notebook
nb-clean clean --remove-empty-cells --remove-all-notebook-metadata chapter1/poisson.ipynb

# Clean all '.ipynb' files under IGA-Python
make clean-notebooks

# Automatically run nb-clean on `git add`-ed *.ipynb files
nb-clean add-filter --remove-empty-cells --remove-all-notebook-metadata

# Undo previous command
nb-clean remove-filter
```

2. Create a branch for your local changes, e.g. `git checkout -b my-local-fixes`.
3. Stage the modified files with `git add`. Then run `git diff` to check if the changed `*.ipynb` notebooks doesn't include unnecessary diffs (e.g. notebook metadata).
4. `git commit` your changes.
5. *OPTIONAL*. Share your changes to this repo via a [pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
2 changes: 1 addition & 1 deletion _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parts:
- file: chapter1/topology
- file: chapter1/space
- file: chapter1/rules
- file: chapter1/poisson
- file: chapter1/poisson
- file: chapter1/boundary-conditions
- file: chapter1/geometry
sections:
Expand Down
2 changes: 1 addition & 1 deletion chapter0/bezier-curves.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Bézier curves
*Author: Ahmed Ratnani*


We recall the definition of a Bézier curve:

Expand Down
2 changes: 1 addition & 1 deletion chapter0/bezier.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Bernstein polynomials
*Author: Ahmed Ratnani*


Without loss of generality, we restrict to the case of the unit interval, namely $a=0$ and $b=1$.
In figure (Fig. \ref{fig:bernstein-polynomials}), we plot the first sixth Bernstein polynomials.
Expand Down
2 changes: 1 addition & 1 deletion chapter0/bsplines-curves.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# B-Splines curves
*Author: Ahmed Ratnani*


Let $(\mathbf{P}_i)_{ 0 \leqslant i \leqslant n}\in \mathbb{R}^d$ be a sequence of control points. Following the same approach as for Bézier curves, we define B-Splines curves as

Expand Down
2 changes: 1 addition & 1 deletion chapter0/bsplines-operations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Fundamental geometric operations for B-Splines
*Author: Ahmed Ratnani*


Having more control on a curve, adding new control points, can be done in two different ways:

Expand Down
2 changes: 1 addition & 1 deletion chapter0/bsplines-surfaces.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# B-Splines surfaces
*Author: Ahmed Ratnani*


The B-spline surface in $\mathbb{R}^d$ associated to knots $(T_u, T_v)$ where $T_u=(u_i)_{0\leqslant i \leqslant n_u + p_u + 1}$ and $T_v=(v_i)_{0\leqslant i \leqslant n_v + p_v + 1}$, and control points $(\mathbf{P}_{ij})_{ 0 \leqslant i \leqslant n_u, 0 \leqslant j \leqslant n_v}$ is defined by :

Expand Down
2 changes: 1 addition & 1 deletion chapter0/bsplines.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# B-Splines
*Author: Ahmed Ratnani*


Given a subdivision $\{x_0 < x_1 < \cdots < x_r\}$ of the interval $I = [x_0, x_r]$, the \textbf{Schoenberg space} is the space of piecewise polynomials of degree $p$, on the interval $I$ and given regularities $\{k_1, k_2, \cdots, k_{r-1}\}$ at the internal points $\{x_1, x_2, \cdots, x_{r-1}\}$.

Expand Down
2 changes: 1 addition & 1 deletion chapter0/cad.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Computer Aided Design
*Author: Ahmed Ratnani*


TODO
2 changes: 1 addition & 1 deletion chapter0/data-structure.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Data Structure
*Author: Ahmed Ratnani*


In the sequel, we shall use **StencilMatrix** and **StencilVector** from the **psydac** library.

Expand Down
2 changes: 1 addition & 1 deletion chapter0/fem.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Introduction to B-Splines FEM
*Author: Ahmed Ratnani*


Let $\Omega \subset \mathbb{R}^d$ be a computational domain that is the image of a logical domain $\mathcal{P}$, *i.e.* a unit line (in *1d*), square (in *2d*) or a cube (in *3d*) with a **mapping** function

Expand Down
2 changes: 1 addition & 1 deletion chapter0/howto.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# What to expect from IGA-Python
*Author: Ahmed Ratnani*

2 changes: 1 addition & 1 deletion chapter0/iga.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Isogeometric Analysis
*Author: Ahmed Ratnani*


TODO
2 changes: 1 addition & 1 deletion chapter0/performance-acceleration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Performance and Acceleration
*Author: Ahmed Ratnani*


In this section, we shall see how to accelerate our Python code assembly and get native speed.
We will be using [Numba](https://numba.pydata.org/) and [Pyccel](https://github.com/pyccel/pyccel).
Expand Down
2 changes: 1 addition & 1 deletion chapter0/poisson-1d.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# B-splines FEM solver for Poisson equation (1D)
*Author: Ahmed Ratnani*


Following the previous [section](http://nbviewer.jupyter.org/github/ratnania/IGA-Python/blob/main/lessons/Chapter1/01_introduction_fem.ipynb), we implement here a B-Splines FEM for the Poisson problem in 1D, with homogeneous boundary conditions.

Expand Down
2 changes: 1 addition & 1 deletion chapter0/poisson-2d.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# B-splines FEM solver for Poisson equation (2D)
*Author: Ahmed Ratnani*


In this section, we show hoa to use **simplines** to solve a 2D Poisson problem with homogeneous boundary conditions
$$
Expand Down
2 changes: 1 addition & 1 deletion chapter1/analytical-mapping.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Analytical Mapping
*Author: Ahmed Ratnani*


Analytical Mappings are provided as symbolic expressions, which allow us to compute automatically their jacobian matrices and all related geometrical information.

Expand Down
2 changes: 1 addition & 1 deletion chapter1/boundary-conditions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Boundary Conditions
*Author: Ahmed Ratnani*


SymPDE & Psydac allows you to use both strong and weak boundary conditions.
We start first by explaining how to identify a boundary in **NCube** domains, such as **Line**, **Square** and a **Cube**.
Expand Down
2 changes: 1 addition & 1 deletion chapter1/discrete-mapping.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Discrete Mapping
*Author: Ahmed Ratnani*



2 changes: 1 addition & 1 deletion chapter1/geometry.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Geometry
*Author: Ahmed Ratnani*


The IGA concept relies on the fact that the geometry (domain) is divided into subdomains, and each of these subdomains is the image of a **Line**, **Square** or a **Cube** by a geometric transformation (also called a **mapping**), that we shall call a **patch** or **logical domain**.

Expand Down
Binary file added chapter1/images/ch1-jupyter-poisson-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chapter1/images/ch1-jupyter-poisson-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chapter1/images/ch1-jupyter-root.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading