Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domino multiscale geometry features capability and inference script #788

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
cross entropy loss.
- Option to offload checkpoints to further reduce memory usage
- Added StormCast model training and simple inference to examples
- Multi-scale geometry features for DoMINO model.

### Changed

Expand Down
22 changes: 22 additions & 0 deletions examples/cfd/external_aerodynamics/domino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ by sampling random neighboring points within the same sub-region. The local-geom
encoding and the computational stencil are aggregrated to predict the solutions on the
discrete points.

A preprint describing additional details about the model architecture can be found here
[paper](https://arxiv.org/abs/2501.13350).

## Dataset

In this example, the DoMINO model is trained using DrivAerML dataset from the
Expand Down Expand Up @@ -69,17 +72,36 @@ To enable retraining the DoMINO model from a pre-trained checkpoint, follow the
5. Download the validation results (saved in form of point clouds in `.vtp` / `.vtu` format),
and visualize in Paraview.

## DoMINO model inference on STLs

The DoMINO model can be evaluated directly on unknown STLs using the pre-trained
checkpoint. Follow the steps outlined below:

1. Run the `inference_on_stl.py` script to perform inference on an STL.

2. Specify the STL paths, velocity inlets, stencil size and model checkpoint
path in the script.

3. The volume predictions are carried out on points sampled in a bounding box around STL.

4. The surface predictions are carried out on the STL surface. The drag and lift
accuracy will depend on the resolution of the STL.

## Guidelines for training DoMINO model

1. The DoMINO model allows for training both volume and surface fields using a single model
but currently the recommendation is to train the volume and surface models separately. This
can be controlled through the config file.

2. MSE loss for both volume and surface model gives the best results.

3. The surface and volume variable names can change but currently the code only
supports the variables in that specific order. For example, Pressure, wall-shear
and turb-visc for surface and velocity, pressure and turb-visc for volume.

4. Bounding box is configurable and will depend on the usecase. The presets are
suitable for the AWS DriveAer-ML dataset.

5. Integral loss factor is currently set to 0.0 as it adversely impacts the training.

The DoMINO model architecture is used to support the Real Time Wind Tunnel OV Blueprint
Expand Down
45 changes: 26 additions & 19 deletions examples/cfd/external_aerodynamics/domino/src/conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ hydra: # Hydra config
dir: ${output}
output_subdir: hydra # Default is .hydra which causes files not being uploaded in W&B.

# The directory to search for checkpoints to continue training.
resume_dir: ${output}/models

data_processor: # Data processor configurable parameters
kind: drivaer_aws # must be either drivesim or drivaer_aws
output_dir: /lustre/rranade/modulus_dev/data/volume_data/
input_dir: /lustre/datasets/drivaer_aws/drivaer_data_full/
num_processors: 12

data: # Input directory for training and validation data
input_dir: /lustre/rranade/modulus_dev/data/volume_data/
input_dir_val: /lustre/rranade/modulus_dev/data/volume_data_val/
Expand All @@ -36,9 +45,6 @@ data: # Input directory for training and validation data
min: [-1.1, -1.2 , -0.32]
max: [4.5 , 1.2 , 1.2]

# The directory to search for checkpoints to continue training.
resume_dir: ${output}/models

variables:
surface:
solution:
Expand All @@ -55,40 +61,45 @@ variables:
model:
model_type: combined # train which model? surface, volume, combined
loss_function: "mse" # mse or rmse
interp_res: [128, 64, 48] # resolution of latent space
interp_res: [128, 128, 128] # resolution of latent space 128, 64, 48
use_sdf_in_basis_func: true # SDF in basis function network
positional_encoding: false # calculate positional encoding?
volume_points_sample: 8192 # Number of points to sample in volume per epoch
surface_points_sample: 8192 # Number of points to sample on surface per epoch
geom_points_sample: 200_000 # Number of points to sample on STL per epoch
geom_points_sample: 300_000 # Number of points to sample on STL per epoch
surface_neighbors: true # Pre-compute surface neighborhood from input data
num_surface_neighbors: 7 # How many neighbors?
use_surface_normals: true # Use surface normals and surface areas for surface computation?
use_only_normals: true # Use only surface normals and not surface area
integral_loss_scaling_factor: 0 # Scale integral loss by this factor
use_surface_area: true # Use only surface normals and not surface area
integral_loss_scaling_factor: 100 # Scale integral loss by this factor
normalization: min_max_scaling # or mean_std_scaling
encode_parameters: true # encode inlet velocity and air density in the model
encode_parameters: false # encode inlet velocity and air density in the model
surf_loss_scaling: 5.0 # scale surface loss with this factor in combined mode
vol_loss_scaling: 1.0 # scale volume loss with this factor in combined mode
geometry_rep: # Hyperparameters for geometry representation network
base_filters: 16
geo_conv:
base_neurons: 32 # 256 or 64
base_neurons_out: 1
radius_short: 0.1
radius_long: 0.5 # 1.0, 1.5
volume_radii: [0.1, 0.5]
surface_radii: [0.05] # 0.05
hops: 1
geo_processor:
base_filters: 8
geo_processor_sdf:
base_filters: 8
nn_basis_functions: # Hyperparameters for basis function network
base_layer: 512
fourier_features: false
num_modes: 5
aggregation_model: # Hyperparameters for aggregation network
base_layer: 512
position_encoder: # Hyperparameters for position encoding network
base_neurons: 512
geometry_local: # Hyperparameters for local geometry extraction
neighbors_in_radius: 64
radius: 0.05 # 0.2 in expt 7
volume_neighbors_in_radius: [128, 128] # [64, 128]
surface_neighbors_in_radius: [128] # [64]
volume_radii: [0.05, 0.1] # [0.05. 0.1]
surface_radii: [0.05] # [0.05]
base_layer: 512
parameter_model:
base_layer: 512
Expand Down Expand Up @@ -117,9 +128,5 @@ eval: # Testing configurable parameters
test_path: /lustre/rranade/benchmarking/drivaer_aws_surface_test_new/
save_path: /lustre/rranade/domino/mesh_predictions_surf_final1/
checkpoint_name: DoMINO.0.50.pt

data_processor: # Data processor configurable parameters
kind: drivaer_aws # must be either drivesim or drivaer_aws
output_dir: /lustre/rranade/modulus_dev/data/volume_data/
input_dir: /lustre/datasets/drivaer_aws/drivaer_data_full/
num_processors: 12
scaling_param_path: /lustre/rranade/modulus_dev/modulus_forked/modulus/examples/cfd/external_aerodynamics/domino/outputs/AWS_Dataset/
refine_stl: False # Automatically refine STL during inference
Loading