diff --git a/flow360/component/simulation/validation/validation_simulation_params.py b/flow360/component/simulation/validation/validation_simulation_params.py index 35894627b..cebba6bd1 100644 --- a/flow360/component/simulation/validation/validation_simulation_params.py +++ b/flow360/component/simulation/validation/validation_simulation_params.py @@ -336,6 +336,11 @@ def _check_complete_boundary_condition_and_unknown_surface( # If transformed then `_will_be_deleted_by_mesher()` will no longer be accurate # since we do not know the final bounding box for each surface and global model. + if farfield_method: + for item in asset_boundary_entities: + if item.private_attributes is None: + # Legacy cloud asset that does not have bounding box information. Just skip the check. + return params # pylint:disable=protected-access asset_boundary_entities = [ item diff --git a/tests/simulation/params/data/surface_mesh/simulation.json b/tests/simulation/params/data/surface_mesh/simulation.json index 01109d4de..b655a607b 100644 --- a/tests/simulation/params/data/surface_mesh/simulation.json +++ b/tests/simulation/params/data/surface_mesh/simulation.json @@ -344,7 +344,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -355,7 +370,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -366,7 +396,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -377,7 +422,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -388,7 +448,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -399,7 +474,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -410,7 +500,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -421,7 +526,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -432,7 +552,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -443,7 +578,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -454,7 +604,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -465,7 +630,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -476,7 +656,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } }, { "private_attribute_registry_bucket_name": "SurfaceEntityType", @@ -487,7 +682,22 @@ "private_attribute_is_interface": null, "private_attribute_tag_key": null, "private_attribute_sub_components": [], - "private_attribute_color": null + "private_attribute_color": null, + "private_attributes": { + "type_name": "SurfacePrivateAttributes", + "bounding_box": [ + [ + 0, + 0, + 0 + ], + [ + 1, + 1, + 1 + ] + ] + } } ], "global_bounding_box": [ diff --git a/tests/simulation/params/test_validators_params.py b/tests/simulation/params/test_validators_params.py index 8011447b9..428b34f90 100644 --- a/tests/simulation/params/test_validators_params.py +++ b/tests/simulation/params/test_validators_params.py @@ -568,6 +568,11 @@ def test_BC_geometry(): with open("./data/geometry_metadata_asset_cache_quasi3D.json") as fp: data = json.load(fp) data["private_attribute_asset_cache"]["project_entity_info"]["face_group_tag"] = "groupName" + # Mock private_attributes for all boundaries + for group in data["private_attribute_asset_cache"]["project_entity_info"]["grouped_faces"]: + for face in group: + if "private_attributes" not in face: + face["private_attributes"] = {"bounding_box": [[0, 0, 0], [1, 1, 1]]} asset_cache = AssetCache(**data["private_attribute_asset_cache"]) symmetry_boundary_1 = [item for item in asset_cache.boundaries if item.name == "symmetry11"][0] @@ -790,11 +795,22 @@ def test_incomplete_BC_volume_mesh(): def test_incomplete_BC_surface_mesh(): ##:: Construct a dummy asset cache - wall_1 = Surface(name="wall_1", private_attribute_is_interface=False) - periodic_1 = Surface(name="periodic_1", private_attribute_is_interface=False) - periodic_2 = Surface(name="periodic_2", private_attribute_is_interface=False) - i_exist = Surface(name="i_exist", private_attribute_is_interface=False) - no_bc = Surface(name="no_bc", private_attribute_is_interface=False) + dummy_attrs = SurfacePrivateAttributes(bounding_box=[[0, 0, 0], [1, 1, 1]]) + wall_1 = Surface( + name="wall_1", private_attribute_is_interface=False, private_attributes=dummy_attrs + ) + periodic_1 = Surface( + name="periodic_1", private_attribute_is_interface=False, private_attributes=dummy_attrs + ) + periodic_2 = Surface( + name="periodic_2", private_attribute_is_interface=False, private_attributes=dummy_attrs + ) + i_exist = Surface( + name="i_exist", private_attribute_is_interface=False, private_attributes=dummy_attrs + ) + no_bc = Surface( + name="no_bc", private_attribute_is_interface=False, private_attributes=dummy_attrs + ) i_will_be_deleted = Surface( name="sym_boundary", private_attribute_is_interface=False, @@ -2018,9 +2034,24 @@ def test_beta_mesher_only_features(): use_inhouse_mesher=True, project_entity_info=SurfaceMeshEntityInfo( boundaries=[ - Surface(name="face1"), - Surface(name="face2"), - Surface(name="face3"), + Surface( + name="face1", + private_attributes=SurfacePrivateAttributes( + bounding_box=[[0, 1, 2], [3, 4, 5]] + ), + ), + Surface( + name="face2", + private_attributes=SurfacePrivateAttributes( + bounding_box=[[0, 1, 2], [3, 4, 5]] + ), + ), + Surface( + name="face3", + private_attributes=SurfacePrivateAttributes( + bounding_box=[[0, 1, 2], [3, 4, 5]] + ), + ), ] ), ),