Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .ci/fluent_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ def _run_single_test(
"""
logging.debug(f"journal_file: {journal_file}")
src_pyfluent_dir = str(Path(pyfluent.__file__).parent)
verion_for_file_name = FluentVersion.current_dev().number
dst_pyfluent_dir = f"/ansys_inc/v{verion_for_file_name}/commonfiles/CPython/3_10/linx64/Release/Ansys/PyFluentCore/ansys/fluent/core"
version_for_file_name = FluentVersion.current_dev().number
dst_pyfluent_dir = f"/ansys_inc/v{version_for_file_name}/commonfiles/CPython/3_10/linx64/Release/Ansys/PyFluentCore/ansys/fluent/core"
src_gen_dir = (
Path(pyfluent.__file__).parent / "ansys" / "fluent" / "core" / "generated"
)
dst_gen_dir = f"/ansys_inc/v{verion_for_file_name}/fluent/fluent{FluentVersion.current_dev()!r}/cortex/pylib/flapi/generated"
dst_gen_dir = f"/ansys_inc/v{version_for_file_name}/fluent/fluent{FluentVersion.current_dev()!r}/cortex/pylib/flapi/generated"
dst_test_dir = "/testing"
working_dir = Path(dst_test_dir)
parent = journal_file.parent
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/4480.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update 26R1 meshing tests.
2 changes: 1 addition & 1 deletion doc/settings_rstgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-- Populate a parents dictionary with current class file name (not class name) as key and list of parents file names (not class names) as value.
- Recursively Generate the rst files for classes starting with settings.root.
-- Add target reference as the file name for the given class. This is used by other classes to generate hyperlinks
-- Add properties like members, undoc-memebers, show-inheritence to the autoclass directive.
-- Add properties like members, undoc-members, show-inheritance to the autoclass directive.
-- Generate the tables of children, commands, arguments, and parents.
--- Get access to the respective properties and members on the class with get_attr.
--- Use the file name of the child class to generate the hyperlink to that class.
Expand Down
6 changes: 3 additions & 3 deletions examples/00-fluent/lunar_lander_thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,13 @@ def get_surf_mean_temp(
)

# Simulate closing louvers below 273 K by changing emissivity
rad_emiss = solver_session.setup.boundary_conditions.wall[
rad_emission = solver_session.setup.boundary_conditions.wall[
"sc-radiator"
].radiation.internal_emissivity_band["thermal-ir"]
if rad_mean_temp < 273:
rad_emiss.value = 0.09
rad_emission.value = 0.09
else:
rad_emiss.value = 0.70
rad_emission.value = 0.70

# Run simulation for 1 timestep
solver_session.solution.run_calculation.calculate()
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ dependencies = [
"grpcio-health-checking>=1.30.0",
"grpcio-status>=1.26.0",
"nltk>=3.9.1",
"numpy>=1.14.0,<3.0.0",
"numpy==2.2.6; python_version >'3.10'", # TODO: Limit to be removed once Python 3.10 support is dropped
"numpy==1.26.4; python_version <= '3.10'", # TODO: Dependency to be removed once Python 3.10 support is dropped
"pandas>=1.1.0,<3.0.0",
"pyansys-tools-report>=0.8.1",
"pyyaml>=6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/fluent_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class MonitorThread(threading.Thread):
"""A class used for monitoring a Fluent session.

Daemon thread which will ensure cleanup of session objects, shutdown of
non-deamon threads etc.
non-daemon threads etc.

Attributes
----------
Expand Down
14 changes: 8 additions & 6 deletions tests/test_datamodel_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ def test_get_and_set_state_for_command_arg_instance(new_meshing_session):

assert x.LengthUnit.get_state() == "ft"

assert x.CadImportOptions.ExtractFeatures()
assert not x.ImportCadPreferences.ShowImportCadPreferences()

x.CadImportOptions.ExtractFeatures.set_state(False)
x.ImportCadPreferences.ShowImportCadPreferences.set_state(True)

assert not x.CadImportOptions.ExtractFeatures()
assert x.ImportCadPreferences.ShowImportCadPreferences()

x.set_state({"FileName": "dummy_file_name.dummy_extn"})

Expand Down Expand Up @@ -813,15 +813,17 @@ def test_set_command_args_and_sub_args(new_meshing_session):
meshing = new_meshing_session
ig = meshing.meshing.ImportGeometry.create_instance()

ig.FileFormat = "Mesh"

# Command Arguments
assert ig.MeshUnit() == "m"
ig.MeshUnit = "mm"
assert ig.MeshUnit() == "mm"

# Command Arguments SubItem
assert ig.CadImportOptions.OneZonePer() == "body"
ig.CadImportOptions.OneZonePer = "face"
assert ig.CadImportOptions.OneZonePer() == "face"
assert ig.ImportCadPreferences.ShowImportCadPreferences() is False
ig.ImportCadPreferences.ShowImportCadPreferences = True
assert ig.ImportCadPreferences.ShowImportCadPreferences() is True


@pytest.mark.fluent_version(">=24.1")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ def test_ansys_units_integration(mixing_elbow_settings_session):
)


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=24.2")
def test_ansys_units_integration_nested_state(mixing_elbow_settings_session):
solver = mixing_elbow_settings_session
Expand Down Expand Up @@ -1135,6 +1136,7 @@ def test_ansys_units_integration_nested_state(mixing_elbow_settings_session):
}


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=24.2")
def test_bug_1001124_quantity_assignment(mixing_elbow_settings_session):
speed = ansys.units.Quantity(100, "m s^-1")
Expand Down Expand Up @@ -1217,6 +1219,7 @@ def test_no_hash_mismatch(new_solver_session, caplog):
assert all(["Mismatch" not in record.message for record in caplog.records])


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=24.2")
def test_default_argument_names_for_commands(static_mixer_settings_session):
solver = static_mixer_settings_session
Expand Down
1 change: 1 addition & 0 deletions tests/test_fluent_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def test_monitors_list_set_data_637_974_1744_2188(new_solver_session):
)


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=24.2")
def test_empty_vector_field_data_2339(new_solver_session):
solver = new_solver_session
Expand Down
1 change: 1 addition & 0 deletions tests/test_icing_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import ansys.fluent.core as pyfluent


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=23.1")
def test_icing_session():
icing_session = pyfluent.launch_fluent(mode=pyfluent.FluentMode.SOLVER_ICING)
Expand Down
1 change: 1 addition & 0 deletions tests/test_meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def test_old_workflow_structure(new_meshing_session):

