-
Notifications
You must be signed in to change notification settings - Fork 20
Description
📝 Description of the example
Node sets in bndout
As a user, I needed to learn the relation between a given input deck (in particular, its node sets) and the output present in the bndout ascii file, accessed through LS Pre Post.
For that, I created with Copilot a "mini, boilerplate" python API which helped me be certain about it ( "lsdyna_bndout_learner.zip" attached below). The set1_vs_set2_comparison_analysis.py summarizes the use case.
The value it brings to the user is relating the node set entities in the input deck (*SET_NODE_LIST kwds.) with the contents of the bndout file. A link which doesn't exist out of the box (afaik, only the nodes are present there; any insights about it are welcomed :) ). In fact, if the bndout is imported to LS-PrePost as ascii file, the node sets don't appear there either (screenshot below)
*SET_NODE_LIST
1
4801 4802 4803 4804 4805 4806 4807 4808
4809 4810 4811 4812 4813 4814 4815 4816
4817 4818 4819 4820 4821 4822 4823 4824
ls-dyna smp s R16 R16.1.1_20_0c90ca date 10/01/2025
n o d a l f o r c e/e n e r g y o u t p u t t= 1.89373E-06
discrete nodal point forces
nd# 4681 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4682 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4683 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4684 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4685 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4686 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
nd# 4687 xforce= 0.0000E+00 yforce= 0.0000E+00 zforce= 0.0000E+00 energy= 0.0000E+00
Bringing that need to PyDyna
For instance, in PyDyna I could only find deck.get_kwds_by_type, whereas in the boilerplate API, there was a get_node_set_by_id available.
node_sets = list(deck.get_kwds_by_type("SET")) ## pydyna
node_set = parser.get_node_set_by_id(set_id) ## lsdyna_parserI'd like to incorporate some of the boilerplate API concepts to PyDyna, as they can be useful for somebody else. For that, I used AI to create a _pydyna.py flavour of the script, which outputs the same results. In it, I missed mainly two features
- a) The concept of "set". I think at least a refinement of the
class Deckcould work for that. See feat: add Deck.get_set_by_id() and extend get_kwds_by_full_type() #1066 - b) Linking "sets" to concepts like "boundary conditions", as per Add ability for keywords to point to each other #599
- c) Loading and handling of the
bndoutfile and its contents.
b) and c) area surely more complex tasks, and I am basically using this issue to jumpstart my contributions to this repo, in alignment with them. Please don't hesitate to raise any concerns regarding these ideas.
Specifically, I believe I must check the PyDPF-Post project, because the necessary contributions will likely belong there. Also, I'd like to explore bringing some of the concepts in PyMechanical as well.
📁 Files needed for running the example
lsdyna_bndout_learner.zip
pip install -r requirements.txtOr install manually:
pip install pandas numpy matplotlib ipykernel pytest pyyamlFiles
.
├── lsdyna_parser.py # Input file parsing module
├── bndout_parser.py # Results file parsing module
├── lsdyna_postprocessor.py # Integrated post-processor
├── example_postprocess.py # Example standalone script
├── example_bndout_analysis.ipynb # Interactive notebook
├── requirements.txt # Python dependencies
└── README.md # This file
Usage
Quick Start - Complete Example
The easiest way to get started is to run the complete example script:
python set1_vs_set2_comparison_analysis.py...
💻 Which operating system are you using?
Windows
📀 Which ANSYS version are you using?
ANSYS 2025 R2, Ansys LS-DYNA, LS-PrePost
🐍 Which Python version are you using?
3.10
📦 Installed packages
pandas
numpy
matplotlib
ansys-dyna-core