Periodic Boundary Conditions#
This example details the configuration and simulation of flow through a stator passage, employing rotational periodic boundary conditions via the Flow360 Python API. It outlines the procedure from importing a pre-existing mesh, defining the operating conditions using Mach and Reynolds numbers, specifying boundary conditions including rotational periodicity, configuring the Spalart-Allmaras turbulence model, and setting up various outputs like surface and slice data before initiating the simulation run.
1import flow360 as fl
2from flow360.examples import TutorialPeriodicBC
3
4TutorialPeriodicBC.get_files()
5project = fl.Project.from_volume_mesh(
6 TutorialPeriodicBC.mesh_filename,
7 name="Tutorial Periodic Boundary Condition from Python",
8)
9volume_mesh = project.volume_mesh
10
11with fl.SI_unit_system:
12 slice_inlet = fl.Slice(
13 name="Inlet",
14 normal=[1, 0, 0],
15 origin=[-179, 0, 0] * fl.u.m,
16 )
17 slice_outlet = fl.Slice(
18 name="Outlet",
19 normal=[1, 0, 0],
20 origin=[539, 0, 0] * fl.u.m,
21 )
22 slice_trailing_edge = fl.Slice(
23 name="TrailingEdge",
24 normal=[1, 0, 0],
25 origin=[183, 0, 0] * fl.u.m,
26 )
27 slice_wake = fl.Slice(
28 name="Wake",
29 normal=[1, 0, 0],
30 origin=[294.65, 0, 0] * fl.u.m,
31 )
32 operating_condition = fl.operating_condition_from_mach_reynolds(
33 mach=0.13989,
34 reynolds=3200,
35 project_length_unit=1 * fl.u.m,
36 temperature=298.25 * fl.u.K,
37 )
38 params = fl.SimulationParams(
39 reference_geometry=fl.ReferenceGeometry(
40 moment_center=[0, 0, 0], moment_length=[1, 1, 1], area=209701.3096271187
41 ),
42 operating_condition=operating_condition,
43 time_stepping=fl.Steady(max_steps=5000, CFL=fl.AdaptiveCFL()),
44 models=[
45 fl.Fluid(
46 navier_stokes_solver=fl.NavierStokesSolver(
47 absolute_tolerance=1e-11,
48 linear_solver=fl.LinearSolver(max_iterations=20),
49 order_of_accuracy=2,
50 kappa_MUSCL=0.33,
51 update_jacobian_frequency=1,
52 equation_evaluation_frequency=1,
53 numerical_dissipation_factor=1,
54 ),
55 turbulence_model_solver=fl.SpalartAllmaras(
56 absolute_tolerance=1e-10,
57 linear_solver=fl.LinearSolver(max_iterations=20),
58 update_jacobian_frequency=1,
59 equation_evaluation_frequency=1,
60 order_of_accuracy=2,
61 ),
62 ),
63 fl.Wall(
64 surfaces=[
65 volume_mesh["fluid/vane_*"], # fluid/vane_ss and vane_ps
66 volume_mesh["fluid/bladeFillet_*"], # fluid/bladeFillet_ss and bladeFillet_ps
67 volume_mesh["fluid/shroud"],
68 volume_mesh["fluid/hub"],
69 ]
70 ),
71 fl.Freestream(
72 surfaces=[
73 volume_mesh["fluid/inlet"],
74 ]
75 ),
76 fl.Outflow(
77 surfaces=[
78 volume_mesh["fluid/outlet"],
79 ],
80 spec=fl.Pressure(1.0032 * operating_condition.thermal_state.pressure),
81 ),
82 fl.SlipWall(
83 surfaces=[
84 volume_mesh["fluid/bottomFront"],
85 volume_mesh["fluid/topFront"],
86 ]
87 ),
88 fl.Periodic(
89 surface_pairs=[(volume_mesh["fluid/periodic-1"], volume_mesh["fluid/periodic-2"])],
90 spec=fl.Rotational(axis_of_rotation=(1, 0, 0)),
91 ),
92 ],
93 outputs=[
94 fl.VolumeOutput(
95 output_format="tecplot",
96 output_fields=[
97 "primitiveVars",
98 "vorticity",
99 "Cp",
100 "Mach",
101 "qcriterion",
102 "mut",
103 "nuHat",
104 "mutRatio",
105 "gradW",
106 "T",
107 "residualNavierStokes",
108 ],
109 ),
110 fl.SurfaceOutput(
111 surfaces=volume_mesh["*"],
112 output_format="both",
113 output_fields=[
114 "primitiveVars",
115 "Cp",
116 "Cf",
117 "CfVec",
118 "yPlus",
119 "nodeForcesPerUnitArea",
120 ],
121 ),
122 fl.SliceOutput(
123 slices=[slice_inlet, slice_outlet, slice_trailing_edge, slice_wake],
124 output_format="both",
125 output_fields=["Cp", "primitiveVars", "T", "Mach", "gradW"],
126 ),
127 ],
128 )
129
130
131project.run_case(params=params, name="Tutorial Periodic Boundary Condition from Python")
Notes#
Rotational periodicity between
periodic-1
andperiodic-2
surfaces is established usingfl.Periodic
combined withfl.Rotational
.fl.SlipWall
boundary conditions are applied to thebottomFront
andtopFront
surfaces, acting as buffer regions to improve convergence behavior near the inlet.fl.SliceOutput
is utilized to extract detailed flow field data at specified cross-sections (Inlet, Outlet, TrailingEdge, Wake) for post-processing.