Skip to content
Merged
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
15 changes: 14 additions & 1 deletion flow360/component/simulation/framework/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,20 @@ def _to_25_7_2(params_as_dict):


def _to_25_7_6(params_as_dict):
"""Remove legacy entity bucket field from all entity dicts."""
"""
- Rename deprecated RotationCylinder discriminator to RotationVolume in meshing.volume_zones
- Remove legacy entity bucket field from all entity dicts
"""
# 1) Update RotationCylinder -> RotationVolume
meshing = params_as_dict.get("meshing")
if isinstance(meshing, dict):
volume_zones = meshing.get("volume_zones")
if isinstance(volume_zones, list):
for volume_zone in volume_zones:
if isinstance(volume_zone, dict) and volume_zone.get("type") == "RotationCylinder":
volume_zone["type"] = "RotationVolume"

# 2) Cleanup legacy entity bucket fields
return remove_entity_bucket_field(params_as_dict=params_as_dict)


Expand Down
32 changes: 32 additions & 0 deletions tests/simulation/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,35 @@ def test_updater_to_25_7_6_remove_entity_bucket_field():

# Non-entity dict remains unchanged
assert params_new["misc"]["private_attribute_registry_bucket_name"] == "keep_me"


def test_updater_to_25_7_6_rename_rotation_cylinder():
# Minimal input containing a RotationCylinder in meshing.volume_zones
params_as_dict = {
"meshing": {
"volume_zones": [
{
"type": "RotationCylinder",
"name": "rot_zone",
"entities": {
"stored_entities": [
{
"private_attribute_entity_type_name": "Cylinder",
"name": "c1",
}
]
},
"spacing_axial": {"value": 1.0, "units": "m"},
"spacing_radial": {"value": 1.0, "units": "m"},
"spacing_circumferential": {"value": 1.0, "units": "m"},
}
]
},
"unit_system": {"name": "SI"},
"version": "25.7.2",
}

params_new = updater(version_from="25.7.2", version_to="25.7.6", params_as_dict=params_as_dict)

assert params_new["version"] == "25.7.6"
assert params_new["meshing"]["volume_zones"][0]["type"] == "RotationVolume"