-
Hello, I am translating some of my APDL code to PyMAPDL and am struggling with the part where I need to define a function. I use that function to apply temperature on all nodes in my meshed geometry with the function t = 10*X. So each node has a temperature equivalent to 10 times the X position. What I did in APDL at the end was:
The thing is that ANSYS does some tabular representation of this rather simple function which I don't understand at all. This is from session editor:
I just copied that part in APDL and it worked but I would really like something cleaner now when writing it in PyMAPDL. What is even going on here, why is the table 6,3,1. Appreciate help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @ememe123 Why not instead build your own table and use a loop to fill out values based on the equation. You could start by *VGET to get the X location of each node, then *TOPER to fill the second column with 10x the first columns values. Mike |
Beta Was this translation helpful? Give feedback.
-
Hi @ememe123 If I were you I would be a bit more pythonic... For instance: mapdl.nsel(..) # Select the nodes you want
def apply_temp(node_id):
x = mapdl.get_value("node", node_id, "loc", "x")
# apply temp
mapdl.d(node_id, "temp", 10*x)
for each_node in mapdl.mesh.nodes:
apply_temp(each_node) Please double check the above code, because I'm writing from the top of my head. But I think you get the point. |
Beta Was this translation helpful? Give feedback.
Hi @ememe123
That function tool is really only meant to be used in Mechanical APDL in interactive mode. The commands you show are how MAPDL stores the function and is not meant to be read/edited by a human....well, at least not easily readable.
Why not instead build your own table and use a loop to fill out values based on the equation. You could start by *VGET to get the X location of each node, then *TOPER to fill the second column with 10x the first columns values.
Mike