Signed Distance Function-biased flow importance sampling for implicit neural compression of flow fields
Omar A. Mures, Miguel Cid Montoya
The bifis
library is available using pip. We recommend using a virtual environment to avoid conflicts with other software on your machine.
pip install bifis
To run the demo:
python main.py -c configs/toy_case.json
To create a conda env for development:
conda env create -f environment.yaml
Sample configuration:
{
"domain": [
0.0,
1.0,
0.0,
1.0
],
"counts": [
[
4,
72,
4
],
[
8,
24,
8
]
],
"roi": [
0.15,
0.85,
0.25,
0.75
],
"preserve_surface": false
}
domain
is an array containing xmin
, xmax
, ymin
, ymax
coordinates representing the limits of the simulation domain. counts
contains the number of samples per section and roi
represents the min and max coordinates of each dimension (it follows the domain
convention) when using VariableDensity
sampling. preserve_surface
lets the user choose to always preserve samples that belong to the surface of interest and choose the rest using the SDF when using BiFIS
sampling.
Sample run script:
from bifis.utils import Config, console
from bifis.sampling import Uniform, VariableDensity, BiFIS
from scipy.interpolate import griddata
# Load configuration
config = Config("config.json")
# Get simulation data
cell_centers, surface = ...
uniform = Uniform(config, args.resolution[0], args.resolution[1], np.arange(len(cell_centers)))
uniform.show(cell_centers[:, 0], cell_centers[:, 1], write=False)
variable_density = VariableDensity(config, args.resolution[0], args.resolution[1], np.arange(len(cell_centers)))
variable_density.show(cell_centers[:, 0], cell_centers[:, 1], write=False)
bifis = BiFIS(config, args.resolution[0], args.resolution[1], np.arange(len(cell_centers)), samples=cell_centers, surface=surface, surface_idx=np.arange(len(surface)))
bifis.show(cell_centers[:, 0], cell_centers[:, 1], write=False)
# Use resulting grid
uni_pixel_data = griddata((cell_centers[:, 0], cell_centers[:, 1]), p_original, (uniform.grid_x, uniform.grid_y), method=interpolation_method)
var_dens_pixel_data = griddata((cell_centers[:, 0], cell_centers[:, 1]), p_original, (variable_density.grid_x, variable_density.grid_y), method=interpolation_method)
# BiFIS uses cell ids instead of interpolation to get pixel data
bifis_pixel_data = p_original[bifis.idx].reshape(bifis.img_shape)
- Hello world! A simple sampling example
- Learn how to use the different sampling classes.
- Visualize their differences.
- Colab example released.
- Initial code version published.
- Pip package released.
- Code coming soon.
The repo is still under construction, thanks for your patience.
- Release Colab example.
- Release pip package.
- Release of the sampling code.
@Article{mures2025signed,
author = {Mures, Omar A. and Cid Montoya, Miguel},
title = {Signed distance function-biased flow importance sampling for implicit neural compression of flow fields},
journal = {Computer-Aided Civil and Infrastructure Engineering},
volume = {40},
number = {17},
pages = {2434-2463},
year = {2025},
doi = {10.1111/mice.13526},
url = {https://doi.org/10.1111/mice.13526},
}