This repository contains the code accompanying the paper [1]. We propose an extension of Latent Dynamics Networks (LDNets) [2], namely Liquid Fourier Latent Dynamics Networks (LFLDNets), to create parameterized spatio-temporal surrogate models for multiscale and multiphysics sets of highly nonlinear differential equations on complex geometries.
LFLDNets employ a neurologically-inspired, sparse, liquid neural network for temporal dynamics, relaxing the requirement of a numerical solver for time advancement and accounting for superior performance in terms of tunable parameters, accuracy and efficiency with respect to neural ODEs based on feedforward fully-connected neural networks. Furthermore, we leverage a Fourier embedding with a tunable kernel for the space coordinates in the reconstruction network to learn complex functions better and faster.
In the framework of computational cardiology, we use LFLDNets to create surrogate models for 3-dimensional anatomies by considering two different test cases arising from cardiac electrophysiology and cardiovascular computational fluid dynamics ('EP'
, 'CFD'
). Note that a significant amount of RAM is required, especially for the 'CFD' test case.
- Install a conda environment containing all the required packages:
conda create -n LFLDNets python=3.8.10 numpy=1.24.3
conda activate LFLDNets
pip install hydra-core
pip install matplotlib
pip install vtk
pip install scipy
pip install dgl
pip install tqdm
pip install meshio
pip install pyvista
pip install torch
pip install torchvision
pip install lightning
pip install tensorflow
pip install ncps
pip install urllib3==1.26.6
pip install "ray[tune]"
pip install optuna
pip install nvidia-tensorrt
- Clone the repository:
git clone https://github.com/MatteoSalvador/LFLDNets.git
-
Activate the conda environment
LFLDNets
by typingconda activate LFLDNets
(in case it is not already active from the installation procedure at point 1). -
Download the pickle files
EP.pkl
andCFD.pkl
at the following link. Place them in thedata
folder. -
LFLDNets (training): run the Python script
train.py
with proper settings, specified in theconfig.yaml
file. Both single run and distributed hyperparameter tuning with ray are supported. Note that a significant amount of RAM is required, especially for the'CFD'
test case. -
LFLDNets (inference): run the Python script
test.py
with proper settings, specified in theconfig.yaml
file. Note that a significant amount of RAM is required, especially for the'CFD'
test case.
- Matteo Salvador ([email protected])
[1] M. Salvador, A. L. Marsden. Liquid Fourier Latent Dynamics Networks for fast GPU-based numerical simulations in computational cardiology. arXiv:2408.09818 (2024).
[2] F. Regazzoni, S. Pagani, M. Salvador, L. Dede', A. Quarteroni. Learning the intrinsic dynamics of spatio-temporal processes through Latent Dynamics Networks. Nature Communications (2024).