Note
Go to the end to download the full example code.
Fluent setup and solution using settings objects#
This example sets up and solves a three-dimensional turbulent fluid flow and heat transfer problem in a mixing elbow, which is common in piping systems in power plants and process industries. Predicting the flow field and temperature field in the area of the mixing region is important to designing the junction properly.
This example uses settings objects.
Problem description
A cold fluid at 20 deg C flows into the pipe through a large inlet. It then mixes
with a warmer fluid at 40 deg C that enters through a smaller inlet located at
the elbow. The pipe dimensions are in inches, and the fluid properties and
boundary conditions are given in SI units. Because the Reynolds number for the
flow at the larger inlet is 50, 800
, a turbulent flow model is required.
Perform required imports#
Perform required imports, which includes downloading and importing the geometry file.
import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
import_file_name = examples.download_file(
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
)
Launch Fluent#
Launch Fluent as a service in solver mode with double precision running on two processors and print Fluent version.
solver = pyfluent.launch_fluent(
precision="double",
processor_count=2,
mode="solver",
)
print(solver.get_fluent_version())
Fluent version 2025 R1
Import mesh and perform mesh check#
Import the mesh and perform a mesh check, which lists the minimum and maximum x, y, and z values from the mesh in the default SI units of meters. The mesh check also reports a number of other mesh features that are checked. Any errors in the mesh are reported. Ensure that the minimum volume is not negative because Fluent cannot begin a calculation when this is the case.
solver.file.read_case(file_name=import_file_name)
solver.mesh.check()
Fast-loading "/ansys_inc/v251/fluent/fluent25.1.0/addons/afd/lib/hdfio.bin"
Done.
Reading from b86e576fd5db:"/mnt/pyfluent/mixing_elbow.msh.h5" in NODE0 mode ...
Reading mesh ...
17822 cells, 1 cell zone ...
17822 mixed cells, zone id: 87
91581 faces, 7 face zones ...
2168 polygonal wall faces, zone id: 34
268 polygonal wall faces, zone id: 33
155 polygonal pressure-outlet faces, zone id: 32
152 polygonal velocity-inlet faces, zone id: 31
55 polygonal velocity-inlet faces, zone id: 30
2001 polygonal symmetry faces, zone id: 29
86782 mixed interior faces, zone id: 89
66417 nodes, 3 node zones ...
Building...
mesh
distributing mesh
parts..,
faces..,
nodes..,
cells..,
bandwidth reduction using Reverse Cuthill-McKee: 8663/269 = 32.2045
materials,
interface,
domains,
zones,
Skipping thread 20 of domain 1 (not referenced by grid).
Skipping thread 21 of domain 1 (not referenced by grid).
Skipping thread 22 of domain 1 (not referenced by grid).
Skipping thread 23 of domain 1 (not referenced by grid).
Skipping thread 24 of domain 1 (not referenced by grid).
Skipping thread 25 of domain 1 (not referenced by grid).
Skipping thread 26 of domain 1 (not referenced by grid).
Skipping thread 27 of domain 1 (not referenced by grid).
Skipping thread 28 of domain 1 (not referenced by grid).
wall-elbow
wall-inlet
outlet
cold-inlet
hot-inlet
symmetry-xyplane
interior--elbow-fluid
elbow-fluid
parallel,
Done.
Mesh is now scaled to meters.
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session_solver.py:309: DeprecatedSettingWarning: 'mesh' is deprecated. Use 'settings.mesh' instead.
warnings.warn(
Domain Extents:
x-coordinate: min (m) = -2.000000e-01, max (m) = 2.000000e-01
y-coordinate: min (m) = -2.250000e-01, max (m) = 2.000000e-01
z-coordinate: min (m) = 0.000000e+00, max (m) = 4.992264e-02
Volume statistics:
minimum volume (m3): 2.443789e-10
maximum volume (m3): 5.720378e-07
total volume (m3): 2.500657e-03
Face area statistics:
minimum face area (m2): 3.226185e-08
maximum face area (m2): 7.873458e-05
Checking mesh.....................................
Done.
Note: Settings to improve the robustness of pathline and
particle tracking have been automatically enabled.
Enable heat transfer#
Enable heat transfer by activating the energy equation.
solver.setup.models.energy.enabled = True
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session_solver.py:309: DeprecatedSettingWarning: 'setup' is deprecated. Use 'settings.setup' instead.
warnings.warn(
Create material#
Create a material named "water-liquid"
.
solver.setup.materials.database.copy_by_name(type="fluid", name="water-liquid")
Set up cell zone conditions#
Set up the cell zone conditions for the fluid zone (elbow-fluid
). Set material
to "water-liquid"
.
solver.setup.cell_zone_conditions.fluid["elbow-fluid"].general.material = "water-liquid"
Set up boundary conditions for CFD analysis#
Set up the boundary conditions for the inlets, outlet, and walls for CFD analysis.
# cold inlet (cold-inlet), Setting: Value:
# Velocity Specification Method: Magnitude, Normal to Boundary
# Velocity Magnitude: 0.4 [m/s]
# Specification Method: Intensity and Hydraulic Diameter
# Turbulent Intensity: 5 [%]
# Hydraulic Diameter: 4 [inch]
# Temperature: 293.15 [K]
cold_inlet = solver.setup.boundary_conditions.velocity_inlet["cold-inlet"]
cold_inlet.momentum.velocity.value = 0.4
cold_inlet.turbulence.turbulence_specification = "Intensity and Hydraulic Diameter"
cold_inlet.turbulence.turbulent_intensity = 0.05
cold_inlet.turbulence.hydraulic_diameter = "4 [in]"
cold_inlet.thermal.temperature.value = 293.15
# hot inlet (hot-inlet), Setting: Value:
# Velocity Specification Method: Magnitude, Normal to Boundary
# Velocity Magnitude: 1.2 [m/s]
# Specification Method: Intensity and Hydraulic Diameter
# Turbulent Intensity: 5 [%]
# Hydraulic Diameter: 1 [inch]
# Temperature: 313.15 [K]
hot_inlet = solver.setup.boundary_conditions.velocity_inlet["hot-inlet"]
hot_inlet.momentum.velocity.value = 1.2
hot_inlet.turbulence.turbulence_specification = "Intensity and Hydraulic Diameter"
hot_inlet.turbulence.hydraulic_diameter = "1 [in]"
hot_inlet.thermal.temperature.value = 313.15
# pressure outlet (outlet), Setting: Value:
# Backflow Turbulent Intensity: 5 [%]
# Backflow Turbulent Viscosity Ratio: 4
solver.setup.boundary_conditions.pressure_outlet[
"outlet"
].turbulence.turbulent_viscosity_ratio = 4
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/solver/flobject.py:637: DeprecatedSettingWarning: Note: A newer syntax is available to perform the last operation:
solver.settings.setup.boundary_conditions.velocity_inlet['cold-inlet'].momentum.velocity_magnitude.value = 0.4
warnings.warn(
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/solver/flobject.py:637: DeprecatedSettingWarning: Note: A newer syntax is available to perform the last operation:
solver.settings.setup.boundary_conditions.velocity_inlet['hot-inlet'].momentum.velocity_magnitude.value = 1.2
warnings.warn(
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/solver/flobject.py:637: DeprecatedSettingWarning: Note: A newer syntax is available to perform the last operation:
solver.settings.setup.boundary_conditions.pressure_outlet['outlet'].turbulence.backflow_turbulent_viscosity_ratio = 4
warnings.warn(
Initialize flow field#
Initialize the flow field using hybrid initialization.
solver.solution.initialization.hybrid_initialize()
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session_solver.py:309: DeprecatedSettingWarning: 'solution' is deprecated. Use 'settings.solution' instead.
warnings.warn(
Initialize using the hybrid initialization method.
Checking case topology...
-This case has both inlets & outlets
-Pressure information is not available at the boundaries.
Case will be initialized with constant pressure
iter scalar-0
1 1.000000e+00
2 1.760484e-04
3 1.013953e-05
4 8.441202e-06
5 1.691978e-06
6 1.891713e-06
7 3.419223e-07
8 3.569689e-07
9 7.704952e-08
10 6.985953e-08
Hybrid initialization is done.
Solve for 150 iterations#
Solve for 150 iterations.
solver.solution.run_calculation.iterate(iter_count=150)
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
1 1.0000e+00 4.1137e-03 4.5135e-03 1.1470e-03 8.6260e-05 9.7773e-02 7.0019e-01 0:00:38 149
2 8.0706e-01 2.5009e-03 3.0803e-03 7.0656e-04 9.9885e-05 5.4827e-02 9.5985e-02 0:00:39 148
3 7.7291e-01 1.5846e-03 2.2853e-03 6.0104e-04 1.0722e-04 2.0138e-02 6.1335e-02 0:00:38 147
4 7.3642e-01 1.0610e-03 1.9724e-03 4.9261e-04 1.1654e-04 1.7333e-02 3.9000e-02 0:00:37 146
5 7.0213e-01 9.0281e-04 1.8307e-03 4.2867e-04 1.2262e-04 1.6101e-02 2.6758e-02 0:00:37 145
6 6.4444e-01 8.5863e-04 1.7234e-03 3.8950e-04 1.2520e-04 1.5875e-02 2.0554e-02 0:00:37 144
7 5.8333e-01 8.0740e-04 1.6552e-03 3.6043e-04 1.2442e-04 1.6170e-02 1.7209e-02 0:00:37 143
8 5.3205e-01 7.5269e-04 1.5867e-03 3.3514e-04 1.2120e-04 1.6910e-02 1.4512e-02 0:00:37 142
9 4.8715e-01 7.0896e-04 1.5259e-03 3.1545e-04 1.1522e-04 1.7722e-02 1.2434e-02 0:00:37 141
10 4.5293e-01 6.7765e-04 1.4539e-03 2.9879e-04 1.0747e-04 1.8164e-02 1.0718e-02 0:00:36 140
11 4.1897e-01 6.4653e-04 1.3728e-03 2.8431e-04 9.7760e-05 1.8130e-02 9.3410e-03 0:00:36 139
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
12 3.8883e-01 6.1527e-04 1.2853e-03 2.7025e-04 8.6984e-05 1.7642e-02 8.2261e-03 0:00:35 138
13 3.6226e-01 5.8432e-04 1.1943e-03 2.5733e-04 7.5582e-05 1.6717e-02 7.3012e-03 0:00:35 137
14 3.3802e-01 5.5438e-04 1.0986e-03 2.4460e-04 6.4139e-05 1.5509e-02 6.5109e-03 0:00:35 136
15 3.1424e-01 5.2432e-04 1.0064e-03 2.3252e-04 5.4545e-05 1.4076e-02 5.7978e-03 0:00:35 135
16 2.9476e-01 4.9676e-04 9.1141e-04 2.2153e-04 4.7612e-05 1.2556e-02 5.1504e-03 0:00:35 134
17 2.7697e-01 4.6816e-04 8.2524e-04 2.1132e-04 4.2943e-05 1.1026e-02 4.5648e-03 0:00:34 133
18 2.6377e-01 4.4056e-04 7.4780e-04 2.0247e-04 3.9755e-05 9.5800e-03 4.0308e-03 0:00:34 132
19 2.5043e-01 4.1216e-04 6.7833e-04 1.9375e-04 3.6966e-05 8.2511e-03 3.5733e-03 0:00:34 131
20 2.3695e-01 3.8418e-04 6.2052e-04 1.8609e-04 3.3618e-05 7.0595e-03 3.1976e-03 0:00:34 130
21 2.2540e-01 3.5678e-04 5.7224e-04 1.7870e-04 3.0111e-05 6.0160e-03 2.8894e-03 0:00:34 129
22 2.1433e-01 3.3054e-04 5.3433e-04 1.7154e-04 2.6643e-05 5.0729e-03 2.6153e-03 0:00:34 128
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
23 2.0254e-01 3.0613e-04 5.0351e-04 1.6475e-04 2.3428e-05 4.2770e-03 2.3740e-03 0:00:33 127
24 1.9191e-01 2.8347e-04 4.7802e-04 1.5806e-04 2.0375e-05 3.6407e-03 2.1714e-03 0:00:33 126
25 1.8165e-01 2.6252e-04 4.5502e-04 1.5101e-04 1.7636e-05 3.1590e-03 1.9927e-03 0:00:33 125
26 1.7177e-01 2.4341e-04 4.3377e-04 1.4337e-04 1.5218e-05 2.7781e-03 1.8309e-03 0:00:33 124
27 1.6250e-01 2.2558e-04 4.1298e-04 1.3525e-04 1.3120e-05 2.4622e-03 1.6805e-03 0:00:32 123
28 1.5278e-01 2.0865e-04 3.9102e-04 1.2748e-04 1.1329e-05 2.2036e-03 1.5438e-03 0:00:32 122
29 1.4348e-01 1.9274e-04 3.6853e-04 1.1958e-04 9.8022e-06 1.9819e-03 1.4179e-03 0:00:32 121
30 1.3496e-01 1.7783e-04 3.4553e-04 1.1150e-04 8.4926e-06 1.8074e-03 1.3060e-03 0:00:31 120
31 1.2590e-01 1.6373e-04 3.2296e-04 1.0337e-04 7.3776e-06 1.6585e-03 1.2069e-03 0:00:31 119
32 1.1759e-01 1.5013e-04 3.0055e-04 9.5403e-05 6.4365e-06 1.5322e-03 1.1217e-03 0:00:31 118
33 1.1005e-01 1.3762e-04 2.7940e-04 8.7813e-05 5.6291e-06 1.4191e-03 1.0419e-03 0:00:31 117
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
34 1.0179e-01 1.2602e-04 2.5955e-04 8.0574e-05 4.9423e-06 1.3187e-03 9.6623e-04 0:00:30 116
35 9.4383e-02 1.1537e-04 2.4100e-04 7.3866e-05 4.3635e-06 1.2279e-03 8.9948e-04 0:00:30 115
36 8.8543e-02 1.0558e-04 2.2372e-04 6.7736e-05 3.8692e-06 1.1435e-03 8.3755e-04 0:00:30 114
37 8.2167e-02 9.6458e-05 2.0738e-04 6.2118e-05 3.4418e-06 1.0677e-03 7.7989e-04 0:00:30 113
38 7.6543e-02 8.8114e-05 1.9182e-04 5.6965e-05 3.0744e-06 9.9614e-04 7.2530e-04 0:00:30 112
39 7.0960e-02 8.0424e-05 1.7714e-04 5.2236e-05 2.7589e-06 9.3285e-04 6.7294e-04 0:00:29 111
40 6.5844e-02 7.3407e-05 1.6401e-04 4.7860e-05 2.4855e-06 8.7496e-04 6.2489e-04 0:00:29 110
41 6.1125e-02 6.6999e-05 1.5161e-04 4.3824e-05 2.2495e-06 8.2006e-04 5.8050e-04 0:00:29 109
42 5.6658e-02 6.1184e-05 1.4008e-04 4.0115e-05 2.0442e-06 7.6780e-04 5.3919e-04 0:00:28 108
43 5.2723e-02 5.5885e-05 1.2935e-04 3.6757e-05 1.8629e-06 7.1786e-04 4.9900e-04 0:00:28 107
44 4.8974e-02 5.1057e-05 1.1939e-04 3.3711e-05 1.7002e-06 6.7017e-04 4.6105e-04 0:00:28 106
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
45 4.5254e-02 4.6631e-05 1.1042e-04 3.0949e-05 1.5545e-06 6.2608e-04 4.2769e-04 0:00:28 105
46 4.2320e-02 4.2588e-05 1.0200e-04 2.8455e-05 1.4254e-06 5.8546e-04 3.9493e-04 0:00:27 104
47 3.8978e-02 3.8961e-05 9.4173e-05 2.6155e-05 1.3087e-06 5.4542e-04 3.6352e-04 0:00:27 103
48 3.5982e-02 3.5556e-05 8.6947e-05 2.4035e-05 1.2021e-06 5.0880e-04 3.3661e-04 0:00:27 102
49 3.4029e-02 3.2586e-05 8.0465e-05 2.2112e-05 1.1055e-06 4.7301e-04 3.1079e-04 0:00:27 101
50 3.1407e-02 2.9825e-05 7.4274e-05 2.0340e-05 1.0175e-06 4.3832e-04 2.8606e-04 0:00:26 100
51 2.8907e-02 2.7301e-05 6.8277e-05 1.8709e-05 9.3610e-07 4.0455e-04 2.6442e-04 0:00:26 99
52 2.7153e-02 2.5041e-05 6.2727e-05 1.7228e-05 8.6175e-07 3.7226e-04 2.4271e-04 0:00:26 98
53 2.4803e-02 2.2924e-05 5.7506e-05 1.5834e-05 7.9334e-07 3.4164e-04 2.2129e-04 0:00:25 97
54 2.2674e-02 2.0958e-05 5.2709e-05 1.4554e-05 7.2973e-07 3.1345e-04 2.0339e-04 0:00:25 96
55 2.1402e-02 1.9211e-05 4.8321e-05 1.3401e-05 6.7138e-07 2.8687e-04 1.8580e-04 0:00:25 95
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
56 1.9471e-02 1.7566e-05 4.4106e-05 1.2317e-05 6.1701e-07 2.6162e-04 1.6879e-04 0:00:24 94
57 1.7761e-02 1.6048e-05 4.0316e-05 1.1316e-05 5.6564e-07 2.3900e-04 1.5503e-04 0:00:24 93
58 1.6877e-02 1.4716e-05 3.6900e-05 1.0422e-05 5.1833e-07 2.1830e-04 1.4141e-04 0:00:24 92
59 1.5294e-02 1.3464e-05 3.3685e-05 9.5850e-06 4.7453e-07 1.9873e-04 1.2806e-04 0:00:24 91
60 1.3865e-02 1.2284e-05 3.0782e-05 8.8112e-06 4.3289e-07 1.8105e-04 1.1760e-04 0:00:27 90
61 1.3258e-02 1.1256e-05 2.8191e-05 8.1246e-06 3.9486e-07 1.6529e-04 1.0707e-04 0:00:26 89
62 1.1944e-02 1.0282e-05 2.5695e-05 7.4728e-06 3.6004e-07 1.5059e-04 9.6591e-05 0:00:25 88
63 1.0755e-02 9.3704e-06 2.3413e-05 6.8668e-06 3.2693e-07 1.3775e-04 8.8959e-05 0:00:24 87
64 1.0390e-02 8.5879e-06 2.1383e-05 6.3259e-06 2.9702e-07 1.2577e-04 8.1042e-05 0:00:24 86
65 9.3161e-03 7.8331e-06 1.9415e-05 5.8060e-06 2.6967e-07 1.1424e-04 7.2831e-05 0:00:23 85
66 8.3444e-03 7.1205e-06 1.7633e-05 5.3219e-06 2.4363e-07 1.0430e-04 6.7236e-05 0:00:22 84
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
67 8.1789e-03 6.5250e-06 1.6074e-05 4.8928e-06 2.2063e-07 9.5188e-05 6.1137e-05 0:00:22 83
68 7.2793e-03 5.9427e-06 1.4547e-05 4.4752e-06 1.9957e-07 8.6336e-05 5.4511e-05 0:00:22 82
69 6.4612e-03 5.3886e-06 1.3178e-05 4.0859e-06 1.7950e-07 7.8668e-05 5.0468e-05 0:00:21 81
70 6.4329e-03 4.9388e-06 1.1999e-05 3.7487e-06 1.6208e-07 7.1596e-05 4.5889e-05 0:00:21 80
71 5.6655e-03 4.4924e-06 1.0830e-05 3.4185e-06 1.4591e-07 6.4585e-05 4.0552e-05 0:00:21 79
72 4.9793e-03 4.0615e-06 9.7859e-06 3.1108e-06 1.3042e-07 5.8636e-05 3.7700e-05 0:00:21 78
73 5.0816e-03 3.7245e-06 8.9126e-06 2.8504e-06 1.1738e-07 5.3211e-05 3.4252e-05 0:00:20 77
74 4.4284e-03 3.3782e-06 8.0184e-06 2.5923e-06 1.0514e-07 4.7749e-05 2.9912e-05 0:00:20 76
75 3.8410e-03 3.0406e-06 7.2209e-06 2.3507e-06 9.3429e-08 4.3278e-05 2.8015e-05 0:00:20 75
76 4.0346e-03 2.7918e-06 6.5729e-06 2.1510e-06 8.4113e-08 3.9259e-05 2.5482e-05 0:00:19 74
77 3.4681e-03 2.5276e-06 5.8905e-06 1.9500e-06 7.4993e-08 3.5044e-05 2.1917e-05 0:00:19 73
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
78 2.9600e-03 2.2641e-06 5.2865e-06 1.7602e-06 6.6164e-08 3.1709e-05 2.0775e-05 0:00:19 72
79 3.2280e-03 2.0843e-06 4.8194e-06 1.6094e-06 5.9193e-08 2.8534e-05 1.8900e-05 0:00:18 71
80 2.7362e-03 1.8828e-06 4.3160e-06 1.4566e-06 5.2306e-08 2.5189e-05 1.5909e-05 0:00:18 70
81 2.2863e-03 1.6846e-06 3.8623e-06 1.3152e-06 4.6409e-08 2.2613e-05 1.3874e-05 0:00:18 69
82 1.9831e-03 1.5263e-06 3.4628e-06 1.1873e-06 4.1148e-08 2.0553e-05 1.4355e-05 0:00:18 68
83 2.5628e-03 1.4299e-06 3.2003e-06 1.0940e-06 3.8327e-08 1.8643e-05 1.3435e-05 0:00:17 67
84 2.0326e-03 1.2890e-06 2.8459e-06 9.8825e-07 3.3903e-08 1.6236e-05 1.0903e-05 0:00:17 66
85 1.6302e-03 1.1379e-06 2.5205e-06 8.8315e-07 2.8383e-08 1.4602e-05 1.0542e-05 0:00:16 65
86 2.0459e-03 1.0618e-06 2.3112e-06 8.0659e-07 2.5546e-08 1.3211e-05 9.8948e-06 0:00:16 64
87 1.6602e-03 9.5826e-07 2.0617e-06 7.3105e-07 2.2773e-08 1.1423e-05 7.9334e-06 0:00:16 63
88 1.3137e-03 8.4199e-07 1.8281e-06 6.5241e-07 1.9950e-08 1.0099e-05 6.7127e-06 0:00:15 62
iter continuity x-velocity y-velocity z-velocity energy k omega time/iter
89 1.1031e-03 7.5453e-07 1.6333e-06 5.8518e-07 1.8090e-08 9.3134e-06 7.9844e-06 0:00:15 61
90 1.7555e-03 7.2942e-07 1.5613e-06 5.4773e-07 1.8162e-08 8.6192e-06 7.7567e-06 0:00:15 60
91 1.2963e-03 6.5504e-07 1.3720e-06 4.9265e-07 1.6348e-08 7.3011e-06 5.8535e-06 0:00:20 59
92 9.6489e-04 5.6422e-07 1.1975e-06 4.3220e-07 1.2993e-08 6.5557e-06 6.0142e-06 0:00:19 58
! 92 solution is converged
Configure graphics picture export#
Since Fluent is being run without the GUI, we will need to export plots as picture files. Edit the picture settings to use a custom resolution so that the images are large enough.
graphics = solver.results.graphics
# use_window_resolution option not active inside containers or Ansys Lab environment
if graphics.picture.use_window_resolution.is_active():
graphics.picture.use_window_resolution = False
graphics.picture.x_resolution = 1920
graphics.picture.y_resolution = 1440
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session_solver.py:309: DeprecatedSettingWarning: 'results' is deprecated. Use 'settings.results' instead.
warnings.warn(
Create velocity vectors#
Create and display velocity vectors on the symmetry-xyplane
plane, then
export the image for inspection.
graphics = solver.results.graphics
graphics.vector["velocity_vector_symmetry"] = {}
velocity_symmetry = solver.results.graphics.vector["velocity_vector_symmetry"]
velocity_symmetry.print_state()
velocity_symmetry.field = "velocity-magnitude"
velocity_symmetry.surfaces_list = [
"symmetry-xyplane",
]
velocity_symmetry.scale.scale_f = 4
velocity_symmetry.style = "arrow"
velocity_symmetry.display()
graphics.views.restore_view(view_name="front")
graphics.views.auto_scale()
graphics.picture.save_picture(file_name="velocity_vector_symmetry.png")
name : velocity_vector_symmetry
vector_field : velocity
field : velocity-magnitude
range_option :
option : auto-range-on
auto_range_on :
global_range : True
range_options :
global_range : True
auto_range : True
clip_to_range : False
minimum : 0.0
maximum : 0.0
options :
auto_scale : True
vector_style : 3d arrow
scale : 1
skip : 0
scale :
auto_scale : True
scale_f : 1
style : 3d arrow
skip : 0
vector_opt :
in_plane : False
fixed_length : False
x_comp : True
y_comp : True
z_comp : True
scale_head : 0.3
tessellation : 24
color :
color_map :
visible : True
color : field-velocity
size : 100
log_scale : False
format : %0.2e
user_skip : 9
show_all : True
position : 1
font_name : Helvetica
font_automatic : True
font_size : 0.032
length : 0.65
width : 6.0
bground_transparent : True
bground_color : #CCD3E2
title_elements : Variable and Object Name
display_state_name : None
Compute mass flow rate#
Compute the mass flow rate.
solver.solution.report_definitions.flux["mass_flow_rate"] = {}
mass_flow_rate = solver.solution.report_definitions.flux["mass_flow_rate"]
mass_flow_rate.boundaries.allowed_values()
mass_flow_rate.boundaries = [
"cold-inlet",
"hot-inlet",
"outlet",
]
mass_flow_rate.print_state()
solver.solution.report_definitions.compute(report_defs=["mass_flow_rate"])
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session_solver.py:309: DeprecatedSettingWarning: 'solution' is deprecated. Use 'settings.solution' instead.
warnings.warn(
name : mass_flow_rate
report_type : flux-massflow
boundaries :
0 : cold-inlet
1 : hot-inlet
2 : outlet
per_zone : False
average_over : 1
retain_instantaneous_values : False
output_parameter : False
Close Fluent#
Close Fluent.
solver.exit()
Mass Flow Rate [kg/s]
-------------------------------- -------------------
mass_flow_rate -1.1143173e-05
Total running time of the script: (1 minutes 24.709 seconds)