@pytest.mark.nightly
@pytest.mark.codegen_required
@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version(">=24.2")
def test_new_2d_meshing_workflow(new_meshing_session_wo_exit):
# Import geometry
Expand Down
1 change: 1 addition & 0 deletions tests/test_meshingmode/test_meshing_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_launch_meshing_and_switch(new_meshing_session_wo_exit, capsys):
solver.exit()


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.fluent_version("latest")
@pytest.mark.codegen_required
def test_meshing_streaming_and_switch(new_meshing_session_wo_exit):
Expand Down
123 changes: 53 additions & 70 deletions tests/test_new_meshing_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,39 +455,6 @@ def test_new_2d_meshing_workflow(new_meshing_session_wo_exit):
assert solver.is_active() is False


@pytest.mark.codegen_required
@pytest.mark.fluent_version(">=23.2")
def test_updating_state_in_new_meshing_workflow(new_meshing_session):
# Import geometry
import_file_name = examples.download_file(
"mixing_elbow.pmdb", "pyfluent/mixing_elbow"
)
watertight = new_meshing_session.watertight()
assert watertight.import_geometry.length_unit() == "mm"
assert watertight.import_geometry.cad_import_options.feature_angle() == 40.0
assert (
watertight.import_geometry.cad_import_options.one_zone_per.allowed_values()
== ["body", "face", "object"]
)
assert watertight.import_geometry.cad_import_options.one_zone_per() == "body"
watertight.import_geometry.arguments = {
"file_name": import_file_name,
"length_unit": "in",
"cad_import_options": {"feature_angle": 35, "one_zone_per": "object"},
}
assert watertight.import_geometry.cad_import_options.feature_angle() == 35.0
assert (
watertight.import_geometry.cad_import_options.one_zone_per.get_state()
== "object"
)
assert watertight.import_geometry.length_unit.get_state() == "in"
watertight.import_geometry.cad_import_options.feature_angle = 25.0
assert watertight.import_geometry.cad_import_options.feature_angle() == 25.0
watertight.import_geometry.cad_import_options.one_zone_per = "face"
assert watertight.import_geometry.cad_import_options.one_zone_per() == "face"
watertight.import_geometry()


def _assert_snake_case_attrs(attrs: Iterable):
for attr in attrs:
assert str(attr).islower()
Expand Down Expand Up @@ -617,10 +584,19 @@ def test_watertight_workflow_dynamic_interface(
watertight = new_meshing_session.watertight()
watertight.import_geometry.file_name = mixing_elbow_geometry_filename
watertight.import_geometry()
create_volume_mesh = watertight.create_volume_mesh
if new_meshing_session.get_fluent_version() < FluentVersion.v261:
create_volume_mesh = watertight.create_volume_mesh
else:
create_volume_mesh = watertight.create_volume_mesh_wtm
assert create_volume_mesh is not None
watertight.delete_tasks(list_of_tasks=["create_volume_mesh"])
assert "create_volume_mesh" not in watertight.task_names()
if new_meshing_session.get_fluent_version() < FluentVersion.v261:
watertight.delete_tasks(list_of_tasks=["create_volume_mesh"])
vol_mesh_task_name = "<Insertable 'create_volume_mesh' task>"
assert "create_volume_mesh" not in watertight.task_names()
else:
watertight.delete_tasks(list_of_tasks=["create_volume_mesh_wtm"])
vol_mesh_task_name = "<Insertable 'create_volume_mesh_wtm' task>"
assert "create_volume_mesh_wtm" not in watertight.task_names()

assert sorted(
[repr(x) for x in watertight.add_boundary_layer.insertable_tasks()]
Expand All @@ -631,15 +607,20 @@ def test_watertight_workflow_dynamic_interface(
"<Insertable 'set_up_rotational_periodic_boundaries' task>",
"<Insertable 'modify_mesh_refinement' task>",
"<Insertable 'improve_surface_mesh' task>",
"<Insertable 'create_volume_mesh' task>",
vol_mesh_task_name,
"<Insertable 'manage_zones_ftm' task>",
"<Insertable 'update_regions' task>",
"<Insertable 'custom_journal_task' task>",
]
)
watertight.add_boundary_layer.insertable_tasks.create_volume_mesh.insert()
assert "create_volume_mesh" in watertight.task_names()
create_volume_mesh = watertight.create_volume_mesh
if new_meshing_session.get_fluent_version() < FluentVersion.v261:
watertight.add_boundary_layer.insertable_tasks.create_volume_mesh.insert()
assert "create_volume_mesh" in watertight.task_names()
create_volume_mesh = watertight.create_volume_mesh
else:
watertight.add_boundary_layer.insertable_tasks.create_volume_mesh_wtm.insert()
assert "create_volume_mesh_wtm" in watertight.task_names()
create_volume_mesh = watertight.create_volume_mesh_wtm
assert create_volume_mesh is not None

assert (
Expand All @@ -653,8 +634,12 @@ def test_watertight_workflow_dynamic_interface(
assert watertight.describe_geometry.enclose_fluid_regions
watertight.describe_geometry.enclose_fluid_regions.delete()
assert "enclose_fluid_regions" not in watertight.task_names()
watertight.create_volume_mesh.delete()
assert "create_volume_mesh" not in watertight.task_names()
if new_meshing_session.get_fluent_version() < FluentVersion.v261:
watertight.create_volume_mesh.delete()
assert "create_volume_mesh" not in watertight.task_names()
else:
watertight.create_volume_mesh_wtm.delete()
assert "create_volume_mesh_wtm" not in watertight.task_names()


@pytest.mark.fluent_version("==23.2")
Expand Down Expand Up @@ -687,7 +672,7 @@ def test_extended_wrapper(new_meshing_session, mixing_elbow_geometry_filename):
import_geometry = watertight.import_geometry
assert import_geometry.Arguments() == {}
import_geometry.Arguments = dict(FileName=mixing_elbow_geometry_filename)
assert 8 < len(import_geometry.arguments.get_state()) < 15
assert 7 <= len(import_geometry.arguments.get_state()) < 15
assert len(import_geometry.arguments.get_state(explicit_only=True)) == 1
import_geometry.arguments.set_state(dict(file_name=None))
time.sleep(5)
Expand Down Expand Up @@ -1095,7 +1080,10 @@ def test_new_meshing_workflow_without_dm_caching(
watertight.add_local_sizing.add_child_to_task()
watertight.add_local_sizing()

watertight.create_volume_mesh()
if new_meshing_session.get_fluent_version() < FluentVersion.v261:
watertight.create_volume_mesh()
else:
watertight.create_volume_mesh_wtm()

watertight.import_geometry.rename(new_name="import_geom_wtm")
time.sleep(2)
Expand Down Expand Up @@ -1236,6 +1224,10 @@ def test_duplicate_tasks_in_workflow(new_meshing_session):
watertight.import_geometry.insertable_tasks.import_boi_geometry.insert()
watertight.import_geometry.insertable_tasks.import_boi_geometry.insert()
watertight.import_geometry.insertable_tasks.import_boi_geometry.insert()
if meshing.get_fluent_version() < FluentVersion.v261:
_entry = "create_volume_mesh"
else:
_entry = "create_volume_mesh_wtm"
assert set(watertight.task_names()) == {
"import_geometry",
"create_surface_mesh",
Expand All @@ -1246,7 +1238,7 @@ def test_duplicate_tasks_in_workflow(new_meshing_session):
"create_regions",
"update_regions",
"add_boundary_layer",
"create_volume_mesh",
_entry,
"add_local_sizing",
"import_boi_geometry",
"import_boi_geometry_1",
Expand Down Expand Up @@ -1360,6 +1352,7 @@ def test_independent_meshing_sessions(new_meshing_session, new_meshing_session2)
assert fault_tolerant.import_cad_and_part_management.arguments()


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.codegen_required
@pytest.mark.fluent_version(">=24.1")
def test_independent_meshing_sessions_without_dm_caching(
Expand Down Expand Up @@ -1442,6 +1435,7 @@ def test_duplicate_children_of_compound_task(
)


@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/4498")
@pytest.mark.codegen_required
@pytest.mark.fluent_version(">=24.1")
def test_current_workflow(new_meshing_session):
Expand Down Expand Up @@ -1517,7 +1511,9 @@ def test_accessors_for_argument_sub_items(new_meshing_session):
meshing.workflow.TaskObject["Import Geometry"].Arguments = dict(LengthUnit="in")
assert import_geom.arguments.length_unit() == "in"

import_geom.arguments.file_format = "Mesh"
assert not import_geom.arguments.mesh_unit.is_read_only()
import_geom.arguments.file_format = "CAD"
assert import_geom.arguments.length_unit.is_active()
assert not import_geom.arguments.file_name.is_read_only()
assert not import_geom.arguments.file_name()
Expand All @@ -1529,23 +1525,21 @@ def test_accessors_for_argument_sub_items(new_meshing_session):
with pytest.raises(AttributeError):
import_geom.arguments.CadImportOptions.OneZonePer = "face"

assert import_geom.arguments.cad_import_options()
assert import_geom.arguments.cad_import_options.one_zone_per()
assert import_geom.arguments.import_cad_preferences()
assert (
not import_geom.arguments.import_cad_preferences.show_import_cad_preferences()
)

assert import_geom.arguments.file_format.get_attrib_value("allowedValues") == [
"CAD",
"Mesh",
]
assert import_geom.arguments.file_format.allowed_values() == ["CAD", "Mesh"]

assert not import_geom.arguments.cad_import_options.one_zone_per.is_read_only()
assert import_geom.arguments.cad_import_options.one_zone_per() == "body"
import_geom.arguments.cad_import_options.one_zone_per.set_state("face")
assert import_geom.arguments.cad_import_options.one_zone_per() == "face"
import_geom.arguments.cad_import_options.one_zone_per = "object"
assert import_geom.arguments.cad_import_options.one_zone_per() == "object"

volume_mesh_gen = watertight.create_volume_mesh
if meshing.get_fluent_version() < FluentVersion.v261:
volume_mesh_gen = watertight.create_volume_mesh
else:
volume_mesh_gen = watertight.create_volume_mesh_wtm
assert (
volume_mesh_gen.arguments.volume_fill_controls.cell_sizing.default_value()
== "Geometric"
Expand All @@ -1559,28 +1553,14 @@ def test_accessors_for_argument_sub_items(new_meshing_session):
"Geometric",
]
)
feat_angle = import_geom.arguments.cad_import_options.feature_angle
assert feat_angle.default_value() == 40.0

# Test particular to numerical type (min() only available in numerical types)
assert feat_angle.min() == 0.0

# Test intended to fail in numerical type (allowed_values() only available in string types)
with pytest.raises(AttributeError) as msg:
assert feat_angle.allowed_values()
assert (
msg.value.args[0] == "'_FeatureAngle' object has no attribute 'allowed_values'"
)

# Test intended to fail in numerical type (allowed_values() only available in string types)
with pytest.raises(AttributeError) as msg:
assert import_geom.arguments.num_parts.allowed_values()
assert msg.value.args[0] == "'_NumParts' object has no attribute 'allowed_values'"

# Test intended to fail in string type (min() only available in numerical types)
with pytest.raises(AttributeError) as msg:
assert import_geom.arguments.length_unit.min()
assert msg.value.args[0] == "'_LengthUnit' object has no attribute 'min'"


@pytest.mark.codegen_required
Expand All @@ -1594,7 +1574,10 @@ def test_scenario_with_common_python_names_from_fdl(new_meshing_session):
assert len(fault_tolerant.task_names()) == len(set(fault_tolerant.task_names()))

# APIName from fdl file
assert "create_volume_mesh" in fault_tolerant.task_names()
if meshing.get_fluent_version() < FluentVersion.v261:
assert "create_volume_mesh" in fault_tolerant.task_names()
else:
assert "create_volume_mesh_ftm" in fault_tolerant.task_names()
assert "generate_volume_mesh" in fault_tolerant.task_names()
assert "generate_surface_mesh" in fault_tolerant.task_names()

Expand Down
Loading
Loading