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,250 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
End-to-end Fluent Solver Workflow using Watertight Meshing
|
|
3
|
-
-----------------------------------------------------------------------------
|
|
4
|
-
This test covers the setup and solution of a 3D
|
|
5
|
-
turbulent fluid flow and heat transfer problem in a mixing elbow. The mixing
|
|
6
|
-
elbow configuration is encountered in piping systems in power plants and
|
|
7
|
-
process industries. It is often important to predict the flow field and
|
|
8
|
-
temperature field in the area of the mixing region to properly design
|
|
9
|
-
the junction.
|
|
10
|
-
|
|
11
|
-
This test queries the following using PyTest:
|
|
12
|
-
|
|
13
|
-
- Meshing workflow tasks state before and after the task execution
|
|
14
|
-
- Report definitions check after solution
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
from functools import partial
|
|
18
|
-
|
|
19
|
-
import pytest
|
|
20
|
-
from util.meshing_workflow import (
|
|
21
|
-
assign_task_arguments,
|
|
22
|
-
execute_task_with_pre_and_postcondition_checks,
|
|
23
|
-
)
|
|
24
|
-
from util.solver import check_report_definition_result
|
|
25
|
-
|
|
26
|
-
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
@pytest.mark.nightly
|
|
30
|
-
@pytest.mark.codegen_required
|
|
31
|
-
def test_mixing_elbow(watertight_workflow_session, mixing_elbow_geometry_filename):
|
|
32
|
-
meshing_session = watertight_workflow_session
|
|
33
|
-
workflow = meshing_session.workflow
|
|
34
|
-
|
|
35
|
-
assign_task_args = partial(
|
|
36
|
-
assign_task_arguments, workflow=workflow, check_state=True
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
execute_task_with_pre_and_postconditions = partial(
|
|
40
|
-
execute_task_with_pre_and_postcondition_checks, workflow=workflow
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
###############################################################################
|
|
44
|
-
# Import the CAD geometry
|
|
45
|
-
# Query the task state before and after task execution
|
|
46
|
-
assign_task_args(
|
|
47
|
-
task_name="Import Geometry",
|
|
48
|
-
FileName=mixing_elbow_geometry_filename,
|
|
49
|
-
LengthUnit="in",
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
execute_task_with_pre_and_postconditions(task_name="Import Geometry")
|
|
53
|
-
|
|
54
|
-
###############################################################################
|
|
55
|
-
# Add local sizing
|
|
56
|
-
# Query the task state before and after task execution
|
|
57
|
-
workflow.TaskObject["Add Local Sizing"].AddChildToTask()
|
|
58
|
-
|
|
59
|
-
execute_task_with_pre_and_postconditions(task_name="Add Local Sizing")
|
|
60
|
-
|
|
61
|
-
###############################################################################
|
|
62
|
-
# Generate the surface mesh
|
|
63
|
-
# Query the task state before and after task execution
|
|
64
|
-
assign_task_args(
|
|
65
|
-
task_name="Generate the Surface Mesh",
|
|
66
|
-
CFDSurfaceMeshControls={"MaxSize": 0.3},
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
execute_task_with_pre_and_postconditions(task_name="Generate the Surface Mesh")
|
|
70
|
-
|
|
71
|
-
###############################################################################
|
|
72
|
-
# Describe the geometry
|
|
73
|
-
# Query the task state before and after task execution
|
|
74
|
-
describe_geo = workflow.TaskObject["Describe Geometry"]
|
|
75
|
-
describe_geo.UpdateChildTasks(SetupTypeChanged=False)
|
|
76
|
-
assign_task_args(
|
|
77
|
-
task_name="Describe Geometry",
|
|
78
|
-
SetupType="The geometry consists of only fluid regions with no voids",
|
|
79
|
-
)
|
|
80
|
-
describe_geo.UpdateChildTasks(SetupTypeChanged=True)
|
|
81
|
-
|
|
82
|
-
execute_task_with_pre_and_postconditions(task_name="Describe Geometry")
|
|
83
|
-
|
|
84
|
-
###############################################################################
|
|
85
|
-
# Update Boundaries Task
|
|
86
|
-
# Query the task state before and after task execution
|
|
87
|
-
assign_task_args(
|
|
88
|
-
task_name="Update Boundaries",
|
|
89
|
-
BoundaryLabelList=["wall-inlet"],
|
|
90
|
-
BoundaryLabelTypeList=["wall"],
|
|
91
|
-
OldBoundaryLabelList=["wall-inlet"],
|
|
92
|
-
OldBoundaryLabelTypeList=["velocity-inlet"],
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
execute_task_with_pre_and_postconditions(task_name="Update Boundaries")
|
|
96
|
-
|
|
97
|
-
###############################################################################
|
|
98
|
-
# Update your regions
|
|
99
|
-
# Query the task state before and after task execution
|
|
100
|
-
|
|
101
|
-
execute_task_with_pre_and_postconditions(task_name="Update Regions")
|
|
102
|
-
|
|
103
|
-
###############################################################################
|
|
104
|
-
# Add Boundary Layers
|
|
105
|
-
# Query the task state before and after task execution
|
|
106
|
-
add_boundary_layers = workflow.TaskObject["Add Boundary Layers"]
|
|
107
|
-
add_boundary_layers.AddChildToTask()
|
|
108
|
-
add_boundary_layers.InsertCompoundChildTask()
|
|
109
|
-
assign_task_args(
|
|
110
|
-
task_name="smooth-transition_1", BLControlName="smooth-transition_1"
|
|
111
|
-
)
|
|
112
|
-
add_boundary_layers.Arguments = {}
|
|
113
|
-
|
|
114
|
-
execute_task_with_pre_and_postconditions(task_name="Add Boundary Layers")
|
|
115
|
-
|
|
116
|
-
###############################################################################
|
|
117
|
-
# Generate the volume mesh
|
|
118
|
-
# Query the task state before and after task execution
|
|
119
|
-
assign_task_args(
|
|
120
|
-
task_name="Generate the Volume Mesh",
|
|
121
|
-
VolumeFill="poly-hexcore",
|
|
122
|
-
VolumeFillControls={"HexMaxCellLength": 0.3},
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
execute_task_with_pre_and_postconditions(task_name="Generate the Volume Mesh")
|
|
126
|
-
|
|
127
|
-
###############################################################################
|
|
128
|
-
# Check the mesh in Meshing mode
|
|
129
|
-
# TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
|
|
130
|
-
if meshing_session.get_fluent_version() < FluentVersion.v231:
|
|
131
|
-
meshing_session.tui.mesh.check_mesh()
|
|
132
|
-
|
|
133
|
-
###############################################################################
|
|
134
|
-
# Switch to Solution mode
|
|
135
|
-
solver_session = meshing_session.switch_to_solver()
|
|
136
|
-
|
|
137
|
-
###############################################################################
|
|
138
|
-
# Check the mesh in Solver mode
|
|
139
|
-
solver_session.tui.mesh.check()
|
|
140
|
-
|
|
141
|
-
###############################################################################
|
|
142
|
-
# Set the working units for the mesh
|
|
143
|
-
define = solver_session.tui.define
|
|
144
|
-
define.units("length", "in")
|
|
145
|
-
|
|
146
|
-
###############################################################################
|
|
147
|
-
# Enable heat transfer by activating the energy equation.
|
|
148
|
-
define.models.energy("yes", ", ", ", ", ", ", ", ")
|
|
149
|
-
|
|
150
|
-
###############################################################################
|
|
151
|
-
# Create a new material called water-liquid.
|
|
152
|
-
define.materials.copy("fluid", "water-liquid")
|
|
153
|
-
|
|
154
|
-
###############################################################################
|
|
155
|
-
# Set up the cell zone conditions for the fluid zone (elbow-fluid). Select
|
|
156
|
-
# water-liquid from the Material list.
|
|
157
|
-
# TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
|
|
158
|
-
if solver_session.get_fluent_version() < FluentVersion.v231:
|
|
159
|
-
define.boundary_conditions.fluid(
|
|
160
|
-
"elbow-fluid",
|
|
161
|
-
"yes",
|
|
162
|
-
"water-liquid",
|
|
163
|
-
"no",
|
|
164
|
-
"no",
|
|
165
|
-
"no",
|
|
166
|
-
"no",
|
|
167
|
-
"0",
|
|
168
|
-
"no",
|
|
169
|
-
"0",
|
|
170
|
-
"no",
|
|
171
|
-
"0",
|
|
172
|
-
"no",
|
|
173
|
-
"0",
|
|
174
|
-
"no",
|
|
175
|
-
"0",
|
|
176
|
-
"no",
|
|
177
|
-
"1",
|
|
178
|
-
"no",
|
|
179
|
-
"no",
|
|
180
|
-
"no",
|
|
181
|
-
"no",
|
|
182
|
-
"no",
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
###############################################################################
|
|
186
|
-
# Set up the boundary conditions
|
|
187
|
-
velocity_inlet = define.boundary_conditions.set.velocity_inlet
|
|
188
|
-
velocity_inlet("cold-inlet", [], "vmag", "no", 0.4, "quit")
|
|
189
|
-
velocity_inlet("cold-inlet", [], "ke-spec", "no", "no", "no", "yes", "quit")
|
|
190
|
-
velocity_inlet("cold-inlet", [], "turb-intensity", 5, "quit")
|
|
191
|
-
velocity_inlet("cold-inlet", [], "turb-hydraulic-diam", 4, "quit")
|
|
192
|
-
velocity_inlet("cold-inlet", [], "temperature", "no", 293.15, "quit")
|
|
193
|
-
velocity_inlet("hot-inlet", [], "vmag", "no", 1.2, "quit")
|
|
194
|
-
velocity_inlet("hot-inlet", [], "ke-spec", "no", "no", "no", "yes", "quit")
|
|
195
|
-
velocity_inlet("hot-inlet", [], "turb-intensity", 5, "quit")
|
|
196
|
-
velocity_inlet("hot-inlet", [], "turb-hydraulic-diam", 1, "quit")
|
|
197
|
-
velocity_inlet("hot-inlet", [], "temperature", "no", 313.15, "quit")
|
|
198
|
-
|
|
199
|
-
pressure_outlet = define.boundary_conditions.set.pressure_outlet
|
|
200
|
-
pressure_outlet("outlet", [], "turb-intensity", 5, "quit")
|
|
201
|
-
pressure_outlet("outlet", [], "turb-viscosity-ratio", 4, "quit")
|
|
202
|
-
|
|
203
|
-
###############################################################################
|
|
204
|
-
# Enable the plotting of residuals during the calculation.
|
|
205
|
-
solver_session.tui.solve.monitors.residual.plot("yes")
|
|
206
|
-
|
|
207
|
-
###############################################################################
|
|
208
|
-
# Initialize the flow field using the Hybrid Initialization
|
|
209
|
-
solver_session.tui.solve.initialize.hyb_initialization()
|
|
210
|
-
|
|
211
|
-
###############################################################################
|
|
212
|
-
# Solve for 250 Iterations.
|
|
213
|
-
solver_session.tui.solve.iterate(250)
|
|
214
|
-
|
|
215
|
-
###############################################################################
|
|
216
|
-
# Assert the returned mass flow rate report definition value
|
|
217
|
-
flux = solver_session.solution.report_definitions.flux
|
|
218
|
-
flux["mass_flow_rate"] = {}
|
|
219
|
-
flux["mass_flow_rate"].zone_names = [
|
|
220
|
-
"cold-inlet",
|
|
221
|
-
"hot-inlet",
|
|
222
|
-
"outlet",
|
|
223
|
-
]
|
|
224
|
-
|
|
225
|
-
check_report_definition = partial(
|
|
226
|
-
check_report_definition_result,
|
|
227
|
-
report_definitions=solver_session.solution.report_definitions,
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
check_report_definition(
|
|
231
|
-
report_definition_name="mass_flow_rate",
|
|
232
|
-
expected_result=pytest.approx(-2.985690364942784e-06, abs=1e-3),
|
|
233
|
-
)
|
|
234
|
-
|
|
235
|
-
###############################################################################
|
|
236
|
-
# Assert the returned temperature report definition value on the outlet surface
|
|
237
|
-
solver_session.solution.report_definitions.surface["temperature_outlet"] = {}
|
|
238
|
-
temp_outlet = solver_session.solution.report_definitions.surface[
|
|
239
|
-
"temperature_outlet"
|
|
240
|
-
]
|
|
241
|
-
temp_outlet.report_type = "surface-massavg"
|
|
242
|
-
temp_outlet.field = "temperature"
|
|
243
|
-
temp_outlet.surface_names = ["outlet"]
|
|
244
|
-
|
|
245
|
-
check_report_definition(
|
|
246
|
-
report_definition_name="temperature_outlet",
|
|
247
|
-
expected_result=pytest.approx(296.229, rel=1e-3),
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
###############################################################################
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
from os.path import dirname, join
|
|
2
|
-
import pathlib
|
|
3
|
-
import shutil
|
|
4
|
-
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
from ansys.fluent.core import examples
|
|
8
|
-
from ansys.fluent.core.filereader import lispy
|
|
9
|
-
from ansys.fluent.core.filereader.case_file import (
|
|
10
|
-
InputParameter,
|
|
11
|
-
InputParameterOld,
|
|
12
|
-
MeshType,
|
|
13
|
-
_get_processed_string,
|
|
14
|
-
)
|
|
15
|
-
from ansys.fluent.core.filereader.case_file import CaseFile as CaseReader
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def call_casereader(
|
|
19
|
-
case_file_name: str | None = None,
|
|
20
|
-
project_file_name: str | None = None,
|
|
21
|
-
expected: dict | None = None,
|
|
22
|
-
):
|
|
23
|
-
reader = CaseReader(
|
|
24
|
-
case_file_name=case_file_name, project_file_name=project_file_name
|
|
25
|
-
)
|
|
26
|
-
if expected is not None:
|
|
27
|
-
assert reader.precision() == expected["precision"]
|
|
28
|
-
assert reader.num_dimensions() == expected["num_dimensions"]
|
|
29
|
-
assert reader.iter_count() == expected["iter_count"]
|
|
30
|
-
assert {
|
|
31
|
-
p.name: (p.numeric_value, p.units) for p in reader.input_parameters()
|
|
32
|
-
} == expected["input_parameters"]
|
|
33
|
-
assert {p.name: p.units for p in reader.output_parameters()} == expected[
|
|
34
|
-
"output_parameters"
|
|
35
|
-
]
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def call_casereader_static_mixer(
|
|
39
|
-
case_file_name: str | None = None, project_file_name: str | None = None
|
|
40
|
-
):
|
|
41
|
-
call_casereader(
|
|
42
|
-
case_file_name=case_file_name,
|
|
43
|
-
project_file_name=project_file_name,
|
|
44
|
-
expected=dict(
|
|
45
|
-
precision=2,
|
|
46
|
-
num_dimensions=3,
|
|
47
|
-
iter_count=100,
|
|
48
|
-
input_parameters=dict(
|
|
49
|
-
inlet1_temp=(300, "K"),
|
|
50
|
-
inlet1_vel=(1, "m/s"),
|
|
51
|
-
inlet2_temp=(350, "K"),
|
|
52
|
-
inlet2_vel=(1, "m/s"),
|
|
53
|
-
),
|
|
54
|
-
output_parameters={
|
|
55
|
-
"outlet-temp-avg-op": "K",
|
|
56
|
-
"outlet-vel-avg-op": "m s^-1",
|
|
57
|
-
},
|
|
58
|
-
),
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def static_mixer_file():
|
|
63
|
-
return examples.download_file(
|
|
64
|
-
"Static_Mixer_Parameters.cas.h5",
|
|
65
|
-
"pyfluent/static_mixer",
|
|
66
|
-
return_without_path=False,
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def test_casereader_static_mixer_h5():
|
|
71
|
-
call_casereader_static_mixer(case_file_name=static_mixer_file())
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def test_casereader_static_mixer_binary_cas():
|
|
75
|
-
call_casereader_static_mixer(
|
|
76
|
-
case_file_name=examples.download_file(
|
|
77
|
-
"Static_Mixer_Parameters_legacy_binary.cas",
|
|
78
|
-
"pyfluent/static_mixer",
|
|
79
|
-
return_without_path=False,
|
|
80
|
-
)
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def test_casereader_static_mixer_binary_gz():
|
|
85
|
-
call_casereader_static_mixer(
|
|
86
|
-
case_file_name=examples.download_file(
|
|
87
|
-
"Static_Mixer_Parameters_legacy_binary.cas.gz",
|
|
88
|
-
"pyfluent/static_mixer",
|
|
89
|
-
return_without_path=False,
|
|
90
|
-
)
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def test_casereader_static_mixer_text_cas():
|
|
95
|
-
call_casereader_static_mixer(
|
|
96
|
-
case_file_name=examples.download_file(
|
|
97
|
-
"Static_Mixer_Parameters_legacy_text.cas",
|
|
98
|
-
"pyfluent/static_mixer",
|
|
99
|
-
return_without_path=False,
|
|
100
|
-
)
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def test_casereader_static_mixer_text_gz():
|
|
105
|
-
call_casereader_static_mixer(
|
|
106
|
-
case_file_name=examples.download_file(
|
|
107
|
-
"Static_Mixer_Parameters_legacy_text.cas.gz",
|
|
108
|
-
"pyfluent/static_mixer",
|
|
109
|
-
return_without_path=False,
|
|
110
|
-
)
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def create_dir_structure_locally(copy_1: bool = False, copy_2: bool = False):
|
|
115
|
-
# Copying from and then creating the entire directory structure locally
|
|
116
|
-
case_file_dir = (
|
|
117
|
-
"Static_Mixer_Parameter_project_file/"
|
|
118
|
-
"Static_Mixer_Parameters.cffdb/Static_Mixer_Parameters-Solve"
|
|
119
|
-
)
|
|
120
|
-
case_file_name = examples.download_file(
|
|
121
|
-
"Static_Mixer_Parameters.cas.h5",
|
|
122
|
-
"pyfluent/static_mixer/" + case_file_dir,
|
|
123
|
-
return_without_path=False,
|
|
124
|
-
)
|
|
125
|
-
prj_dir = join(dirname(case_file_name), case_file_dir)
|
|
126
|
-
pathlib.Path(prj_dir).mkdir(parents=True, exist_ok=True)
|
|
127
|
-
if copy_1:
|
|
128
|
-
shutil.copy2(case_file_name, prj_dir)
|
|
129
|
-
if copy_2:
|
|
130
|
-
case_file_name_2 = examples.download_file(
|
|
131
|
-
"Static_Mixer_Parameters_legacy_binary.cas.gz",
|
|
132
|
-
"pyfluent/static_mixer",
|
|
133
|
-
return_without_path=False,
|
|
134
|
-
)
|
|
135
|
-
shutil.copy2(case_file_name_2, prj_dir)
|
|
136
|
-
prj_file_dir = "Static_Mixer_Parameter_project_file"
|
|
137
|
-
prj_file = r"Static_Mixer_Parameters.flprj"
|
|
138
|
-
prj_file_name = examples.download_file(
|
|
139
|
-
prj_file, "pyfluent/static_mixer/" + prj_file_dir, return_without_path=False
|
|
140
|
-
)
|
|
141
|
-
prj_file_dir = join(dirname(prj_file_name), prj_file_dir)
|
|
142
|
-
shutil.copy2(prj_file_name, prj_file_dir)
|
|
143
|
-
|
|
144
|
-
return join(prj_file_dir, prj_file)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def test_processed_string():
|
|
148
|
-
assert (
|
|
149
|
-
_get_processed_string(b"Hello! World (37 ( Get this part of the string ))")
|
|
150
|
-
== "(37 ( Get this part of the string ))"
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def test_casereader_no_file():
|
|
155
|
-
with pytest.raises(FileNotFoundError):
|
|
156
|
-
call_casereader("no_file.cas.h5")
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def test_casereader_with_both_project_and_case_file():
|
|
160
|
-
with pytest.raises(RuntimeError):
|
|
161
|
-
call_casereader(
|
|
162
|
-
case_file_name="case_file.cas.h5", project_file_name="project.flprj"
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def test_casereader_for_project_directory_invalid_project_file():
|
|
167
|
-
with pytest.raises(FileNotFoundError):
|
|
168
|
-
call_casereader(project_file_name="project.flprx")
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def test_case_reader_with_bad_data_to_be_skipped_and_input_parameters_labeled_differently():
|
|
172
|
-
call_casereader(
|
|
173
|
-
case_file_name=examples.download_file(
|
|
174
|
-
"mixer-ran_2019r3.cas.gz", "pyfluent/optislang", return_without_path=False
|
|
175
|
-
),
|
|
176
|
-
expected=dict(
|
|
177
|
-
precision=1,
|
|
178
|
-
num_dimensions=3,
|
|
179
|
-
iter_count=25,
|
|
180
|
-
input_parameters=dict(
|
|
181
|
-
swirl_max_hot=(0.1, "m s^-1"),
|
|
182
|
-
vel_hot=(0.1, "m s^-1"),
|
|
183
|
-
vel_cold=(0.1, "m s^-1"),
|
|
184
|
-
swirl_max_cold=(0.1, "m s^-1"),
|
|
185
|
-
),
|
|
186
|
-
output_parameters={
|
|
187
|
-
"p2-op": "kg m^-1 s^-2",
|
|
188
|
-
"t-dev-op": "K",
|
|
189
|
-
"p1-op": "kg m^-1 s^-2",
|
|
190
|
-
"ave_temp_out": "K",
|
|
191
|
-
},
|
|
192
|
-
),
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
def test_case_reader_get_rp_and_config_vars():
|
|
197
|
-
reader = CaseReader(case_file_name=static_mixer_file())
|
|
198
|
-
rp_vars = reader.rp_vars()
|
|
199
|
-
assert rp_vars
|
|
200
|
-
assert hasattr(rp_vars, "__getitem__")
|
|
201
|
-
config_vars = reader.config_vars()
|
|
202
|
-
assert config_vars
|
|
203
|
-
assert hasattr(config_vars, "__getitem__")
|
|
204
|
-
assert config_vars["rp-3d?"] is True
|
|
205
|
-
assert reader.config_var("rp-3d?") is True
|
|
206
|
-
assert reader.config_var.rp_3d__q() is True
|
|
207
|
-
assert reader.rp_var.smooth_mesh.niter() == 4
|
|
208
|
-
assert reader.rp_var.pressure.output_dpdt__q() is True
|
|
209
|
-
assert len(reader.rp_var.context.map_r17__plus()) == 53
|
|
210
|
-
assert reader.rp_var.defaults.pre_r19__dot0_early__q() is False
|
|
211
|
-
|
|
212
|
-
with pytest.raises(RuntimeError) as msg:
|
|
213
|
-
reader.rp_var.defaults.pre_r19__dot0_early()
|
|
214
|
-
|
|
215
|
-
with pytest.raises(ValueError) as msg:
|
|
216
|
-
reader.config_var("rp-3d")
|
|
217
|
-
assert (
|
|
218
|
-
msg.value.args[0] == "'config-vars' has no attribute 'rp-3d'.\n"
|
|
219
|
-
"The most similar names are: rp-3d?, rp-des?."
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def test_case_reader_input_parameter():
|
|
224
|
-
number = InputParameter(raw_data=(("name", "n"), ("definition", "12.4")))
|
|
225
|
-
|
|
226
|
-
assert number.name == "n"
|
|
227
|
-
assert number.units == ""
|
|
228
|
-
assert number.numeric_value == 12.4
|
|
229
|
-
assert number.value == "12.4"
|
|
230
|
-
|
|
231
|
-
length = InputParameter(raw_data=(("name", "x"), ("definition", "12.4 [m]")))
|
|
232
|
-
|
|
233
|
-
assert length.name == "x"
|
|
234
|
-
assert length.units == "m"
|
|
235
|
-
assert length.numeric_value == 12.4
|
|
236
|
-
assert length.value == "12.4 [m]"
|
|
237
|
-
|
|
238
|
-
momentum = InputParameter(
|
|
239
|
-
raw_data=(("name", "p"), ("definition", "12.4 [kg m s^-1]"))
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
assert momentum.name == "p"
|
|
243
|
-
assert momentum.units == "kg m s^-1"
|
|
244
|
-
assert momentum.numeric_value == 12.4
|
|
245
|
-
assert momentum.value == "12.4 [kg m s^-1]"
|
|
246
|
-
|
|
247
|
-
velocity = InputParameter(raw_data=(("name", "v"), ("definition", "2[m/s]")))
|
|
248
|
-
|
|
249
|
-
assert velocity.name == "v"
|
|
250
|
-
assert velocity.units == "m/s"
|
|
251
|
-
assert velocity.numeric_value == 2
|
|
252
|
-
assert velocity.value == "2 [m/s]"
|
|
253
|
-
|
|
254
|
-
vel_data = [
|
|
255
|
-
"real-1",
|
|
256
|
-
[
|
|
257
|
-
("type", "real"),
|
|
258
|
-
["name", ("value", '"inlet_velocity"'), ("type", "string-class")],
|
|
259
|
-
[
|
|
260
|
-
"parameter-value",
|
|
261
|
-
("type", "real-class"),
|
|
262
|
-
("value", 20.0),
|
|
263
|
-
("min", False),
|
|
264
|
-
("max", False),
|
|
265
|
-
("units-quantity", "velocity"),
|
|
266
|
-
],
|
|
267
|
-
],
|
|
268
|
-
]
|
|
269
|
-
velocity = InputParameterOld(raw_data=vel_data)
|
|
270
|
-
|
|
271
|
-
assert velocity.name == "inlet_velocity"
|
|
272
|
-
assert velocity.value == [
|
|
273
|
-
"parameter-value",
|
|
274
|
-
("type", "real-class"),
|
|
275
|
-
("value", 20.0),
|
|
276
|
-
("min", False),
|
|
277
|
-
("max", False),
|
|
278
|
-
("units-quantity", "velocity"),
|
|
279
|
-
]
|
|
280
|
-
assert velocity.units == "velocity"
|
|
281
|
-
assert velocity.numeric_value == 20.0
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
def test_lispy_for_multiline_string():
|
|
285
|
-
assert lispy.parse('(define x "abc\ndef")') == ["define", "x", '"abc\ndef"']
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
def test_lispy_for_quotes():
|
|
289
|
-
assert lispy.parse(
|
|
290
|
-
'(define x "\n(format \\"\n-------------------------\nRunning Original Settings\n------------------------\n\\")")'
|
|
291
|
-
) == [
|
|
292
|
-
"define",
|
|
293
|
-
"x",
|
|
294
|
-
'"\n(format \\"\n-------------------------\nRunning Original Settings\n------------------------\n\\")"',
|
|
295
|
-
]
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
def test_mesh_reader():
|
|
299
|
-
mesh_file_2d = examples.download_file(
|
|
300
|
-
"sample_2d_mesh.msh.h5",
|
|
301
|
-
"pyfluent/surface_mesh",
|
|
302
|
-
return_without_path=False,
|
|
303
|
-
)
|
|
304
|
-
mesh_file_3d = examples.download_file(
|
|
305
|
-
"mixing_elbow.msh.h5",
|
|
306
|
-
"pyfluent/mixing_elbow",
|
|
307
|
-
return_without_path=False,
|
|
308
|
-
)
|
|
309
|
-
case_file = examples.download_file(
|
|
310
|
-
"mixing_elbow.cas.h5",
|
|
311
|
-
"pyfluent/mixing_elbow",
|
|
312
|
-
return_without_path=False,
|
|
313
|
-
)
|
|
314
|
-
mesh_reader_2d = CaseReader(case_file_name=mesh_file_2d)
|
|
315
|
-
mesh_reader_3d = CaseReader(case_file_name=mesh_file_3d)
|
|
316
|
-
case_reader = CaseReader(case_file_name=case_file)
|
|
317
|
-
|
|
318
|
-
assert mesh_reader_2d.get_mesh().get_mesh_type() == MeshType.SURFACE
|
|
319
|
-
assert mesh_reader_3d.get_mesh().get_mesh_type() == MeshType.VOLUME
|
|
320
|
-
assert case_reader.get_mesh().get_mesh_type() == MeshType.VOLUME
|
|
321
|
-
|
|
322
|
-
assert mesh_reader_2d.precision() is None
|
|
323
|
-
assert mesh_reader_3d.precision() is None
|
|
324
|
-
assert case_reader.precision() == 2
|