ansys-fluent-core 0.20.dev9__py3-none-any.whl → 0.20.dev10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansys-fluent-core might be problematic. Click here for more details.
- ansys/fluent/core/__init__.py +1 -1
- ansys/fluent/core/_version.py +1 -1
- ansys/fluent/core/data/api_tree_231.pickle +0 -0
- ansys/fluent/core/data/api_tree_232.pickle +0 -0
- ansys/fluent/core/data/api_tree_241.pickle +0 -0
- ansys/fluent/core/data/api_tree_242.pickle +0 -0
- ansys/fluent/core/fluent_connection.py +5 -5
- ansys/fluent/core/launcher/standalone_launcher.py +1 -1
- ansys/fluent/core/meshing/tui_231.py +6497 -6497
- ansys/fluent/core/meshing/tui_232.py +7573 -7573
- ansys/fluent/core/meshing/tui_241.py +7803 -7803
- ansys/fluent/core/meshing/tui_242.py +8059 -8059
- ansys/fluent/core/session.py +12 -12
- ansys/fluent/core/session_meshing.py +1 -1
- ansys/fluent/core/session_pure_meshing.py +1 -1
- ansys/fluent/core/session_solver.py +5 -5
- ansys/fluent/core/session_solver_lite.py +1 -1
- ansys/fluent/core/solver/flobject.py +57 -52
- ansys/fluent/core/solver/settings_242/__init__.py +1 -1
- ansys/fluent/core/solver/settings_242/plane_surface_child.py +1 -1
- ansys/fluent/core/solver/tui_231.py +35045 -34364
- ansys/fluent/core/solver/tui_232.py +26365 -26365
- ansys/fluent/core/solver/tui_241.py +28076 -28076
- ansys/fluent/core/solver/tui_242.py +29096 -29096
- ansys/fluent/core/systemcoupling.py +1 -1
- ansys/fluent/core/utils/setup_for_fluent.py +1 -1
- ansys/fluent/core/workflow.py +4 -4
- ansys/fluent/tests/test_field_data.py +16 -0
- ansys/fluent/tests/test_flobject.py +6 -1
- ansys/fluent/tests/test_fluent_session.py +4 -4
- ansys/fluent/tests/test_launcher_remote.py +9 -7
- ansys/fluent/tests/test_reduction.py +36 -25
- ansys/fluent/tests/test_session.py +6 -6
- ansys/fluent/tests/test_settings_api.py +49 -12
- ansys/fluent/tests/test_solution_variables.py +17 -0
- {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/METADATA +2 -2
- {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/RECORD +39 -39
- {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/LICENSE +0 -0
- {ansys_fluent_core-0.20.dev9.dist-info → ansys_fluent_core-0.20.dev10.dist-info}/WHEEL +0 -0
|
@@ -90,7 +90,7 @@ class SystemCoupling:
|
|
|
90
90
|
)
|
|
91
91
|
|
|
92
92
|
# download the file locally in case Fluent is in a container
|
|
93
|
-
if self._solver.
|
|
93
|
+
if self._solver._fluent_connection._remote_instance != None:
|
|
94
94
|
self._solver.download(scp_file_name)
|
|
95
95
|
|
|
96
96
|
assert os.path.exists(
|
|
@@ -12,7 +12,7 @@ def setup_for_fluent(*args, **kwargs):
|
|
|
12
12
|
globals["meshing"] = session
|
|
13
13
|
globals["PartManagement"] = session.PartManagement
|
|
14
14
|
globals["PMFileManagement"] = session.PMFileManagement
|
|
15
|
-
globals["solver"] = Solver(fluent_connection=session.
|
|
15
|
+
globals["solver"] = Solver(fluent_connection=session._fluent_connection)
|
|
16
16
|
else:
|
|
17
17
|
globals["solver"] = session
|
|
18
18
|
|
ansys/fluent/core/workflow.py
CHANGED
|
@@ -349,7 +349,7 @@ class BaseTask:
|
|
|
349
349
|
camel_attr = snake_to_camel_case(
|
|
350
350
|
str(attr), [*self._get_camel_case_arg_keys(), *dir(self._task)]
|
|
351
351
|
)
|
|
352
|
-
attr = camel_attr
|
|
352
|
+
attr = camel_attr or attr
|
|
353
353
|
try:
|
|
354
354
|
result = getattr(self._task, attr)
|
|
355
355
|
if result:
|
|
@@ -706,7 +706,7 @@ class ArgumentWrapper(PyCallableStateObject):
|
|
|
706
706
|
f"Try using '{camel_to_snake_case(attr)}' instead."
|
|
707
707
|
)
|
|
708
708
|
camel_attr = snake_to_camel_case(str(attr), self._get_camel_case_arg_keys())
|
|
709
|
-
attr = camel_attr
|
|
709
|
+
attr = camel_attr or attr
|
|
710
710
|
return getattr(self._arg, attr)
|
|
711
711
|
|
|
712
712
|
def __setattr__(self, attr, value):
|
|
@@ -717,7 +717,7 @@ class ArgumentWrapper(PyCallableStateObject):
|
|
|
717
717
|
camel_attr = snake_to_camel_case(
|
|
718
718
|
str(attr), self._get_camel_case_arg_keys()
|
|
719
719
|
)
|
|
720
|
-
attr = camel_attr
|
|
720
|
+
attr = camel_attr or attr
|
|
721
721
|
self.set_state({attr: value})
|
|
722
722
|
|
|
723
723
|
def __dir__(self):
|
|
@@ -1185,7 +1185,7 @@ class Workflow:
|
|
|
1185
1185
|
f"Try using '{camel_to_snake_case(attr)}' instead."
|
|
1186
1186
|
)
|
|
1187
1187
|
camel_attr = snake_to_camel_case(str(attr), dir(self._workflow))
|
|
1188
|
-
attr = camel_attr
|
|
1188
|
+
attr = camel_attr or attr
|
|
1189
1189
|
obj = self._attr_from_wrapped_workflow(attr)
|
|
1190
1190
|
if obj:
|
|
1191
1191
|
return obj
|
|
@@ -3,6 +3,7 @@ import pytest
|
|
|
3
3
|
from util.solver_workflow import new_solver_session # noqa: F401
|
|
4
4
|
|
|
5
5
|
from ansys.fluent.core import examples
|
|
6
|
+
from ansys.fluent.core.examples.downloads import download_file
|
|
6
7
|
from ansys.fluent.core.exceptions import DisallowedValuesError
|
|
7
8
|
from ansys.fluent.core.services.field_data import FieldUnavailable, SurfaceDataType
|
|
8
9
|
|
|
@@ -369,3 +370,18 @@ def test_field_info_validators(new_solver_session) -> None:
|
|
|
369
370
|
|
|
370
371
|
with pytest.raises(DisallowedValuesError) as surface_error:
|
|
371
372
|
solver.fields.field_info.validate_surfaces(["out"])
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/2404")
|
|
376
|
+
@pytest.mark.fluent_version(">=24.2")
|
|
377
|
+
def test_field_data_does_not_modify_case(new_solver_session):
|
|
378
|
+
solver = new_solver_session
|
|
379
|
+
case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
|
|
380
|
+
download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
381
|
+
solver.file.read_case_data(file_name=case_path)
|
|
382
|
+
solver.scheme_eval.scheme_eval("(%save-case-id)")
|
|
383
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
384
|
+
solver.field_data.get_scalar_field_data(
|
|
385
|
+
field_name="absolute-pressure", surface_name="cold-inlet"
|
|
386
|
+
)
|
|
387
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
@@ -38,6 +38,7 @@ class Setting:
|
|
|
38
38
|
|
|
39
39
|
attrs = {
|
|
40
40
|
"active?": lambda self: True,
|
|
41
|
+
"webui-release-active?": lambda self: True,
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
|
|
@@ -294,6 +295,7 @@ class Root(Group):
|
|
|
294
295
|
attrs = {
|
|
295
296
|
"active?": lambda self: not self.parent.objs["b-3"].get_state(),
|
|
296
297
|
"allowed-values": lambda self: ["foo", "bar"],
|
|
298
|
+
"webui-release-active?": lambda self: True,
|
|
297
299
|
}
|
|
298
300
|
|
|
299
301
|
children = {
|
|
@@ -365,7 +367,10 @@ class Proxy:
|
|
|
365
367
|
return self.r
|
|
366
368
|
obj = self.r
|
|
367
369
|
for c in path.split("/"):
|
|
368
|
-
|
|
370
|
+
try:
|
|
371
|
+
obj = obj.get_child(c)
|
|
372
|
+
except KeyError:
|
|
373
|
+
obj = obj.get_command(c)
|
|
369
374
|
return obj
|
|
370
375
|
|
|
371
376
|
def get_var(self, path):
|
|
@@ -214,7 +214,7 @@ def test_fluent_freeze_kill(
|
|
|
214
214
|
else:
|
|
215
215
|
raise Exception("Test should have temporarily frozen Fluent, but did not.")
|
|
216
216
|
|
|
217
|
-
assert session.
|
|
217
|
+
assert session._fluent_connection.wait_process_finished(wait=5)
|
|
218
218
|
|
|
219
219
|
|
|
220
220
|
@pytest.mark.fluent_version(">=23.1")
|
|
@@ -254,15 +254,15 @@ def test_fluent_exit(monkeypatch: pytest.MonkeyPatch):
|
|
|
254
254
|
def test_fluent_exit_wait():
|
|
255
255
|
session1 = pyfluent.launch_fluent()
|
|
256
256
|
session1.exit()
|
|
257
|
-
assert not session1.
|
|
257
|
+
assert not session1._fluent_connection.wait_process_finished(wait=0)
|
|
258
258
|
|
|
259
259
|
session2 = pyfluent.launch_fluent()
|
|
260
260
|
session2.exit(wait=60)
|
|
261
|
-
assert session2.
|
|
261
|
+
assert session2._fluent_connection.wait_process_finished(wait=0)
|
|
262
262
|
|
|
263
263
|
session3 = pyfluent.launch_fluent()
|
|
264
264
|
session3.exit(wait=True)
|
|
265
|
-
assert session3.
|
|
265
|
+
assert session3._fluent_connection.wait_process_finished(wait=0)
|
|
266
266
|
|
|
267
267
|
with pytest.raises(WaitTypeError) as msg:
|
|
268
268
|
session4 = pyfluent.launch_fluent()
|
|
@@ -39,11 +39,13 @@ def test_launch_remote_instance(monkeypatch, new_solver_session):
|
|
|
39
39
|
ready=True,
|
|
40
40
|
status_message=None,
|
|
41
41
|
services={
|
|
42
|
-
"grpc": pypim.Service(
|
|
42
|
+
"grpc": pypim.Service(
|
|
43
|
+
uri=fluent._fluent_connection._channel_str, headers={}
|
|
44
|
+
)
|
|
43
45
|
},
|
|
44
46
|
)
|
|
45
47
|
pim_channel = grpc.insecure_channel(
|
|
46
|
-
fluent.
|
|
48
|
+
fluent._fluent_connection._channel_str,
|
|
47
49
|
)
|
|
48
50
|
mock_instance.wait_for_ready = create_autospec(mock_instance.wait_for_ready)
|
|
49
51
|
mock_instance.build_grpc_channel = create_autospec(
|
|
@@ -82,10 +84,10 @@ def test_launch_remote_instance(monkeypatch, new_solver_session):
|
|
|
82
84
|
mock_instance.build_grpc_channel.assert_called_with()
|
|
83
85
|
|
|
84
86
|
# And it connected using the channel created by PyPIM
|
|
85
|
-
assert fluent.
|
|
87
|
+
assert fluent._fluent_connection._channel == pim_channel
|
|
86
88
|
|
|
87
89
|
# and it kept track of the instance to be able to delete it
|
|
88
|
-
assert fluent.
|
|
90
|
+
assert fluent._fluent_connection._remote_instance == mock_instance
|
|
89
91
|
|
|
90
92
|
server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
|
|
91
93
|
ip = "127.0.0.1"
|
|
@@ -108,7 +110,7 @@ def test_launch_remote_instance(monkeypatch, new_solver_session):
|
|
|
108
110
|
)
|
|
109
111
|
)
|
|
110
112
|
session.exit(wait=60)
|
|
111
|
-
session.
|
|
113
|
+
session._fluent_connection.wait_process_finished(wait=60)
|
|
112
114
|
|
|
113
115
|
|
|
114
116
|
class TransferRequestRecorder:
|
|
@@ -141,7 +143,7 @@ def test_file_purpose_on_remote_instance(
|
|
|
141
143
|
file_service = TransferRequestRecorder()
|
|
142
144
|
|
|
143
145
|
solver_session = Solver(
|
|
144
|
-
fluent_connection=solver.
|
|
146
|
+
fluent_connection=solver._fluent_connection,
|
|
145
147
|
file_transfer_service=file_service,
|
|
146
148
|
)
|
|
147
149
|
|
|
@@ -156,7 +158,7 @@ def test_file_purpose_on_remote_instance(
|
|
|
156
158
|
meshing = new_mesh_session
|
|
157
159
|
|
|
158
160
|
meshing_session = PureMeshing(
|
|
159
|
-
fluent_connection=meshing.
|
|
161
|
+
fluent_connection=meshing._fluent_connection,
|
|
160
162
|
file_transfer_service=file_service,
|
|
161
163
|
)
|
|
162
164
|
|
|
@@ -45,12 +45,12 @@ def _test_locn_extraction(solver1, solver2):
|
|
|
45
45
|
def _test_context(solver):
|
|
46
46
|
solver.solution.initialization.hybrid_initialize()
|
|
47
47
|
|
|
48
|
-
assert solver.reduction.area(
|
|
48
|
+
assert solver.fields.reduction.area(
|
|
49
49
|
locations=[solver.setup.boundary_conditions.velocity_inlet["inlet1"]],
|
|
50
50
|
ctxt=solver,
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
-
assert solver.reduction.area(locations=["inlet1"], ctxt=solver)
|
|
53
|
+
assert solver.fields.reduction.area(locations=["inlet1"], ctxt=solver)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def _test_area_average(solver):
|
|
@@ -62,7 +62,7 @@ def _test_area_average(solver):
|
|
|
62
62
|
)
|
|
63
63
|
expr_val = solver_named_expressions["test_expr_1"].get_value()
|
|
64
64
|
assert type(expr_val) == float and expr_val != 0.0
|
|
65
|
-
val = solver.reduction.area_average(
|
|
65
|
+
val = solver.fields.reduction.area_average(
|
|
66
66
|
expression="AbsolutePressure",
|
|
67
67
|
locations=solver.setup.boundary_conditions.velocity_inlet,
|
|
68
68
|
)
|
|
@@ -82,7 +82,7 @@ def _test_min(solver1, solver2):
|
|
|
82
82
|
test_expr2 = solver2_named_expr["test_expr_2"]
|
|
83
83
|
test_expr2.definition = "minimum(test_expr_2, ['outlet'])"
|
|
84
84
|
expected_result = test_expr2.get_value()
|
|
85
|
-
result = solver1.reduction.minimum(
|
|
85
|
+
result = solver1.fields.reduction.minimum(
|
|
86
86
|
expression=test_expr1.definition(),
|
|
87
87
|
locations=[
|
|
88
88
|
solver1.setup.boundary_conditions["outlet"],
|
|
@@ -107,9 +107,9 @@ def _test_count(solver):
|
|
|
107
107
|
solver_named_expressions["test_expr_1"].definition = "Count(['inlet1', 'inlet2'])"
|
|
108
108
|
expr_val_3 = solver_named_expressions["test_expr_1"].get_value()
|
|
109
109
|
assert expr_val_3 == expr_val_1 + expr_val_2
|
|
110
|
-
red_val_1 = solver.reduction.count(locations=[s_velocity_inlet["inlet1"]])
|
|
111
|
-
red_val_2 = solver.reduction.count(locations=[s_velocity_inlet["inlet2"]])
|
|
112
|
-
red_val_3 = solver.reduction.count(locations=[s_velocity_inlet])
|
|
110
|
+
red_val_1 = solver.fields.reduction.count(locations=[s_velocity_inlet["inlet1"]])
|
|
111
|
+
red_val_2 = solver.fields.reduction.count(locations=[s_velocity_inlet["inlet2"]])
|
|
112
|
+
red_val_3 = solver.fields.reduction.count(locations=[s_velocity_inlet])
|
|
113
113
|
assert red_val_1 == expr_val_1
|
|
114
114
|
assert red_val_2 == expr_val_2
|
|
115
115
|
assert red_val_3 == expr_val_3
|
|
@@ -129,9 +129,9 @@ def _test_centroid(solver):
|
|
|
129
129
|
"Centroid(['inlet1', 'inlet2'])"
|
|
130
130
|
)
|
|
131
131
|
expr_val_3 = solver_named_expressions["test_expr_1"].get_value()
|
|
132
|
-
red_val_1 = solver.reduction.centroid(locations=[velocity_inlet["inlet1"]])
|
|
133
|
-
red_val_2 = solver.reduction.centroid(locations=[velocity_inlet["inlet2"]])
|
|
134
|
-
red_val_3 = solver.reduction.centroid(locations=[velocity_inlet])
|
|
132
|
+
red_val_1 = solver.fields.reduction.centroid(locations=[velocity_inlet["inlet1"]])
|
|
133
|
+
red_val_2 = solver.fields.reduction.centroid(locations=[velocity_inlet["inlet2"]])
|
|
134
|
+
red_val_3 = solver.fields.reduction.centroid(locations=[velocity_inlet])
|
|
135
135
|
assert [red_val_1.x, red_val_1.y, red_val_1.z] == expr_val_1
|
|
136
136
|
assert [red_val_2.x, red_val_2.y, red_val_2.z] == expr_val_2
|
|
137
137
|
assert [red_val_3.x, red_val_3.y, red_val_3.z] == expr_val_3
|
|
@@ -163,15 +163,15 @@ def _test_area_integrated_average(solver1, solver2):
|
|
|
163
163
|
|
|
164
164
|
assert expr_val_3 - (expr_val_1 + expr_val_2) <= 0.000000001
|
|
165
165
|
|
|
166
|
-
red_val_1 = solver1.reduction.area_integral(
|
|
166
|
+
red_val_1 = solver1.fields.reduction.area_integral(
|
|
167
167
|
expression="AbsolutePressure",
|
|
168
168
|
locations=[solver1_boundary_conditions.velocity_inlet["inlet1"]],
|
|
169
169
|
)
|
|
170
|
-
red_val_2 = solver1.reduction.area_integral(
|
|
170
|
+
red_val_2 = solver1.fields.reduction.area_integral(
|
|
171
171
|
expression="AbsolutePressure",
|
|
172
172
|
locations=[solver1_boundary_conditions.velocity_inlet["inlet2"]],
|
|
173
173
|
)
|
|
174
|
-
red_val_3 = solver1.reduction.area_integral(
|
|
174
|
+
red_val_3 = solver1.fields.reduction.area_integral(
|
|
175
175
|
expression="AbsolutePressure",
|
|
176
176
|
locations=[solver1_boundary_conditions.velocity_inlet],
|
|
177
177
|
)
|
|
@@ -197,15 +197,15 @@ def _test_area_integrated_average(solver1, solver2):
|
|
|
197
197
|
|
|
198
198
|
assert expr_val_6 - (expr_val_4 + expr_val_5) <= 0.000000001
|
|
199
199
|
|
|
200
|
-
red_val_4 = solver2.reduction.area_integral(
|
|
200
|
+
red_val_4 = solver2.fields.reduction.area_integral(
|
|
201
201
|
expression="AbsolutePressure",
|
|
202
202
|
locations=[solver2_boundary_conditions.velocity_inlet["inlet1"]],
|
|
203
203
|
)
|
|
204
|
-
red_val_5 = solver2.reduction.area_integral(
|
|
204
|
+
red_val_5 = solver2.fields.reduction.area_integral(
|
|
205
205
|
expression="AbsolutePressure",
|
|
206
206
|
locations=[solver2_boundary_conditions.velocity_inlet["inlet2"]],
|
|
207
207
|
)
|
|
208
|
-
red_val_6 = solver2.reduction.area_integral(
|
|
208
|
+
red_val_6 = solver2.fields.reduction.area_integral(
|
|
209
209
|
expression="AbsolutePressure",
|
|
210
210
|
locations=[solver2_boundary_conditions.velocity_inlet],
|
|
211
211
|
)
|
|
@@ -214,7 +214,7 @@ def _test_area_integrated_average(solver1, solver2):
|
|
|
214
214
|
assert red_val_5 == expr_val_5
|
|
215
215
|
assert red_val_6 == expr_val_6
|
|
216
216
|
|
|
217
|
-
red_val_7 = solver2.reduction.area_integral(
|
|
217
|
+
red_val_7 = solver2.fields.reduction.area_integral(
|
|
218
218
|
expression="AbsolutePressure",
|
|
219
219
|
locations=[
|
|
220
220
|
solver1_boundary_conditions.velocity_inlet,
|
|
@@ -230,7 +230,7 @@ def _test_area_integrated_average(solver1, solver2):
|
|
|
230
230
|
def _test_error_handling(solver):
|
|
231
231
|
if int(solver._version) < 241:
|
|
232
232
|
with pytest.raises(RuntimeError) as msg:
|
|
233
|
-
solver.reduction.area_average(
|
|
233
|
+
solver.fields.reduction.area_average(
|
|
234
234
|
expression="AbsoluteVelocity", # This is a wrong expression intentionally passed
|
|
235
235
|
locations=solver.setup.boundary_conditions.velocity_inlet,
|
|
236
236
|
)
|
|
@@ -243,13 +243,13 @@ def _test_force(solver):
|
|
|
243
243
|
solver_named_expressions["test_expr_1"].definition = "Force(['wall'])"
|
|
244
244
|
expr_val_1 = solver_named_expressions["test_expr_1"].get_value()
|
|
245
245
|
|
|
246
|
-
red_total_force = solver.reduction.force(
|
|
246
|
+
red_total_force = solver.fields.reduction.force(
|
|
247
247
|
locations=[solver.setup.boundary_conditions.wall]
|
|
248
248
|
)
|
|
249
|
-
red_pressure_force = solver.reduction.pressure_force(
|
|
249
|
+
red_pressure_force = solver.fields.reduction.pressure_force(
|
|
250
250
|
locations=[solver.setup.boundary_conditions.wall]
|
|
251
251
|
)
|
|
252
|
-
red_viscous_force = solver.reduction.viscous_force(
|
|
252
|
+
red_viscous_force = solver.fields.reduction.viscous_force(
|
|
253
253
|
locations=[solver.setup.boundary_conditions.wall]
|
|
254
254
|
)
|
|
255
255
|
|
|
@@ -277,11 +277,11 @@ def _test_moment(solver):
|
|
|
277
277
|
solver_named_expressions["test_expr_1"].definition = "Moment(['inlet1'],['wall'])"
|
|
278
278
|
expr_val_2 = solver_named_expressions["test_expr_1"].get_value()
|
|
279
279
|
|
|
280
|
-
red_moment_force = solver.reduction.moment(
|
|
280
|
+
red_moment_force = solver.fields.reduction.moment(
|
|
281
281
|
expression="Force(['wall'])", locations=[location]
|
|
282
282
|
)
|
|
283
283
|
|
|
284
|
-
red_moment_location = solver.reduction.moment(
|
|
284
|
+
red_moment_location = solver.fields.reduction.moment(
|
|
285
285
|
expression="['inlet1']", locations=[location]
|
|
286
286
|
)
|
|
287
287
|
|
|
@@ -304,7 +304,7 @@ def _test_sum(solver):
|
|
|
304
304
|
expr_val = solver.setup.named_expressions["test_expr_1"].get_value()
|
|
305
305
|
assert type(expr_val) == float and expr_val != 0.0
|
|
306
306
|
|
|
307
|
-
val = solver.reduction.sum(
|
|
307
|
+
val = solver.fields.reduction.sum(
|
|
308
308
|
expression="AbsolutePressure",
|
|
309
309
|
locations=[solver.setup.boundary_conditions.velocity_inlet["inlet1"]],
|
|
310
310
|
weight="Area",
|
|
@@ -323,7 +323,7 @@ def _test_sum_if(solver):
|
|
|
323
323
|
expr_val = solver.setup.named_expressions["test_expr_1"].get_value()
|
|
324
324
|
assert type(expr_val) == float and expr_val != 0.0
|
|
325
325
|
|
|
326
|
-
val = solver.reduction.sum_if(
|
|
326
|
+
val = solver.fields.reduction.sum_if(
|
|
327
327
|
expression="AbsolutePressure",
|
|
328
328
|
condition="AbsolutePressure > 0[Pa]",
|
|
329
329
|
locations=[solver.setup.boundary_conditions.velocity_inlet["inlet1"]],
|
|
@@ -351,3 +351,14 @@ def test_reductions(load_static_mixer_case, load_static_mixer_case_2) -> None:
|
|
|
351
351
|
_test_moment(solver1)
|
|
352
352
|
_test_sum(solver1)
|
|
353
353
|
_test_sum_if(solver1)
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
@pytest.mark.fluent_version(">=24.2")
|
|
357
|
+
def test_reduction_does_not_modify_case(load_static_mixer_case):
|
|
358
|
+
solver = load_static_mixer_case
|
|
359
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
360
|
+
solver.reduction.area_average(
|
|
361
|
+
expression="AbsolutePressure",
|
|
362
|
+
locations=solver.setup.boundary_conditions.velocity_inlet,
|
|
363
|
+
)
|
|
364
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
@@ -337,9 +337,9 @@ def test_read_case_using_lightweight_mode():
|
|
|
337
337
|
case_file_name=import_file_name, lightweight_mode=True
|
|
338
338
|
)
|
|
339
339
|
solver.setup.models.energy.enabled = False
|
|
340
|
-
old_fluent_connection_id = id(solver.
|
|
340
|
+
old_fluent_connection_id = id(solver._fluent_connection)
|
|
341
341
|
timeout_loop(
|
|
342
|
-
id(solver.
|
|
342
|
+
id(solver._fluent_connection) != old_fluent_connection_id,
|
|
343
343
|
timeout=60,
|
|
344
344
|
idle_period=1,
|
|
345
345
|
)
|
|
@@ -361,13 +361,13 @@ def test_build_from_fluent_connection(make_new_session):
|
|
|
361
361
|
assert solver1.health_check_service.is_serving
|
|
362
362
|
assert solver2.health_check_service.is_serving
|
|
363
363
|
health_check_service1 = solver1.health_check_service
|
|
364
|
-
cortex_pid2 = solver2.
|
|
365
|
-
solver1.build_from_fluent_connection(solver2.
|
|
364
|
+
cortex_pid2 = solver2._fluent_connection.connection_properties.cortex_pid
|
|
365
|
+
solver1.build_from_fluent_connection(solver2._fluent_connection)
|
|
366
366
|
assert solver1.health_check_service.is_serving
|
|
367
367
|
assert solver2.health_check_service.is_serving
|
|
368
368
|
assert not health_check_service1.is_serving
|
|
369
|
-
assert solver1.
|
|
370
|
-
assert solver2.
|
|
369
|
+
assert solver1._fluent_connection.connection_properties.cortex_pid == cortex_pid2
|
|
370
|
+
assert solver2._fluent_connection.connection_properties.cortex_pid == cortex_pid2
|
|
371
371
|
|
|
372
372
|
|
|
373
373
|
@pytest.mark.standalone
|
|
@@ -2,7 +2,11 @@ import pytest
|
|
|
2
2
|
from util.solver_workflow import new_solver_session # noqa: F401
|
|
3
3
|
|
|
4
4
|
from ansys.fluent.core.examples import download_file
|
|
5
|
-
from ansys.fluent.core.solver.flobject import
|
|
5
|
+
from ansys.fluent.core.solver.flobject import (
|
|
6
|
+
DeprecatedSettingWarning,
|
|
7
|
+
UnstableSettingWarning,
|
|
8
|
+
_Alias,
|
|
9
|
+
)
|
|
6
10
|
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
7
11
|
|
|
8
12
|
|
|
@@ -156,6 +160,26 @@ def test_deprecated_settings(new_solver_session):
|
|
|
156
160
|
with pytest.warns(DeprecatedSettingWarning):
|
|
157
161
|
solver.file.rcd(file_name=case_path)
|
|
158
162
|
|
|
163
|
+
solver.setup.boundary_conditions.velocity_inlet.child_object_type._child_aliases[
|
|
164
|
+
"mom"
|
|
165
|
+
] = "momentum"
|
|
166
|
+
with pytest.warns(DeprecatedSettingWarning):
|
|
167
|
+
solver.setup.boundary_conditions.velocity_inlet["hot-inlet"].mom.velocity = 20
|
|
168
|
+
assert (
|
|
169
|
+
solver.setup.boundary_conditions.velocity_inlet[
|
|
170
|
+
"hot-inlet"
|
|
171
|
+
].momentum.velocity.value()
|
|
172
|
+
== 20
|
|
173
|
+
)
|
|
174
|
+
with pytest.warns(DeprecatedSettingWarning):
|
|
175
|
+
solver.setup.boundary_conditions.velocity_inlet["cold-inlet"].mom.velocity = 2
|
|
176
|
+
assert (
|
|
177
|
+
solver.setup.boundary_conditions.velocity_inlet[
|
|
178
|
+
"cold-inlet"
|
|
179
|
+
].momentum.velocity.value()
|
|
180
|
+
== 2
|
|
181
|
+
)
|
|
182
|
+
|
|
159
183
|
solver.setup.boundary_conditions.wall["wall-inlet"].thermal.thermal_bc = (
|
|
160
184
|
"Temperature"
|
|
161
185
|
)
|
|
@@ -182,7 +206,7 @@ def test_deprecated_settings(new_solver_session):
|
|
|
182
206
|
> 0
|
|
183
207
|
)
|
|
184
208
|
assert isinstance(
|
|
185
|
-
solver.setup.boundary_conditions.wall["wall-inlet"].thermal.t.
|
|
209
|
+
solver.setup.boundary_conditions.wall["wall-inlet"].thermal.t._child_alias_objs[
|
|
186
210
|
"constant"
|
|
187
211
|
],
|
|
188
212
|
_Alias,
|
|
@@ -216,17 +240,15 @@ def test_deprecated_settings(new_solver_session):
|
|
|
216
240
|
with pytest.warns(DeprecatedSettingWarning):
|
|
217
241
|
solver.results.gr.contour.create("c1")
|
|
218
242
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
# with pytest.warns(DeprecatedSettingWarning):
|
|
222
|
-
# solver.results.gr.contour["c1"].field = "pressure"
|
|
243
|
+
with pytest.warns(DeprecatedSettingWarning):
|
|
244
|
+
solver.results.gr.contour["c1"].field = "pressure"
|
|
223
245
|
|
|
224
|
-
|
|
246
|
+
assert solver.results.graphics.contour["c1"].field() == "pressure"
|
|
225
247
|
|
|
226
|
-
|
|
227
|
-
|
|
248
|
+
with pytest.warns(DeprecatedSettingWarning):
|
|
249
|
+
del solver.results.gr.contour["c1"]
|
|
228
250
|
|
|
229
|
-
|
|
251
|
+
assert "c1" not in solver.results.graphics.contour
|
|
230
252
|
|
|
231
253
|
solver.setup.boundary_conditions.velocity_inlet[
|
|
232
254
|
"hot-inlet"
|
|
@@ -242,8 +264,7 @@ def test_deprecated_settings(new_solver_session):
|
|
|
242
264
|
== 10
|
|
243
265
|
)
|
|
244
266
|
|
|
245
|
-
|
|
246
|
-
# solver.setup.cell_zone_conditions.fluid["elbow-fluid"] = {"material": "air"}
|
|
267
|
+
solver.setup.cell_zone_conditions.fluid["elbow-fluid"] = {"material": "air"}
|
|
247
268
|
|
|
248
269
|
|
|
249
270
|
@pytest.mark.fluent_version(">=24.2")
|
|
@@ -258,3 +279,19 @@ def test_command_return_type(new_solver_session):
|
|
|
258
279
|
)
|
|
259
280
|
ret = solver.solution.report_definitions.compute(report_defs=["surface-1"])
|
|
260
281
|
assert ret is not None
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
@pytest.mark.fluent_version(">=24.2")
|
|
285
|
+
def test_unstable_settings_warning(new_solver_session, recwarn):
|
|
286
|
+
solver = new_solver_session
|
|
287
|
+
solver.file.export
|
|
288
|
+
assert len(recwarn) == 1
|
|
289
|
+
assert recwarn.pop().category == UnstableSettingWarning
|
|
290
|
+
try:
|
|
291
|
+
solver.file.exp
|
|
292
|
+
except AttributeError:
|
|
293
|
+
pass
|
|
294
|
+
assert len(recwarn) == 0
|
|
295
|
+
solver.file.export
|
|
296
|
+
assert len(recwarn) == 1
|
|
297
|
+
assert recwarn.pop().category == UnstableSettingWarning
|
|
@@ -6,6 +6,7 @@ from util.solver_workflow import ( # noqa: F401
|
|
|
6
6
|
)
|
|
7
7
|
|
|
8
8
|
from ansys.fluent.core import examples
|
|
9
|
+
from ansys.fluent.core.examples.downloads import download_file
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
@pytest.mark.fluent_version(">=23.2")
|
|
@@ -388,3 +389,19 @@ def test_svars_single_precision(new_solver_session_single_precision):
|
|
|
388
389
|
fluid_temp = sv_p_wall_fluid["tank"]
|
|
389
390
|
assert fluid_temp.size == 183424
|
|
390
391
|
assert str(fluid_temp.dtype) == "float32"
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
@pytest.mark.fluent_version(">=24.2")
|
|
395
|
+
def test_solution_variable_does_not_modify_case(new_solver_session):
|
|
396
|
+
solver = new_solver_session
|
|
397
|
+
case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
|
|
398
|
+
download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
399
|
+
solver.file.read_case_data(file_name=case_path)
|
|
400
|
+
solver.scheme_eval.scheme_eval("(%save-case-id)")
|
|
401
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
402
|
+
solver.fields.solution_variable_data.get_data(
|
|
403
|
+
solution_variable_name="SV_P",
|
|
404
|
+
zone_names=["elbow-fluid", "wall-elbow"],
|
|
405
|
+
domain_name="mixture",
|
|
406
|
+
)
|
|
407
|
+
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ansys-fluent-core
|
|
3
|
-
Version: 0.20.
|
|
3
|
+
Version: 0.20.dev10
|
|
4
4
|
Summary: PyFluent provides Pythonic access to Ansys Fluent
|
|
5
5
|
Home-page: https://github.com/ansys/pyfluent
|
|
6
6
|
License: MIT
|
|
@@ -21,7 +21,7 @@ Provides-Extra: reader
|
|
|
21
21
|
Provides-Extra: tests
|
|
22
22
|
Requires-Dist: ansys-api-fluent (>=0.3.22,<0.4.0)
|
|
23
23
|
Requires-Dist: ansys-platform-instancemanagement (>=1.0,<2.0)
|
|
24
|
-
Requires-Dist: ansys-units (>=0.3.
|
|
24
|
+
Requires-Dist: ansys-units (>=0.3.2,<0.4.0)
|
|
25
25
|
Requires-Dist: beartype (>=0.17,<0.18)
|
|
26
26
|
Requires-Dist: docker (>=6.1.3,<7.0.0)
|
|
27
27
|
Requires-Dist: grpcio (>=1.30.0,<2.0.0)
|