ansys-fluent-core 0.28.2__py3-none-any.whl → 0.29.0__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 +26 -1
- ansys/fluent/core/_stand_alone_datamodel_client/_datamodel_client.py +22 -0
- ansys/fluent/core/_version.py +24 -2
- ansys/fluent/core/codegen/__init__.py +22 -0
- ansys/fluent/core/codegen/allapigen.py +38 -5
- ansys/fluent/core/codegen/builtin_settingsgen.py +22 -0
- ansys/fluent/core/codegen/data/__init__.py +21 -0
- ansys/fluent/core/codegen/data/fluent_gui_help_patch.py +22 -0
- ansys/fluent/core/codegen/data/meshing_utilities_examples.py +22 -0
- ansys/fluent/core/codegen/datamodelgen.py +40 -4
- ansys/fluent/core/codegen/print_fluent_version.py +22 -0
- ansys/fluent/core/codegen/settingsgen.py +67 -4
- ansys/fluent/core/codegen/tuigen.py +44 -6
- ansys/fluent/core/codegen/walk_api.py +67 -18
- ansys/fluent/core/codegen/write_settings_yaml.py +22 -0
- ansys/fluent/core/data_model_cache.py +22 -0
- ansys/fluent/core/examples/__init__.py +22 -0
- ansys/fluent/core/examples/downloads.py +22 -0
- ansys/fluent/core/exceptions.py +22 -0
- ansys/fluent/core/file_session.py +22 -0
- ansys/fluent/core/filereader/__init__.py +21 -0
- ansys/fluent/core/filereader/case_file.py +22 -0
- ansys/fluent/core/filereader/casereader.py +22 -0
- ansys/fluent/core/filereader/data_file.py +22 -0
- ansys/fluent/core/filereader/lispy.py +22 -0
- ansys/fluent/core/fluent_connection.py +23 -1
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +32 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/solver/settings_222.py +0 -72
- ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
- ansys/fluent/core/generated/solver/settings_231.py +0 -574
- ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
- ansys/fluent/core/generated/solver/settings_232.py +0 -527
- ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
- ansys/fluent/core/generated/solver/settings_241.py +0 -478
- ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
- ansys/fluent/core/generated/solver/settings_242.py +0 -361
- ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
- ansys/fluent/core/generated/solver/settings_251.py +0 -399
- ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
- ansys/fluent/core/generated/solver/settings_252.py +7794 -4185
- ansys/fluent/core/generated/solver/settings_252.pyi +6986 -3213
- ansys/fluent/core/generated/solver/tui_252.py +537 -181
- ansys/fluent/core/get_build_details.py +22 -0
- ansys/fluent/core/journaling.py +38 -0
- ansys/fluent/core/launcher/__init__.py +22 -0
- ansys/fluent/core/launcher/container_launcher.py +65 -56
- ansys/fluent/core/launcher/error_handler.py +30 -0
- ansys/fluent/core/launcher/fluent_container.py +45 -20
- ansys/fluent/core/launcher/launcher.py +53 -5
- ansys/fluent/core/launcher/launcher_utils.py +22 -0
- ansys/fluent/core/launcher/pim_launcher.py +120 -86
- ansys/fluent/core/launcher/process_launch_string.py +22 -0
- ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
- ansys/fluent/core/launcher/server_info.py +45 -3
- ansys/fluent/core/launcher/slurm_launcher.py +25 -3
- ansys/fluent/core/launcher/standalone_launcher.py +68 -63
- ansys/fluent/core/launcher/watchdog.py +22 -0
- ansys/fluent/core/logging.py +24 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/meshing/meshing_workflow.py +22 -0
- ansys/fluent/core/parametric.py +22 -0
- ansys/fluent/core/post_objects/__init__.py +21 -0
- ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
- ansys/fluent/core/post_objects/meta.py +22 -0
- ansys/fluent/core/post_objects/post_helper.py +22 -0
- ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
- ansys/fluent/core/post_objects/post_objects_container.py +22 -0
- ansys/fluent/core/post_objects/singleton_meta.py +22 -0
- ansys/fluent/core/post_objects/timing_decorator.py +22 -0
- ansys/fluent/core/report.py +77 -0
- ansys/fluent/core/rpvars.py +22 -0
- ansys/fluent/core/scheduler/__init__.py +22 -0
- ansys/fluent/core/scheduler/load_machines.py +22 -0
- ansys/fluent/core/scheduler/machine_list.py +22 -0
- ansys/fluent/core/search.py +22 -0
- ansys/fluent/core/services/__init__.py +22 -0
- ansys/fluent/core/services/api_upgrade.py +22 -0
- ansys/fluent/core/services/app_utilities.py +38 -0
- ansys/fluent/core/services/batch_ops.py +22 -0
- ansys/fluent/core/services/datamodel_se.py +26 -1
- ansys/fluent/core/services/datamodel_tui.py +22 -0
- ansys/fluent/core/services/deprecated_field_data.py +23 -1
- ansys/fluent/core/services/events.py +22 -0
- ansys/fluent/core/services/field_data.py +285 -2
- ansys/fluent/core/services/health_check.py +22 -0
- ansys/fluent/core/services/interceptors.py +50 -2
- ansys/fluent/core/services/monitor.py +22 -0
- ansys/fluent/core/services/reduction.py +22 -0
- ansys/fluent/core/services/scheme_eval.py +22 -0
- ansys/fluent/core/services/settings.py +22 -0
- ansys/fluent/core/services/solution_variables.py +22 -0
- ansys/fluent/core/services/streaming.py +22 -0
- ansys/fluent/core/services/transcript.py +22 -0
- ansys/fluent/core/session.py +39 -2
- ansys/fluent/core/session_base_meshing.py +22 -0
- ansys/fluent/core/session_meshing.py +22 -0
- ansys/fluent/core/session_meshing.pyi +22 -0
- ansys/fluent/core/session_pure_meshing.py +22 -0
- ansys/fluent/core/session_pure_meshing.pyi +22 -0
- ansys/fluent/core/session_shared.py +22 -0
- ansys/fluent/core/session_solver.py +43 -0
- ansys/fluent/core/session_solver.pyi +22 -0
- ansys/fluent/core/session_solver_aero.py +22 -0
- ansys/fluent/core/session_solver_icing.py +22 -0
- ansys/fluent/core/session_solver_lite.py +22 -0
- ansys/fluent/core/solver/__init__.py +22 -0
- ansys/fluent/core/solver/error_message.py +22 -0
- ansys/fluent/core/solver/flobject.py +22 -0
- ansys/fluent/core/solver/flunits.py +22 -0
- ansys/fluent/core/solver/function/__init__.py +22 -0
- ansys/fluent/core/solver/function/reduction.py +22 -0
- ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
- ansys/fluent/core/solver/settings_builtin_data.py +22 -0
- ansys/fluent/core/solver/settings_external.py +22 -0
- ansys/fluent/core/streaming_services/__init__.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +22 -0
- ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
- ansys/fluent/core/streaming_services/events_streaming.py +22 -0
- ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
- ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
- ansys/fluent/core/streaming_services/streaming.py +22 -0
- ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
- ansys/fluent/core/systemcoupling.py +22 -0
- ansys/fluent/core/utils/__init__.py +22 -0
- ansys/fluent/core/utils/data_transfer.py +22 -0
- ansys/fluent/core/utils/deprecate.py +24 -1
- ansys/fluent/core/utils/dictionary_operations.py +22 -0
- ansys/fluent/core/utils/dump_session_data.py +22 -0
- ansys/fluent/core/utils/event_loop.py +22 -0
- ansys/fluent/core/utils/execution.py +22 -0
- ansys/fluent/core/utils/file_transfer_service.py +22 -0
- ansys/fluent/core/utils/fix_doc.py +22 -0
- ansys/fluent/core/utils/fldoc.py +22 -0
- ansys/fluent/core/utils/fluent_version.py +22 -0
- ansys/fluent/core/utils/networking.py +22 -0
- ansys/fluent/core/utils/setup_for_fluent.py +22 -0
- ansys/fluent/core/warnings.py +22 -0
- ansys/fluent/core/workflow.py +22 -0
- {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/LICENSE +8 -8
- {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.dist-info}/METADATA +56 -33
- ansys_fluent_core-0.29.0.dist-info/RECORD +219 -0
- {ansys_fluent_core-0.28.2.dist-info → ansys_fluent_core-0.29.0.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 -429
- 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 -766
- 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.28.2.dist-info/AUTHORS +0 -12
- ansys_fluent_core-0.28.2.dist-info/RECORD +0 -294
|
@@ -1,466 +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
|
-
from ansys.fluent.core.exceptions import DisallowedValuesError
|
|
7
|
-
from ansys.fluent.core.services.field_data import FieldUnavailable, SurfaceDataType
|
|
8
|
-
|
|
9
|
-
HOT_INLET_TEMPERATURE = 313.15
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.mark.fluent_version(">=24.1")
|
|
13
|
-
def test_field_data(new_solver_session) -> None:
|
|
14
|
-
solver = new_solver_session
|
|
15
|
-
import_file_name = examples.download_file(
|
|
16
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
17
|
-
)
|
|
18
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
19
|
-
solver.tui.mesh.check()
|
|
20
|
-
|
|
21
|
-
solver.setup.models.energy.enabled = True
|
|
22
|
-
solver.setup.materials.database.copy_by_name(type="fluid", name="water-liquid")
|
|
23
|
-
solver.setup.cell_zone_conditions.fluid["elbow-fluid"].material = "water-liquid"
|
|
24
|
-
|
|
25
|
-
# Set up boundary conditions for CFD analysis
|
|
26
|
-
cold_inlet = solver.setup.boundary_conditions.velocity_inlet["cold-inlet"]
|
|
27
|
-
cold_inlet.momentum.velocity = 0.4
|
|
28
|
-
cold_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter"
|
|
29
|
-
cold_inlet.turbulence.turbulent_intensity = 0.05
|
|
30
|
-
cold_inlet.turbulence.hydraulic_diameter = "4 [in]"
|
|
31
|
-
cold_inlet.thermal.t = 293.15
|
|
32
|
-
|
|
33
|
-
hot_inlet = solver.setup.boundary_conditions.velocity_inlet["hot-inlet"]
|
|
34
|
-
hot_inlet.momentum.velocity = 1.2
|
|
35
|
-
hot_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter"
|
|
36
|
-
hot_inlet.turbulence.hydraulic_diameter = "1 [in]"
|
|
37
|
-
hot_inlet.thermal.t = HOT_INLET_TEMPERATURE
|
|
38
|
-
|
|
39
|
-
solver.tui.solve.monitors.residual.plot("no")
|
|
40
|
-
|
|
41
|
-
# Initialize flow field
|
|
42
|
-
solver.solution.initialization.hybrid_initialize()
|
|
43
|
-
|
|
44
|
-
iterate = solver.solution.run_calculation.iterate
|
|
45
|
-
iterate.get_attr("arguments")
|
|
46
|
-
iterate(iter_count=10)
|
|
47
|
-
|
|
48
|
-
# Get field data object
|
|
49
|
-
field_data = solver.fields.field_data
|
|
50
|
-
|
|
51
|
-
transaction = field_data.new_transaction()
|
|
52
|
-
|
|
53
|
-
hot_inlet_surf_id = solver.fields.field_info.get_surfaces_info()["hot-inlet"][
|
|
54
|
-
"surface_id"
|
|
55
|
-
][0]
|
|
56
|
-
transaction.add_surfaces_request(
|
|
57
|
-
surfaces=[1, hot_inlet_surf_id],
|
|
58
|
-
data_types=[SurfaceDataType.Vertices, SurfaceDataType.FacesCentroid],
|
|
59
|
-
)
|
|
60
|
-
transaction.add_scalar_fields_request(
|
|
61
|
-
surfaces=[1, hot_inlet_surf_id],
|
|
62
|
-
field_name="temperature",
|
|
63
|
-
node_value=True,
|
|
64
|
-
boundary_value=True,
|
|
65
|
-
)
|
|
66
|
-
transaction.add_pathlines_fields_request(
|
|
67
|
-
surfaces=[1, hot_inlet_surf_id],
|
|
68
|
-
field_name="temperature",
|
|
69
|
-
provide_particle_time_field=True,
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
data = transaction.get_fields()
|
|
73
|
-
|
|
74
|
-
surface_data_tag = (("type", "surface-data"),) # tuple containing surface data info
|
|
75
|
-
scalar_field_tag = (
|
|
76
|
-
("type", "scalar-field"),
|
|
77
|
-
("dataLocation", 0),
|
|
78
|
-
("boundaryValues", True),
|
|
79
|
-
) # tuple containing scalar field info
|
|
80
|
-
pathline_tag = (("type", "pathlines-field"), ("field", "temperature"))
|
|
81
|
-
assert len(data) == 3
|
|
82
|
-
assert list(data[surface_data_tag][hot_inlet_surf_id].keys()) == [
|
|
83
|
-
"vertices",
|
|
84
|
-
"centroid",
|
|
85
|
-
]
|
|
86
|
-
assert list(data[scalar_field_tag][hot_inlet_surf_id].keys()) == ["temperature"]
|
|
87
|
-
temp_inlet_data = data[scalar_field_tag][hot_inlet_surf_id]["temperature"]
|
|
88
|
-
assert (
|
|
89
|
-
len(temp_inlet_data)
|
|
90
|
-
== len(data[surface_data_tag][hot_inlet_surf_id]["vertices"]) / 3
|
|
91
|
-
)
|
|
92
|
-
assert round(float(np.average(temp_inlet_data)), 2) == HOT_INLET_TEMPERATURE
|
|
93
|
-
assert sorted(list(data[pathline_tag][hot_inlet_surf_id].keys())) == sorted(
|
|
94
|
-
[
|
|
95
|
-
"vertices",
|
|
96
|
-
"lines",
|
|
97
|
-
"temperature",
|
|
98
|
-
"pathlines-count",
|
|
99
|
-
"particle-time",
|
|
100
|
-
]
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
# multiple surface *names* transaction
|
|
104
|
-
transaction2 = field_data.new_transaction()
|
|
105
|
-
fields_request = transaction2.add_scalar_fields_request
|
|
106
|
-
surface_names = fields_request.surface_names.allowed_values()
|
|
107
|
-
fields_request(surfaces=surface_names, field_name="temperature")
|
|
108
|
-
data2 = transaction2.get_fields()
|
|
109
|
-
assert data2
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def test_field_data_allowed_values(new_solver_session) -> None:
|
|
113
|
-
solver = new_solver_session
|
|
114
|
-
import_file_name = examples.download_file(
|
|
115
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
field_data = solver.fields.field_data
|
|
119
|
-
field_info = solver.fields.field_info
|
|
120
|
-
transaction = field_data.new_transaction()
|
|
121
|
-
fields_request = transaction.add_scalar_fields_request
|
|
122
|
-
|
|
123
|
-
assert [] == field_data.get_scalar_field_data.field_name.allowed_values()
|
|
124
|
-
|
|
125
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
126
|
-
|
|
127
|
-
allowed_args_no_init = field_data.get_scalar_field_data.field_name.allowed_values()
|
|
128
|
-
assert len(allowed_args_no_init) != 0
|
|
129
|
-
|
|
130
|
-
assert not field_data.is_data_valid()
|
|
131
|
-
|
|
132
|
-
solver.solution.initialization.hybrid_initialize()
|
|
133
|
-
|
|
134
|
-
assert field_data.is_data_valid()
|
|
135
|
-
|
|
136
|
-
expected_allowed_args = sorted(field_info.get_scalar_fields_info())
|
|
137
|
-
allowed_args = field_data.get_scalar_field_data.field_name.allowed_values()
|
|
138
|
-
assert expected_allowed_args and (expected_allowed_args == allowed_args)
|
|
139
|
-
assert len(allowed_args) > len(allowed_args_no_init)
|
|
140
|
-
allowed_args = fields_request.field_name.allowed_values()
|
|
141
|
-
assert expected_allowed_args == allowed_args
|
|
142
|
-
|
|
143
|
-
expected_allowed_args = sorted(field_info.get_surfaces_info())
|
|
144
|
-
allowed_args = field_data.get_scalar_field_data.surface_name.allowed_values()
|
|
145
|
-
assert expected_allowed_args and (expected_allowed_args == allowed_args)
|
|
146
|
-
allowed_args = fields_request.surface_names.allowed_values()
|
|
147
|
-
assert expected_allowed_args == allowed_args
|
|
148
|
-
|
|
149
|
-
expected_allowed_args = sorted(field_info.get_surfaces_info())
|
|
150
|
-
allowed_args = field_data.get_surface_data.surface_name.allowed_values()
|
|
151
|
-
assert expected_allowed_args and (expected_allowed_args == allowed_args)
|
|
152
|
-
allowed_args = fields_request.surface_names.allowed_values()
|
|
153
|
-
assert expected_allowed_args == allowed_args
|
|
154
|
-
|
|
155
|
-
allowed_args = field_data.get_surface_data.surface_ids.allowed_values()
|
|
156
|
-
assert len(expected_allowed_args) == len(allowed_args)
|
|
157
|
-
allowed_args = fields_request.surface_ids.allowed_values()
|
|
158
|
-
assert len(expected_allowed_args) == len(allowed_args)
|
|
159
|
-
|
|
160
|
-
expected_allowed_args = sorted(field_info.get_vector_fields_info())
|
|
161
|
-
allowed_args = field_data.get_vector_field_data.field_name.allowed_values()
|
|
162
|
-
assert expected_allowed_args and (expected_allowed_args == allowed_args)
|
|
163
|
-
allowed_args = transaction.add_vector_fields_request.field_name.allowed_values()
|
|
164
|
-
assert expected_allowed_args == allowed_args
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
168
|
-
def test_field_data_objects_3d(new_solver_session) -> None:
|
|
169
|
-
solver = new_solver_session
|
|
170
|
-
import_file_name = examples.download_file(
|
|
171
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
field_data = solver.fields.field_data
|
|
175
|
-
|
|
176
|
-
assert [] == field_data.get_scalar_field_data.field_name.allowed_values()
|
|
177
|
-
|
|
178
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
179
|
-
|
|
180
|
-
allowed_args_no_init = field_data.get_scalar_field_data.field_name.allowed_values()
|
|
181
|
-
assert len(allowed_args_no_init) != 0
|
|
182
|
-
|
|
183
|
-
assert not field_data.is_data_valid()
|
|
184
|
-
|
|
185
|
-
solver.solution.initialization.hybrid_initialize()
|
|
186
|
-
|
|
187
|
-
assert field_data.is_data_valid()
|
|
188
|
-
|
|
189
|
-
# Absolute Pressure data over the cold-inlet (surface_id=3)
|
|
190
|
-
abs_press_data = field_data.get_scalar_field_data(
|
|
191
|
-
field_name="absolute-pressure", surfaces=["cold-inlet"]
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
assert abs_press_data["cold-inlet"].shape == (241,)
|
|
195
|
-
assert abs_press_data["cold-inlet"][120] == 101325.0
|
|
196
|
-
|
|
197
|
-
vertices_data = field_data.get_surface_data(
|
|
198
|
-
data_types=[SurfaceDataType.Vertices], surfaces=["cold-inlet"]
|
|
199
|
-
)
|
|
200
|
-
assert vertices_data["cold-inlet"][SurfaceDataType.Vertices].shape == (241, 3)
|
|
201
|
-
assert (
|
|
202
|
-
round(float(vertices_data["cold-inlet"][SurfaceDataType.Vertices][5][0]), 2)
|
|
203
|
-
== -0.2
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
vertices_and_faces_centroid_data = field_data.get_surface_data(
|
|
207
|
-
data_types=[SurfaceDataType.Vertices, SurfaceDataType.FacesCentroid],
|
|
208
|
-
surfaces=["hot-inlet", "cold-inlet"],
|
|
209
|
-
)
|
|
210
|
-
assert list(vertices_and_faces_centroid_data["cold-inlet"].keys()) == [
|
|
211
|
-
SurfaceDataType.Vertices,
|
|
212
|
-
SurfaceDataType.FacesCentroid,
|
|
213
|
-
]
|
|
214
|
-
assert vertices_and_faces_centroid_data["hot-inlet"][
|
|
215
|
-
SurfaceDataType.Vertices
|
|
216
|
-
].shape == (79, 3)
|
|
217
|
-
assert list(vertices_and_faces_centroid_data.keys()) == [
|
|
218
|
-
"hot-inlet",
|
|
219
|
-
"cold-inlet",
|
|
220
|
-
]
|
|
221
|
-
assert (
|
|
222
|
-
round(
|
|
223
|
-
float(
|
|
224
|
-
vertices_and_faces_centroid_data["cold-inlet"][
|
|
225
|
-
SurfaceDataType.FacesCentroid
|
|
226
|
-
][5][1]
|
|
227
|
-
),
|
|
228
|
-
2,
|
|
229
|
-
)
|
|
230
|
-
== -0.18
|
|
231
|
-
)
|
|
232
|
-
assert (
|
|
233
|
-
round(
|
|
234
|
-
float(
|
|
235
|
-
vertices_and_faces_centroid_data["hot-inlet"][
|
|
236
|
-
SurfaceDataType.FacesCentroid
|
|
237
|
-
][5][1]
|
|
238
|
-
),
|
|
239
|
-
2,
|
|
240
|
-
)
|
|
241
|
-
== -0.23
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
faces_normal_data = field_data.get_surface_data(
|
|
245
|
-
data_types=[SurfaceDataType.FacesNormal], surfaces=[3, 5]
|
|
246
|
-
)
|
|
247
|
-
assert faces_normal_data[3][SurfaceDataType.FacesNormal].shape == (152, 3)
|
|
248
|
-
assert faces_normal_data[5][SurfaceDataType.FacesNormal].shape == (2001, 3)
|
|
249
|
-
|
|
250
|
-
faces_connectivity_data = field_data.get_surface_data(
|
|
251
|
-
data_types=[SurfaceDataType.FacesConnectivity], surfaces=["cold-inlet"]
|
|
252
|
-
)
|
|
253
|
-
assert (
|
|
254
|
-
faces_connectivity_data["cold-inlet"][SurfaceDataType.FacesConnectivity][5]
|
|
255
|
-
== [12, 13, 17, 16]
|
|
256
|
-
).all()
|
|
257
|
-
|
|
258
|
-
velocity_vector_data = field_data.get_vector_field_data(
|
|
259
|
-
field_name="velocity", surfaces=["cold-inlet"]
|
|
260
|
-
)
|
|
261
|
-
|
|
262
|
-
assert velocity_vector_data["cold-inlet"].shape == (152, 3)
|
|
263
|
-
|
|
264
|
-
path_lines_data = field_data.get_pathlines_field_data(
|
|
265
|
-
field_name="velocity", surfaces=["cold-inlet", "hot-inlet"]
|
|
266
|
-
)
|
|
267
|
-
|
|
268
|
-
assert path_lines_data["cold-inlet"]["vertices"].shape == (76152, 3)
|
|
269
|
-
assert len(path_lines_data["cold-inlet"]["lines"]) == 76000
|
|
270
|
-
assert path_lines_data["cold-inlet"]["velocity"].shape == (76152,)
|
|
271
|
-
|
|
272
|
-
assert path_lines_data["hot-inlet"]["vertices"].shape == (27555, 3)
|
|
273
|
-
assert len(path_lines_data["hot-inlet"]["lines"]) == 27500
|
|
274
|
-
assert path_lines_data["hot-inlet"]["velocity"].shape == (27555,)
|
|
275
|
-
|
|
276
|
-
assert all(path_lines_data["cold-inlet"]["lines"][100] == [100, 101])
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
280
|
-
def test_field_data_objects_2d(disk_case_session) -> None:
|
|
281
|
-
solver = disk_case_session
|
|
282
|
-
|
|
283
|
-
field_data = solver.fields.field_data
|
|
284
|
-
|
|
285
|
-
allowed_args_no_init = field_data.get_scalar_field_data.field_name.allowed_values()
|
|
286
|
-
assert len(allowed_args_no_init) != 0
|
|
287
|
-
|
|
288
|
-
assert not field_data.is_data_valid()
|
|
289
|
-
|
|
290
|
-
solver.solution.initialization.hybrid_initialize()
|
|
291
|
-
|
|
292
|
-
assert field_data.is_data_valid()
|
|
293
|
-
|
|
294
|
-
# Absolute Pressure data over the cold-inlet (surface_id=3)
|
|
295
|
-
abs_press_data = field_data.get_scalar_field_data(
|
|
296
|
-
field_name="absolute-pressure", surfaces=["velocity-inlet-2"]
|
|
297
|
-
)
|
|
298
|
-
|
|
299
|
-
assert abs_press_data["velocity-inlet-2"].shape == (11,)
|
|
300
|
-
assert abs_press_data["velocity-inlet-2"][5] == 101325.0
|
|
301
|
-
|
|
302
|
-
vertices_data = field_data.get_surface_data(
|
|
303
|
-
data_types=[SurfaceDataType.Vertices], surfaces=["interior-4"]
|
|
304
|
-
)
|
|
305
|
-
assert round(vertices_data["interior-4"][SurfaceDataType.Vertices][5][0], 2) == 0.0
|
|
306
|
-
|
|
307
|
-
faces_centroid_data = field_data.get_surface_data(
|
|
308
|
-
data_types=[SurfaceDataType.FacesCentroid], surfaces=["velocity-inlet-2"]
|
|
309
|
-
)
|
|
310
|
-
assert (
|
|
311
|
-
round(
|
|
312
|
-
float(
|
|
313
|
-
faces_centroid_data["velocity-inlet-2"][SurfaceDataType.FacesCentroid][
|
|
314
|
-
5
|
|
315
|
-
][1]
|
|
316
|
-
),
|
|
317
|
-
2,
|
|
318
|
-
)
|
|
319
|
-
== 0.02
|
|
320
|
-
)
|
|
321
|
-
|
|
322
|
-
faces_connectivity_data = field_data.get_surface_data(
|
|
323
|
-
data_types=[SurfaceDataType.FacesConnectivity], surfaces=["velocity-inlet-2"]
|
|
324
|
-
)["velocity-inlet-2"][SurfaceDataType.FacesConnectivity][5]
|
|
325
|
-
assert (faces_connectivity_data == [5, 6]).all()
|
|
326
|
-
|
|
327
|
-
velocity_vector_data = field_data.get_vector_field_data(
|
|
328
|
-
field_name="velocity", surfaces=["velocity-inlet-2"]
|
|
329
|
-
)
|
|
330
|
-
|
|
331
|
-
assert velocity_vector_data["velocity-inlet-2"].shape == (10, 3)
|
|
332
|
-
|
|
333
|
-
path_lines_data = field_data.get_pathlines_field_data(
|
|
334
|
-
field_name="velocity", surfaces=["velocity-inlet-2"]
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
assert path_lines_data["velocity-inlet-2"]["vertices"].shape == (5010, 3)
|
|
338
|
-
assert len(path_lines_data["velocity-inlet-2"]["lines"]) == 5000
|
|
339
|
-
assert path_lines_data["velocity-inlet-2"]["velocity"].shape == (5010,)
|
|
340
|
-
|
|
341
|
-
assert all(path_lines_data["velocity-inlet-2"]["lines"][100] == [100, 101])
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
def test_field_data_errors(new_solver_session) -> None:
|
|
345
|
-
solver = new_solver_session
|
|
346
|
-
import_file_name = examples.download_file(
|
|
347
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
with pytest.raises(DisallowedValuesError):
|
|
351
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
352
|
-
field_name="y-face-area", surfaces=[0]
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
with pytest.raises(DisallowedValuesError):
|
|
356
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
357
|
-
field_name="partition-neighbors", surfaces=[0]
|
|
358
|
-
)
|
|
359
|
-
|
|
360
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
361
|
-
|
|
362
|
-
with pytest.raises(FieldUnavailable):
|
|
363
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
364
|
-
field_name="density", surfaces=[0]
|
|
365
|
-
)
|
|
366
|
-
|
|
367
|
-
y_face_area = solver.fields.field_data.get_scalar_field_data(
|
|
368
|
-
field_name="y-face-area", surfaces=[0]
|
|
369
|
-
)
|
|
370
|
-
assert y_face_area and isinstance(y_face_area, dict)
|
|
371
|
-
|
|
372
|
-
partition_neighbors = solver.fields.field_data.get_scalar_field_data(
|
|
373
|
-
field_name="partition-neighbors", surfaces=[0]
|
|
374
|
-
)
|
|
375
|
-
assert partition_neighbors and isinstance(partition_neighbors, dict)
|
|
376
|
-
|
|
377
|
-
# Initialize flow field
|
|
378
|
-
solver.solution.initialization.hybrid_initialize()
|
|
379
|
-
|
|
380
|
-
# Get field data object
|
|
381
|
-
assert solver.fields.field_data
|
|
382
|
-
|
|
383
|
-
with pytest.raises(DisallowedValuesError):
|
|
384
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
385
|
-
field_name="density", surfaces=["bob"]
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
with pytest.raises(DisallowedValuesError):
|
|
389
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
390
|
-
field_name="xdensity", surfaces=[0]
|
|
391
|
-
)
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
395
|
-
def test_field_info_validators(new_solver_session) -> None:
|
|
396
|
-
solver = new_solver_session
|
|
397
|
-
import_file_name = examples.download_file(
|
|
398
|
-
"mixing_elbow.msh.h5", "pyfluent/mixing_elbow"
|
|
399
|
-
)
|
|
400
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
401
|
-
solver.solution.initialization.hybrid_initialize()
|
|
402
|
-
|
|
403
|
-
vector_field_1 = solver.fields.field_info.validate_vector_fields("velocity")
|
|
404
|
-
assert vector_field_1 is None
|
|
405
|
-
|
|
406
|
-
with pytest.raises(DisallowedValuesError):
|
|
407
|
-
solver.fields.field_info.validate_vector_fields("relative-vel")
|
|
408
|
-
|
|
409
|
-
scalar_field_1 = solver.fields.field_info.validate_scalar_fields("z-velocity")
|
|
410
|
-
assert scalar_field_1 is None
|
|
411
|
-
|
|
412
|
-
with pytest.raises(DisallowedValuesError):
|
|
413
|
-
solver.fields.field_info.validate_scalar_fields("z-vel")
|
|
414
|
-
|
|
415
|
-
surface = solver.fields.field_info.validate_surfaces(["cold-inlet"])
|
|
416
|
-
assert surface is None
|
|
417
|
-
|
|
418
|
-
with pytest.raises(DisallowedValuesError):
|
|
419
|
-
solver.fields.field_info.validate_surfaces(["out"])
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/2404")
|
|
423
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
424
|
-
def test_field_data_does_not_modify_case(new_solver_session):
|
|
425
|
-
solver = new_solver_session
|
|
426
|
-
case_path = download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
|
|
427
|
-
download_file("mixing_elbow.dat.h5", "pyfluent/mixing_elbow")
|
|
428
|
-
solver.file.read_case_data(file_name=case_path)
|
|
429
|
-
solver.scheme_eval.scheme_eval("(%save-case-id)")
|
|
430
|
-
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
431
|
-
solver.fields.field_data.get_scalar_field_data(
|
|
432
|
-
field_name="absolute-pressure", surfaces=["cold-inlet"]
|
|
433
|
-
)
|
|
434
|
-
assert not solver.scheme_eval.scheme_eval("(case-modified?)")
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
@pytest.mark.fluent_version(">=24.1")
|
|
438
|
-
def test_field_data_streaming_in_meshing_mode(new_meshing_session):
|
|
439
|
-
meshing = new_meshing_session
|
|
440
|
-
import_file_name = examples.download_file(
|
|
441
|
-
"mixing_elbow.pmdb", "pyfluent/mixing_elbow"
|
|
442
|
-
)
|
|
443
|
-
|
|
444
|
-
mesh_data = {}
|
|
445
|
-
|
|
446
|
-
def plot_mesh(index, field_name, data):
|
|
447
|
-
if data is not None:
|
|
448
|
-
if index in mesh_data:
|
|
449
|
-
mesh_data[index].update({field_name: data})
|
|
450
|
-
else:
|
|
451
|
-
mesh_data[index] = {field_name: data}
|
|
452
|
-
|
|
453
|
-
meshing.fields.field_data_streaming.register_callback(plot_mesh)
|
|
454
|
-
meshing.fields.field_data_streaming.start(provideBytesStream=True, chunkSize=1024)
|
|
455
|
-
|
|
456
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
457
|
-
meshing.workflow.TaskObject["Import Geometry"].Arguments = {
|
|
458
|
-
"FileName": import_file_name,
|
|
459
|
-
"LengthUnit": "in",
|
|
460
|
-
}
|
|
461
|
-
meshing.workflow.TaskObject["Import Geometry"].Execute()
|
|
462
|
-
|
|
463
|
-
assert len(mesh_data[5]["vertices"]) == 66
|
|
464
|
-
assert len(mesh_data[5]["faces"]) == 80
|
|
465
|
-
|
|
466
|
-
assert list(mesh_data[12].keys()) == ["vertices", "faces"]
|