ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev1__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.dev1.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev1.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,355 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
|
|
3
|
-
import pytest
|
|
4
|
-
|
|
5
|
-
from ansys.fluent.core import examples
|
|
6
|
-
from ansys.fluent.core.file_session import (
|
|
7
|
-
FileSession,
|
|
8
|
-
InvalidFieldName,
|
|
9
|
-
InvalidMultiPhaseFieldName,
|
|
10
|
-
)
|
|
11
|
-
from ansys.fluent.core.services.field_data import SurfaceDataType
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def round_off_list_elements(input_list):
|
|
15
|
-
for index, value in enumerate(input_list):
|
|
16
|
-
input_list[index] = round(value, 6)
|
|
17
|
-
|
|
18
|
-
return input_list
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def test_field_info_data_multi_phase():
|
|
22
|
-
case_file_name = examples.download_file(
|
|
23
|
-
"mixing_elbow_mul_ph.cas.h5",
|
|
24
|
-
"pyfluent/file_session",
|
|
25
|
-
return_without_path=False,
|
|
26
|
-
)
|
|
27
|
-
data_file_name = examples.download_file(
|
|
28
|
-
"mixing_elbow_mul_ph.dat.h5",
|
|
29
|
-
"pyfluent/file_session",
|
|
30
|
-
return_without_path=False,
|
|
31
|
-
)
|
|
32
|
-
file_session = FileSession()
|
|
33
|
-
|
|
34
|
-
# backward compatibility check
|
|
35
|
-
assert file_session.fields.field_data == file_session.field_data
|
|
36
|
-
|
|
37
|
-
assert Path(case_file_name).exists()
|
|
38
|
-
assert Path(data_file_name).exists()
|
|
39
|
-
file_session.read_case(case_file_name)
|
|
40
|
-
file_session.read_data(data_file_name)
|
|
41
|
-
|
|
42
|
-
sv_density = file_session.fields.field_data.get_scalar_field_data(
|
|
43
|
-
field_name="phase-2:SV_DENSITY", surfaces=[33]
|
|
44
|
-
)
|
|
45
|
-
assert sv_density[33].shape == (268,)
|
|
46
|
-
assert sv_density[33][130] == 1.225
|
|
47
|
-
assert (
|
|
48
|
-
round(
|
|
49
|
-
file_session.fields.field_data.get_scalar_field_data(
|
|
50
|
-
field_name="phase-2:SV_WALL_YPLUS", surfaces=[33]
|
|
51
|
-
)[33][130],
|
|
52
|
-
5,
|
|
53
|
-
)
|
|
54
|
-
== 0.00103
|
|
55
|
-
)
|
|
56
|
-
vector_data = file_session.fields.field_data.get_vector_field_data
|
|
57
|
-
assert vector_data(field_name="phase-2:velocity", surfaces=[33])[33].shape == (
|
|
58
|
-
268,
|
|
59
|
-
3,
|
|
60
|
-
)
|
|
61
|
-
assert vector_data(field_name="phase-1:velocity", surfaces=[34])[34].shape == (
|
|
62
|
-
2168,
|
|
63
|
-
3,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def test_field_info_data_single_phase():
|
|
68
|
-
case_file_name = examples.download_file(
|
|
69
|
-
"elbow1.cas.h5", "pyfluent/file_session", return_without_path=False
|
|
70
|
-
)
|
|
71
|
-
data_file_name = examples.download_file(
|
|
72
|
-
"elbow1.dat.h5", "pyfluent/file_session", return_without_path=False
|
|
73
|
-
)
|
|
74
|
-
file_session = FileSession()
|
|
75
|
-
|
|
76
|
-
# backward compatibility check
|
|
77
|
-
assert file_session.fields.field_data == file_session.field_data
|
|
78
|
-
|
|
79
|
-
file_session.read_case(case_file_name)
|
|
80
|
-
file_session.read_data(data_file_name)
|
|
81
|
-
|
|
82
|
-
assert round_off_list_elements(
|
|
83
|
-
file_session.field_info.get_scalar_field_range("SV_P")
|
|
84
|
-
) == [-339.203452, 339.417934]
|
|
85
|
-
assert len(file_session.field_info.get_scalar_fields_info()) == 29
|
|
86
|
-
assert list(file_session.field_info.get_surfaces_info().keys()) == [
|
|
87
|
-
"wall",
|
|
88
|
-
"symmetry",
|
|
89
|
-
"pressure-outlet-7",
|
|
90
|
-
"velocity-inlet-6",
|
|
91
|
-
"velocity-inlet-5",
|
|
92
|
-
"default-interior",
|
|
93
|
-
]
|
|
94
|
-
sv_t_wall = file_session.fields.field_data.get_scalar_field_data(
|
|
95
|
-
"SV_T", surfaces=["wall"]
|
|
96
|
-
)
|
|
97
|
-
assert sv_t_wall["wall"].shape == (3630,)
|
|
98
|
-
assert round(sv_t_wall["wall"][1800], 4) == 313.15
|
|
99
|
-
|
|
100
|
-
surface_data = file_session.fields.field_data.get_surface_data
|
|
101
|
-
surface_data_wall = surface_data(
|
|
102
|
-
data_types=[SurfaceDataType.Vertices], surfaces=[3]
|
|
103
|
-
)
|
|
104
|
-
assert surface_data_wall[3].shape == (3810, 3)
|
|
105
|
-
assert round(surface_data_wall[3][1500][0], 5) == 0.12406
|
|
106
|
-
assert round(surface_data_wall[3][1500][1], 5) == 0.09525
|
|
107
|
-
assert round(surface_data_wall[3][1500][2], 5) == 0.04216
|
|
108
|
-
|
|
109
|
-
surface_data_symmetry = surface_data(
|
|
110
|
-
data_types=[SurfaceDataType.FacesConnectivity], surfaces=["symmetry"]
|
|
111
|
-
)
|
|
112
|
-
assert len(surface_data_symmetry["symmetry"]) == 2018
|
|
113
|
-
assert list(surface_data_symmetry["symmetry"][1000]) == [1259, 1260, 1227, 1226]
|
|
114
|
-
|
|
115
|
-
vector_data = file_session.fields.field_data.get_vector_field_data
|
|
116
|
-
assert vector_data("velocity", surfaces=["wall"])["wall"].shape == (3630, 3)
|
|
117
|
-
|
|
118
|
-
vector_data_symmetry = vector_data("velocity", surfaces=["symmetry"])["symmetry"]
|
|
119
|
-
assert vector_data_symmetry.shape == (2018, 3)
|
|
120
|
-
assert round(vector_data_symmetry[1009][0], 5) == 0.0023
|
|
121
|
-
assert round(vector_data_symmetry[1009][1], 5) == 1.22311
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def test_data_reader_single_phase():
|
|
125
|
-
case_file_name = examples.download_file(
|
|
126
|
-
"elbow1.cas.h5", "pyfluent/file_session", return_without_path=False
|
|
127
|
-
)
|
|
128
|
-
data_file_name = examples.download_file(
|
|
129
|
-
"elbow1.dat.h5", "pyfluent/file_session", return_without_path=False
|
|
130
|
-
)
|
|
131
|
-
file_session = FileSession()
|
|
132
|
-
file_session.read_case(case_file_name)
|
|
133
|
-
file_session.read_data(data_file_name)
|
|
134
|
-
|
|
135
|
-
data_file = file_session._data_file
|
|
136
|
-
assert data_file.case_file == "elbow1.cas.h5"
|
|
137
|
-
assert data_file.get_phases() == ["phase-1"]
|
|
138
|
-
assert len(data_file.get_face_variables("phase-1")) == 30
|
|
139
|
-
assert len(data_file.get_cell_variables("phase-1")) == 14
|
|
140
|
-
|
|
141
|
-
assert data_file.get_cell_variables("phase-1") == [
|
|
142
|
-
"SV_BF_V",
|
|
143
|
-
"SV_D",
|
|
144
|
-
"SV_DENSITY",
|
|
145
|
-
"SV_H",
|
|
146
|
-
"SV_K",
|
|
147
|
-
"SV_LORENTZ_FORCE",
|
|
148
|
-
"SV_MU_LAM",
|
|
149
|
-
"SV_MU_T",
|
|
150
|
-
"SV_P",
|
|
151
|
-
"SV_T",
|
|
152
|
-
"SV_U",
|
|
153
|
-
"SV_V",
|
|
154
|
-
"SV_W",
|
|
155
|
-
"",
|
|
156
|
-
]
|
|
157
|
-
|
|
158
|
-
assert len(data_file.get_face_scalar_field_data("phase-1", "SV_DENSITY", 3)) == 3630
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def test_data_reader_multi_phase():
|
|
162
|
-
case_file_name = examples.download_file(
|
|
163
|
-
"mixing_elbow_mul_ph.cas.h5",
|
|
164
|
-
"pyfluent/file_session",
|
|
165
|
-
return_without_path=False,
|
|
166
|
-
)
|
|
167
|
-
data_file_name = examples.download_file(
|
|
168
|
-
"mixing_elbow_mul_ph.dat.h5",
|
|
169
|
-
"pyfluent/file_session",
|
|
170
|
-
return_without_path=False,
|
|
171
|
-
)
|
|
172
|
-
file_session = FileSession()
|
|
173
|
-
file_session.read_case(case_file_name)
|
|
174
|
-
file_session.read_data(data_file_name)
|
|
175
|
-
|
|
176
|
-
data_file = file_session._data_file
|
|
177
|
-
assert data_file.case_file == "mixing_elbow_mul_ph.cas.h5"
|
|
178
|
-
assert data_file.get_phases() == [
|
|
179
|
-
"phase-1",
|
|
180
|
-
"phase-2",
|
|
181
|
-
"phase-3",
|
|
182
|
-
"phase-4",
|
|
183
|
-
]
|
|
184
|
-
assert len(data_file.get_face_variables("phase-1")) == 23
|
|
185
|
-
assert len(data_file.get_face_variables("phase-3")) == 13
|
|
186
|
-
assert len(data_file.get_cell_variables("phase-2")) == 14
|
|
187
|
-
|
|
188
|
-
assert data_file.get_cell_variables("phase-2") == [
|
|
189
|
-
"SV_BF_V",
|
|
190
|
-
"SV_DENSITY",
|
|
191
|
-
"SV_DENSITY_M1",
|
|
192
|
-
"SV_MU_LAM",
|
|
193
|
-
"SV_MU_T",
|
|
194
|
-
"SV_U",
|
|
195
|
-
"SV_U_M1",
|
|
196
|
-
"SV_V",
|
|
197
|
-
"SV_VOF",
|
|
198
|
-
"SV_VOF_M1",
|
|
199
|
-
"SV_V_M1",
|
|
200
|
-
"SV_W",
|
|
201
|
-
"SV_W_M1",
|
|
202
|
-
"",
|
|
203
|
-
]
|
|
204
|
-
|
|
205
|
-
assert len(data_file.get_face_scalar_field_data("phase-1", "SV_DENSITY", 33)) == 268
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
def test_transaction_request_single_phase():
|
|
209
|
-
case_file_name = examples.download_file(
|
|
210
|
-
"elbow1.cas.h5", "pyfluent/file_session", return_without_path=False
|
|
211
|
-
)
|
|
212
|
-
data_file_name = examples.download_file(
|
|
213
|
-
"elbow1.dat.h5", "pyfluent/file_session", return_without_path=False
|
|
214
|
-
)
|
|
215
|
-
file_session = FileSession()
|
|
216
|
-
file_session.read_case(case_file_name)
|
|
217
|
-
file_session.read_data(data_file_name)
|
|
218
|
-
|
|
219
|
-
field_data = file_session.fields.field_data
|
|
220
|
-
|
|
221
|
-
transaction_1 = field_data.new_transaction()
|
|
222
|
-
|
|
223
|
-
transaction_1.add_surfaces_request(surfaces=[3, 5])
|
|
224
|
-
|
|
225
|
-
transaction_1.add_scalar_fields_request("SV_T", surfaces=[3, 5])
|
|
226
|
-
transaction_1.add_scalar_fields_request("SV_T", surfaces=["wall", "symmetry"])
|
|
227
|
-
|
|
228
|
-
transaction_1.add_vector_fields_request("velocity", surfaces=[3, 5])
|
|
229
|
-
|
|
230
|
-
data = transaction_1.get_fields()
|
|
231
|
-
|
|
232
|
-
assert data
|
|
233
|
-
|
|
234
|
-
assert len(data) == 3
|
|
235
|
-
|
|
236
|
-
# Surfaces Data
|
|
237
|
-
surface_data = data[(("type", "surface-data"),)]
|
|
238
|
-
assert len(surface_data) == 2
|
|
239
|
-
assert list(surface_data[3].keys()) == ["faces", "vertices"]
|
|
240
|
-
|
|
241
|
-
# Scalar Field Data
|
|
242
|
-
scalar_field_tag = (
|
|
243
|
-
("type", "scalar-field"),
|
|
244
|
-
("dataLocation", 1),
|
|
245
|
-
("boundaryValues", False),
|
|
246
|
-
)
|
|
247
|
-
scalar_data = data[scalar_field_tag]
|
|
248
|
-
assert len(scalar_data) == 3
|
|
249
|
-
assert len(scalar_data[5]["SV_T"]) == 100
|
|
250
|
-
assert round(scalar_data[5]["SV_T"][50], 2) == 295.43
|
|
251
|
-
|
|
252
|
-
surf_id = file_session.field_info.get_surfaces_info()["symmetry"]["surface_id"][0]
|
|
253
|
-
assert round(scalar_data[surf_id]["SV_T"][50], 2) == 293.15
|
|
254
|
-
|
|
255
|
-
# Vector Field Data
|
|
256
|
-
vector_data = data[(("type", "vector-field"),)]
|
|
257
|
-
assert len(vector_data) == 2
|
|
258
|
-
assert len(vector_data[5]["velocity"]) == 300
|
|
259
|
-
assert round(vector_data[5]["velocity"][150], 5) == 0.03035
|
|
260
|
-
assert round(vector_data[5]["velocity"][151], 5) == 0.49224
|
|
261
|
-
assert round(vector_data[5]["velocity"][152], 5) == 0.00468
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
def test_transaction_request_multi_phase():
|
|
265
|
-
case_file_name = examples.download_file(
|
|
266
|
-
"mixing_elbow_mul_ph.cas.h5",
|
|
267
|
-
"pyfluent/file_session",
|
|
268
|
-
return_without_path=False,
|
|
269
|
-
)
|
|
270
|
-
data_file_name = examples.download_file(
|
|
271
|
-
"mixing_elbow_mul_ph.dat.h5",
|
|
272
|
-
"pyfluent/file_session",
|
|
273
|
-
return_without_path=False,
|
|
274
|
-
)
|
|
275
|
-
file_session = FileSession()
|
|
276
|
-
file_session.read_case(case_file_name)
|
|
277
|
-
file_session.read_data(data_file_name)
|
|
278
|
-
|
|
279
|
-
field_data = file_session.fields.field_data
|
|
280
|
-
|
|
281
|
-
transaction_1 = field_data.new_transaction()
|
|
282
|
-
|
|
283
|
-
transaction_1.add_scalar_fields_request("phase-2:SV_WALL_YPLUS", surfaces=[29, 30])
|
|
284
|
-
|
|
285
|
-
transaction_1.add_vector_fields_request("phase-3:velocity", surfaces=[31])
|
|
286
|
-
|
|
287
|
-
data = transaction_1.get_fields()
|
|
288
|
-
|
|
289
|
-
assert data
|
|
290
|
-
|
|
291
|
-
assert len(data) == 2
|
|
292
|
-
|
|
293
|
-
# Scalar Field Data
|
|
294
|
-
scalar_field_tag = (
|
|
295
|
-
("type", "scalar-field"),
|
|
296
|
-
("dataLocation", 1),
|
|
297
|
-
("boundaryValues", False),
|
|
298
|
-
)
|
|
299
|
-
|
|
300
|
-
assert len(data[scalar_field_tag]) == 2
|
|
301
|
-
|
|
302
|
-
# Vector Field Data
|
|
303
|
-
vector_data = data[(("type", "vector-field"),)]
|
|
304
|
-
assert len(vector_data) == 1
|
|
305
|
-
assert len(vector_data[31]["phase-3:velocity"]) == 456
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
def test_error_handling_single_phase():
|
|
309
|
-
case_file_name = examples.download_file(
|
|
310
|
-
"elbow1.cas.h5", "pyfluent/file_session", return_without_path=False
|
|
311
|
-
)
|
|
312
|
-
data_file_name = examples.download_file(
|
|
313
|
-
"elbow1.dat.h5", "pyfluent/file_session", return_without_path=False
|
|
314
|
-
)
|
|
315
|
-
file_session = FileSession()
|
|
316
|
-
file_session.read_case(case_file_name)
|
|
317
|
-
file_session.read_data(data_file_name)
|
|
318
|
-
|
|
319
|
-
field_data = file_session.fields.field_data
|
|
320
|
-
|
|
321
|
-
transaction_1 = field_data.new_transaction()
|
|
322
|
-
|
|
323
|
-
with pytest.raises(NotImplementedError):
|
|
324
|
-
transaction_1.add_pathlines_fields_request("SV_T", surfaces=[3, 5])
|
|
325
|
-
|
|
326
|
-
with pytest.raises(NotImplementedError):
|
|
327
|
-
field_data.get_pathlines_field_data("SV_T", surfaces=[3, 5])
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
def test_error_handling_multi_phase():
|
|
331
|
-
case_file_name = examples.download_file(
|
|
332
|
-
"mixing_elbow_mul_ph.cas.h5",
|
|
333
|
-
"pyfluent/file_session",
|
|
334
|
-
return_without_path=False,
|
|
335
|
-
)
|
|
336
|
-
data_file_name = examples.download_file(
|
|
337
|
-
"mixing_elbow_mul_ph.dat.h5",
|
|
338
|
-
"pyfluent/file_session",
|
|
339
|
-
return_without_path=False,
|
|
340
|
-
)
|
|
341
|
-
file_session = FileSession()
|
|
342
|
-
file_session.read_case(case_file_name)
|
|
343
|
-
file_session.read_data(data_file_name)
|
|
344
|
-
|
|
345
|
-
field_data = file_session.fields.field_data
|
|
346
|
-
|
|
347
|
-
transaction_1 = field_data.new_transaction()
|
|
348
|
-
with pytest.raises(InvalidMultiPhaseFieldName):
|
|
349
|
-
transaction_1.add_scalar_fields_request("SV_WALL_YPLUS", surfaces=[29, 30])
|
|
350
|
-
|
|
351
|
-
with pytest.raises(InvalidMultiPhaseFieldName):
|
|
352
|
-
field_data.get_vector_field_data("velocity", surfaces=[34])[34].size
|
|
353
|
-
|
|
354
|
-
with pytest.raises(InvalidFieldName):
|
|
355
|
-
field_data.get_vector_field_data("phase-1:temperature", surfaces=[34])[34].size
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"""Test file transfer service."""
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
import pathlib
|
|
5
|
-
|
|
6
|
-
import pytest
|
|
7
|
-
|
|
8
|
-
from ansys.fluent.core import examples
|
|
9
|
-
from ansys.fluent.core.utils.file_transfer_service import (
|
|
10
|
-
LocalFileTransferStrategy,
|
|
11
|
-
RemoteFileTransferStrategy,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def file_downloaded_to_the_client(file_name: str) -> bool:
|
|
16
|
-
"""Check if client file exists.
|
|
17
|
-
|
|
18
|
-
Parameters
|
|
19
|
-
----------
|
|
20
|
-
file_name: str
|
|
21
|
-
File name.
|
|
22
|
-
|
|
23
|
-
Returns
|
|
24
|
-
-------
|
|
25
|
-
Whether file exists.
|
|
26
|
-
"""
|
|
27
|
-
full_file_name = pathlib.Path(
|
|
28
|
-
"/home/runner/.local/share/ansys_fluent_core/examples"
|
|
29
|
-
) / os.path.basename(file_name)
|
|
30
|
-
return full_file_name.is_file()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@pytest.mark.codegen_required
|
|
34
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
35
|
-
def test_remote_grpc_fts_container(
|
|
36
|
-
monkeypatch, new_solver_session, new_meshing_session
|
|
37
|
-
):
|
|
38
|
-
solver = new_solver_session
|
|
39
|
-
import_case_file_name = examples.download_file(
|
|
40
|
-
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
41
|
-
)
|
|
42
|
-
import_mesh_file_name = examples.download_file(
|
|
43
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
44
|
-
)
|
|
45
|
-
solver.file.read_case(file_name=import_case_file_name)
|
|
46
|
-
if solver._file_transfer_service:
|
|
47
|
-
solver.file.write_case(file_name="downloaded_solver_mixing_elbow.cas.h5")
|
|
48
|
-
assert solver.file_exists_on_remote("downloaded_solver_mixing_elbow.cas.h5")
|
|
49
|
-
assert file_downloaded_to_the_client("downloaded_solver_mixing_elbow.cas.h5")
|
|
50
|
-
|
|
51
|
-
meshing = new_meshing_session
|
|
52
|
-
meshing.meshing.File.ReadMesh(FileName=import_mesh_file_name)
|
|
53
|
-
if meshing._file_transfer_service:
|
|
54
|
-
meshing.meshing.File.WriteMesh(
|
|
55
|
-
FileName="downloaded_meshing_mixing_elbow.msh.h5"
|
|
56
|
-
)
|
|
57
|
-
assert meshing.file_exists_on_remote("downloaded_meshing_mixing_elbow.msh.h5")
|
|
58
|
-
assert file_downloaded_to_the_client("downloaded_meshing_mixing_elbow.msh.h5")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@pytest.mark.standalone
|
|
62
|
-
def test_read_case_and_data(monkeypatch):
|
|
63
|
-
import ansys.fluent.core as pyfluent
|
|
64
|
-
|
|
65
|
-
monkeypatch.setattr(pyfluent, "USE_FILE_TRANSFER_SERVICE", True)
|
|
66
|
-
|
|
67
|
-
case_file_name = examples.download_file(
|
|
68
|
-
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
69
|
-
)
|
|
70
|
-
data_file_name = examples.download_file(
|
|
71
|
-
"mixing_elbow.dat.h5", "pyfluent/mixing_elbow"
|
|
72
|
-
)
|
|
73
|
-
assert case_file_name
|
|
74
|
-
assert data_file_name
|
|
75
|
-
solver = pyfluent.launch_fluent(file_transfer_service=LocalFileTransferStrategy())
|
|
76
|
-
|
|
77
|
-
solver.file.read(file_type="case-data", file_name=case_file_name)
|
|
78
|
-
solver.file.write(file_type="case-data", file_name="write_data.cas.h5")
|
|
79
|
-
|
|
80
|
-
solver.file.read_case_data(file_name=case_file_name)
|
|
81
|
-
solver.file.write_case_data(file_name="write_case_data.cas.h5")
|
|
82
|
-
solver.exit()
|
|
83
|
-
|
|
84
|
-
solver = pyfluent.launch_fluent(
|
|
85
|
-
file_transfer_service=LocalFileTransferStrategy(server_cwd=os.getcwd())
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
solver.file.read(file_type="case-data", file_name=case_file_name)
|
|
89
|
-
solver.file.write(file_type="case-data", file_name="write_data.cas.h5")
|
|
90
|
-
|
|
91
|
-
solver.file.read_case_data(file_name=case_file_name)
|
|
92
|
-
solver.file.write_case_data(file_name="write_case_data.cas.h5")
|
|
93
|
-
solver.exit()
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@pytest.mark.skip(reason="Skips upload even after adding ImportGeometry task object.")
|
|
97
|
-
def test_datamodel_execute():
|
|
98
|
-
import ansys.fluent.core as pyfluent
|
|
99
|
-
|
|
100
|
-
meshing = pyfluent.launch_fluent(
|
|
101
|
-
mode="meshing", file_transfer_service=RemoteFileTransferStrategy()
|
|
102
|
-
)
|
|
103
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
104
|
-
import_geom = meshing.workflow.TaskObject["Import Geometry"]
|
|
105
|
-
import_geom.Arguments = {"FileName": "geom"}
|
|
106
|
-
|
|
107
|
-
with pytest.raises(RuntimeError):
|
|
108
|
-
import_geom.Execute()
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def test_file_list_in_datamodel(fault_tolerant_workflow_session):
|
|
112
|
-
meshing = fault_tolerant_workflow_session
|
|
113
|
-
fmd_file = examples.download_file("exhaust_system.fmd", "pyfluent/exhaust_system")
|
|
114
|
-
meshing.PartManagement.AppendFmdFiles(
|
|
115
|
-
AssemblyParentNode=0,
|
|
116
|
-
FilePath=[fmd_file],
|
|
117
|
-
FileUnit="mm",
|
|
118
|
-
IgnoreSolidNamesAppend=False,
|
|
119
|
-
JtLOD="1",
|
|
120
|
-
Options={
|
|
121
|
-
"Line": False,
|
|
122
|
-
"Solid": True,
|
|
123
|
-
"Surface": True,
|
|
124
|
-
},
|
|
125
|
-
PartPerBody=False,
|
|
126
|
-
PrefixParentName=False,
|
|
127
|
-
RemoveEmptyParts=True,
|
|
128
|
-
Route="Native",
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@pytest.mark.standalone
|
|
133
|
-
def test_local_file_transfer_in_datamodel(monkeypatch):
|
|
134
|
-
import ansys.fluent.core as pyfluent
|
|
135
|
-
|
|
136
|
-
monkeypatch.setattr(pyfluent, "USE_FILE_TRANSFER_SERVICE", True)
|
|
137
|
-
|
|
138
|
-
fmd_file = examples.download_file("exhaust_system.fmd", "pyfluent/exhaust_system")
|
|
139
|
-
|
|
140
|
-
assert fmd_file
|
|
141
|
-
|
|
142
|
-
meshing = pyfluent.launch_fluent(
|
|
143
|
-
mode=pyfluent.FluentMode.MESHING,
|
|
144
|
-
file_transfer_service=LocalFileTransferStrategy(),
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
148
|
-
|
|
149
|
-
meshing.PartManagement.AppendFmdFiles(
|
|
150
|
-
AssemblyParentNode=0,
|
|
151
|
-
FilePath=[fmd_file],
|
|
152
|
-
FileUnit="mm",
|
|
153
|
-
IgnoreSolidNamesAppend=False,
|
|
154
|
-
JtLOD="1",
|
|
155
|
-
Options={
|
|
156
|
-
"Line": False,
|
|
157
|
-
"Solid": True,
|
|
158
|
-
"Surface": True,
|
|
159
|
-
},
|
|
160
|
-
PartPerBody=False,
|
|
161
|
-
PrefixParentName=False,
|
|
162
|
-
RemoveEmptyParts=True,
|
|
163
|
-
Route="Native",
|
|
164
|
-
)
|
|
165
|
-
meshing.exit()
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from ansys.fluent.core.utils.fix_doc import fix_settings_doc
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_fix_definition_list_in_settings_doc():
|
|
5
|
-
old_doc = """Menu to define the rotor pitch and flapping angles.
|
|
6
|
-
- blade-pitch-collective : ,
|
|
7
|
-
- blade-pitch-cyclic-sin : ,
|
|
8
|
-
- blade-pitch-cyclic-cos : ,
|
|
9
|
-
For more details please consult the help option of the corresponding menu or TUI command."""
|
|
10
|
-
new_doc = fix_settings_doc(old_doc)
|
|
11
|
-
assert (
|
|
12
|
-
new_doc
|
|
13
|
-
== """Menu to define the rotor pitch and flapping angles.
|
|
14
|
-
|
|
15
|
-
- blade-pitch-collective : ,
|
|
16
|
-
- blade-pitch-cyclic-sin : ,
|
|
17
|
-
- blade-pitch-cyclic-cos : ,
|
|
18
|
-
|
|
19
|
-
For more details please consult the help option of the corresponding menu or TUI command."""
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def test_fix_wildcards_in_settings_doc():
|
|
24
|
-
old_doc = """Read boundary profile data (*.prof, *.csv). Default is *.prof."""
|
|
25
|
-
new_doc = fix_settings_doc(old_doc)
|
|
26
|
-
assert (
|
|
27
|
-
new_doc
|
|
28
|
-
== r"""Read boundary profile data (\\*.prof, \\*.csv). Default is \\*.prof."""
|
|
29
|
-
)
|