Skip to content

Commit a941506

Browse files
committed
Improve perf
1 parent 1bed018 commit a941506

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

tests/test_cff.py

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ def test_cff_model(server_type, fluent_multi_species):
2020
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
2121
reason="CFF source operators where not supported before 7.0,",
2222
)
23-
@pytest.mark.parametrize(
24-
"result_name",
25-
[
23+
def test_results_cfx(cfx_heating_coil, server_type):
24+
model = dpf.Model(cfx_heating_coil(server=server_type), server=server_type)
25+
print(model)
26+
result_names = [
2627
"specific_heat",
2728
"epsilon",
2829
"enthalpy",
@@ -38,40 +39,42 @@ def test_cff_model(server_type, fluent_multi_species):
3839
"temperature",
3940
"total_temperature",
4041
"velocity",
41-
],
42-
)
43-
def test_results_cfx(cfx_heating_coil, result_name, server_type):
44-
model = dpf.Model(cfx_heating_coil(server=server_type), server=server_type)
45-
print(model)
46-
result_op = getattr(model.results, result_name)()
47-
result = result_op.eval()
48-
assert isinstance(result, dpf.FieldsContainer)
49-
result_op.connect(1000, {"phase": 2})
50-
result = result_op.eval()
51-
assert isinstance(result, dpf.FieldsContainer)
42+
]
43+
for result_name in result_names:
44+
result_op = getattr(model.results, result_name)()
45+
result = result_op.eval()
46+
assert isinstance(result, dpf.FieldsContainer)
47+
result_op.connect(1000, {"phase": 2})
48+
result = result_op.eval()
49+
assert isinstance(result, dpf.FieldsContainer)
5250

5351

5452
@pytest.mark.skipif(
5553
not conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
5654
reason="CFF source operators where not supported before 7.0,",
5755
)
58-
@pytest.mark.parametrize(
59-
"result_name",
60-
[
56+
def test_results_fluent(fluent_mixing_elbow_steady_state, server_type):
57+
model = dpf.Model(fluent_mixing_elbow_steady_state(server=server_type), server=server_type)
58+
print(model)
59+
result_names = [
60+
"epsilon",
6161
"enthalpy",
62+
"turbulent_kinetic_energy",
63+
"mach_number",
6264
"mass_flow_rate",
65+
"dynamic_viscosity",
66+
"turbulent_viscosity",
6367
"static_pressure",
6468
"surface_heat_rate",
6569
"density",
6670
"temperature",
6771
"velocity",
68-
],
69-
)
70-
def test_results_fluent(fluent_mixing_elbow_steady_state, result_name, server_type):
71-
model = dpf.Model(fluent_mixing_elbow_steady_state(server=server_type), server=server_type)
72-
result_op = getattr(model.results, result_name)()
73-
result = result_op.eval()
74-
assert isinstance(result, dpf.FieldsContainer)
75-
result_op.connect(1000, {"phase": 1})
76-
result = result_op.eval()
77-
assert isinstance(result, dpf.FieldsContainer)
72+
"y_plus",
73+
]
74+
for result_name in result_names:
75+
result_op = getattr(model.results, result_name)()
76+
result = result_op.eval()
77+
assert isinstance(result, dpf.FieldsContainer)
78+
result_op.connect(1000, {"phase": 1})
79+
result = result_op.eval()
80+
assert isinstance(result, dpf.FieldsContainer)

0 commit comments

Comments
 (0)