diff --git a/.github/workflows/execute-examples-weekly.yml b/.github/workflows/execute-examples-weekly.yml index 810516dd906c..caeb1c8cc610 100644 --- a/.github/workflows/execute-examples-weekly.yml +++ b/.github/workflows/execute-examples-weekly.yml @@ -154,6 +154,11 @@ jobs: run: | python examples/00-fluent/single_battery_cell_workflow.py + - name: Execute fsi_1way_workflow.py + run: | + python examples/00-fluent/fsi_1way_workflow.py + + # https://github.com/ansys/pyfluent/issues/4157 # - name: Execute conjugate_heat_transfer.py # run: | diff --git a/codegen/allapigen.py b/codegen/allapigen.py index 2a92ccb4e865..dd5a1bed161a 100644 --- a/codegen/allapigen.py +++ b/codegen/allapigen.py @@ -11,7 +11,6 @@ if __name__ == "__main__": t0 = time() - config.fluent_automatic_transcript = True meshing = launch_fluent(mode=FluentMode.MESHING) version = get_version_for_file_name(session=meshing) gt_222 = FluentVersion(version) > FluentVersion.v222 diff --git a/doc/changelog.d/4390.fixed.md b/doc/changelog.d/4390.fixed.md deleted file mode 100644 index ab8576dd1ff5..000000000000 --- a/doc/changelog.d/4390.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Turn on automatic transcript while running codegen diff --git a/doc/changelog.d/4396.fixed.md b/doc/changelog.d/4396.fixed.md deleted file mode 100644 index aadac0aaf8f2..000000000000 --- a/doc/changelog.d/4396.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Raise the underlying urlerror while downloading example file diff --git a/doc/changelog.d/4399.fixed.md b/doc/changelog.d/4399.fixed.md deleted file mode 100644 index 4bf152e42308..000000000000 --- a/doc/changelog.d/4399.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Fix test_docker_compose diff --git a/doc/source/_static/fsi_1way_1.png b/doc/source/_static/fsi_1way_1.png new file mode 100644 index 000000000000..a5b2445ceaf4 Binary files /dev/null and b/doc/source/_static/fsi_1way_1.png differ diff --git a/doc/source/_static/fsi_1way_2.png b/doc/source/_static/fsi_1way_2.png new file mode 100644 index 000000000000..0c4f224af68a Binary files /dev/null and b/doc/source/_static/fsi_1way_2.png differ diff --git a/doc/source/_static/fsi_1way_3.png b/doc/source/_static/fsi_1way_3.png new file mode 100644 index 000000000000..e73d104033b8 Binary files /dev/null and b/doc/source/_static/fsi_1way_3.png differ diff --git a/doc/source/conf.py b/doc/source/conf.py index 1502218b4c6e..54ef8dce4d9f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -151,7 +151,7 @@ def _stop_fluent_container(gallery_conf, fname): # path where to save gallery generated examples "gallery_dirs": ["examples"], # Pattern to search for example files - "filename_pattern": r"exhaust_system_settings_api\.py|external_compressible_flow\.py|mixing_elbow_settings_api\.py|modeling_cavitation\.py|species_transport\.py|ahmed_body_workflow\.py|brake\.py|DOE_ML\.py|radiation_headlamp\.py|parametric_static_mixer_1\.py|conjugate_heat_transfer\.py|tyler_sofrin_modes\.py|lunar_lander_thermal\.py|modeling_ablation\.py|frozen_rotor_workflow\.py|mixing_tank_workflow\.py|single_battery_cell_workflow\.py|", + "filename_pattern": r"exhaust_system_settings_api\.py|external_compressible_flow\.py|mixing_elbow_settings_api\.py|modeling_cavitation\.py|species_transport\.py|ahmed_body_workflow\.py|brake\.py|DOE_ML\.py|radiation_headlamp\.py|parametric_static_mixer_1\.py|conjugate_heat_transfer\.py|tyler_sofrin_modes\.py|lunar_lander_thermal\.py|modeling_ablation\.py|frozen_rotor_workflow\.py|mixing_tank_workflow\.py|single_battery_cell_workflow\.py|fsi_1way_workflow\.py|", # Do not execute examples "plot_gallery": False, # Remove the "Download all examples" button from the top level gallery diff --git a/examples/00-fluent/fsi_1way_workflow.py b/examples/00-fluent/fsi_1way_workflow.py new file mode 100644 index 000000000000..037450e8a3ee --- /dev/null +++ b/examples/00-fluent/fsi_1way_workflow.py @@ -0,0 +1,220 @@ +# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +""".. _One_Way_FSI_Simulation: + +Modeling One-Way Fluid-Structure Interaction +------------------------------------------------------------- +""" + +####################################################################################### +# Objective +# ===================================================================================== +# +# The Simulation focuses on simulating turbulent airflow through a cylindrical test chamber +# containing a steel probe, and analyzing the deformation of the probe due to +# aerodynamic forces. The deformation is assumed to be small enough that it +# does not influence the fluid flow, allowing for a one-way coupling approach. + +####################################################################################### +# Problem Description: +# ===================================================================================== +# +# The cylindrical test chamber is 20 cm long, with a diameter of 10 cm. +# Turbulent air enters the chamber at 100 m/s, flows around and through +# the steel probe, and exits through a pressure outlet. +# +# +# .. image:: ../../_static/fsi_1way_1.png +# :align: center +# :alt: One-Way Fluid-Structure Interaction Model + +####################################################################################### +# Import modules +# ===================================================================================== + +import os + +import ansys.fluent.core as pyfluent +from ansys.fluent.core import FluentMode, Precision, examples + +####################################################################################### +# Launch Fluent session in solver mode +# ===================================================================================== + +solver = pyfluent.launch_fluent( + precision=Precision.DOUBLE, + mode=FluentMode.SOLVER, +) + +####################################################################################### +# Download and Read the journal file +# ===================================================================================== +# +# .. note:: +# Mesh file is required as input for the journal file. +# +# Journal file serves as a script that instructs Ansys Fluent on sequential operations + +journal_file = examples.download_file( + "fsi_1way.jou", + "pyfluent/fsi_1way", + save_path=os.getcwd(), +) + +examples.download_file( + "fsi_1way.msh.h5", + "pyfluent/fsi_1way", + save_path=os.getcwd(), +) + +solver.tui.file.read_journal(journal_file) # Read the journal file + +graphics_object = solver.settings.results.graphics +graphics_object.picture.x_resolution = 650 +graphics_object.picture.y_resolution = 450 +graphics_object.views.restore_view(view_name="front") + +solver.settings.results.graphics.contour["contour-vel"].display() +graphics_object.picture.save_picture(file_name="fsi_1way_2.png") + +# %% +# .. image:: ../../_static/fsi_1way_2.png +# :align: center +# :alt: Velocity Contour + +####################################################################################### +# Structural model and Material +# ===================================================================================== +# To analyze the deformation of a steel probe under fluid flow, +# Linear Elasticity Structural model is chosen + +solver.settings.setup.models.structure.model = "linear-elasticity" + +# Copy materials from the database and assign to solid zone + +solver.settings.setup.materials.database.copy_by_name(type="solid", name="steel") +solver.settings.setup.cell_zone_conditions.solid["solid"] = { + "general": {"material": "steel"} +} + +####################################################################################### +# Defining the boundary conditions +# ===================================================================================== +# configure Fluent to define the steel probe's support and movement using +# structural boundary conditions + +wall = solver.settings.setup.boundary_conditions.wall + +# Configure solid-symmetry boundary +wall["solid-symmetry"] = { + "structure": { + "z_disp_boundary_value": 0, + "z_disp_boundary_condition": "Node Z-Displacement", + } +} + +# Set solid-top boundary +wall["solid-top"] = { + "structure": { + "z_disp_boundary_value": 0, + "z_disp_boundary_condition": "Node Z-Displacement", + "y_disp_boundary_value": 0, + "y_disp_boundary_condition": "Node Y-Displacement", + "x_disp_boundary_value": 0, + "x_disp_boundary_condition": "Node X-Displacement", + } +} + +# Copy boundary conditions from solid-symmetry to solid-symmetry:011 +solver.settings.setup.boundary_conditions.copy( + from_="solid-symmetry", to=["solid-symmetry:011"] +) + +# Configure FSI surface +wall["fsisurface-solid"] = { + "structure": { + "z_disp_boundary_condition": "Intrinsic FSI", + "y_disp_boundary_condition": "Intrinsic FSI", + "x_disp_boundary_condition": "Intrinsic FSI", + } +} + +####################################################################################### +# Inclusion of Operating Pressure in Fluid-Structure Interaction Forces +# ===================================================================================== +# Fluent uses gauge pressure for fluid-structure interaction force calculations. +# By setting ``include_pop_in_fsi_force`` to ``True``, Fluent uses absolute pressure. + +solver.settings.setup.models.structure.expert.include_pop_in_fsi_force = True + +####################################################################################### +# Configure flow settings +# ===================================================================================== + +solver.settings.solution.controls.equations["flow"] = False +solver.settings.solution.controls.equations["kw"] = False + +####################################################################################### +# Run the simulation +# ===================================================================================== + +solver.settings.file.write_case(file_name="probe_fsi_1way.cas.h5") # save the case file + +solver.settings.solution.run_calculation.iter_count = 2 +solver.settings.solution.run_calculation.calculate() + +####################################################################################### +# Post-Processing +# ===================================================================================== + +displacement_contour = solver.settings.results.graphics.contour.create( + "displacement_contour" +) +displacement_contour.field = "total-displacement" +displacement_contour.surfaces_list = ["fsisurface-solid"] +displacement_contour.range_options.compute() + +graphics_object.views.restore_view(view_name="front") +displacement_contour.display() +graphics_object.picture.save_picture(file_name="fsi_1way_3.png") + +# save the case and data file +solver.settings.file.write_case_data(file_name="probe_fsi_1way") + +# %% +# .. image:: ../../_static/fsi_1way_3.png +# :align: center +# :alt: Structural Displacement Contour + +####################################################################################### +# Close the solver +# ===================================================================================== +solver.exit() + +####################################################################################### +# References: +# ===================================================================================== +# .. _Reference: +# [1] Modeling One-Way Fluid-Structure Interaction (FSI) Within Fluent, `Ansys Fluent documentation​ `_. + +# sphinx_gallery_thumbnail_path = '_static/fsi_1way_2.png' diff --git a/src/ansys/fluent/core/launcher/fluent_container.py b/src/ansys/fluent/core/launcher/fluent_container.py index 385c4602b0c9..b1c58e7f73f5 100644 --- a/src/ansys/fluent/core/launcher/fluent_container.py +++ b/src/ansys/fluent/core/launcher/fluent_container.py @@ -353,8 +353,6 @@ def configure_container_dict( "FLUENT_ALLOW_REMOTE_GRPC_CONNECTION": "1", } ) - if compose_config.is_compose: - container_dict["environment"]["FLUENT_SERVER_INFO_PERMISSION_SYSTEM"] = "1" if "labels" not in container_dict: test_name = pyfluent.config.test_name diff --git a/src/ansys/fluent/core/solver/flunits.py b/src/ansys/fluent/core/solver/flunits.py index f578e6d6bb30..96f4e4697dc4 100644 --- a/src/ansys/fluent/core/solver/flunits.py +++ b/src/ansys/fluent/core/solver/flunits.py @@ -298,8 +298,6 @@ def get_si_unit_for_fluent_quantity( # attribute only for dimensionless variables if quantity is None: return "" - if isinstance(quantity, list): # real vector - quantity = quantity[0] if not isinstance(quantity, str): raise InvalidQuantityType(quantity) try: diff --git a/src/ansys/fluent/core/utils/networking.py b/src/ansys/fluent/core/utils/networking.py index c5d97e76e30a..92e034628b0b 100644 --- a/src/ansys/fluent/core/utils/networking.py +++ b/src/ansys/fluent/core/utils/networking.py @@ -25,7 +25,6 @@ from concurrent import futures import logging import socket -import ssl from typing import Any import urllib.request @@ -131,20 +130,12 @@ def check_url_exists(url: str) -> bool: ------- bool True if the URL exists, False otherwise - - Raises - ------ - ssl.SSLError - If there is an SSL error while checking the URL """ try: with urllib.request.urlopen(url) as response: return response.status == 200 - except urllib.error.URLError as ex: - if ex.__context__ and isinstance(ex.__context__, ssl.SSLError): - raise ex.__context__ - else: - return False + except Exception: + return False def get_url_content(url: str) -> str: diff --git a/tests/test_settings_api.py b/tests/test_settings_api.py index 0e86e4ca6243..b37ef364e872 100644 --- a/tests/test_settings_api.py +++ b/tests/test_settings_api.py @@ -515,9 +515,6 @@ def test_child_alias_with_parent_path(mixing_elbow_settings_session): ) solver.settings.solution.initialization.hybrid_initialize() - if solver.get_fluent_version() >= FluentVersion.v261: - solver.settings.setup.models.multiphase.model = "eulerian" - solver.tui.define.models.multiphase.hybrid_models.ddpm("yes") assert ( solver.settings.setup.models.discrete_phase.numerics.node_based_averaging.kernel._child_aliases == {