Dear STKO,
I am currently trying to export nodal displacement time history to a text file.
I am able to do so by going over the displacement at each time step following the Python API tutorials provided.
My question is:
Is it possible to access the entire displacement time-history for a single node at once?
I have over 9000 time-steps and 30 nodes, therefore going step by step in a 'for loop' becomes a very lengthy process
I have attached my code for reference.
Thank you for your help.
Export Nodal results time history via Python API
Export Nodal results time history via Python API
- Attachments
-
- Extract_Nodal_Results.zip
- (1.79 KiB) Downloaded 241 times
Re: Export Nodal results time history via Python API
Try this:
I fixed an error in the indexing. The step_id is not necessarily 1-based (it depends on how many stages you have).
I used the zip command to iterate over the step_id and the step_time at the same time:
To speed up the process I made a reduced mesh containing only the nodes you need to extract.
It will reduce the size of the dataset of each evaluation:
Let me know the speed-up you get. I tried it on a small model and it already gave a 20x speed-up
I used the zip command to iterate over the step_id and the step_time at the same time:
Code: Select all
for step_id, step_time in zip(all_steps, all_times): #Loop for timesepIt will reduce the size of the dataset of each evaluation:
Code: Select all
# make a fake mesh with only the required nodes
# 1. do a first evaluation to get the real mesh
# 2. from the real mesh get the requested nodes and copy them into the reduced mesh
# 3. save the reduced mesh in the evaluation options
opt.step = all_steps[0]
field = Disp.evaluate(opt)
reduced_mesh = MpcMesh()
for i in NODES:
inode = field.mesh.getNode(i)
reduced_mesh.addNode(inode)
opt.mesh = reduced_mesh
Re: Export Nodal results time history via Python API
Reducing the mesh for each evaluation worked perfectly!
It was able to speed up the process by 20x
Thank you very much for your help.
Andres R
It was able to speed up the process by 20x
Thank you very much for your help.
Andres R
Re: Export Nodal results time history via Python API
You're welcome. And the speed up will be greater as the ratio total_number_of_nodes/required_number_of_nodes increases (i.e. for large models the speed up is larger)