Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
103 changes: 102 additions & 1 deletion flow360/component/simulation/framework/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,106 @@ def rename_origin_to_reference_point(params_as_dict):
return params_as_dict


def _to_25_8_4(params_as_dict):
"""
Populate wind tunnel ghost surfaces in ghost_entities if they are not present,
ensuring that they are available for entity selection.
"""

def _has_wind_tunnel_ghost_surfaces(ghost_entities):
"""Check if ghost_entities already contains WindTunnelGhostSurface entities."""
for entity in ghost_entities:
if entity.get("private_attribute_entity_type_name") == "WindTunnelGhostSurface":
return True
return False

def _get_all_wind_tunnel_ghost_surfaces():
"""Return a list of all possible WindTunnelGhostSurface dicts."""
return [
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelInlet",
"private_attribute_id": "windTunnelInlet",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelOutlet",
"private_attribute_id": "windTunnelOutlet",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelCeiling",
"private_attribute_id": "windTunnelCeiling",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelFloor",
"private_attribute_id": "windTunnelFloor",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelLeft",
"private_attribute_id": "windTunnelLeft",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelRight",
"private_attribute_id": "windTunnelRight",
"used_by": ["all"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelFrictionPatch",
"private_attribute_id": "windTunnelFrictionPatch",
"used_by": ["StaticFloor"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelCentralBelt",
"private_attribute_id": "windTunnelCentralBelt",
"used_by": ["CentralBelt", "WheelBelts"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelFrontWheelBelt",
"private_attribute_id": "windTunnelFrontWheelBelt",
"used_by": ["WheelBelts"],
},
{
"private_attribute_entity_type_name": "WindTunnelGhostSurface",
"name": "windTunnelRearWheelBelt",
"private_attribute_id": "windTunnelRearWheelBelt",
"used_by": ["WheelBelts"],
},
]

# Get asset cache, entity info, and ghost entities
asset_cache = params_as_dict.get("private_attribute_asset_cache")
if asset_cache is None:
return params_as_dict

entity_info = asset_cache.get("project_entity_info")
if entity_info is None:
return params_as_dict

ghost_entities = entity_info.get("ghost_entities", [])

# Check if a wind tunnel ghost surface is already included
if _has_wind_tunnel_ghost_surfaces(ghost_entities):
return params_as_dict

# Add all wind tunnel ghost surfaces and update entity_info
ghost_entities.extend(_get_all_wind_tunnel_ghost_surfaces())
entity_info["ghost_entities"] = ghost_entities

return params_as_dict


VERSION_MILESTONES = [
(Flow360Version("24.11.1"), _to_24_11_1),
(Flow360Version("24.11.7"), _to_24_11_7),
Expand All @@ -510,7 +610,8 @@ def rename_origin_to_reference_point(params_as_dict):
(Flow360Version("25.8.0b4"), _to_25_8_0),
(Flow360Version("25.8.1"), _to_25_8_1),
(Flow360Version("25.8.3"), _to_25_8_3),
] # A list of the Python API version tuple with there corresponding updaters.
(Flow360Version("25.8.4"), _to_25_8_4),
] # A list of the Python API version tuple with their corresponding updaters.


# pylint: disable=dangerous-default-value
Expand Down
2 changes: 1 addition & 1 deletion flow360/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version
"""

__version__ = "25.8.3"
__version__ = "25.8.4"
__solver_version__ = "release-25.8"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flow360"
version = "v25.8.3"
version = "v25.8.4"
description = "Flow360 Python Client"
authors = ["Flexcompute <[email protected]>"]

Expand Down
2 changes: 1 addition & 1 deletion tests/ref/simulation/service_init_geometry.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/ref/simulation/service_init_surface_mesh.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/ref/simulation/service_init_volume_mesh.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/simulation/converter/ref/ref_monitor.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/simulation/data/geometry_airplane/simulation.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/simulation/data/simulation_by_face_id.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,5 +744,5 @@
"name": "SI"
},
"user_defined_fields": [],
"version": "25.8.3"
"version": "25.8.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -744,5 +744,5 @@
"name": "SI"
},
"user_defined_fields": [],
"version": "25.8.3"
"version": "25.8.4"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1152,5 +1152,5 @@
"name": "SI"
},
"user_defined_fields": [],
"version": "25.8.3"
"version": "25.8.4"
}
100 changes: 100 additions & 0 deletions tests/simulation/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,3 +1336,103 @@ def test_updater_to_25_8_3_no_coordinate_systems():
]
== []
)


def test_updater_to_25_8_4_add_wind_tunnel_ghost_surfaces():
"""Ensures ghost_entities is populated with wind tunnel ghost surfaces"""

# from translator/data/simulation_with_auto_area.json
params_as_dict = {
"version": "25.6.6",
"unit_system": {"name": "CGS"},
"private_attribute_asset_cache": {
"project_entity_info": {
"ghost_entities": [
{
"private_attribute_registry_bucket_name": "SurfaceEntityType",
"private_attribute_entity_type_name": "GhostSphere",
"private_attribute_id": "farfield",
"name": "farfield",
"private_attribute_full_name": None,
"center": [11, 6, 5],
"max_radius": 1100.0000000000005,
},
{
"private_attribute_registry_bucket_name": "SurfaceEntityType",
"private_attribute_entity_type_name": "GhostCircularPlane",
"private_attribute_id": "symmetric-1",
"name": "symmetric-1",
"private_attribute_full_name": None,
"center": [11, 0, 5],
"max_radius": 22.00000000000001,
"normal_axis": [0, 1, 0],
},
{
"private_attribute_registry_bucket_name": "SurfaceEntityType",
"private_attribute_entity_type_name": "GhostCircularPlane",
"private_attribute_id": "symmetric-2",
"name": "symmetric-2",
"private_attribute_full_name": None,
"center": [11, 12, 5],
"max_radius": 22.00000000000001,
"normal_axis": [0, 1, 0],
},
{
"private_attribute_registry_bucket_name": "SurfaceEntityType",
"private_attribute_entity_type_name": "GhostCircularPlane",
"private_attribute_id": "symmetric",
"name": "symmetric",
"private_attribute_full_name": None,
"center": [11, 0, 5],
"max_radius": 22.00000000000001,
"normal_axis": [0, 1, 0],
},
],
}
},
}

# Verify no WindTunnelGhostSurface currently exists
ghost_entities_before = params_as_dict["private_attribute_asset_cache"]["project_entity_info"][
"ghost_entities"
]
assert not any(
e.get("private_attribute_entity_type_name") == "WindTunnelGhostSurface"
for e in ghost_entities_before
)

# Update
params_new = updater(
version_from="25.6.6",
version_to="25.8.4",
params_as_dict=params_as_dict,
)
assert params_new["version"] == "25.8.4"

ghost_entities = params_new["private_attribute_asset_cache"]["project_entity_info"][
"ghost_entities"
]

# Should still have original ghost entities (GhostSphere, GhostCircularPlane)
assert any(e["name"] == "farfield" for e in ghost_entities)
assert any(e["name"] == "symmetric" for e in ghost_entities)

# Should now have all 10 wind tunnel ghost surfaces
wind_tunnel_names = [
"windTunnelInlet",
"windTunnelOutlet",
"windTunnelCeiling",
"windTunnelFloor",
"windTunnelLeft",
"windTunnelRight",
"windTunnelFrictionPatch",
"windTunnelCentralBelt",
"windTunnelFrontWheelBelt",
"windTunnelRearWheelBelt",
]
for name in wind_tunnel_names:
assert any(
e.get("private_attribute_entity_type_name") == "WindTunnelGhostSurface"
and e["name"] == name
for e in ghost_entities
), f"Missing wind tunnel ghost surface: {name}"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "25.8.3",
"version": "25.8.4",
"unit_system": {
"name": "SI"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_current_flow360_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "25.8.3"
assert __version__ == "25.8.4"