Skip to main content
Python-Fortran notebooks - Home Python-Fortran notebooks - Home

Call Fortran from Python with f2py

  • F2py
  • Python class linked with fortran module

Examples

  • Julia Set
  • Vlasov-Poisson
  • Co-rotating vortices
  • Gray-Scott Model
  • Maxwell solver in two dimensions with FDTD scheme

Swig and ctypes

  • SWIG and Ctypes
  • Repository
  • Suggest edit
  • Open issue
  • .md

Python-Fortran bindings examples

Python-Fortran bindings examples#

Binder

git clone https://github.com/pnavaro/python-fortran.git
cd python-fortran
conda env create -f environment.yml
conda activate python-fortran
jupyter notebook
  • Introduction to F2PY

  • F2PY and Fortran 90 modules

  • Comparison with Cython, Numba, Pythran and PyJulia : The Julia set example

  • The 1D1V Vlasov-Poisson solved with Semi-Lagrangian method

  • Co-rotating vortices solved with discrete vortex method

  • Finite differences and the Gray-Scott model

  • Finite differences on staggered grid to solve Maxwell equations in 2D

  • Short example with SWIG and CTYPES

Pierre Navaro IRMAR CNRS

next

F2py

By Pierre Navaro

© Copyright 2023.