Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing surfaces\elements in the field result exports. #5317

Open
2 tasks done
chamanth-vct opened this issue Oct 21, 2024 · 0 comments
Open
2 tasks done

Missing surfaces\elements in the field result exports. #5317

chamanth-vct opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chamanth-vct
Copy link

Before submitting the issue

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

Description of the bug

When exporting field results for conductors, the generated .case file does not contain the complete mesh — certain surfaces of the conductor are missing. However, when exporting the mesh plot, the entire structure appears correctly, as shown in the image below.
image

In the above image:

  • Left Side: Mesh in the exported case file for Mesh Plot (full structure visible)
  • Right Side: Mesh in the exported H Vector Plot (some surfaces\elements missing)

Additional Observation:

This behavior is consistent even when visualizing the Mesh Plot and the H Vector plot from AEDT GUI as shown in the below image.

image

Steps To Reproduce

The following code demonstrates the issue:

  1. Export both the H Vector plot and Mesh Plot for all parts (objects).
  2. Load the individual .case files into PyVista and compare the meshes.
  3. If the meshes do not match, visualize them to confirm the missing surfaces.
import ansys.aedt.core 
from pathlib import Path
import pyvista as pv

folder_path = Path(r"C:\Users\chamanth\Downloads\testing_error")
file_path =  folder_path.joinpath("Project3.aedt")     

exports_folder_path = folder_path.joinpath("exports_folder")
exports_folder_path.mkdir(parents=True,exist_ok=True)

mesh_folder = exports_folder_path.joinpath("mesh_folder")
mesh_folder.mkdir(parents=True,exist_ok=True)

result_folder = exports_folder_path.joinpath("result_folder")
result_folder.mkdir(parents=True,exist_ok=True)

desktop = ansys.aedt.core.Desktop() 
prj= desktop.load_project(file_path.__str__())
model = prj.modeler
part_names = model.object_names
post = prj.post  # post_processor

for name in part_names:
    obj =  model.get_object_from_name(name)

    #################### Export Mesh Plot #######################

    if obj.solve_inside:       # check for solve_inside
        mesh_plot = post.create_fieldplot_volume([name],quantity="Mesh",
                                                 plot_name="Mesh_plot")
    else:
        mesh_plot = post.create_fieldplot_surface(obj.faces,quantity="Mesh",
                                                  plot_name="Mesh_plot",
                                                  intrinsics=prj.setups[0].default_intrinsics)
    
    print(f"Exporting Mesh and H_Vector for: {name}")

    mesh_file_name = mesh_folder.joinpath(name+'_mesh')
    export_status = post.export_field_plot(plot_name = "Mesh_plot",
                            output_dir = exports_folder_path,
                            file_name = mesh_file_name.__str__(),
                            file_format = 'case')

    if export_status:
            print(f"\tExported Mesh")
    else:
        print(f"\tNot Exported Mesh")
    
    mesh_plot.delete()

    #################### Export H Vector #######################
    if obj.solve_inside:
        h_field_plot = post.create_fieldplot_volume([name],quantity="Vector_H",
                                                    plot_name="H_vector_plot")
    else:
        h_field_plot = post.create_fieldplot_surface(obj.faces,quantity="Vector_H",
                                                     plot_name="H_vector_plot",
                                                     intrinsics=prj.setups[0].default_intrinsics)


    result_file_name = result_folder.joinpath(name+'_h_vector')
    export_status = post.export_field_plot(plot_name = "H_vector_plot",
                            output_dir = exports_folder_path,
                            file_name = result_file_name.__str__(),
                            file_format = 'case')
    if export_status:
        print(f"\tExported H_Vector")
    else:
        print(f"\tNot Exported H_Vector")

    h_field_plot.delete()

desktop.close_desktop()

#part_names = ['Ground','Pin','Dielectric','Cylinder6','L1','D1','G1','signal_via__38V','L1_line_PG1','Region']

### Compare Mesh file and Result file for each object

for name in part_names:
    mesh_file_name = mesh_folder.joinpath(name+'_mesh.case')
    result_file_name = result_folder.joinpath(name+'_h_vector.case')

    print(f"Comparing Mesh Plot file and H Vector Plot file for: {name}")

    mesh = pv.read(mesh_file_name)
    result = pv.read(result_file_name)

    if mesh[0].number_of_cells == result[0].number_of_cells:
        print("\t Matching")
    else:
        print("\t Not matching")
        p = pv.Plotter(shape=(1, 2))
        p.add_mesh(mesh[0],show_edges=True)
        p.add_axes()
        p.add_title("Mesh Plot",font_size=16)
        p.add_text(f"No of Cells: {mesh[0].number_of_cells}",position='lower_left',font_size=12)


        p.subplot(0,1)
        p.add_mesh(result[0],show_edges=True)
        p.add_axes()
        p.add_title("H Vector Plot",font_size=16)
        p.add_text(f"No of Cells: {result[0].number_of_cells}",position='lower_left',font_size=12)
    
        p.show(title=name)

Notes

  • The sample file can be downloaded from this link.
  • From my experience, this discrepancy occurs only for objects where solve_inside is off.

Any insights or suggestions to resolve this issue would be greatly appreciated.

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

annotated-types==0.7.0
ansys-pythonnet==3.1.0rc3
asttokens==2.4.1
attrs==24.2.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.3.2
clr-loader==0.2.6
colorama==0.4.6
comm==0.2.2
contourpy==1.3.0
cycler==0.12.1
debugpy==1.8.5
decorator==5.1.1
defusedxml==0.7.1
exceptiongroup==1.2.2
executing==2.1.0
fonttools==4.53.1
fpdf2==2.7.9
idna==3.10
ipykernel==6.29.5
ipython==8.27.0
jedi==0.19.1
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_client==8.6.3
jupyter_core==5.7.2
kiwisolver==1.4.7
matplotlib==3.9.2
matplotlib-inline==0.1.7
nest-asyncio==1.6.0
numpy==1.26.4
packaging==24.1
pandas==2.2.2
parso==0.8.4
pillow==10.4.0
platformdirs==4.3.6
plumbum==1.8.3
pooch==1.8.2
prompt_toolkit==3.0.47
psutil==6.0.0
pure_eval==0.2.3
pyaedt==0.10.2
pycparser==2.22
pydantic==2.9.2
pydantic_core==2.23.4
pyedb==0.28.0
Pygments==2.18.0
pyparsing==3.1.4
python-dateutil==2.9.0.post0
pytomlpp==1.0.13
pytz==2024.2
pyvista==0.44.1
pywin32==306
PyYAML==6.0.2
pyzmq==26.2.0
referencing==0.35.1
requests==2.32.3
rpds-py==0.20.0
rpyc==6.0.0
Rtree==1.3.0
scikit-rf==1.3.0
scipy==1.14.1
scooby==0.10.0
six==1.16.0
stack-data==0.6.3
toml==0.10.2
tornado==6.4.1
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.3
vtk==9.3.1
wcwidth==0.2.13

@chamanth-vct chamanth-vct added the bug Something isn't working label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant