Read data from txt with apdl commands inserted in tree
Hello everyone!
I'm working in workbench mechanical (2022r2) in a coupled field module. I want to insert apdl commands in the tree to read a table and interpolate to get some results.
I have a file (txt with values separated by comma)with element ids and for each element i have temperature and two parameters defined. Separately i have a 3D table with a result(val) based on temperature and the two parameters. !
So in the table the value is defined as val1(param1,param2,temp).
How can i read my file and interpolate on the table with apdl commands inserted in the tree? I am new to apdl.
Is there a way to do this with mechanical scripting?
/PREP7
*DEL, model, , NOPR
*DIM, model, TABLE, 50, 20, 40
*TREAD, model, 'Model', 'table'
/INQUIRE,numlines,LINES,'test_complete','txt'
*DEL,mytable,,NOPR
*DIM,mytable,TABLE,numlines,4 !
*DEL, final_val, , nopr
*DIM, final_val, TABLE, numlines,1
*TREAD,mytable,'test_complete','txt','',,
*STATUS,mytable
*VITRP, final_val(1,1), model, mytable(3,2,), mytable(2,2,), mytable(4,2,)
FINISH
/SOLU
this is what i used. i know it's not defined properly but i can't figure out how to define it.
Any help is much appreciated!
A nice day to everyone
Answers
-
Depending on what you want to do with the data you could also consider a pythonic way of interpolating multi-dimensional data. This is via scipy, which would require C-Python implementation for your python code object.
0 -
@Mike.Thompson said:
Depending on what you want to do with the data you could also consider a pythonic way of interpolating multi-dimensional data. This is via scipy, which would require C-Python implementation for your python code object.I'm already working in ironpython to fully automatize my simulation. I know i can add commands from script to the tree. That's why i was interested in apdl commands or a way to interpolate with ironpython scripts. After interpolation i just want to write the values back to a txt file
0