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/)
-   -   Motion with DEFINE_GRID_MOTION (https://www.cfd-online.com/Forums/fluent-udf/215773-motion-define_grid_motion.html)

LeftCoefficient March 16, 2019 07:07

Motion with DEFINE_GRID_MOTION
 
Hi! I'm trying to define the motion of a thread with DEFINE_GRID_MOTION. The movement of the wall is sinusoidal, and this occurs around a point of equilibrium. Then I need to save de initial coordinates of my thread to use them en the loop in order to update the position of the wall correctly.

Could any one help me?? :confused:

This is my UDF:

DEFINE_GRID_MOTION(Expansion, domain, dt, time, dtime)
{
Thread *tf = DT_THREAD((Dynamic_Thread *)dt);
face_t f;
Node *v;
real displ;
real NV_VEC(axis);
real NV_VEC(posinit);
real NV_VEC(posupdate);
real A[ND_ND]; /* face area normal vector */
real AMag; /* face area magnitude */
int n;

SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

begin_f_loop(f, tf)

{

f_node_loop(f,tf,n)
{

F_AREA(A,f,tf); /*A is a vector, f face index, t thread index */
AMag=NV_MAG(A); /* Face normal vector magnitude*/
A[0]=A[0]/AMag; /* Componente en X del vector unitario */
A[1]=A[1]/AMag; /* Componente en Y del vector unitario */
NV_D(axis, =, A[0], A[1]);

v=F_NODE(f,tf,n);

if (NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);
displ=0.001*cos(2*M_PI*freq*CURRENT_TIME);
NV_V_VS(NODE_COORD(v), =, posinit, +, axis,*,displ);
Message("\n");
Message("Posicion inicial del nodo %i: %g mm\n",n,NV_MAG(posinit)*1000);
}

}
Update_Face_Metrics(f, tf);
}
end_f_loop(f,tf);
}

In summary, I need to get "posinit" was constant in all the time steps

Thanks in advance!

Kimtero December 12, 2021 01:15

so I'd like to ask you how to deal with this problem? I met a similar problem.thanks

AlexanderZ December 14, 2021 07:38

Quote:

Originally Posted by Kimtero (Post 818335)
so I'd like to ask you how to deal with this problem? I met a similar problem.thanks

if you need help open new thread and explain in detail your problem, attach your code and compilation log


All times are GMT -4. The time now is 10:55.