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/)
-   -   Explanation of a UDF codes (https://www.cfd-online.com/Forums/fluent-udf/220602-explanation-udf-codes.html)

Helium September 13, 2019 06:40

Explanation of a UDF codes
 
Hi guys,

I am trying to apply a UDF to move one of the wall of a cubic tank in order to generate wave in the fluid inside.

Regarding these thread I found:

https://www.cfd-online.com/Forums/fl...cillating.html
https://www.cfd-online.com/Forums/fl...ting-wall.html

It seems that I am in a very similar case, because I need to move just one of the faces (let's say along the x-axis for example) to obtain the effect.
Essentially I do not grasp if these codes are moving one wall back and forth, because the key point of simulation is that my wall goes REALLY back and forth between a starting and an ending position (following a cosinusoidal law for the x-velocity that I wrote).

Do they do this? In which part?

AlexanderZ September 23, 2019 06:17

Code:

#include "udf.h"
#include "dynamesh_tools.h"
DEFINE_CG_MOTION(oscillate,dt,vel,omega,time,dtime )
{
Thread *t;
face_t f; /* define the variables */
t = DT_THREAD(dt);
begin_f_loop(f,t) /* loop over each face in the zone to create an array of data */
{
vel[0]= sin(time);
}
end_f_loop(f,t)
}

wall will move along x-direction with velocity value = sin(time), change thisa value according to your needs

best regards


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