ODIL (Optimizing a Discrete Loss) is a Python framework for solving inverse and data assimilation problems for partial differential equations. ODIL formulates the problem through optimization of a loss function including the residuals of a finite-difference and finite-volume discretization along with data and regularization terms. ODIL solves the same problems as PINN (Physics-Informed Neural Networks) but more efficiently.
Key features:
- automatic differentiation using TensorFlow or JAX
- optimization by gradient-based methods (Adam, L-BFGS) and Newton's method
- orders of magnitude lower computational cost than PINN [1]
- multigrid decomposition for faster optimization [2]
These demos use a C++ implementation of ODIL with autodiff and Emscripten to run interactively in the web browser.
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|
| Poisson | Wave | Heat | Advection | Advection2 |
pip install odil
or
pip install git+https://github.com/cselab/odil.git
uv venv --python 3.12
. .venv/bin/activate
uv sync --group dev --extra tensorflow --extra jax
To enable GPU support, provide a non-empty list of devices in CUDA_VISIBLE_DEVICES.
Values CUDA_VISIBLE_DEVICES= and CUDA_VISIBLE_DEVICES=-1 disable GPU support.
ODIL is developed by researchers at Harvard University
advised by
-
Karnakov P, Litvinov S, Koumoutsakos P. Solving inverse problems in physics by optimizing a discrete loss: Fast and accurate learning without neural networks. PNAS Nexus, 2024. DOI:10.1093/pnasnexus/pgae005
-
Karnakov P, Litvinov S, Koumoutsakos P. Flow reconstruction by multiresolution optimization of a discrete loss with automatic differentiation. Eur. Phys. J, 2023. DOI:10.1140/epje/s10189-023-00313-7 | arXiv:2303.04679 | slides
-
Balcerak M, Amiranashvili T, Wagner A, Weidner J, Karnakov P, Paetzold JC, et al. Physics-regularized multi-modal image assimilation for braintumor localization. NeurIPS, 2024. PDF
-
Balcerak M, Weidner J, Karnakov P, Ezhov I, Litvinov S, Koumoutsakos P, et al. Individualizing glioma radiotherapy planning by optimization of a data and physics-informed discrete loss. Nature Communications, 2025. DOI:10.1038/s41467-025-60366-4
-
Buhendwa B Aaron B., Koumoutsakos P. Data-driven shape inference in three-dimensional steady-state supersonic flows: Optimizing a discrete loss with JAX-fluids. Phys Rev Fluids, 2025. DOI:10.1103/9wj9-nmr8 | arXiv:2408.10094
-
Karnakov P, Amoudruz L, Koumoutsakos P. Optimal navigation in microfluidics via the optimization of a discrete loss. Phys Rev Lett, 2025. DOI:PhysRevLett.134.044001 | arXiv:2506.15902
-
Amoudruz L, Karnakov P, Koumoutsakos P. Contactless precision steering of particles in a fluid inside a cube with rotating walls. Journal of Fluid Mechanics, 2025. DOI:10.1017/jfm.2025.10174 | arXiv:2506.15958 | Videos 1 2 3
-
Amoudruz L, Litvinov S, Papadimitriou C, Koumoutsakos P. Bayesian Inference for PDE-based Inverse Problems using the Optimization of a Discrete Loss. arXiv, 2025. arXiv:2510.15664




