Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Data generation instructions are available in the [SFNO folder](./fno).
## Examples
- Demos of different simulation setups:
- [2D simulation with a pseudo-spectral solver](./examples/Kolmogrov2d_rk4_cn_forced_turbulence.ipynb)
- [2D simulation with a finite volume solver](./examples/Kolmogrov2d_rk4_fvm_forced_turbulence.ipynb)
- Demos of Spatiotemporal FNO's training and evaluation using the neural operator-assisted fluid simulation pipelines
- [Training of SFNO for only 15 epochs for the isotropic turbulence example](./examples/ex2_SFNO_train.ipynb)
- [Training of SFNO for only ***10*** epochs with 1k samples and reach `1e-2` level of relative error](./examples/ex2_SFNO_train_fnodata.ipynb) using the data in the FNO paper, which to our best knowledge no operator learner can do this in <100 epochs in the small data regime.
Expand All @@ -56,6 +57,7 @@ The Apache 2.0 License in the root folder applies to the `torch-cfd` folder of t
## Contributions
PR welcome. Currently, the port of `torch-cfd` currently includes:
- The pseudospectral method for vorticity uses anti-aliasing filtering techniques for nonlinear terms to maintain stability.
- The finite volume method on a MAC grid for velocity, and using the projection scheme to impose the divergence free condition.
- Temporal discretization: Currently only RK4 temporal discretization uses explicit time-stepping for advection and either implicit or explicit time-stepping for diffusion.
- Boundary conditions: only periodic boundary conditions.

Expand Down
222 changes: 222 additions & 0 deletions examples/Kolmogrov2d_rk4_fvm_forced_turbulence.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/ex2_FNO3d_train_normalized.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"train_dataset = BochnerDatasetFixed(\n",
"train_dataset = SpatioTemporalDatasetFixedTime(\n",
" datapath=TRAIN_PATH,\n",
" fields=[\"vorticity\"],\n",
" n_samples=Ntrain,\n",
Expand All @@ -112,7 +112,7 @@
" out_steps=T,\n",
" T_start=T_start,\n",
")\n",
"test_dataset = BochnerDatasetFixed(\n",
"test_dataset = SpatioTemporalDatasetFixedTime(\n",
" datapath=VALID_PATH,\n",
" fields=[\"vorticity\"],\n",
" n_samples=Ntest,\n",
Expand Down Expand Up @@ -493,7 +493,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.10.17"
}
},
"nbformat": 4,
Expand Down
18 changes: 10 additions & 8 deletions examples/ex2_SFNO_finetune_fnodata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -14,11 +14,13 @@
"import torch.nn.functional as F\n",
"from torch.linalg import norm\n",
"\n",
"from sfno.utils import get_seed\n",
"from sfno.pipeline import *\n",
"from sfno.visualizations import *\n",
"from sfno.sfno import SFNO\n",
"from sfno.finetune import OutConvFT\n",
"from fno.utils import get_seed\n",
"from fno.pipeline import *\n",
"from fno.visualizations import *\n",
"from fno.datasets import *\n",
"from fno.losses import *\n",
"from fno.sfno import SFNO\n",
"from fno.finetune import OutConvFT\n",
"from torch.utils.data import DataLoader\n",
"\n",
"get_seed(42, printout=False)\n",
Expand Down Expand Up @@ -78,11 +80,11 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"test_dataset = BochnerDataset(datapath=TEST_PATH, \n",
"test_dataset = SpatioTemporalDataset(datapath=TEST_PATH, \n",
" fields=fields,\n",
" n_samples=Ntest,\n",
" steps=T,\n",
Expand Down
Loading