Skip to content

Bug located in post.load_simulation for Extraction of EQV(elastic_strain_eqv_von_mises_nodal) #372

Open
@Tony-ooo

Description

@Tony-ooo

Before submitting the issue

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

Description of the bug

When I use "post.load_simulation" to extract EQV (elastic_strain_eqv_von_mises_nodal), I noticed that the length of data in the EQV result field is less than the number of mesh nodes, which makes it impossible for me to extract complete data. Especially when there are many triangular meshes, I suspect this is one of the reasons for the errors. Meanwhile, when I extracted SEQV(stress_eqv_von_mises_nodal) from the same file of "file.rst", the error did not occur.

Steps To Reproduce

Note that I am using ANSYS 2023R1.
The code I use is as follows:

from ansys.mapdl import reader as pymapdl_reader
import numpy as np
from ansys.dpf import post

rstfile = 'file.rst'
datfile = 'ds.dat'

simulation = post.StaticMechanicalSimulation(rstfile)

rst = pymapdl_reader.read_binary(rstfile)
dat = pymapdl_reader.Archive(datfile)

maxstep = rst.n_results
step = np.arange(0,maxstep,1)
nnum = dat.nnum
coordinates=dat.nodes
coordinates = np.hstack((nnum.reshape([-1, 1]), coordinates))

for substep in step:

    # ---------------------------------------------------------------
    # Extraction of EQV is not working !!!
    elastic_strain_eqv_von_mises_nodal = simulation.elastic_strain_eqv_von_mises_nodal(node_ids=nnum, set_ids=int(substep+1))

    node_ids = elastic_strain_eqv_von_mises_nodal._fc[0].scoping.ids
    EVM = elastic_strain_eqv_von_mises_nodal._fc[0].data
    middle_to_remove = np.arange(EVM.shape[0])[((np.arange(EVM.shape[0])+1) % 3 == 0)]
    EVM = np.delete(EVM, middle_to_remove, axis=0)
    node_ids = np.asarray([x for i in node_ids for x in [i] * 2]).reshape([-1, 1])
    coordinates_ = np.asarray([x for i in coordinates for x in [i] * 2])
    EVM = np.hstack((node_ids,EVM.reshape([-1,1])))
    EVM = np.asarray(sorted(EVM, key=lambda x: x[0]))
    EVM = np.hstack((coordinates_,EVM[:,1:2]))

    EVM_filename = 'EVM{}.csv'.format(substep + 1)
    fmt = ['%d'] + ['%.18f'] * 3 + ['%.18e']
    header = 'Node,X,Y,Z,' + 'EVM'
    np.savetxt(EVM_filename, EVM, delimiter=',',comments='',fmt=fmt,header=header)

Enclosed is a minimum working example result file that I have compressed into a zip archive. Kindly do your best to address this issue.
post_error_example.zip

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

Installed packages

absl-py==1.4.0
ansys-dpf-core==0.8.0
ansys-dpf-gate==0.3.1
ansys-dpf-gatebin==0.3.1
ansys-dpf-post==0.4.0
ansys-grpc-dpf==0.7.1
ansys-mapdl-reader==0.52.11
appdirs==1.4.4
astunparse==1.6.3
Bottleneck==1.3.5
cachetools==5.3.0
certifi==2022.12.7
charset-normalizer==3.1.0
colorama==0.4.6
contourpy==1.0.7
cycler==0.11.0
et-xmlfile==1.1.0
flatbuffers==2.0.7
fonttools==4.39.3
gast==0.4.0
google-api-core==2.11.0
google-api-python-client==2.83.0
google-auth==2.17.2
google-auth-httplib2==0.1.0
google-auth-oauthlib==1.0.0
google-pasta==0.2.0
googleapis-common-protos==1.59.0
grpcio==1.53.0
h5py==3.8.0
httplib2==0.22.0
idna==3.4
imageio==2.27.0
importlib-metadata==6.1.0
importlib-resources==5.12.0
joblib==1.2.0
keras==2.7.0
Keras-Preprocessing==1.1.2
kiwisolver==1.4.4
libclang==16.0.0
Markdown==3.4.3
MarkupSafe==2.1.2
matplotlib==3.7.1
mkl-fft==1.3.1
mkl-random==1.2.2
mkl-service==2.4.0
numexpr==2.8.4
numpy==1.24.2
oauthlib==3.2.2
openpyxl==3.1.2
opt-einsum==3.3.0
packaging==23.0
pandas==1.5.3
Pillow==9.5.0
pip==23.0.1
platformdirs==3.2.0
pooch==1.7.0
protobuf==4.22.1
psutil==5.9.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.9
python-dateutil==2.8.2
pytz==2022.7
pyvista==0.38.5
requests==2.28.2
requests-oauthlib==1.3.1
rsa==4.9
scikit-learn==1.2.2
scipy==1.10.1
scooby==0.7.1
setuptools==67.6.1
six==1.16.0
tensorboard==2.12.1
tensorboard-data-server==0.7.0
tensorboard-plugin-wit==1.8.1
tensorflow-estimator==2.7.0
tensorflow-gpu==2.7.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==2.2.0
threadpoolctl==3.1.0
tqdm==4.65.0
typing_extensions==4.5.0
uritemplate==4.1.1
urllib3==1.26.15
vtk==9.2.6
Werkzeug==2.2.3
wheel==0.40.0
wincertstore==0.2
wrapt==1.15.0
zipp==3.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions