6969beta_mesher_context .is_beta_mesher = True
7070beta_mesher_context .project_length_unit = "mm"
7171
72+ snappy_context = ParamsValidationInfo ({}, [])
73+ snappy_context .use_snappy = True
74+ snappy_context .is_beta_mesher = True
75+
7276
7377def test_structured_box_only_in_beta_mesher ():
7478 # raises when beta mesher is off
@@ -870,7 +874,20 @@ def test_sphere_in_uniform_refinement():
870874 ],
871875 )
872876
873- # raises without beta mesher
877+ # also allowed with snappy
878+ with ValidationContext (VOLUME_MESH , snappy_context ):
879+ with CGS_unit_system :
880+ sphere = Sphere (
881+ name = "s_snappy" ,
882+ center = (0 , 0 , 0 ),
883+ radius = 1.0 ,
884+ )
885+ UniformRefinement (
886+ entities = [sphere ],
887+ spacing = 0.1 ,
888+ )
889+
890+ # raises without beta mesher or snappy
874891 with pytest .raises (
875892 pd .ValidationError ,
876893 match = r"`Sphere` entity for `UniformRefinement` is supported only with beta mesher" ,
@@ -888,6 +905,45 @@ def test_sphere_in_uniform_refinement():
888905 )
889906
890907
908+ def test_uniform_refinement_snappy_entity_restrictions ():
909+ """With snappy, UniformRefinement only accepts Box, Cylinder, and Sphere entities."""
910+ # Box, Cylinder, Sphere all allowed
911+ with ValidationContext (VOLUME_MESH , snappy_context ):
912+ with CGS_unit_system :
913+ UniformRefinement (
914+ entities = [
915+ Box (center = (0 , 0 , 0 ), size = (1 , 1 , 1 ), name = "box" ),
916+ Cylinder (
917+ name = "cyl" ,
918+ axis = (0 , 0 , 1 ),
919+ center = (0 , 0 , 0 ),
920+ height = 1.0 ,
921+ outer_radius = 0.5 ,
922+ ),
923+ Sphere (name = "sph" , center = (0 , 0 , 0 ), radius = 1.0 ),
924+ ],
925+ spacing = 0.1 ,
926+ )
927+
928+ # AxisymmetricBody rejected with snappy
929+ with pytest .raises (
930+ pd .ValidationError ,
931+ match = r"`AxisymmetricBody` entity for `UniformRefinement` is not supported with snappyHexMesh" ,
932+ ):
933+ with ValidationContext (VOLUME_MESH , snappy_context ):
934+ with CGS_unit_system :
935+ axisymmetric_body = AxisymmetricBody (
936+ name = "axisymm" ,
937+ axis = (0 , 0 , 1 ),
938+ center = (0 , 0 , 0 ),
939+ profile_curve = [(- 1 , 0 ), (- 1 , 1 ), (1 , 1 ), (1 , 0 )],
940+ )
941+ UniformRefinement (
942+ entities = [axisymmetric_body ],
943+ spacing = 0.1 ,
944+ )
945+
946+
891947def test_require_mesh_zones ():
892948 with SI_unit_system :
893949 ModularMeshingWorkflow (
0 commit comments