2D GA(W)-2#
This document details the setup and execution of a steady-state simulation for flow over a 2D General Aviation (Whitcomb)-2 airfoil using the Flow360 Python API. The process begins with importing the geometry, followed by automated mesh generation incorporating several refinement strategies. Simulation parameters, including the operating conditions and reference geometry, are defined using the SI unit system. The Spalart-Allmaras turbulence model is employed, and specific output fields are requested before the case is submitted for execution.
1import flow360 as fl
2from flow360.examples import Tutorial2DGAW2
3
4Tutorial2DGAW2.get_files()
5
6project = fl.Project.from_geometry(Tutorial2DGAW2.geometry, name="Tutorial 2D GA(W)-2 from Python")
7geometry = project.geometry
8
9# show face and edge groupings
10geometry.show_available_groupings(verbose_mode=True)
11geometry.group_faces_by_tag("faceName")
12geometry.group_edges_by_tag("edgeName")
13
14
15with fl.SI_unit_system:
16 cylinders = [
17 fl.Cylinder(
18 name=f"cylinder{i+1}",
19 axis=[0, 1, 0],
20 center=[0.7, 0.5, 0],
21 outer_radius=outer_radius,
22 height=1.0,
23 )
24 for i, outer_radius in enumerate([1.1, 2.2, 3.3, 4.5])
25 ]
26 cylinder5 = fl.Cylinder(
27 name="cylinder5", axis=[-1, 0, 0], center=[6.5, 0.5, 0], outer_radius=6.5, height=10
28 )
29 farfield = fl.AutomatedFarfield(method="quasi-3d")
30 params = fl.SimulationParams(
31 meshing=fl.MeshingParams(
32 defaults=fl.MeshingDefaults(
33 surface_edge_growth_rate=1.17,
34 surface_max_edge_length=1.1,
35 curvature_resolution_angle=12 * fl.u.deg,
36 boundary_layer_growth_rate=1.12,
37 boundary_layer_first_layer_thickness=2.8089171e-06,
38 ),
39 refinement_factor=1.35,
40 gap_treatment_strength=0.5,
41 volume_zones=[farfield],
42 refinements=[
43 fl.UniformRefinement(name="refinement1", spacing=0.1, entities=[cylinders[0]]),
44 fl.UniformRefinement(name="refinement2", spacing=0.15, entities=[cylinders[1]]),
45 fl.UniformRefinement(name="refinement3", spacing=0.225, entities=[cylinders[2]]),
46 fl.UniformRefinement(name="refinement4", spacing=0.275, entities=[cylinders[3]]),
47 fl.UniformRefinement(name="refinement5", spacing=0.325, entities=[cylinder5]),
48 fl.SurfaceRefinement(name="wing", max_edge_length=0.74, faces=[geometry["wing"]]),
49 fl.SurfaceRefinement(
50 name="flap",
51 max_edge_length=0.55,
52 faces=[geometry["flap"]],
53 ),
54 fl.SurfaceRefinement(
55 name="trailing",
56 max_edge_length=0.36,
57 faces=[
58 geometry["*Trailing"],
59 ],
60 ),
61 fl.SurfaceEdgeRefinement(
62 name="edges",
63 method=fl.HeightBasedRefinement(value=0.0007),
64 edges=[
65 geometry["*trailingEdge"],
66 geometry["*leadingEdge"],
67 ],
68 ),
69 fl.SurfaceEdgeRefinement(
70 name="symmetry", method=fl.ProjectAnisoSpacing(), edges=[geometry["symmetry"]]
71 ),
72 ],
73 ),
74 reference_geometry=fl.ReferenceGeometry(
75 moment_center=[0.25, 0, 0], moment_length=[1, 1, 1], area=0.01
76 ),
77 operating_condition=fl.operating_condition_from_mach_reynolds(
78 mach=0.13,
79 reynolds=2.2e06,
80 project_length_unit=1 * fl.u.m,
81 temperature=288.16,
82 alpha=4 * fl.u.deg,
83 beta=0 * fl.u.deg,
84 ),
85 time_stepping=fl.Steady(
86 max_steps=3000, CFL=fl.RampCFL(initial=20, final=300, ramp_steps=500)
87 ),
88 models=[
89 fl.Wall(
90 surfaces=[
91 geometry["*"],
92 ],
93 ),
94 fl.Freestream(surfaces=farfield.farfield),
95 fl.SlipWall(surfaces=farfield.symmetry_planes),
96 fl.Fluid(
97 navier_stokes_solver=fl.NavierStokesSolver(
98 absolute_tolerance=1e-11,
99 linear_solver=fl.LinearSolver(max_iterations=35),
100 kappa_MUSCL=0.33,
101 ),
102 turbulence_model_solver=fl.SpalartAllmaras(
103 absolute_tolerance=1e-10,
104 linear_solver=fl.LinearSolver(max_iterations=25),
105 equation_evaluation_frequency=1,
106 ),
107 ),
108 ],
109 outputs=[
110 fl.VolumeOutput(
111 output_fields=[
112 "primitiveVars",
113 "vorticity",
114 "residualNavierStokes",
115 "residualTurbulence",
116 "Cp",
117 "Mach",
118 "qcriterion",
119 "mut",
120 ],
121 ),
122 fl.SurfaceOutput(
123 surfaces=geometry["*"],
124 output_fields=["primitiveVars", "Cp", "Cf", "CfVec", "yPlus"],
125 ),
126 ],
127 )
128
129
130project.run_case(params=params, name="Case of tutorial 2D GA(W)-2 from Python")
Notes#
fl.AutomatedFarfield
withmethod="quasi-3d"
is used to establish the farfield boundary conditions appropriate for a 2D simulation setup.Multiple mesh refinement strategies are employed, including
fl.UniformRefinement
around cylindrical regions, andfl.SurfaceRefinement
andfl.SurfaceEdgeRefinement
on specific airfoil surfaces and edges to enhance mesh resolution in critical areas.The Spalart-Allmaras turbulence model (
fl.SpalartAllmaras
) is utilized for modeling turbulent flow characteristics.