ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev2__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 +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/walk_api.py +45 -18
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +395 -390
- ansys/fluent/core/generated/solver/settings_252.py +782 -306
- ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
- ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
- ansys/fluent/core/launcher/container_launcher.py +4 -3
- ansys/fluent/core/launcher/fluent_container.py +22 -19
- ansys/fluent/core/launcher/launcher.py +2 -2
- ansys/fluent/core/launcher/pim_launcher.py +2 -2
- ansys/fluent/core/launcher/slurm_launcher.py +2 -2
- ansys/fluent/core/launcher/standalone_launcher.py +2 -2
- ansys/fluent/core/logging.py +2 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/services/app_utilities.py +2 -1
- ansys/fluent/core/services/datamodel_se.py +141 -61
- ansys/fluent/core/services/field_data.py +252 -0
- ansys/fluent/core/services/interceptors.py +28 -2
- ansys/fluent/core/session.py +7 -2
- ansys/fluent/core/session_solver.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/WHEEL +1 -1
- ansys/fluent/core/docs/README.rst +0 -155
- ansys/fluent/tests/conftest.py +0 -415
- ansys/fluent/tests/fluent_fixtures.py +0 -195
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
- ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
- ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
- ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
- ansys/fluent/tests/test_aero_session.py +0 -88
- ansys/fluent/tests/test_batch_ops.py +0 -39
- ansys/fluent/tests/test_builtin_settings.py +0 -761
- ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
- ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
- ansys/fluent/tests/test_casereader.py +0 -324
- ansys/fluent/tests/test_codegen.py +0 -783
- ansys/fluent/tests/test_creatable.py +0 -31
- ansys/fluent/tests/test_data_model_cache.py +0 -434
- ansys/fluent/tests/test_datamodel_api.py +0 -449
- ansys/fluent/tests/test_datamodel_service.py +0 -814
- ansys/fluent/tests/test_datareader.py +0 -103
- ansys/fluent/tests/test_error_handling.py +0 -24
- ansys/fluent/tests/test_events_manager.py +0 -214
- ansys/fluent/tests/test_field_data.py +0 -466
- ansys/fluent/tests/test_file_session.py +0 -355
- ansys/fluent/tests/test_file_transfer_service.py +0 -165
- ansys/fluent/tests/test_fix_doc.py +0 -29
- ansys/fluent/tests/test_flobject.py +0 -1235
- ansys/fluent/tests/test_fluent_fixes.py +0 -106
- ansys/fluent/tests/test_fluent_session.py +0 -270
- ansys/fluent/tests/test_fluent_version.py +0 -66
- ansys/fluent/tests/test_fluent_version_marker.py +0 -65
- ansys/fluent/tests/test_icing_session.py +0 -9
- ansys/fluent/tests/test_launcher.py +0 -529
- ansys/fluent/tests/test_launcher_remote.py +0 -272
- ansys/fluent/tests/test_lispy.py +0 -40
- ansys/fluent/tests/test_logging.py +0 -16
- ansys/fluent/tests/test_mapped_api.py +0 -774
- ansys/fluent/tests/test_meshing_utilities.py +0 -2436
- ansys/fluent/tests/test_meshing_workflow.py +0 -421
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
- ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
- ansys/fluent/tests/test_preferences.py +0 -89
- ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
- ansys/fluent/tests/test_reduction.py +0 -484
- ansys/fluent/tests/test_rp_vars.py +0 -77
- ansys/fluent/tests/test_scheduler.py +0 -471
- ansys/fluent/tests/test_scheme_eval_222.py +0 -338
- ansys/fluent/tests/test_scheme_eval_231.py +0 -243
- ansys/fluent/tests/test_search.py +0 -344
- ansys/fluent/tests/test_session.py +0 -594
- ansys/fluent/tests/test_settings_api.py +0 -606
- ansys/fluent/tests/test_settings_reader.py +0 -85
- ansys/fluent/tests/test_slurm_future.py +0 -67
- ansys/fluent/tests/test_solution_variables.py +0 -241
- ansys/fluent/tests/test_solver_monitors.py +0 -83
- ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
- ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
- ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
- ansys/fluent/tests/test_solvermode/test_general.py +0 -109
- ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
- ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
- ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
- ansys/fluent/tests/test_solvermode/test_models.py +0 -99
- ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
- ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
- ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
- ansys/fluent/tests/test_streaming_services.py +0 -52
- ansys/fluent/tests/test_systemcoupling.py +0 -44
- ansys/fluent/tests/test_topy.py +0 -179
- ansys/fluent/tests/test_tui_api.py +0 -70
- ansys/fluent/tests/test_type_stub.py +0 -37
- ansys/fluent/tests/test_utils.py +0 -82
- ansys/fluent/tests/util/__init__.py +0 -36
- ansys/fluent/tests/util/meshing_workflow.py +0 -33
- ansys/fluent/tests/util/solver.py +0 -72
- ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
from concurrent.futures import Future
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
from ansys.fluent.core.launcher.slurm_launcher import SlurmFuture
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class SlurmEnvironment:
|
|
9
|
-
def __init__(self):
|
|
10
|
-
self.state = None
|
|
11
|
-
|
|
12
|
-
def set_state(self, state):
|
|
13
|
-
self.state = state
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class SlurmFutureResult:
|
|
17
|
-
pass
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class SlurmFutureException:
|
|
21
|
-
pass
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@pytest.fixture
|
|
25
|
-
def slurm_future(monkeypatch: pytest.MonkeyPatch) -> SlurmFuture:
|
|
26
|
-
env = SlurmEnvironment()
|
|
27
|
-
future = Future()
|
|
28
|
-
future.set_running_or_notify_cancel()
|
|
29
|
-
slurm_future = SlurmFuture(future, 0)
|
|
30
|
-
monkeypatch.setattr(slurm_future, "_get_state", lambda: env.state)
|
|
31
|
-
monkeypatch.setattr(slurm_future, "_cancel", lambda: env.set_state(""))
|
|
32
|
-
env.set_state("RUNNING")
|
|
33
|
-
slurm_future.env = env
|
|
34
|
-
return slurm_future
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def test_cancel_slurm_future(slurm_future: SlurmFuture):
|
|
38
|
-
assert slurm_future.cancel()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def test_slurm_future_lifecycle(slurm_future: SlurmFuture):
|
|
42
|
-
assert slurm_future.pending()
|
|
43
|
-
assert not slurm_future.running()
|
|
44
|
-
assert not slurm_future.done()
|
|
45
|
-
slurm_future._future.set_result(SlurmFutureResult())
|
|
46
|
-
assert not slurm_future.pending()
|
|
47
|
-
assert slurm_future.running()
|
|
48
|
-
assert not slurm_future.done()
|
|
49
|
-
assert isinstance(slurm_future.result(), SlurmFutureResult)
|
|
50
|
-
slurm_future.env.set_state("")
|
|
51
|
-
assert not slurm_future.pending()
|
|
52
|
-
assert not slurm_future.running()
|
|
53
|
-
assert slurm_future.done()
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_slurm_future_exception(slurm_future: SlurmFuture):
|
|
57
|
-
slurm_future._future.set_exception(SlurmFutureException())
|
|
58
|
-
assert isinstance(slurm_future.exception(), SlurmFutureException)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def test_slurm_future_done_callback(slurm_future: SlurmFuture):
|
|
62
|
-
called = []
|
|
63
|
-
slurm_future.add_done_callback(lambda session: called.append(True))
|
|
64
|
-
assert not called
|
|
65
|
-
slurm_future._future.set_result(SlurmFutureResult())
|
|
66
|
-
assert called
|
|
67
|
-
assert called[0]
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import pytest
|
|
3
|
-
|
|
4
|
-
from ansys.fluent.core import examples
|
|
5
|
-
from ansys.fluent.core.examples.downloads import download_file
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
9
|
-
def test_solution_variables(new_solver_session):
|
|
10
|
-
solver = new_solver_session
|
|
11
|
-
import_file_name = examples.download_file(
|
|
12
|
-
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
13
|
-
)
|
|
14
|
-
examples.download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
15
|
-
|
|
16
|
-
solution_variable_info = solver.fields.solution_variable_info
|
|
17
|
-
solution_variable_data = solver.fields.solution_variable_data
|
|
18
|
-
assert solution_variable_info == solver.svar_info
|
|
19
|
-
assert solution_variable_data == solver.svar_data
|
|
20
|
-
|
|
21
|
-
solver.file.read_case_data(file_name=import_file_name)
|
|
22
|
-
|
|
23
|
-
zones_info = solution_variable_info.get_zones_info()
|
|
24
|
-
|
|
25
|
-
assert zones_info.domains == ["mixture"]
|
|
26
|
-
|
|
27
|
-
assert set(zones_info.zones) == {
|
|
28
|
-
"symmetry-xyplane",
|
|
29
|
-
"hot-inlet",
|
|
30
|
-
"cold-inlet",
|
|
31
|
-
"outlet",
|
|
32
|
-
"wall-inlet",
|
|
33
|
-
"wall-elbow",
|
|
34
|
-
"elbow-fluid",
|
|
35
|
-
"interior--elbow-fluid",
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
zone_info = zones_info["wall-inlet"]
|
|
39
|
-
|
|
40
|
-
assert zone_info.name == "wall-inlet"
|
|
41
|
-
|
|
42
|
-
assert zone_info.count == 268
|
|
43
|
-
|
|
44
|
-
assert zone_info.zone_id == 33
|
|
45
|
-
|
|
46
|
-
assert zone_info.zone_type == "wall"
|
|
47
|
-
|
|
48
|
-
wall_fluid_info = solution_variable_info.get_variables_info(
|
|
49
|
-
zone_names=["wall-elbow", "elbow-fluid"], domain_name="mixture"
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
assert set(wall_fluid_info.solution_variables) == {
|
|
53
|
-
"SV_ADS_0",
|
|
54
|
-
"SV_ADS_1",
|
|
55
|
-
"SV_CENTROID",
|
|
56
|
-
"SV_H",
|
|
57
|
-
"SV_K",
|
|
58
|
-
"SV_O",
|
|
59
|
-
"SV_P",
|
|
60
|
-
"SV_T",
|
|
61
|
-
"SV_U",
|
|
62
|
-
"SV_V",
|
|
63
|
-
"SV_W",
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
solution_variable_info_centroid = wall_fluid_info["SV_CENTROID"]
|
|
67
|
-
|
|
68
|
-
assert solution_variable_info_centroid.name == "SV_CENTROID"
|
|
69
|
-
|
|
70
|
-
assert solution_variable_info_centroid.dimension == 3
|
|
71
|
-
|
|
72
|
-
assert solution_variable_info_centroid.field_type == np.float64
|
|
73
|
-
|
|
74
|
-
sv_p_wall_fluid = solution_variable_data.get_data(
|
|
75
|
-
solution_variable_name="SV_P",
|
|
76
|
-
zone_names=["elbow-fluid", "wall-elbow"],
|
|
77
|
-
domain_name="mixture",
|
|
78
|
-
)
|
|
79
|
-
assert sv_p_wall_fluid.domain == "mixture"
|
|
80
|
-
|
|
81
|
-
assert sv_p_wall_fluid.zones == ["wall-elbow", "elbow-fluid"]
|
|
82
|
-
|
|
83
|
-
fluid_temp = sv_p_wall_fluid["elbow-fluid"]
|
|
84
|
-
assert fluid_temp.size == 17822
|
|
85
|
-
assert str(fluid_temp.dtype) == "float64"
|
|
86
|
-
|
|
87
|
-
wall_press_array = solution_variable_data.create_empty_array(
|
|
88
|
-
"SV_P", "wall-elbow", "mixture"
|
|
89
|
-
)
|
|
90
|
-
fluid_press_array = solution_variable_data.create_empty_array(
|
|
91
|
-
"SV_P", "elbow-fluid", "mixture"
|
|
92
|
-
)
|
|
93
|
-
wall_press_array[:] = 500
|
|
94
|
-
fluid_press_array[:] = 600
|
|
95
|
-
zone_names_to_solution_variable_data = {
|
|
96
|
-
"wall-elbow": wall_press_array,
|
|
97
|
-
"elbow-fluid": fluid_press_array,
|
|
98
|
-
}
|
|
99
|
-
solution_variable_data.set_data(
|
|
100
|
-
solution_variable_name="SV_P",
|
|
101
|
-
zone_names_to_solution_variable_data=zone_names_to_solution_variable_data,
|
|
102
|
-
domain_name="mixture",
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
updated_sv_p_data = solution_variable_data.get_data(
|
|
106
|
-
solution_variable_name="SV_P",
|
|
107
|
-
zone_names=["elbow-fluid", "wall-elbow"],
|
|
108
|
-
domain_name="mixture",
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
assert updated_sv_p_data.domain == "mixture"
|
|
112
|
-
assert updated_sv_p_data.zones == ["wall-elbow", "elbow-fluid"]
|
|
113
|
-
|
|
114
|
-
assert updated_sv_p_data["elbow-fluid"].size == 17822
|
|
115
|
-
assert str(updated_sv_p_data["elbow-fluid"].dtype) == "float64"
|
|
116
|
-
|
|
117
|
-
assert updated_sv_p_data["wall-elbow"][0] == 500.0
|
|
118
|
-
assert updated_sv_p_data["elbow-fluid"][-1] == 600.0
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
122
|
-
def test_solution_variables_single_precision(new_solver_session_sp):
|
|
123
|
-
solver = new_solver_session_sp
|
|
124
|
-
import_file_name = examples.download_file(
|
|
125
|
-
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
126
|
-
)
|
|
127
|
-
examples.download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
128
|
-
|
|
129
|
-
solution_variable_info = solver.fields.solution_variable_info
|
|
130
|
-
solution_variable_data = solver.fields.solution_variable_data
|
|
131
|
-
assert solution_variable_info == solver.svar_info
|
|
132
|
-
assert solution_variable_data == solver.svar_data
|
|
133
|
-
|
|
134
|
-
solver.file.read_case_data(file_name=import_file_name)
|
|
135
|
-
|
|
136
|
-
zones_info = solution_variable_info.get_zones_info()
|
|
137
|
-
|
|
138
|
-
assert zones_info.domains == ["mixture"]
|
|
139
|
-
|
|
140
|
-
assert set(zones_info.zones) == {
|
|
141
|
-
"symmetry-xyplane",
|
|
142
|
-
"hot-inlet",
|
|
143
|
-
"cold-inlet",
|
|
144
|
-
"outlet",
|
|
145
|
-
"wall-inlet",
|
|
146
|
-
"wall-elbow",
|
|
147
|
-
"elbow-fluid",
|
|
148
|
-
"interior--elbow-fluid",
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
zone_info = zones_info["wall-elbow"]
|
|
152
|
-
|
|
153
|
-
assert zone_info.name == "wall-elbow"
|
|
154
|
-
|
|
155
|
-
assert zone_info.count == 2168
|
|
156
|
-
|
|
157
|
-
assert zone_info.zone_id == 34
|
|
158
|
-
|
|
159
|
-
assert zone_info.zone_type == "wall"
|
|
160
|
-
|
|
161
|
-
wall_fluid_info = solution_variable_info.get_variables_info(
|
|
162
|
-
zone_names=["wall-elbow", "elbow-fluid"], domain_name="mixture"
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
assert set(wall_fluid_info.solution_variables) == {
|
|
166
|
-
"SV_ADS_0",
|
|
167
|
-
"SV_ADS_1",
|
|
168
|
-
"SV_CENTROID",
|
|
169
|
-
"SV_H",
|
|
170
|
-
"SV_K",
|
|
171
|
-
"SV_O",
|
|
172
|
-
"SV_P",
|
|
173
|
-
"SV_T",
|
|
174
|
-
"SV_U",
|
|
175
|
-
"SV_V",
|
|
176
|
-
"SV_W",
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
solution_variable_info_centroid = wall_fluid_info["SV_CENTROID"]
|
|
180
|
-
|
|
181
|
-
assert solution_variable_info_centroid.name == "SV_CENTROID"
|
|
182
|
-
|
|
183
|
-
assert solution_variable_info_centroid.dimension == 3
|
|
184
|
-
|
|
185
|
-
assert solution_variable_info_centroid.field_type == np.float32
|
|
186
|
-
|
|
187
|
-
sv_p_wall_fluid = solution_variable_data.get_data(
|
|
188
|
-
solution_variable_name="SV_P",
|
|
189
|
-
zone_names=["wall-elbow", "elbow-fluid"],
|
|
190
|
-
domain_name="mixture",
|
|
191
|
-
)
|
|
192
|
-
assert sv_p_wall_fluid.domain == "mixture"
|
|
193
|
-
|
|
194
|
-
assert sv_p_wall_fluid.zones == ["wall-elbow", "elbow-fluid"]
|
|
195
|
-
|
|
196
|
-
fluid_temp = sv_p_wall_fluid["elbow-fluid"]
|
|
197
|
-
assert fluid_temp.size == 17822
|
|
198
|
-
assert str(fluid_temp.dtype) == "float32"
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
202
|
-
def test_solution_variable_does_not_modify_case(new_solver_session):
|
|
203
|
-
solver = new_solver_session
|
|
204
|
-
case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
|
|
205
|
-
download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
206
|
-
solver.file.read_case_data(file_name=case_path)
|
|
207
|
-
solver.scheme_eval.scheme_eval("(%save-case-id)")
|
|
208
|
-
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
209
|
-
solver.fields.solution_variable_data.get_data(
|
|
210
|
-
solution_variable_name="SV_P",
|
|
211
|
-
zone_names=["elbow-fluid", "wall-elbow"],
|
|
212
|
-
domain_name="mixture",
|
|
213
|
-
)
|
|
214
|
-
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
@pytest.mark.fluent_version(">=25.2")
|
|
218
|
-
def test_solution_variable_udm_data(mixing_elbow_case_session_t4):
|
|
219
|
-
solver = mixing_elbow_case_session_t4
|
|
220
|
-
solver.tui.define.user_defined.user_defined_memory("2")
|
|
221
|
-
solver.settings.solution.initialization.hybrid_initialize()
|
|
222
|
-
solver.settings.solution.run_calculation.iterate(iter_count=1)
|
|
223
|
-
udm_data = solver.fields.solution_variable_data.get_data(
|
|
224
|
-
solution_variable_name="SV_UDM_I",
|
|
225
|
-
domain_name="mixture",
|
|
226
|
-
zone_names=["wall-elbow"],
|
|
227
|
-
)["wall-elbow"]
|
|
228
|
-
np.testing.assert_array_equal(udm_data, np.zeros(4336))
|
|
229
|
-
udm_data[:2168] = 5
|
|
230
|
-
udm_data[2168:] = 10
|
|
231
|
-
solver.fields.solution_variable_data.set_data(
|
|
232
|
-
solution_variable_name="SV_UDM_I",
|
|
233
|
-
domain_name="mixture",
|
|
234
|
-
zone_names_to_solution_variable_data={"wall-elbow": udm_data},
|
|
235
|
-
)
|
|
236
|
-
new_array = solver.fields.solution_variable_data.get_data(
|
|
237
|
-
solution_variable_name="SV_UDM_I",
|
|
238
|
-
domain_name="mixture",
|
|
239
|
-
zone_names=["wall-elbow"],
|
|
240
|
-
)["wall-elbow"]
|
|
241
|
-
np.testing.assert_array_equal(new_array, udm_data)
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
from ansys.fluent.core import examples
|
|
4
|
-
from ansys.fluent.core.utils.execution import timeout_loop
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
8
|
-
def test_solver_monitors(new_solver_session):
|
|
9
|
-
|
|
10
|
-
solver = new_solver_session
|
|
11
|
-
|
|
12
|
-
import_case = examples.download_file(
|
|
13
|
-
file_name="exhaust_system.cas.h5", directory="pyfluent/exhaust_system"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
solver.file.read_case(file_name=import_case)
|
|
17
|
-
|
|
18
|
-
ordered_report_plot_names = [
|
|
19
|
-
"mass-bal-rplot",
|
|
20
|
-
"mass-in-rplot",
|
|
21
|
-
"mass-tot-rplot",
|
|
22
|
-
"point-vel-rplot",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
assert (
|
|
26
|
-
sorted(solver.settings.solution.monitor.report_plots())
|
|
27
|
-
== ordered_report_plot_names
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
# monitor set names unavailable without data
|
|
31
|
-
assert len(solver.monitors.get_monitor_set_names()) == 0
|
|
32
|
-
|
|
33
|
-
import_data = examples.download_file(
|
|
34
|
-
file_name="exhaust_system.dat.h5", directory="pyfluent/exhaust_system"
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
solver.file.read_data(file_name=import_data)
|
|
38
|
-
|
|
39
|
-
# monitor set names remains unavailable after loading data
|
|
40
|
-
assert len(solver.monitors.get_monitor_set_names()) == 0
|
|
41
|
-
|
|
42
|
-
# monitor set names becomes available after initializing
|
|
43
|
-
solver.solution.initialization.hybrid_initialize()
|
|
44
|
-
|
|
45
|
-
monitor_set_names = ordered_report_plot_names + ["residual"]
|
|
46
|
-
assert sorted(solver.monitors.get_monitor_set_names()) == sorted(monitor_set_names)
|
|
47
|
-
|
|
48
|
-
# no data in monitors at this point
|
|
49
|
-
assert all(
|
|
50
|
-
all(
|
|
51
|
-
len(elem) == 0
|
|
52
|
-
for elem in solver.monitors.get_monitor_set_data(monitor_set_name=name)
|
|
53
|
-
)
|
|
54
|
-
for name in monitor_set_names
|
|
55
|
-
), "One or more monitor sets contain non-empty elements."
|
|
56
|
-
|
|
57
|
-
# run the solver...
|
|
58
|
-
solver.solution.run_calculation.iterate(iter_count=1)
|
|
59
|
-
|
|
60
|
-
# ...data is in monitors
|
|
61
|
-
assert all(
|
|
62
|
-
all(
|
|
63
|
-
len(elem) != 0
|
|
64
|
-
for elem in solver.monitors.get_monitor_set_data(monitor_set_name=name)
|
|
65
|
-
)
|
|
66
|
-
for name in monitor_set_names
|
|
67
|
-
), "One or more monitor sets contain empty elements."
|
|
68
|
-
|
|
69
|
-
def monitor_callback():
|
|
70
|
-
monitor_callback.called = True
|
|
71
|
-
|
|
72
|
-
monitor_callback.called = False
|
|
73
|
-
|
|
74
|
-
# n.b. there is no checking of the callback signature at registration. Instead
|
|
75
|
-
# we would get a TypeError at callback time if the signature is wrong. The correct
|
|
76
|
-
# signature is undocumented.
|
|
77
|
-
solver.monitors.register_callback(monitor_callback)
|
|
78
|
-
|
|
79
|
-
# trigger callback by running the solver
|
|
80
|
-
assert not monitor_callback.called
|
|
81
|
-
solver.solution.run_calculation.iterate(iter_count=1)
|
|
82
|
-
assert timeout_loop(lambda: monitor_callback.called, 5)
|
|
83
|
-
assert monitor_callback.called
|