Can someone help me with an UDF for a rotatory mesh?
1 Attachment(s)
Hello, I am trying to create a code to this geometry, as you can see at the images it is a simple geometry, it is a pipe with 2 bodies rotating inside, so far I have been reading the UDF manual, and I made a code I would like to make some questions but first here is the code:
#include "udf.h" DEFINE_CG_MOTION(Rotation,dt,vel,omega,time,dtime) { Thread *t; face_t f; /*reset velocities*/ NV_S(vel, =, 0.0); NV_S(omega, =, 0.0); /*not too sure what this is for*/ if (!Data_Valid_P()) return; /*get the thread pointer for which this motion is defines (I assume that this is the cell zone that I made)*/ t = DT_THREAD(dt); /* motion */ velocity[0] = 0; velocity[1] = 0; velocity[2] = 0; omega[0] = 0; omega[1] = 0; /*This will be just a random number, I will try different values anyway*/ omega[2] = 120; /*not sure how to do the loop and if I should make the loop for faces or cells*/ } Question 1: Do I have to create a UDF for each body? Or can I include both bodies at the same UDF? Question 2: Well as you can see at the code, I am not quite sure of how to make the loop (I have a decent programming knowledge, and because of this forced to learn C, I know how to create a loop, but I do not know what variables to include for the loop, so far I know the pointer will tell the program to use some faces/cells and that leads me to my other question) Question 3: Should I use faces or cells for the Loop? Question 4: There is something that I am missing? I read just the first 2 chapters of the UDF guide, I will finish all the guide soon, but I think that the next chapters will not clear those doubts. Thanks |
I would like to know if I should use the cells or the faces, so far I understand that I should use the faces because that will make the adjacent cells to move as well and that is what I am looking for
|
All times are GMT -4. The time now is 21:36. |