Skip to content

meshing.tui.report.mesh_size() does not return the mesh size results#2868

Description

@OmarZaki96

馃攳 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

馃悶 Description of the bug

I am trying to get some statistics on the mesh (specifically the mesh size), but I am unable to do this. I am using the following method:

meshing.tui.report.mesh_size()

but it returns an empty string.

is there something wrong with the method? is there another method?

馃摑 Steps to reproduce

import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples

import_file_name = examples.download_file("mixing_elbow.pmdb", "pyfluent/mixing_elbow")

###############################################################################
# Launch Fluent
# ~~~~~~~~~~~~~
# Launch Fluent as a service in meshing mode with double precision running on
# two processors.

meshing = pyfluent.launch_fluent(
    precision="double",
    processor_count=2,
    mode="meshing",
)


###############################################################################
# Initialize workflow
# ~~~~~~~~~~~~~~~~~~~
# Initialize the watertight geometry meshing workflow.

meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")


###############################################################################
# Watertight geometry meshing workflow
# ------------------------------------
# The fault-tolerant meshing workflow guides you through the several tasks that
# follow.
#
# Import CAD and set length units
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Import the CAD geometry and set the length units to inches.
geo_import = meshing.workflow.TaskObject["Import Geometry"]
geo_import.Arguments = {
    "FileName": import_file_name,
    "LengthUnit": "in",
}

# Import geometry
# ~~~~~~~~~~~~~~~
# Import the geometry.

geo_import.Execute()

###############################################################################
# Add local sizing
# ~~~~~~~~~~~~~~~~
# Add local sizing. This task asks whether you want to add local sizing controls
# to the faceted geometry. You can keep the default settings and execute the task.
add_local_sizing = meshing.workflow.TaskObject["Add Local Sizing"]
add_local_sizing.AddChildToTask()
add_local_sizing.Execute()

###############################################################################
# Generate surface mesh
# ~~~~~~~~~~~~~~~~~~~~~
# Generate the surface mash. In this task, you can set various properties of the
# surface mesh for the faceted geometry. For ``"MaxSize"``, set ``0.3``.
surface_mesh_gen = meshing.workflow.TaskObject["Generate the Surface Mesh"]
surface_mesh_gen.Arguments = {"CFDSurfaceMeshControls": {"MaxSize": 0.3}}
surface_mesh_gen.Execute()

###############################################################################
# Describe geometry
# ~~~~~~~~~~~~~~~~~
# Describe the geometry. In this task, you are prompted with questions
# relating to the nature of the imported geometry, which defines
# the fluid region. The geometry consists of only fluid regions.
describe_geo = meshing.workflow.TaskObject["Describe Geometry"]
describe_geo.UpdateChildTasks(SetupTypeChanged=False)
describe_geo.Arguments = {
    "SetupType": "The geometry consists of only fluid regions with no voids"
}
describe_geo.UpdateChildTasks(SetupTypeChanged=True)
describe_geo.Execute()

###############################################################################
# Update boundaries
# ~~~~~~~~~~~~~~~~~
# Update the boundaries. Set ``"BoundaryLabelTypeList"`` to ``"wall"`` and
# update the boundaries.
update_boundaries = meshing.workflow.TaskObject["Update Boundaries"]
update_boundaries.Arguments = {
    "BoundaryLabelList": ["wall-inlet"],
    "BoundaryLabelTypeList": ["wall"],
    "OldBoundaryLabelList": ["wall-inlet"],
    "OldBoundaryLabelTypeList": ["velocity-inlet"],
}
update_boundaries.Execute()

###############################################################################
# Update regions
# ~~~~~~~~~~~~~~
# Update the regions. In this task, you can review the names and types of
# the various regions that have been generated from your imported geometry and
# change them as needed. You can keep the default settings.

meshing.workflow.TaskObject["Update Regions"].Execute()

###############################################################################
# Add boundary layers
# ~~~~~~~~~~~~~~~~~~~
# Add boundary layers, which consist of setting properties for the
# boundary layer mesh. You can keep the default settings.
add_boundary_layers = meshing.workflow.TaskObject["Add Boundary Layers"]
add_boundary_layers.AddChildToTask()
add_boundary_layers.InsertCompoundChildTask()
smooth_transition_1 = meshing.workflow.TaskObject["smooth-transition_1"]
smooth_transition_1.Arguments = {
    "BLControlName": "smooth-transition_1",
}
add_boundary_layers.Arguments = {}
smooth_transition_1.Execute()

###############################################################################
# Generate volume mesh
# ~~~~~~~~~~~~~~~~~~~~
# Generate the volume mesh, which consists of setting properties for the
# volume mesh. Set ``"VolumeFill"`` to ``"poly-hexcore"``.
volume_mesh_gen = meshing.workflow.TaskObject["Generate the Volume Mesh"]
volume_mesh_gen.Arguments = {
    "VolumeFill": "poly-hexcore",
    "VolumeFillControls": {
        "HexMaxCellLength": 0.3,
    },
}
volume_mesh_gen.Execute()
mesh_size = meshing.tui.report.mesh_size()
print(mesh_size.__str__())

馃捇 Which operating system are you using?

Windows

馃搥 Which ANSYS version are you using?

2024R1

馃悕 Which Python version are you using?

3.10

馃摝 Installed packages

about-time==4.2.1
adjustText==0.8
alive-progress==3.1.5
ansys-api-dbu==0.3.0
ansys-api-fluent==0.3.22
ansys-api-geometry==0.4.1
ansys-api-mechanical==0.1.1
ansys-api-platform-instancemanagement==1.1.0
ansys-fluent-core==0.20.1
ansys-geometry-core==0.5.5
ansys-mechanical-core==0.10.10
ansys-mechanical-env==0.1.6
ansys-platform-instancemanagement==1.1.2
ansys-pythonnet==3.1.0rc3
ansys-tools-path==0.5.2
ansys-units==0.3.2
appdirs==1.4.4
astropy==6.1.0
astropy-iers-data==0.2024.5.20.0.29.40
asttokens==2.4.1
autograd==1.6.2
beartype==0.17.2
cadquery==2.4.0
cadquery-ocp==7.7.2
casadi==3.6.5
certifi==2023.11.17
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cloudpickle==3.0.0
clr-loader==0.2.6
cma==2.7.0
colorama==0.4.6
comm==0.2.2
contourpy==1.2.0
CoolProp==6.6.0
cycler==0.12.1
darkdetect==0.7.1
debugpy==1.8.1
decorator==5.1.1
docker==6.1.3
docx==0.2.4
et-xmlfile==1.1.0
exceptiongroup==1.2.1
executing==2.0.1
ezdxf==1.3.0
fonttools==4.47.0
func-timeout==4.3.5
future==0.18.3
gmsh==4.12.0
grapheme==0.6.0
grpcio==1.64.0
grpcio-health-checking==1.48.2
idna==3.6
importlib_metadata==7.1.0
ipykernel==6.29.4
ipython==8.24.0
jedi==0.19.1
joblib==1.3.2
jupyter_client==8.6.2
jupyter_core==5.7.2
kiwisolver==1.4.5
lxml==4.9.4
markdown-it-py==3.0.0
matplotlib==3.8.2
matplotlib-inline==0.1.7
mdurl==0.1.2
meshio==5.3.4
mpmath==1.3.0
multimethod==1.9.1
nest-asyncio==1.6.0
nlopt==2.7.1
nptyping==2.0.1
ntplib==0.4.0
numpy==1.23.4
openpyxl==3.1.2
packaging==23.2
pandas==1.5.3
parso==0.8.4
path==16.14.0
Pebble==5.0.6
Pillow==10.1.0
Pint==0.23
platformdirs==3.11.0
pooch==1.8.1
prompt-toolkit==3.0.43
protobuf==3.20.3
psutil==5.9.7
PsychroLib==2.5.0
pure-eval==0.2.2
pycparser==2.22
pycryptodome==3.19.1
pyerfa==2.0.1.4
Pygments==2.17.2
pygmsh==7.1.17
pymoo==0.5.0
pyparsing==3.1.1
pyperclip==1.8.2
pyqtdarktheme==2.1.0
PySide2==5.15.2.1
python-dateutil==2.8.2
pytz==2023.3.post1
pyvista==0.43.8
pywin32==306
PyYAML==6.0.1
pyzmq==26.0.3
requests==2.31.0
rich==13.7.0
scikit-learn==1.3.2
scipy==1.11.4
scooby==0.10.0
semver==3.0.2
shiboken2==5.15.2.1
six==1.16.0
spyder-kernels==2.5.1
stack-data==0.6.3
sympy==1.12
threadpoolctl==3.2.0
tornado==6.4
tqdm==4.66.4
traitlets==5.14.3
trimesh==4.4.0
typing_extensions==4.11.0
typish==1.9.3
tzdata==2023.4
urllib3==2.1.0
vtk==9.3.0
wcwidth==0.2.13
websocket-client==1.8.0
WMI==1.5.1
XlsxWriter==3.1.9
zipp==3.18.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprove any current implemented feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions