Steady 3D Cylinder#
This script illustrates the setup and execution of a steady-state simulation for flow around a 3D cylinder using the Flow360 Python API. It demonstrates the process starting from geometry input, proceeding through automated mesh generation, defining simulation parameters within the SI unit system, and configuring laminar flow models and desired outputs, before submitting the simulation case.
1import flow360 as fl
2from flow360.examples import Cylinder3D
3
4Cylinder3D.get_files()
5
6project = fl.Project.from_geometry(Cylinder3D.geometry, name="Steady 3D Cylinder from Python")
7
8geo = project.geometry
9
10geo.show_available_groupings()
11geo.group_faces_by_tag("faceId")
12
13with fl.SI_unit_system:
14 farfield = fl.AutomatedFarfield()
15 params = fl.SimulationParams(
16 meshing=fl.MeshingParams(
17 defaults=fl.MeshingDefaults(
18 surface_max_edge_length=1,
19 curvature_resolution_angle=15 * fl.u.deg,
20 surface_edge_growth_rate=1.2,
21 boundary_layer_first_layer_thickness=0.01,
22 ),
23 volume_zones=[farfield],
24 ),
25 reference_geometry=fl.ReferenceGeometry(
26 area=340, moment_center=[0, 0, 0], moment_length=[1, 1, 1]
27 ),
28 operating_condition=fl.operating_condition_from_mach_reynolds(
29 reynolds=5, mach=0.1, project_length_unit=fl.u.m
30 ),
31 time_stepping=fl.Steady(),
32 models=[
33 fl.Fluid(
34 navier_stokes_solver=fl.NavierStokesSolver(
35 absolute_tolerance=1e-11, linear_solver=fl.LinearSolver(max_iterations=35)
36 ),
37 turbulence_model_solver=fl.NoneSolver(),
38 ),
39 fl.Wall(
40 surfaces=[
41 geo["*"],
42 ],
43 ),
44 fl.Freestream(surfaces=farfield.farfield),
45 ],
46 outputs=[
47 fl.SurfaceOutput(
48 output_fields=["Cp", "Cf", "CfVec", "yPlus", "nodeForcesPerUnitArea"],
49 surfaces=[geo["*"]],
50 ),
51 fl.VolumeOutput(output_fields=["primitiveVars", "qcriterion"]),
52 ],
53 )
54
55project.run_case(params, "Steady 3D Cylinder case from Python")
Notes#
fl.AutomatedFarfield
is employed to automatically generate and configure farfield boundary conditions.The script configures a laminar flow simulation by setting
turbulence_model_solver=fl.NoneSolver()
.