ansys / pydpf-core

Data Processing Framework - Python Core
http://dpf.docs.pyansys.com/
MIT License
68 stars 25 forks source link

PyAnsys-dpf-core issue in reading binout energy plots #1887

Open ybavge opened 1 week ago

ybavge commented 1 week ago

Before submitting the issue

Description of the bug

I am currently exploring PyDPF capabilities for ls-dyna results postprocessing. I have faced issue while extracting energy plots from LSDyna d3plot/binout. (As d3plot size is quiet large I will not attach to bug) Internal energy, kinetic energy, total energy extraction using PYDPF is not correct (compared to LS-Prepost). Image I had a closer look by writing file in .CSV , pydpf time frequency column is inconsistent in order. Image

Steps To Reproduce

Extract the energy plots using following code : from ansys.dpf import core as dpf import matplotlib.pyplot as plt import os

serve config

server = dpf.start_local_server(ansys_path=r"D:\PyANSYS\dpf_Server_25R1_pre0\ansys_dpf_server_win_v2025.1.pre0\ansys\dpf\server_2025_1_pre0") ds=dpf.DataSources() print(dpf.SERVER.version)

User inputs needed

d3plot_dir = r"D:\Magna_iDS\LS_Dyna_Models\A05_updated\CF_study\Final_A05_DOE\Design0005_3c44fde4f8d311ee90230050568b68ba" State_ID = 250 Part_ID_list = list(range(1,15)) + list(range(2000001,2000007))

dpf setup

d3plot_file = os.path.join(d3plot_dir,"d3plot") binout_file = os.path.join(d3plot_dir, "binout") ds=dpf.DataSources() ds.set_result_file_path(d3plot_file,"d3plot") ds.set_result_file_path(binout_file, "binout") model=dpf.Model(ds)

print(model)

get length of transient data

tf = model.metadata.time_freq_support.time_frequencies.data no_of_states = len(tf)

Check energy balance and sliding interface energy

SE = model.results.global_sliding_interface_energy().eval() IE = model.results.global_internal_energy().eval() KE = model.results.global_kinetic_energy().eval() TE = model.results.global_total_energy().eval()

plt.plot(SE.time_freq_support.time_frequencies.data, SE[0].data)

plt.plot(IE.time_freq_support.time_frequencies.data, IE[0].data)

print(IE.time_freq_support.time_frequencies.data)

print(IE[0].data)

plt.plot(KE.time_freq_support.time_frequencies.data, KE[0].data)

plt.plot(TE.time_freq_support.time_frequencies.data, TE[0].data)

plt.show()

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

DPF Server 2025.1.pre0

Which Python version causes the issue?

3.11

Installed packages

(pydpfvenv1) D:\PyANSYS\sample_workflow>C:\Users\ybavge.ansys_python_venvs\venv_pydpf_171024\Scripts\pip list Package Version


aiohappyeyeballs 2.4.3 aiohttp 3.10.10 aiosignal 1.3.1 ansys-api-mechanical 0.1.2 ansys-api-platform-instancemanagement 1.1.0 ansys-dpf-core 0.12.1 ansys-mechanical-core 0.11.8 ansys-mechanical-env 0.1.8 ansys-platform-instancemanagement 1.1.2 ansys-pythonnet 3.1.0rc3 ansys-tools-path 0.6.0 ansys-tools-visualization-interface 0.4.5 appdirs 1.4.4 attrs 24.2.0 beartype 0.19.0 cachetools 5.5.0 certifi 2024.8.30 cffi 1.17.1 charset-normalizer 3.4.0 click 8.1.7 clr-loader 0.2.6 colorama 0.4.6 contourpy 1.3.0 cycler 0.12.1 fonttools 4.54.1 frozenlist 1.4.1 google-api-core 2.21.0 google-api-python-client 2.149.0 google-auth 2.35.0 google-auth-httplib2 0.2.0 googleapis-common-protos 1.65.0 grpcio 1.67.0 httplib2 0.22.0 idna 3.10 imageio 2.36.0 importlib_metadata 8.5.0 kiwisolver 1.4.7 matplotlib 3.9.2 more-itertools 10.5.0 msgpack 1.1.0 multidict 6.1.0 numpy 2.1.2 packaging 24.1 pillow 11.0.0 pip 24.0 platformdirs 4.3.6 pooch 1.8.2 propcache 0.2.0 proto-plus 1.24.0 protobuf 5.28.2 psutil 6.0.0 pyasn1 0.6.1 pyasn1_modules 0.4.1 pycparser 2.22 pyparsing 3.2.0 python-dateutil 2.9.0.post0 pyvista 0.44.1 requests 2.32.3 rsa 4.9 scooby 0.10.0 setuptools 65.5.0 six 1.16.0 tqdm 4.66.5 trame 3.7.0 trame-client 3.4.0 trame-server 3.2.3 trame-vtk 2.8.11 trame-vuetify 2.7.1 typing_extensions 4.12.2 uritemplate 4.1.1 urllib3 2.2.3 usd-core 24.8 vtk 9.3.1 websockets 13.1 wslink 2.2.1 yarl 1.15.5 zipp 3.20.2

ybavge commented 1 week ago

@ayush-kumar-423 Let me know if you need more inputs from my end. Thanks

ayush-kumar-423 commented 1 week ago

@PProfizi