ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
421 stars 119 forks source link

Difference between line numbers in APDL and mapdl.lplot() #1249

Closed natter1 closed 11 months ago

natter1 commented 2 years ago

Describe the bug Line numbers shown via mapdl.lplot() differ from the internal APDL numbers.

grafik

As shown above, for L11 and L19 the numbers in the PyMAPDL plot are the same, but the other lines are shifted by 1.

To Reproduce Steps to reproduce the behavior:

import numpy as np
from ansys.mapdl.core import launch_mapdl

beam_thickness = 20  # [µm]
beam_length = 1450
beam_width = 400
base_width = 8000
base_height = 2000
base_inlay = 100
deltabeam_xoffset = 1680
deltabeam_width = 740
deltabeam_angle = 58.7466 * (np.pi / 180)
deltabeam_outer_end_x = deltabeam_xoffset - beam_length / np.tan(deltabeam_angle)
tip_part1_width = 1080
mass_thickness = 600

mapdl = launch_mapdl()
mapdl.clear()
mapdl.prep7()

kps_x = [0, deltabeam_outer_end_x - deltabeam_width,
         beam_width / 2,
         tip_part1_width / 2,
         deltabeam_outer_end_x,
         beam_width / 2 + deltabeam_width,
         deltabeam_xoffset - deltabeam_width,
         deltabeam_xoffset,
         base_width / 2
         ]
kps_y = [-base_height, -base_inlay, 0]
kps_z = [0, -beam_thickness, -mass_thickness]

x_indices = [2, 6, 7, 8]
y_indices = [0, 1, 2]
z_indices = [0, 1, 2]
base_kps = []
for iz in z_indices:
    base_kps.append([])
    for iy in y_indices:
        for ix in x_indices[::-1]:
            base_kps[iz].append(mapdl.k("", -kps_x[ix], kps_y[iy], kps_z[iz]))
        for ix in x_indices:
            base_kps[iz].append(mapdl.k("", kps_x[ix], kps_y[iy], kps_z[iz]))

x_nodes = 8
y_nodes = 3
kps = base_kps
for iy in range(y_nodes - 1):
    for ix in range(iy * x_nodes, iy * x_nodes + x_nodes - 1):
        for iz in range(len(kps) - 1):
            kp_list = kps[iz][ix], kps[iz][ix + 1], kps[iz][ix + x_nodes + 1], kps[iz][ix + x_nodes], \
                      kps[iz + 1][ix], kps[iz + 1][ix + 1], kps[iz + 1][ix + x_nodes + 1], kps[iz + 1][
                          ix + x_nodes]
            mapdl.v(*kp_list)

mapdl.lplot()
mapdl.open_gui()

Expected behavior Line numbers should be identical.

System Information:

Run a PyMAPDL report

-------------------------------------------------------------------------------
PyMAPDL Software and Environment Report
-------------------------------------------------------------------------------
  Date: Mon Jul 04 17:42:00 2022 Mitteleuropäische Sommerzeit

                OS : Windows
            CPU(s) : 12
           Machine : AMD64
      Architecture : 64bit
       Environment : Python
NVIDIA Corporation : GPU Vendor
Quadro 2000/PCIe/SSE2 : GPU Renderer
4.5.0 NVIDIA 353.30 : GPU Version

  Python 3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit
  (AMD64)]

  ansys.mapdl.core : 0.62.1
             numpy : 1.22.4
           appdirs : 1.4.4
             scipy : 1.8.1
              grpc : 1.46.3
ansys.api.mapdl.v0 : Version unknown
ansys.mapdl.reader : 0.51.14
   google.protobuf : 3.20.1
        matplotlib : 3.5.2
           pyvista : 0.34.1
            pyiges : 0.2.1
              tqdm : 4.64.0
-------------------------------------------------------------------------------

Ansys Installation
******************
Version   Location
------------------
221       C:\Program Files\ANSYS Inc\v221

Ansys Environment Variables
***************************
ANSYS194_DIR                   C:\Program Files\ANSYS Inc\v194\ANSYS
ANSYS221_DIR                   C:\Program Files\ANSYS Inc\v221\ANSYS
ANSYS_SYSDIR                   winx64
ANSYS_SYSDIR32                 win32
AWP_LOCALE221                  de
AWP_ROOT221                    C:\Program Files\ANSYS Inc\v221
CADOE_LIBDIR221                C:\Program Files\ANSYS Inc\v221\CommonFiles\Language\de

Process finished with exit code 0
germa89 commented 11 months ago

This has been fixed with the recent changes in geometry module. Please update to v0.65.1 at least.