Skip to content

Refactor on DoMINO utils.py to improve code quality #985

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

Merged
merged 23 commits into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fd47323
Massive refactor on domino utils.py to improve code quality
peterdsharpe Jun 20, 2025
832ea53
Adds missing tensorboard requirement
peterdsharpe Jun 20, 2025
5f23d5c
Fixes missing cuml requirement
peterdsharpe Jun 20, 2025
f0dc954
Begins process of fixing inference_on_stl.py
peterdsharpe Jun 20, 2025
55c8c7d
Fixes outdated type definition
peterdsharpe Jun 20, 2025
69b0766
black formatting pass
peterdsharpe Jun 20, 2025
57dba91
Fixes import order
peterdsharpe Jun 20, 2025
5fc6d96
black formatting
peterdsharpe Jun 20, 2025
d0fd16b
Reshape accepts a shape, not a splatted iterable
peterdsharpe Jun 20, 2025
f41a1bf
Fixes lost array axis
peterdsharpe Jun 20, 2025
d2167a9
Enhances docstrings in utils.py with examples and improved clarity; r…
peterdsharpe Jun 20, 2025
a7d8448
Enhances area_weighted_shuffle_array function by adding area_factor p…
peterdsharpe Jun 20, 2025
87dafe0
Updates docstrings in utils.py for accuracy and clarity; modifies exa…
peterdsharpe Jun 20, 2025
8de5fc6
black format
peterdsharpe Jun 20, 2025
bf3cca9
Merge branch 'main' into psharpe/code-quality
peterdsharpe Jun 25, 2025
b2fe5fa
Merge branch 'main' into psharpe/code-quality
peterdsharpe Jul 7, 2025
abc5464
Merge branch 'main' into psharpe/code-quality
peterdsharpe Jul 8, 2025
daac91a
Add test suite for domino utils module
peterdsharpe Jul 8, 2025
d2b11c7
Refactor array_type function to handle CuPy import gracefully and opt…
peterdsharpe Jul 8, 2025
02849e0
Import PyVista conditionally in extract_surface_triangles function to…
peterdsharpe Jul 8, 2025
7837572
Merge branch 'main' into psharpe/code-quality
peterdsharpe Jul 8, 2025
cdbf352
black formatting
peterdsharpe Jul 8, 2025
6251d3c
Remove unused import
peterdsharpe Jul 8, 2025
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
4 changes: 3 additions & 1 deletion examples/cfd/external_aerodynamics/domino/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
torchinfo
warp-lang
warp-lang
tensorboard
cuml-cu12>=25.6.0
16 changes: 11 additions & 5 deletions examples/cfd/external_aerodynamics/domino/src/inference_on_stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
import numpy as np
import torch

from modulus.models.domino.model import DoMINO
from modulus.utils.domino.utils import *
from physicsnemo.models.domino.model import DoMINO
from physicsnemo.utils.domino.utils import (
unnormalize,
create_directory,
nd_interpolator,
get_filenames,
write_to_vtp,
)
from torch.cuda.amp import autocast
from torch.nn.parallel import DistributedDataParallel
from modulus.distributed import DistributedManager
from physicsnemo.distributed import DistributedManager

from numpy.typing import NDArray
from typing import Any, Iterable, List, Literal, Mapping, Optional, Union, Callable
Expand All @@ -49,7 +55,7 @@
import pyvista as pv

try:
from modulus.sym.geometry.tessellation import Tessellation
from physicsnemo.sym.geometry.tessellation import Tessellation

SYM_AVAILABLE = True
except ImportError:
Expand Down Expand Up @@ -663,7 +669,7 @@ def __init__(
self,
cfg: DictConfig,
dist: None,
cached_geo_encoding: False,
cached_geo_encoding: bool = False,
):

self.cfg = cfg
Expand Down
2 changes: 1 addition & 1 deletion examples/cfd/external_aerodynamics/domino/src/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def compute_loss_dict(
integral_scaling_factor: float,
surf_loss_scaling: float,
vol_loss_scaling: float,
) -> Tuple[torch.Tensor, dict]:
) -> tuple[torch.Tensor, dict]:
"""
Compute the loss terms in a single function call.

Expand Down
2 changes: 1 addition & 1 deletion physicsnemo/datapipes/cae/domino_datapipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def preprocess_volume(
mesh_indices_flattened,
grid_reshaped,
use_sign_winding_number=True,
).reshape(nx, ny, nz)
).reshape((nx, ny, nz))

if self.config.sampling:
volume_coordinates_sampled, idx_volume = shuffle_array(
Expand Down
Loading