Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c9286eb
(feat) Add data preprocessing pipeline for HLPW
Nov 17, 2025
f251b34
(chore) Fix errors in the pipeline
Nov 18, 2025
d65adcb
(feat) Pipeline for global params addition similar to volume/surface…
Nov 19, 2025
073c19f
Merge branch 'NVIDIA:main' into sn/hlpw-data
ns5678 Nov 19, 2025
6b70451
(chore) fix error and clean implementation
Nov 23, 2025
a72d1ad
(chore) clean code for PR
ns5678 Nov 23, 2025
88362dc
(chore) refactor constants.py and its propagation through config
ns5678 Nov 26, 2025
fe19370
(chore) remove VSCode settings file
ns5678 Nov 26, 2025
d380280
(chore) update external aerodynamics data processing and logging
ns5678 Nov 26, 2025
197220e
Merge branch 'main' into sn/hlpw-data
ns5678 Nov 26, 2025
6e6712a
(chore) set data_processors inputs to previous state
ns5678 Nov 26, 2025
34a21b8
Merge branch 'sn/hlpw-data' of https://github.com/ns5678/physicsnemo-…
ns5678 Nov 26, 2025
2eb368a
(chore) remove whitespace
ns5678 Nov 26, 2025
5751d6b
(chore) refactor drivaerml and hlpw yaml files to comply with new loc…
ns5678 Nov 27, 2025
ea52c3a
(chore) further clean up drivaerml yaml
ns5678 Nov 27, 2025
240dd21
(chore) minor comment fix
ns5678 Nov 27, 2025
552da5b
(chore) update imports in data processors
ns5678 Nov 27, 2025
437dc88
(chore) fix import in data_transformations
ns5678 Nov 27, 2025
1a0619e
(feat) improve metadata processing and global_params processing
ns5678 Nov 27, 2025
2f5746b
(chore) improve global_params extraction and handling
ns5678 Nov 27, 2025
0c8cd9c
(chore) reformat comments and logs
ns5678 Nov 27, 2025
d403a48
(chore) fix some more tests
ns5678 Dec 1, 2025
f8b517b
(chore) black formatting
ns5678 Dec 3, 2025
8ea75aa
Merge branch 'main' into sn/hlpw-data
ns5678 Dec 3, 2025
23a0cc5
(chore) address PR comments
ns5678 Dec 11, 2025
6dec34e
(chore) update PR
ns5678 Dec 11, 2025
c79eb9b
(chore) fix blossom error
ns5678 Dec 15, 2025
b5fe9da
Merge branch 'main' into sn/hlpw-data
ns5678 Dec 15, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.coverage*
.pytest_cache*
.ruff_cache*
.vscode/
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ For more information, see the [Zarr project website](https://zarr.dev/).
├── stl_centers # Cell centers
├── stl_coordinates # Vertex coordinates
├── stl_faces # Face connectivity
├── global_params_values # Simulation-specific global parameters (optional)
├── global_params_reference # Reference values for global parameters (optional)
├── surface_areas # Cell areas (surface, optional)
├── surface_fields # Field data (surface, optional)
├── surface_mesh_centers # Cell centers (surface, optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
defaults:
- /variables/surface: drivaerml
- /variables/volume: drivaerml
- /variables/global: drivaerml
- /serialization_format: zarr # Default value, can be overridden via CLI
- /override_transformations: ${serialization_format}
- _self_
Expand Down Expand Up @@ -98,6 +99,16 @@ etl:
- _target_: external_aero_volume_data_processors.shuffle_volume_data
_partial_: true

global_params_preprocessing:
_target_: data_transformations.ExternalAerodynamicsGlobalParamsTransformation
_convert_: all
global_parameters: ${etl.global_parameters}
# Regardless of whether there are any additional global params processors,
# We always apply the default global params processing. This ensure that there are global params references present.
global_params_processors:
- _target_: external_aero_global_params_data_processors.process_global_params
_partial_: true

write_ready_transformation: ${override_transformations.write_ready_transformation}

sink:
Expand Down
76 changes: 76 additions & 0 deletions examples/external_aerodynamics/config/external_aero_etl_hlpw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

defaults:
- /external_aero_etl_drivaerml
- override /variables/surface: hlpw
- override /variables/volume: hlpw
- override /variables/global: hlpw
- _self_

etl:
common:
kind: hlpw
model_type: surface # produce data for which model? surface, volume, combined

processing:
num_processes: 12

transformations:
surface_preprocessing:
# Use HLPW-specific transformation that handles N_BF field
_target_: data_transformations.ExternalAerodynamicsSurfaceTransformationHLPW
_convert_: all
nbf_field_name: "N_BF"

surface_processors:
- _target_: external_aero_surface_data_processors.decimate_mesh
_partial_: true
algo: decimate_pro
reduction: 0.0
preserve_topology: false

# Note: normalize_surface_normals not needed - already done via N_BF normalization

# HLPW-specific non-dimensionalization
- _target_: external_aero_surface_data_processors.non_dimensionalize_surface_fields_hlpw
_partial_: true
pref: 176.352
tref: 518.67
- _target_: external_aero_surface_data_processors.update_surface_data_to_float32
_partial_: true

volume_preprocessing:
_target_: data_transformations.ExternalAerodynamicsVolumeTransformation
_convert_: all
volume_processors:
- _target_: external_aero_volume_data_processors.non_dimensionalize_volume_fields_hlpw
_partial_: true
pref: 176.352
tref: 518.67
uref: 2679.505
- _target_: external_aero_volume_data_processors.update_volume_data_to_float32
_partial_: true
- _target_: external_aero_volume_data_processors.shuffle_volume_data
_partial_: true

global_params_preprocessing:
_target_: data_transformations.ExternalAerodynamicsGlobalParamsTransformation
_convert_: all
global_parameters: ${etl.global_parameters}
global_params_processors:
- _target_: external_aero_global_params_data_processors.process_global_params_hlpw
_partial_: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @package etl
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

global_parameters:
inlet_velocity:
type: vector
reference: [30.0] # Inlet velocity vector in m/s, if a 2D vector, give [30, 30], if a 3D vector give [30, 30, 30]
air_density:
type: scalar
reference: 1.205 # Air density in kg/m³
pressure:
type: scalar
reference: 101325.0 # Reference pressure in Pa
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @package etl
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

global_parameters:
inlet_velocity:
type: vector
reference: [30.0] # Inlet velocity vector in m/s, if a 2D vector, give [30, 30], if a 3D vector give [30, 30, 30]
air_density:
type: scalar
reference: 1.205 # Air density in kg/m³
pressure:
type: scalar
reference: 101325.0 # Reference pressure in Pa
21 changes: 21 additions & 0 deletions examples/external_aerodynamics/config/variables/global/hlpw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @package etl
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

global_parameters:
AoA:
type: scalar
reference: 22.0 # Angle of Attack in degrees
23 changes: 23 additions & 0 deletions examples/external_aerodynamics/config/variables/surface/hlpw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# @package etl.transformations.surface_preprocessing
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

surface_variables:
PROJ(AVG(T)): scalar
PROJ(AVG(P)): scalar
AVG(TAU_WALL(0)): scalar
AVG(TAU_WALL(1)): scalar
AVG(TAU_WALL(2)): scalar
21 changes: 21 additions & 0 deletions examples/external_aerodynamics/config/variables/volume/hlpw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @package etl.transformations.volume_preprocessing
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
# SPDX-FileCopyrightText: All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

volume_variables:
avg(P): scalar
avg(T): scalar
avg(u): vector
38 changes: 36 additions & 2 deletions examples/external_aerodynamics/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@


@dataclass(frozen=True)
class PhysicsConstants:
"""Physical constants used in the simulation."""
class PhysicsConstantsCarAerodynamics:
"""Physical constants used in the simulation in DriveAerML or AhmedML"""

AIR_DENSITY: float = 1.205 # kg/m³
STREAM_VELOCITY: float = 30.00 # m/s


@dataclass(frozen=True)
class PhysicsConstantsHLPW:
"""Physical constants used in the simulation for HLPW dataset."""

PREF: float = 176.352 # HLPW reference pressure
UREF: float = 2679.505 # HLPW reference velocity
TREF: float = 518.67 # HLPW reference temperature


class ModelType(str, Enum):
"""Types of models that can be processed."""

Expand All @@ -44,6 +53,7 @@ class DatasetKind(str, Enum):
DRIVESIM = "drivesim"
DRIVAERML = "drivaerml"
AHMEDML = "ahmedml"
HLPW = "hlpw"


@dataclass(frozen=True)
Expand All @@ -52,3 +62,27 @@ class DefaultVariables:

SURFACE: tuple[str, ...] = ("pMean", "wallShearStress")
VOLUME: tuple[str, ...] = ("UMean", "pMean")


def get_physics_constants(kind: DatasetKind) -> dict[str, float]:
"""Get physics constants dict based on dataset kind. Add a branch
to the if-elif pipeline below to populate metadata with values
used for non-dimensionalization.

Args:
kind: The dataset kind (from config etl.common.kind)

Returns:
Dictionary of physics constant names to values.

Raises:
ValueError: If dataset kind is unknown.
"""
if kind in (DatasetKind.DRIVAERML, DatasetKind.AHMEDML, DatasetKind.DRIVESIM):
c = PhysicsConstantsCarAerodynamics()
return {"air_density": c.AIR_DENSITY, "stream_velocity": c.STREAM_VELOCITY}
elif kind == DatasetKind.HLPW:
c = PhysicsConstantsHLPW()
return {"pref": c.PREF, "uref": c.UREF, "tref": c.TREF}
else:
raise ValueError(f"Unknown dataset kind: {kind}")
Loading