CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF to obtain and store node number (https://www.cfd-online.com/Forums/fluent-udf/225265-udf-obtain-store-node-number.html)

Shiv1510 March 20, 2020 12:43

UDF to obtain and store node number
 
Hello everyone,

I am trying to write an UDF to store x,y,z and node number of a 3D geometry/mesh at 1st time step. Later I want to refer the same node number and positions (at first time step) to calculate new positions of nodes in further time step. I am using DEFINE_GRID_MOTION macro to move my nodes. Is it possible to obtain the node number at any time step? If yes how can I store it in an array ?

vinerm March 20, 2020 14:39

Define_grid_motion
 
Grid motion macro will anyway provide you with access to each Node. Why would you want to save the node numbers in array? Do note that these numbers will change if you use deforming mesh.

Shiv1510 March 20, 2020 15:24

Quote:

Originally Posted by vinerm (Post 762313)
Grid motion macro will anyway provide you with access to each Node. Why would you want to save the node numbers in array? Do note that these numbers will change if you use deforming mesh.

Hi Vinerm,

Thank you for your interest in my problem. I am moving the nodes in a certain fashion that requires the coordinates of that particular node from t=0. Hence I was thinking to put a marker to each node at t=0 that can be referred back at each time step for t>0. So I thought that node number would be a good option. But if you can guide me to a better idea I would be glad as I have been on this problem for quite a while and I am stuck.

vinerm March 20, 2020 16:40

Nodes and Memory
 
You can try by assuming that the nodes keep their number but I am doubtful of that if there is remeshing. The other option is UDM for nodes. Just like UDMs for cells and faces, nodes have their own UDMs where you can store whatever you want, such as, a marker. Even with UDMs, if the mesh deforms and is remeshed, nodes will be lost and along with that their UDM value will be lost as well.

Shiv1510 March 20, 2020 21:52

2 Attachment(s)
Yes you are write and this actually fails what I am trying to do. However, full disclosure here is my actual problem, so please share if you have any advice on this:

I am trying to write an UDF to deform and perform undulating motion on a 3D cylinder, so it can move like an eel. The picture of the cylinder is attached. I do have the equation of motion along the centerline. I have also figured the motion for a 2D case (picture attached), however to apply the logic in 3D case I need to figure out the y-coordinate of each node at t=0. Because the equation to position the nodes at each time step is different for nodes which had positive y value at t=0 and negative y value at t=0, hence I was trying to store the node number to refer the nodes but it seems like this wont work. Please share if you have any ideas and let me know if my problem was understandable.

vinerm March 21, 2020 05:41

Equation of Motion
 
In my view, you do not need to store the position coordinates or node numbers. You have to look at the equation of motion that you are using. I doubt that the equation would predict the movement based on the nodes' initial position. Most likely, it would be incremental, i.e., the next position would be dependent on the current position and not on the initial position. If it is dependent on the current position, you can fetch the current position of node, then update the position based on the equation. In case the equation determines the position on the basis of original position, it would be better to transform the equation so that the motion is dependent on current position. Another option is to store original y-coordinate values in UDM. But as mentioned before, this would work as long as the remeshing is not done.

yuezhuo November 27, 2023 21:36

May I ask if you have solved this problem, I had a similar problem


All times are GMT -4. The time now is 02:39.