Skip to content

Commit f40594d

Browse files
benflexcomputeflow360-auto-hotfix-bot
authored andcommitted
[SCFD-6737] Added updater to convert RotationCylinder to RotationVolume (#1584)
1 parent d0e13b5 commit f40594d

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

flow360/component/simulation/framework/updater.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,20 @@ def _to_25_7_2(params_as_dict):
369369

370370

371371
def _to_25_7_6(params_as_dict):
372-
"""Remove legacy entity bucket field from all entity dicts."""
372+
"""
373+
- Rename deprecated RotationCylinder discriminator to RotationVolume in meshing.volume_zones
374+
- Remove legacy entity bucket field from all entity dicts
375+
"""
376+
# 1) Update RotationCylinder -> RotationVolume
377+
meshing = params_as_dict.get("meshing")
378+
if isinstance(meshing, dict):
379+
volume_zones = meshing.get("volume_zones")
380+
if isinstance(volume_zones, list):
381+
for volume_zone in volume_zones:
382+
if isinstance(volume_zone, dict) and volume_zone.get("type") == "RotationCylinder":
383+
volume_zone["type"] = "RotationVolume"
384+
385+
# 2) Cleanup legacy entity bucket fields
373386
return remove_entity_bucket_field(params_as_dict=params_as_dict)
374387

375388

tests/simulation/test_updater.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,3 +845,35 @@ def test_updater_to_25_7_6_remove_entity_bucket_field():
845845

846846
# Non-entity dict remains unchanged
847847
assert params_new["misc"]["private_attribute_registry_bucket_name"] == "keep_me"
848+
849+
850+
def test_updater_to_25_7_6_rename_rotation_cylinder():
851+
# Minimal input containing a RotationCylinder in meshing.volume_zones
852+
params_as_dict = {
853+
"meshing": {
854+
"volume_zones": [
855+
{
856+
"type": "RotationCylinder",
857+
"name": "rot_zone",
858+
"entities": {
859+
"stored_entities": [
860+
{
861+
"private_attribute_entity_type_name": "Cylinder",
862+
"name": "c1",
863+
}
864+
]
865+
},
866+
"spacing_axial": {"value": 1.0, "units": "m"},
867+
"spacing_radial": {"value": 1.0, "units": "m"},
868+
"spacing_circumferential": {"value": 1.0, "units": "m"},
869+
}
870+
]
871+
},
872+
"unit_system": {"name": "SI"},
873+
"version": "25.7.2",
874+
}
875+
876+
params_new = updater(version_from="25.7.2", version_to="25.7.6", params_as_dict=params_as_dict)
877+
878+
assert params_new["version"] == "25.7.6"
879+
assert params_new["meshing"]["volume_zones"][0]["type"] == "RotationVolume"

0 commit comments

Comments
 (0)