CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Can someone help me with an UDF for a rotatory mesh? (http://www.cfd-online.com/Forums/fluent-udf/121638-can-someone-help-me-udf-rotatory-mesh.html)

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)
{
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)*/

/* 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