Skip to content

Commit 02c4ff5

Browse files
authored
Fix settings API examples for 23.1 (#761)
1 parent 301fda5 commit 02c4ff5

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

examples/00-fluent/mixing_elbow_settings_api.py

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@
7272
# ~~~~~~~~~~~~~~~
7373
# Create a material named ``"water-liquid"``.
7474

75-
solver.setup.materials.copy_database_material_by_name(type="fluid", name="water-liquid")
75+
if solver.get_fluent_version() == "22.2.0":
76+
solver.setup.materials.copy_database_material_by_name(
77+
type="fluid", name="water-liquid"
78+
)
79+
else:
80+
solver.setup.materials.database.copy_by_name(type="fluid", name="water-liquid")
7681

7782
###############################################################################
7883
# Set up cell zone conditions
@@ -96,21 +101,27 @@
96101
# Hydraulic Diameter: 4 [inch]
97102
# Temperature: 293.15 [K]
98103

99-
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].vmag = {
100-
"option": "constant or expression",
101-
"constant": 0.4,
102-
}
104+
if solver.get_fluent_version() == "22.2.0":
105+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].vmag = {
106+
"option": "constant or expression",
107+
"constant": 0.4,
108+
}
109+
else:
110+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].vmag = 0.4
103111
solver.setup.boundary_conditions.velocity_inlet[
104112
"cold-inlet"
105113
].ke_spec = "Intensity and Hydraulic Diameter"
106-
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].turb_intensity = 5
114+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].turb_intensity = 0.05
107115
solver.setup.boundary_conditions.velocity_inlet[
108116
"cold-inlet"
109117
].turb_hydraulic_diam = "4 [in]"
110-
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].t = {
111-
"option": "constant or expression",
112-
"constant": 293.15,
113-
}
118+
if solver.get_fluent_version() == "22.2.0":
119+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].t = {
120+
"option": "constant or expression",
121+
"constant": 293.15,
122+
}
123+
else:
124+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].t = 293.15
114125

115126
# hot inlet (hot-inlet), Setting: Value:
116127
# Velocity Specification Method: Magnitude, Normal to Boundary
@@ -120,20 +131,26 @@
120131
# Hydraulic Diameter: 1 [inch]
121132
# Temperature: 313.15 [K]
122133

123-
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].vmag = {
124-
"option": "constant or expression",
125-
"constant": 1.2,
126-
}
134+
if solver.get_fluent_version() == "22.2.0":
135+
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].vmag = {
136+
"option": "constant or expression",
137+
"constant": 1.2,
138+
}
139+
else:
140+
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].vmag = 1.2
127141
solver.setup.boundary_conditions.velocity_inlet[
128142
"hot-inlet"
129143
].ke_spec = "Intensity and Hydraulic Diameter"
130144
solver.setup.boundary_conditions.velocity_inlet[
131145
"hot-inlet"
132146
].turb_hydraulic_diam = "1 [in]"
133-
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].t = {
134-
"option": "constant or expression",
135-
"constant": 313.15,
136-
}
147+
if solver.get_fluent_version() == "22.2.0":
148+
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].t = {
149+
"option": "constant or expression",
150+
"constant": 313.15,
151+
}
152+
else:
153+
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].t = 313.15
137154

138155
# pressure outlet (outlet), Setting: Value:
139156
# Backflow Turbulent Intensity: 5 [%]

0 commit comments

Comments
 (0)