### Visualize 2D Shallow Water Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 2D shallow water equation. ```bash # get data: 2D_rdb_NA_NA.h5 https://darus.uni-stuttgart.de/api/access/datafile/133021 # visualize python visualize_pdes.py --pde_name "swe" --data_path "./" ``` -------------------------------- ### Visualize 1D Diffusion Sorption Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 1D diffusion sorption equation. ```bash # get data: 1D_diff-sorp_NA_NA.h5 https://darus.uni-stuttgart.de/api/access/datafile/133020 # visualize python visualize_pdes.py --pde_name "diff_sorp" --data_path "./" ``` -------------------------------- ### Visualize 1D Burgers Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 1D burgers equation. ```bash # get data: 1D_Burgers_Sols_Nu0.01.hdf5 https://darus.uni-stuttgart.de/api/access/datafile/133136 # visualize python visualize_pdes.py --pde_name "burgers" --param 0.01 ``` -------------------------------- ### Visualize 2D Diffusion Reaction Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 2D diffusion reaction equation. ```bash # get data: 2D_diff-react_NA_NA.h5 https://darus.uni-stuttgart.de/api/access/datafile/133017 # visualize python visualize_pdes.py --pde_name "2d_reacdiff" ``` -------------------------------- ### Visualize 1D CFD Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 1D CFD equation. ```bash # get data: 1D_CFD_Rand_Eta1.e-8_Zeta1.e-8_periodic_Train.hdf5 https://darus.uni-stuttgart.de/api/access/datafile/135485 # visualize python visualize_pdes.py --pde_name "1d_cfd" ``` -------------------------------- ### Visualize 2D Darcy Flow Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 2D Darcy flow equation. ```bash # get data: 2D_DarcyFlow_beta1.0_Train.hdf5 https://darus.uni-stuttgart.de/api/access/datafile/133219 # visualize python visualize_pdes.py --pde_name "darcy" ``` -------------------------------- ### Visualize 1D Diffusion Reaction Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 1D diffusion reaction equation. ```bash # get data: ReacDiff_Nu1.0_Rho1.0.hdf5 https://darus.uni-stuttgart.de/api/access/datafile/133181 # visualize python visualize_pdes.py --pde_name "1d_reacdiff" ``` -------------------------------- ### Visualize 1D Advection Eqn Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Get data and visualize 1D advection equation. ```bash # get data: 1D_Advection_Sols_beta0.4.hdf5 https://darus.uni-stuttgart.de/api/access/datafile/133110 # visualize python visualize_pdes.py --pde_name "advection" --param 0.4 ``` -------------------------------- ### Visualize particles at offset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Plots a slice of the particles dataset starting at index 1000. ```python columns = 5 fsize = 12 arr = data_f["particles"][0, 1000 : 1000 + columns, :, :, 0] fig = plt.figure(figsize=(fsize, fsize / columns)) plt.imshow(rearrange(arr, "t x y -> x (t y)")) plt.gca().set_axis_off() plt.tight_layout(pad=1) plt.show() ``` -------------------------------- ### Create and activate the Conda environment Source: https://github.com/astringency/fm4pde/blob/main/README.md Use these commands to set up the project environment from the provided environment.yml file. ```bash conda env create -f environment.yml conda activate fm4pde ``` -------------------------------- ### Visualize initial particles Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Plots the first few time steps of the particles dataset. ```python columns = 5 fsize = 12 arr = data_f["particles"][0, :columns, :, :, 0] fig = plt.figure(figsize=(fsize, fsize / columns)) plt.imshow(rearrange(arr, "t x y -> x (t y)")) plt.gca().set_axis_off() plt.tight_layout(pad=1) plt.show() ``` -------------------------------- ### Download Shallow Water Equations Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the swe dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name swe ``` -------------------------------- ### Download Darcy Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the darcy dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name darcy ``` -------------------------------- ### Download Diffusion Sorption Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the diff_sorp dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name diff_sorp ``` -------------------------------- ### Download 1D Reaction Diffusion Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the 1d_reacdiff dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name 1d_reacdiff ``` -------------------------------- ### Download Incompressible Navier-Stokes Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the ns_incom dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name ns_incom ``` -------------------------------- ### Inspect HDF5 keys Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Opens the HDF5 file and lists the available keys. ```python data_f = h5py.File(data_path, "r") data_f.keys() ``` -------------------------------- ### Download 2D Reaction Diffusion Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the 2d_reacdiff dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name 2d_reacdiff ``` -------------------------------- ### Verify environment load Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Displays the result of the environment loading operation. ```text Result: True ``` -------------------------------- ### Download 3D CFD Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the 3d_cfd dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name 3d_cfd ``` -------------------------------- ### Download Advection Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the advection dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name advection ``` -------------------------------- ### Download 2D CFD Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the 2d_cfd dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name 2d_cfd ``` -------------------------------- ### Import visualization and data utilities Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Imports necessary libraries for HDF5 handling, plotting, and array manipulation. ```python # images list return, save import h5py import matplotlib.pyplot as plt from einops import rearrange from src.utils import resolve_path ``` -------------------------------- ### Download Burgers Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the burgers dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name burgers ``` -------------------------------- ### Configure 1D Reaction Diffusion Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Update the configuration file for 1D Reaction Diffusion parameters. ```yaml type: "ReacDiff" # 'advection'/'ReacDiff'/'burgers'/'CFD' dim: 1 savedir: "./save/ReacDiff" ``` -------------------------------- ### Download 1D CFD Dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_download/README.md Command to download the 1d_cfd dataset. ```bash python download_direct.py --root_folder $proj_home/data --pde_name 1d_cfd ``` -------------------------------- ### Configure 1D Burgers' Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Update the configuration file for 1D Burgers' parameters. ```yaml type: "burgers" # 'advection'/'ReacDiff'/'burgers'/'CFD' dim: 1 savedir: "./save/burgers" ``` -------------------------------- ### HDF5 keys output Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Displays the keys found in the HDF5 file. ```text Result: ``` -------------------------------- ### Display resolved data path Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Shows the output path string for the resolved HDF5 file. ```text Output: /datasets/work/mlai-fsp-pdeemu/work/PDEBench/working/ns_sim_cmd/2022-06-04/14-20-40/device=GPU,jit=True,label=basic,mode=slurm,n_batch=10,profile=False,save_gif=False,save_images=False,seed=99,sim_name=nsi_2d/98/basic-99.h5 ``` -------------------------------- ### Configure DarcyFlow 2D Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Update the configuration file to set the equation type and dimensions. ```yaml type: "ReacDiff" # 'advection'/'ReacDiff'/'burgers'/'CFD' dim: 2 ``` -------------------------------- ### Visualize force dataset Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Plots the force dataset using the first few entries. ```python columns = 5 fsize = 12 arr = data_f["force"][:columns, :, :, 0] fig = plt.figure(figsize=(fsize, fsize / columns)) plt.imshow(rearrange(arr, "b x y -> x (b y)")) plt.gca().set_axis_off() plt.tight_layout(pad=1) plt.show() ``` -------------------------------- ### Generate 1D Reaction Diffusion Equation Data Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Commands to generate 1D Reaction Diffusion data as .npy files, either as a single file or via a batch script. ```bash # generate data and save as .npy array cd PDEBench/pdebench/data_gen/data_gen_NLE/ReactionDiffusionEq/ # Either generate a single file CUDA_VISIBLE_DEVICES='0,1' python3 reaction_diffusion_multi_solution_Hydra.py +multi=Rho2e0_Nu5e0.yaml # Or generate all files bash run_trainset.sh ``` -------------------------------- ### Configure 1D Advection Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Update the configuration file for 1D Advection parameters. ```yaml type: "advection" # 'advection'/'ReacDiff'/'burgers'/'CFD' dim: 1 savedir: "./save/advection" ``` -------------------------------- ### Load environment variables Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Loads environment variables from a .env file if present in the directory structure. ```python import dotenv # load environment variables from `.env` file if it exists # recursively searches for `.env` in all folders starting from work dir dotenv.load_dotenv() ``` -------------------------------- ### Run DarcyFlow 2D Data Generation Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Execute the shell script to generate DarcyFlow 2D data, which triggers the associated Python script. ```bash bash data_gen/data_gen_NLE/ReactionDiffusionEq/run_DarcyFlow2D.sh ``` -------------------------------- ### Update system path Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Adds the current working directory to the system path to allow local module imports. ```python import sys from pathlib import Path parentdir = Path.cwd() sys.path.append(str(parentdir)) ``` -------------------------------- ### Resolve data path Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Resolves the path to HDF5 data files using a glob pattern. ```python data_path = resolve_path("${WORKING_DIR}/*/*/*/*/*/*.h5", idx=-1, unique=False) print(data_path) # noqa: T201 ``` -------------------------------- ### Visualization output Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Displays the figure object result. ```text Result:
``` -------------------------------- ### Configure autoreload Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Enables automatic reloading of modules in Jupyter notebooks. ```python from __future__ import annotations %load_ext autoreload %autoreload 2 ``` -------------------------------- ### Generate 1D Burgers' Equation Data Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Commands to generate 1D Burgers' data as .npy files, either as a single file or via a batch script. ```bash # generate data and save as .npy array cd PDEBench/pdebench/data_gen/data_gen_NLE/BurgersEq/ # Either generate a single file CUDA_VISIBLE_DEVICES='0,2' python3 burgers_multi_solution_Hydra.py +multi=1e-1.yaml # Or generate all files bash run_trainset.sh ``` -------------------------------- ### Particle shape output Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Displays the dimensions of the particles array. ```text Result: (10, 99901, 256, 256, 1) ``` -------------------------------- ### Check particle shape Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/notebooks/Analysis.ipynb Retrieves the shape of the particles dataset. ```python data_f["particles"].shape ``` -------------------------------- ### Generate 1D Advection Equation Data Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Commands to generate 1D Advection data as .npy files, either as a single file or via a batch script. ```bash # generate data and save as .npy array cd PDEBench/pdebench/data_gen/data_gen_NLE/AdvectionEq # Either generate a single file CUDA_VISIBLE_DEVICES='2,3' python3 advection_multi_solution_Hydra.py +multi=beta1e0.yaml # Or generate all files bash run_trainset.sh ``` -------------------------------- ### Merge DarcyFlow Data Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Run the data merge script to finalize the dataset. ```python python data_gen/data_gen_NLE/Data_Merge.py ``` -------------------------------- ### Merge 1D Advection Data Source: https://github.com/astringency/fm4pde/blob/main/data/DataGen/time_dependent/DataGen/pdebench/data_gen/data_gen_NLE/README.md Serialize the generated .npy files into HDF5 format. ```bash # serialize to hdf5 by transforming npy file cd .. python Data_Merge.py ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.