Auto Meshing - Internal Flow#
This script details the procedure for generating a computational mesh for an internal flow configuration using the automated meshing capabilities of the Flow360 Python API. It covers the steps from importing the geometry and grouping faces to specifying detailed meshing parameters, including defaults, surface refinements, boundary layer settings, and passive spacing controls, finishing with the sequential generation of the surface and volume meshes.
1import flow360 as fl
2from flow360.examples import TutorialAutoMeshingInternalFlow
3
4TutorialAutoMeshingInternalFlow.get_files()
5project = fl.Project.from_geometry(
6 TutorialAutoMeshingInternalFlow.geometry,
7 name="Tutorial Auto Meshing Internal Flow from Python",
8)
9geometry = project.geometry
10
11# show face groupings
12geometry.show_available_groupings(verbose_mode=True)
13geometry.group_faces_by_tag("faceName")
14
15with fl.SI_unit_system:
16 farfield = fl.UserDefinedFarfield()
17 params = fl.SimulationParams(
18 meshing=fl.MeshingParams(
19 defaults=fl.MeshingDefaults(
20 surface_max_edge_length=1.2 * fl.u.m,
21 curvature_resolution_angle=15 * fl.u.deg,
22 surface_edge_growth_rate=1.2,
23 boundary_layer_first_layer_thickness=1e-6,
24 boundary_layer_growth_rate=1.2,
25 ),
26 refinement_factor=1.0,
27 volume_zones=[farfield],
28 refinements=[
29 fl.SurfaceRefinement(
30 name="sphere", max_edge_length=0.1, faces=[geometry["sphere"]]
31 ),
32 fl.SurfaceRefinement(name="strut", max_edge_length=0.01, faces=[geometry["strut"]]),
33 fl.BoundaryLayer(
34 name="floor", first_layer_thickness=1e-5, faces=[geometry["floor"]]
35 ),
36 fl.PassiveSpacing(
37 name="adjacent2floor", type="projected", faces=[geometry["adjacent2floor"]]
38 ),
39 fl.PassiveSpacing(name="ceiling", type="unchanged", faces=[geometry["ceiling"]]),
40 ],
41 ),
42 )
43
44project.generate_surface_mesh(params)
45project.generate_volume_mesh(params)
Notes#
This example focuses exclusively on the mesh generation process, utilizing
generate_surface_mesh
andgenerate_volume_mesh
methods of theProject
class.Detailed control over mesh characteristics is achieved through
MeshingDefaults
and specific refinements (SurfaceRefinement
,BoundaryLayer
,PassiveSpacing
) applied to designated geometric faces identified by tags.fl.AutomatedFarfield
is used to define the farfield volume zone required for meshing.