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.

Files changed (107) hide show
  1. ansys/fluent/core/__init__.py +1 -1
  2. ansys/fluent/core/_version.py +2 -2
  3. ansys/fluent/core/codegen/tuigen.py +1 -1
  4. ansys/fluent/core/codegen/walk_api.py +45 -18
  5. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  6. ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
  7. ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
  8. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  9. ansys/fluent/core/generated/meshing/tui_252.py +395 -390
  10. ansys/fluent/core/generated/solver/settings_252.py +782 -306
  11. ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
  12. ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
  13. ansys/fluent/core/launcher/container_launcher.py +4 -3
  14. ansys/fluent/core/launcher/fluent_container.py +22 -19
  15. ansys/fluent/core/launcher/launcher.py +2 -2
  16. ansys/fluent/core/launcher/pim_launcher.py +2 -2
  17. ansys/fluent/core/launcher/slurm_launcher.py +2 -2
  18. ansys/fluent/core/launcher/standalone_launcher.py +2 -2
  19. ansys/fluent/core/logging.py +2 -0
  20. ansys/fluent/core/logging_config.yaml +3 -0
  21. ansys/fluent/core/services/app_utilities.py +2 -1
  22. ansys/fluent/core/services/datamodel_se.py +141 -61
  23. ansys/fluent/core/services/field_data.py +252 -0
  24. ansys/fluent/core/services/interceptors.py +28 -2
  25. ansys/fluent/core/session.py +7 -2
  26. ansys/fluent/core/session_solver.py +21 -0
  27. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
  28. {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/LICENSE +1 -1
  29. {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/METADATA +53 -31
  30. {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/RECORD +65 -141
  31. {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/WHEEL +1 -1
  32. ansys/fluent/core/docs/README.rst +0 -155
  33. ansys/fluent/tests/conftest.py +0 -415
  34. ansys/fluent/tests/fluent_fixtures.py +0 -195
  35. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  36. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  37. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  38. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  39. ansys/fluent/tests/test_aero_session.py +0 -88
  40. ansys/fluent/tests/test_batch_ops.py +0 -39
  41. ansys/fluent/tests/test_builtin_settings.py +0 -761
  42. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  43. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  44. ansys/fluent/tests/test_casereader.py +0 -324
  45. ansys/fluent/tests/test_codegen.py +0 -783
  46. ansys/fluent/tests/test_creatable.py +0 -31
  47. ansys/fluent/tests/test_data_model_cache.py +0 -434
  48. ansys/fluent/tests/test_datamodel_api.py +0 -449
  49. ansys/fluent/tests/test_datamodel_service.py +0 -814
  50. ansys/fluent/tests/test_datareader.py +0 -103
  51. ansys/fluent/tests/test_error_handling.py +0 -24
  52. ansys/fluent/tests/test_events_manager.py +0 -214
  53. ansys/fluent/tests/test_field_data.py +0 -466
  54. ansys/fluent/tests/test_file_session.py +0 -355
  55. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  56. ansys/fluent/tests/test_fix_doc.py +0 -29
  57. ansys/fluent/tests/test_flobject.py +0 -1235
  58. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  59. ansys/fluent/tests/test_fluent_session.py +0 -270
  60. ansys/fluent/tests/test_fluent_version.py +0 -66
  61. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  62. ansys/fluent/tests/test_icing_session.py +0 -9
  63. ansys/fluent/tests/test_launcher.py +0 -529
  64. ansys/fluent/tests/test_launcher_remote.py +0 -272
  65. ansys/fluent/tests/test_lispy.py +0 -40
  66. ansys/fluent/tests/test_logging.py +0 -16
  67. ansys/fluent/tests/test_mapped_api.py +0 -774
  68. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  69. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  70. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  71. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  72. ansys/fluent/tests/test_preferences.py +0 -89
  73. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  74. ansys/fluent/tests/test_reduction.py +0 -484
  75. ansys/fluent/tests/test_rp_vars.py +0 -77
  76. ansys/fluent/tests/test_scheduler.py +0 -471
  77. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  78. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  79. ansys/fluent/tests/test_search.py +0 -344
  80. ansys/fluent/tests/test_session.py +0 -594
  81. ansys/fluent/tests/test_settings_api.py +0 -606
  82. ansys/fluent/tests/test_settings_reader.py +0 -85
  83. ansys/fluent/tests/test_slurm_future.py +0 -67
  84. ansys/fluent/tests/test_solution_variables.py +0 -241
  85. ansys/fluent/tests/test_solver_monitors.py +0 -83
  86. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  87. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  88. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  89. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  90. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  91. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  92. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  93. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  94. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  95. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  96. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  97. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  98. ansys/fluent/tests/test_streaming_services.py +0 -52
  99. ansys/fluent/tests/test_systemcoupling.py +0 -44
  100. ansys/fluent/tests/test_topy.py +0 -179
  101. ansys/fluent/tests/test_tui_api.py +0 -70
  102. ansys/fluent/tests/test_type_stub.py +0 -37
  103. ansys/fluent/tests/test_utils.py +0 -82
  104. ansys/fluent/tests/util/__init__.py +0 -36
  105. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  106. ansys/fluent/tests/util/solver.py +0 -72
  107. ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
@@ -1,127 +0,0 @@
1
- import json
2
- import os
3
- from unittest import TestCase
4
-
5
- import pytest
6
- from util.solver import SettingsValDict as D
7
- from util.solver import assign_settings_value_from_value_dict as assign_dict_val
8
- from util.solver import get_name_info
9
-
10
-
11
- @pytest.mark.fluent_version(">=24.1")
12
- @pytest.mark.settings_only
13
- @pytest.mark.codegen_required
14
- def test_boundaries_elbow(mixing_elbow_settings_session):
15
- solver_session = mixing_elbow_settings_session
16
- solver_session.setup.models.energy.enabled = True
17
-
18
- cold_inlet = solver_session.setup.boundary_conditions.velocity_inlet["cold-inlet"]
19
- assert D(1) == cold_inlet.momentum.velocity()
20
- assign_dict_val(cold_inlet.momentum.velocity, 0.4)
21
- assert D(0.4) == cold_inlet.momentum.velocity()
22
-
23
- cold_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter"
24
- cold_inlet.turbulence.turbulent_intensity = 0.05
25
- cold_inlet.turbulence.hydraulic_diameter = "4 [in]"
26
- assign_dict_val(cold_inlet.thermal.t, 293.15)
27
-
28
- assert {
29
- "name": "cold-inlet",
30
- "momentum": {
31
- "initial_gauge_pressure": {"option": "value", "value": 0},
32
- "reference_frame": "Absolute",
33
- "velocity": {"option": "value", "value": 0.4},
34
- "velocity_specification_method": "Magnitude, Normal to Boundary",
35
- },
36
- "turbulence": {
37
- "turbulent_specification": "Intensity and Hydraulic Diameter",
38
- "turbulent_intensity": 0.05,
39
- "hydraulic_diameter": "4 [in]",
40
- },
41
- "thermal": {"t": {"option": "value", "value": 293.15}},
42
- } == cold_inlet()
43
-
44
- hot_inlet = solver_session.setup.boundary_conditions.velocity_inlet["hot-inlet"]
45
- assign_dict_val(hot_inlet.momentum.velocity, 1.2)
46
- hot_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter"
47
- hot_inlet.turbulence.hydraulic_diameter = "1 [in]"
48
- assign_dict_val(hot_inlet.thermal.t, 313.15)
49
-
50
- assert {
51
- "name": "hot-inlet",
52
- "momentum": {
53
- "initial_gauge_pressure": {"option": "value", "value": 0},
54
- "reference_frame": "Absolute",
55
- "velocity": {"option": "value", "value": 1.2},
56
- "velocity_specification_method": "Magnitude, Normal to Boundary",
57
- },
58
- "turbulence": {
59
- "turbulent_specification": "Intensity and Hydraulic Diameter",
60
- "turbulent_intensity": 0.05,
61
- "hydraulic_diameter": "1 [in]",
62
- },
63
- "thermal": {"t": {"option": "value", "value": 313.15}},
64
- } == hot_inlet()
65
-
66
- solver_session.setup.boundary_conditions.pressure_outlet[
67
- "outlet"
68
- ].turbulence.turbulent_viscosity_ratio = 4
69
- assert (
70
- solver_session.setup.boundary_conditions.pressure_outlet[
71
- "outlet"
72
- ].turbulence.turbulent_viscosity_ratio()
73
- == 4
74
- )
75
-
76
-
77
- @pytest.mark.settings_only
78
- @pytest.mark.fluent_version("latest")
79
- def test_boundaries_periodic(periodic_rot_settings_session):
80
- solver_session = periodic_rot_settings_session
81
- print(__file__)
82
- _THIS_DIR = os.path.dirname(__file__)
83
- _DATA_FILE = os.path.join(_THIS_DIR, "boundaries_periodic_expDict")
84
- boundary_exp = json.load(open(_DATA_FILE))
85
- boundary_test = dict()
86
- boundary_tested = dict()
87
- for name, boundary in solver_session.setup.boundary_conditions.items():
88
- boundary_test[name] = boundary()
89
- boundary_tested["val_1"] = boundary_test
90
-
91
- TestCase().assertDictEqual(boundary_tested["val_1"], boundary_exp["val_1"])
92
-
93
- boundary_test = dict()
94
- for (
95
- boundary_type
96
- ) in solver_session.setup.boundary_conditions.get_active_child_names():
97
- if boundary_type in ["non_reflecting_bc", "perforated_wall", "settings"]:
98
- continue
99
- for name, boundary in getattr(
100
- solver_session.setup.boundary_conditions, boundary_type
101
- ).items():
102
- boundary_test[name] = boundary()
103
- boundary_tested["val_2"] = boundary_test
104
- TestCase().assertDictEqual(boundary_tested["val_2"], boundary_exp["val_2"])
105
-
106
- boundaries_check = ["inlet", "outlet", "pipe_2_wall"]
107
- selected_bou_test = get_name_info(boundary_tested["val_1"], boundaries_check)
108
- selected_bou_exp = get_name_info(boundary_exp["val_1"], boundaries_check)
109
- TestCase().assertDictEqual(selected_bou_test, selected_bou_exp)
110
- solver_session.setup.boundary_conditions.wall["pipe_2_wall"].rename("pipe2_wall")
111
- solver_session.setup.boundary_conditions.pressure_outlet["outlet"].rename("out")
112
- solver_session.setup.boundary_conditions.velocity_inlet[
113
- "inlet"
114
- ].momentum.velocity = 5.0
115
- solver_session.setup.boundary_conditions["inlet"].momentum.velocity = 10.0
116
- boundaries_check = ["inlet", "out", "pipe2_wall"]
117
- boundary_test = dict()
118
- for name, boundary in solver_session.setup.boundary_conditions.items():
119
- boundary_test[name] = boundary()
120
- boundary_tested["val_3"] = boundary_test
121
- TestCase().assertDictEqual(boundary_tested["val_3"], boundary_exp["val_3"])
122
-
123
- selected_bou_test = get_name_info(boundary_tested["val_3"], boundaries_check)
124
- selected_bou_exp = get_name_info(boundary_exp["val_3"], boundaries_check)
125
- TestCase().assertDictEqual(selected_bou_test, selected_bou_exp)
126
- with open("boundaries_periodic_outDict.py", "a") as f:
127
- json.dump(boundary_tested, f, sort_keys=True, indent=4)
@@ -1,20 +0,0 @@
1
- import pytest
2
-
3
- from ansys.fluent.core.utils.fluent_version import FluentVersion
4
-
5
-
6
- @pytest.mark.fluent_version("latest")
7
- def test_solver_calculation(static_mixer_case_session):
8
- solver_session = static_mixer_case_session
9
- scheme_eval = solver_session.scheme_eval.scheme_eval
10
- assert scheme_eval("(client-get-var 'residuals/plot?)") is True
11
- # TODO: Remove the if condition after a stable version of 23.1 is available and update the commands as required.
12
- if solver_session.get_fluent_version() < FluentVersion.v231:
13
- solver_session.tui.solve.monitors.residual.plot("no")
14
- assert scheme_eval("(client-get-var 'residuals/plot?)") is False
15
- assert scheme_eval("(data-valid?)") is False
16
- solver_session.solution.initialization.hybrid_initialize()
17
- assert scheme_eval("(data-valid?)") is True
18
- # solver_session.solution.run_calculation.iterate.get_attr("arguments")
19
- # solver_session.solution.run_calculation.number_of_iterations = 5
20
- # assert solver_session.solution.run_calculation.number_of_iterations == 5
@@ -1,131 +0,0 @@
1
- import pytest
2
-
3
-
4
- @pytest.mark.settings_only
5
- @pytest.mark.fluent_version("latest")
6
- def test_controls(mixing_elbow_settings_session):
7
- solver = mixing_elbow_settings_session
8
- solver.setup.models.multiphase.models = "vof"
9
- assert solver.setup.models.multiphase.models() == "vof"
10
- solver.setup.general.operating_conditions.gravity = {
11
- "enable": True,
12
- "components": [0.0, 0.0, -9.81],
13
- }
14
- assert solver.setup.general.operating_conditions.gravity.components() == [
15
- 0,
16
- 0,
17
- -9.81,
18
- ]
19
- solver.setup.general.solver.time = "steady"
20
- assert solver.setup.general.solver.time() == "steady"
21
- param_coarsening = (
22
- solver.solution.controls.advanced.multi_grid.amg_controls.coupled_parameters.coarsening_parameters
23
- )
24
- param_coarsening.laplace_coarsening = True
25
- assert param_coarsening() == {
26
- "max_coarse_levels": 40,
27
- "coarsen_by_interval": 8,
28
- "conservative_coarsening": False,
29
- "aggressive_coarsening": False,
30
- "laplace_coarsening": True,
31
- }
32
- param_coarsening.max_coarse_levels = 45
33
- assert param_coarsening.max_coarse_levels() == 45
34
-
35
- param_coarsening.set_state(
36
- {
37
- "max_coarse_levels": 48,
38
- "coarsen_by_interval": 9,
39
- "conservative_coarsening": True,
40
- "aggressive_coarsening": True,
41
- "laplace_coarsening": True,
42
- }
43
- )
44
- assert param_coarsening.max_coarse_levels() == 48
45
- assert param_coarsening.coarsen_by_interval() == 9
46
- assert param_coarsening.conservative_coarsening() is True
47
- assert param_coarsening.aggressive_coarsening() is True
48
-
49
- param_fixed_cycle = (
50
- solver.solution.controls.advanced.multi_grid.amg_controls.scalar_parameters.fixed_cycle_parameters
51
- )
52
- param_fixed_cycle.max_cycle = 300
53
- assert param_fixed_cycle.max_cycle() == 300
54
- param_fixed_cycle.set_state(
55
- {
56
- "pre_sweeps": 1,
57
- "post_sweeps": 2,
58
- "max_cycle": 350,
59
- }
60
- )
61
- assert param_fixed_cycle() == {
62
- "pre_sweeps": 1,
63
- "post_sweeps": 2,
64
- "max_cycle": 350,
65
- }
66
- solver.solution.methods.p_v_coupling.flow_scheme = "Coupled"
67
- assert solver.solution.methods.p_v_coupling.flow_scheme() == "Coupled"
68
- solver.solution.methods.p_v_coupling.coupled_form = True
69
- assert solver.solution.methods.p_v_coupling.coupled_form() is True
70
- solver.solution.controls.advanced.multi_grid.amg_controls.scalar_parameters.smoother_type = (
71
- "Gauss-Seidel"
72
- )
73
- assert (
74
- solver.solution.controls.advanced.multi_grid.amg_controls.scalar_parameters.smoother_type()
75
- == "Gauss-Seidel"
76
- )
77
- assert solver.solution.controls.pseudo_time_explicit_relaxation_factor() == {
78
- "global_dt_pseudo_relax": {
79
- "turb-viscosity": 1.0,
80
- "body-force": 1.0,
81
- "k": 0.75,
82
- "omega": 0.75,
83
- "mp": 0.5,
84
- "density": 1.0,
85
- "temperature": 0.75,
86
- }
87
- }
88
- solver.solution.controls.pseudo_time_explicit_relaxation_factor = {
89
- "global_dt_pseudo_relax": {"turb-viscosity": 0.9, "body-force": 0.8}
90
- }
91
- assert solver.solution.controls.pseudo_time_explicit_relaxation_factor() == {
92
- "global_dt_pseudo_relax": {
93
- "turb-viscosity": 0.9,
94
- "body-force": 0.8,
95
- "k": 0.75,
96
- "omega": 0.75,
97
- "mp": 0.5,
98
- "density": 1.0,
99
- "temperature": 0.75,
100
- }
101
- }
102
- solver.solution.methods.p_v_coupling.flow_scheme = "SIMPLE"
103
- solver.solution.controls.under_relaxation = {"pressure": 0.9}
104
- solver.solution.controls.under_relaxation = {"density": 0.9}
105
- assert solver.solution.controls.under_relaxation() == {
106
- "mom": 0.7,
107
- "turb-viscosity": 1,
108
- "density": 0.9,
109
- "omega": 0.8,
110
- "mp": 0.5,
111
- "body-force": 1.0,
112
- "pressure": 0.9,
113
- "k": 0.8,
114
- "temperature": 1.0,
115
- }
116
- solver.solution.controls.under_relaxation = {
117
- "body-force": 0.7,
118
- "density": 0.75,
119
- "mom": 0.8,
120
- }
121
- assert solver.solution.controls.under_relaxation() == {
122
- "mom": 0.8,
123
- "turb-viscosity": 1,
124
- "density": 0.75,
125
- "omega": 0.8,
126
- "mp": 0.5,
127
- "body-force": 0.7,
128
- "pressure": 0.9,
129
- "k": 0.8,
130
- "temperature": 1.0,
131
- }
@@ -1,109 +0,0 @@
1
- import os
2
- from pathlib import Path
3
-
4
- import pytest
5
-
6
- import ansys.fluent.core as pyfluent
7
-
8
-
9
- @pytest.mark.settings_only
10
- @pytest.mark.fluent_version("latest")
11
- def test_solver_import_mixingelbow(mixing_elbow_settings_session):
12
- solver_session = mixing_elbow_settings_session
13
- assert solver_session.settings.is_active()
14
- assert solver_session.health_check.is_serving
15
- file_name = Path(pyfluent.EXAMPLES_PATH) / "jou_test_general.py"
16
- solver_session.journal.start(file_name.as_posix())
17
- ###
18
- assert solver_session.setup.models.energy.enabled()
19
- scheme_eval = solver_session.scheme_eval.scheme_eval
20
- assert scheme_eval("(case-valid?)")
21
- ###
22
- solver_session.tui.mesh.check()
23
- solver_session.tui.define.units("length", "in")
24
- assert scheme_eval('(units/quantity-info "length")')[-1] == "in"
25
- general_solver = solver_session.setup.general.solver
26
- general_solver.time.allowed_values()
27
- assert general_solver.time.allowed_values() == [
28
- "steady",
29
- "unsteady-1st-order",
30
- "unsteady-2nd-order",
31
- "unsteady-2nd-order-bounded",
32
- ]
33
-
34
- general_solver.time = "unsteady-2nd-order"
35
- general_solver.time = "unsteady-1st-order"
36
- general_solver.time = "unsteady-2nd-order-bounded"
37
- general_solver.time = "steady"
38
-
39
- # solver.setup.general.gravity = {"gravity": True, "y_component": -9.81}
40
- # solver.mesh.scale(x_scale=0.001, y_scale=0.001, z_scale=0.001)
41
-
42
- assert general_solver.type.get_attr("allowed-values") == [
43
- "pressure-based",
44
- "density-based-implicit",
45
- "density-based-explicit",
46
- ]
47
- assert general_solver.type.allowed_values() == [
48
- "pressure-based",
49
- "density-based-implicit",
50
- "density-based-explicit",
51
- ]
52
- # Below line is commented due to TFS Bug 714494
53
- # assert solver_session.setup.general.solver.type.default_value() == "pressure-based"
54
- assert general_solver.type.is_active()
55
- assert not general_solver.type.is_read_only()
56
- general_solver.type = "density-based-implicit"
57
- assert general_solver.type() == "density-based-implicit"
58
- general_solver.type = "density-based-explicit"
59
- assert general_solver.type() == "density-based-explicit"
60
- general_solver.type = "pressure-based"
61
- assert general_solver.type() == "pressure-based"
62
-
63
- auto_save = solver_session.file.auto_save
64
- auto_save.data_frequency = 10
65
- assert auto_save.data_frequency.default_value() == 0
66
- assert auto_save.data_frequency() == 10
67
- auto_save.case_frequency = "each-time"
68
- assert auto_save.case_frequency() == "each-time"
69
- auto_save.root_name = "file_auto_save"
70
- assert auto_save.root_name() == "file_auto_save"
71
- solver_session.setup.reference_values.compute(
72
- from_zone_name="outlet", from_zone_type="pressure-outlet"
73
- )
74
- solver_session.journal.stop()
75
- solver_session.tui.file.read_journal(file_name.as_posix())
76
- assert auto_save.root_name() == "file_auto_save"
77
- assert general_solver.type() == "pressure-based"
78
- assert auto_save.data_frequency() == 10
79
- assert general_solver.time() == "steady"
80
- if os.path.exists(file_name):
81
- os.remove(file_name)
82
-
83
-
84
- @pytest.mark.settings_only
85
- @pytest.mark.fluent_version("latest")
86
- def test_disk_2d_setup(disk_settings_session):
87
- session = disk_settings_session
88
- assert session.settings.is_active()
89
- assert session.health_check.is_serving
90
- ###
91
- assert not session.setup.models.energy.enabled()
92
- assert session.scheme_eval.scheme_eval("(case-valid?)")
93
- session.tui.mesh.check()
94
-
95
- session_solver = session.setup.general.solver
96
- assert session_solver.two_dim_space.get_attr("allowed-values") == [
97
- "swirl",
98
- "axisymmetric",
99
- "planar",
100
- ]
101
- assert session_solver.two_dim_space() == "planar"
102
- session_solver.two_dim_space = "axisymmetric"
103
- assert session_solver.two_dim_space() == "axisymmetric"
104
- session_solver.two_dim_space = "swirl"
105
- assert session_solver.two_dim_space() == "swirl"
106
- session_solver.two_dim_space = "planar"
107
- assert session_solver.two_dim_space() == "planar"
108
- # Bug 682773
109
- # session.setup.general.gravity = {"gravity": True, "x_component": -9.81}
@@ -1,83 +0,0 @@
1
- import pytest
2
-
3
- from ansys.fluent.core.examples.downloads import download_file
4
-
5
-
6
- @pytest.mark.settings_only
7
- def test_initialization_settings(new_solver_session):
8
- solver = new_solver_session
9
- case_name = download_file(
10
- "wigley.cas.h5",
11
- "pyfluent/wigley_hull",
12
- )
13
- solver.file.read(
14
- file_type="case",
15
- file_name=case_name,
16
- lightweight_setup=True,
17
- )
18
- solver.parallel.partition.set.laplace_smoothing.enabled = True
19
- solver.parallel.partition.method(partition_method="metis", count=2)
20
- copy_by_name = solver.setup.materials.database.copy_by_name
21
- copy_by_name(type="fluid", name="air")
22
- copy_by_name(type="fluid", name="water-liquid")
23
- solver.setup.models.multiphase.models = "vof"
24
- solver.setup.general.operating_conditions.gravity = {
25
- "enable": True,
26
- "components": [0.0, 0.0, -9.81],
27
- }
28
- solver.setup.general.solver.time = "steady"
29
-
30
- solver.tui.define.models.multiphase.vof_sub_models("yes", "no")
31
- solver.tui.define.phases.set_domain_properties.change_phases_names("water", "air")
32
- solver.setup.boundary_conditions.pressure_inlet["inflow"].phase["mixture"] = {
33
- "multiphase": {
34
- "open_channel": True,
35
- "vmag": 1.452,
36
- "ht_bottom": -0.941875,
37
- },
38
- "momentum": {"direction_specification_method": "Direction Vector"},
39
- "turbulence": {
40
- "turbulent_intensity": 0.01,
41
- "turbulent_viscosity_ratio": 1,
42
- },
43
- }
44
- solver.setup.boundary_conditions.pressure_outlet["outflow"].phase["mixture"] = {
45
- "multiphase": {
46
- "open_channel": True,
47
- "ht_bottom": -0.941875,
48
- "den_spec": "From Free Surface Level",
49
- },
50
- "momentum": {
51
- "direction_spec": "Normal to Boundary",
52
- "p_backflow_spec_gen": "Static Pressure",
53
- },
54
- "turbulence": {
55
- "turbulent_intensity": 0.01,
56
- "turbulent_viscosity_ratio": 1,
57
- },
58
- }
59
-
60
- solver.solution.methods.p_v_coupling.flow_scheme = "Coupled"
61
- solver.solution.methods.p_v_coupling.coupled_form = True
62
- solver.solution.controls.advanced.multi_grid.amg_controls.coupled_parameters.coarsening_parameters.laplace_coarsening = (
63
- True
64
- )
65
- solver.solution.initialization.open_channel_auto_init = {
66
- "boundary_zone": 3,
67
- "flat_init": True,
68
- }
69
- assert solver.solution.initialization.open_channel_auto_init() == {
70
- "boundary_zone": 3,
71
- "flat_init": True,
72
- }
73
-
74
-
75
- @pytest.mark.fluent_version(">=24.1")
76
- def test_fmg_initialize(new_solver_session):
77
- solver = new_solver_session
78
- case_name = download_file("vki_turbine.cas.gz", "pyfluent/vki_turbine")
79
- solver.file.read(file_type="case", file_name=case_name)
80
- solver.mesh.check()
81
- solver.solution.initialization.standard_initialize()
82
- solver.solution.initialization.fmg.fmg_initialize()
83
- solver.tui.solve.iterate(2)
@@ -1,40 +0,0 @@
1
- import pytest
2
- from util.solver import copy_database_material
3
-
4
-
5
- @pytest.mark.settings_only
6
- @pytest.mark.fluent_version("latest")
7
- def test_solver_material(mixing_elbow_settings_session):
8
- solver_session = mixing_elbow_settings_session
9
- setup_materials = solver_session.setup.materials
10
- copy_database_material(materials=setup_materials, type="fluid", name="water-liquid")
11
- elbow_fluid = solver_session.setup.cell_zone_conditions.fluid["elbow-fluid"]
12
-
13
- assert "water-liquid" not in elbow_fluid.material()
14
- elbow_fluid.material = "water-liquid"
15
- assert "water-liquid" in elbow_fluid.material()
16
-
17
- setup_materials.database.copy_by_name(type="fluid", name="air")
18
- elbow_fluid.material = "air"
19
- assert "air" in elbow_fluid.material()
20
- assert "air" in elbow_fluid.material()
21
-
22
- assert setup_materials.child_names == [
23
- "database",
24
- "fluid",
25
- "solid",
26
- "mixture",
27
- "inert_particle",
28
- "droplet_particle",
29
- "combusting_particle",
30
- "particle_mixture",
31
- ]
32
- assert setup_materials.database.get_active_command_names() == [
33
- "copy_by_formula",
34
- "copy_by_name",
35
- "list_materials",
36
- "list_properties",
37
- ]
38
- setup_materials.database.copy_by_formula(type="fluid", formula="c2h6")
39
- elbow_fluid.material = "ethane"
40
- assert "ethane" in elbow_fluid.material()
@@ -1,65 +0,0 @@
1
- import pytest
2
-
3
-
4
- @pytest.mark.settings_only
5
- @pytest.mark.fluent_version("latest")
6
- def test_methods(mixing_elbow_settings_session):
7
- solver = mixing_elbow_settings_session
8
- solver.setup.models.multiphase.models = "vof"
9
- solver.setup.general.operating_conditions.gravity = {
10
- "enable": True,
11
- "components": [0.0, 0.0, -9.81],
12
- }
13
- solver.setup.general.solver.time = "steady"
14
-
15
- p_v_coupling = solver.solution.methods.p_v_coupling
16
- p_v_coupling.flow_scheme = "Coupled"
17
- p_v_coupling.coupled_form = False
18
- assert p_v_coupling() == {
19
- "flow_scheme": "Coupled",
20
- "coupled_form": False,
21
- }
22
- solver.solution.methods.discretization_scheme = {"pressure": "presto!"}
23
- assert solver.solution.methods.discretization_scheme() == {
24
- "mom": "second-order-upwind",
25
- "omega": "second-order-upwind",
26
- "mp": "compressive",
27
- "pressure": "presto!",
28
- "k": "second-order-upwind",
29
- "temperature": "second-order-upwind",
30
- }
31
- solver.solution.methods.gradient_scheme = "least-square-cell-based"
32
- assert solver.solution.methods.gradient_scheme() == "least-square-cell-based"
33
-
34
- enable_warped_face = solver.solution.methods.warped_face_gradient_correction
35
- enable_warped_face(enable=True, mode="fast")
36
- enable_warped_face(enable=False, mode="fast")
37
-
38
- solver.solution.methods.expert.numerics_pbns.velocity_formulation = "relative"
39
- assert (
40
- solver.solution.methods.expert.numerics_pbns.velocity_formulation()
41
- == "relative"
42
- )
43
- solver.solution.methods.expert.numerics_pbns = {
44
- "implicit_bodyforce_treatment": True,
45
- "velocity_formulation": "absolute",
46
- "physical_velocity_formulation": True,
47
- "disable_rhie_chow_flux": True,
48
- "presto_pressure_scheme": False,
49
- "first_to_second_order_blending": 1.0,
50
- }
51
- assert solver.solution.methods.expert.numerics_pbns() == {
52
- "implicit_bodyforce_treatment": True,
53
- "velocity_formulation": "absolute",
54
- "physical_velocity_formulation": True,
55
- "disable_rhie_chow_flux": True,
56
- "presto_pressure_scheme": False,
57
- "first_to_second_order_blending": 1.0,
58
- }
59
- solver.solution.methods.expert.numerics_pbns.presto_pressure_scheme = True
60
- assert solver.solution.methods.expert.numerics_pbns.presto_pressure_scheme() is True
61
- solver.solution.methods.gradient_scheme = "green-gauss-node-based"
62
- assert solver.solution.methods.gradient_scheme() == "green-gauss-node-based"
63
- solver.solution.methods.warped_face_gradient_correction(
64
- enable=True, mode="memory-saving"
65
- )
@@ -1,99 +0,0 @@
1
- import pytest
2
-
3
-
4
- @pytest.mark.settings_only
5
- @pytest.mark.fluent_version("latest")
6
- def test_solver_models(mixing_elbow_settings_session):
7
- solver_session = mixing_elbow_settings_session
8
- models = solver_session.setup.models
9
- assert models.energy.enabled()
10
- models.energy.enabled = False
11
- assert not models.energy.enabled()
12
- models.multiphase.models = "vof"
13
- assert models.multiphase.models() == "vof"
14
- models.viscous.model = "laminar"
15
- assert models.viscous.model() == "laminar"
16
- models.viscous.model = "k-epsilon"
17
- assert models.viscous.model() == "k-epsilon"
18
-
19
- models.viscous.near_wall_treatment.wall_treatment = "enhanced-wall-treatment"
20
- models.multiphase.models = "eulerian"
21
- assert models.multiphase.models() == "eulerian"
22
-
23
-
24
- @pytest.mark.settings_only
25
- @pytest.mark.fluent_version("latest")
26
- def test_disk_2d_models(disk_settings_session):
27
- solver_session = disk_settings_session
28
- models = solver_session.setup.models
29
- solver_session.setup.general.solver.two_dim_space = "axisymmetric"
30
- solver_session.setup.general.solver.two_dim_space = "swirl"
31
-
32
- models.viscous.model = "k-epsilon"
33
- near_wall = models.viscous.near_wall_treatment
34
- assert models.viscous.model() == "k-epsilon"
35
- near_wall.wall_treatment = "enhanced-wall-treatment"
36
- assert near_wall.wall_treatment() == "enhanced-wall-treatment"
37
- assert near_wall.wall_treatment.get_attr("allowed-values") == [
38
- "standard-wall-fn",
39
- "non-equilibrium-wall-fn",
40
- "enhanced-wall-treatment",
41
- "menter-lechner",
42
- "scalable-wall-functions",
43
- ]
44
-
45
- near_wall.wall_treatment = "standard-wall-fn"
46
- assert near_wall.wall_treatment() == "standard-wall-fn"
47
- near_wall.wall_treatment = "non-equilibrium-wall-fn"
48
- assert near_wall.wall_treatment() == "non-equilibrium-wall-fn"
49
- near_wall.wall_treatment = "menter-lechner"
50
- assert near_wall.wall_treatment() == "menter-lechner"
51
- near_wall.wall_treatment = "scalable-wall-functions"
52
- assert near_wall.wall_treatment() == "scalable-wall-functions"
53
-
54
- models.viscous.model = "k-omega"
55
- assert models.viscous.model() == "k-omega"
56
- assert models.viscous.k_omega_model.get_attr("allowed-values") == [
57
- "standard",
58
- "geko",
59
- "bsl",
60
- "sst",
61
- ]
62
-
63
- assert models.viscous.k_omega_model() == "standard"
64
- models.viscous.k_omega_model = "geko"
65
- assert models.viscous.k_omega_model() == "geko"
66
- models.viscous.k_omega_model = "bsl"
67
- assert models.viscous.k_omega_model() == "bsl"
68
- models.viscous.k_omega_model = "sst"
69
- assert models.viscous.k_omega_model() == "sst"
70
- assert models.viscous.model.get_attr("allowed-values") == [
71
- "inviscid",
72
- "laminar",
73
- "k-epsilon",
74
- "k-omega",
75
- "mixing-length",
76
- "spalart-allmaras",
77
- "k-kl-w",
78
- "transition-sst",
79
- "reynolds-stress",
80
- "scale-adaptive-simulation",
81
- "detached-eddy-simulation",
82
- ]
83
- k_omega_options = models.viscous.k_omega_options
84
- k_omega_options.kw_low_re_correction = True
85
- assert k_omega_options.kw_low_re_correction() is True
86
-
87
- turb_options = models.viscous.options
88
- turb_options.production_kato_launder_enabled = True
89
- assert turb_options.production_kato_launder_enabled() is True
90
- turb_options.production_limiter.clip_factor = 9
91
- assert turb_options.production_limiter.clip_factor() == 9
92
- turb_expert = models.viscous.turbulence_expert
93
- turb_expert.turb_non_newtonian = True
94
- assert turb_expert.turb_non_newtonian() is True
95
-
96
- models.viscous.model = "laminar"
97
- assert models.viscous.model() == "laminar"
98
- models.viscous.model = "spalart-allmaras"
99
- assert models.viscous.model() == "spalart-allmaras"