CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF on-off Pulsed velocity inlet (https://www.cfd-online.com/Forums/fluent/29474-udf-off-pulsed-velocity-inlet.html)

 Samuel March 10, 2002 23:07

UDF on-off Pulsed velocity inlet

Hi, I've got a problem using UDF for inlet velocity profile.

I have managed to write in Matlab file, but having trouble to write in Fluent UDF file.

**********vinlet.m***********
clear all;
<blockquote>
for I=0:Per:0.5
<blockquote>

for t = I:0.001:I+Per

<blockquote>

if(t<=I+Per/3),

Flow = abs(A*sin(3*pi*t/Per));

else

Flow = 0;

end

plot (t,Flow);

hold on;

</blockquote>

end
</blockquote>
end
</blockquote>
plot (t,Flow);
*****END******

*******vinlet.c***********

#include "udf.h"

DEFINE_PROFILE(inlet_xv_sinusoidal, /* function name */ <blockquote> <blockquote>

<blockquote>

<blockquote>

nv) /* variable number */

</blockquote>

</blockquote> </blockquote> </blockquote>
{

<blockquote>
face_t f;

real pi = 4*atan(1);

real U = 36.6;

real A = 3*pi*U/2;

real Per = 0.1;

real i;

real flow_time = RP_Get_Real("flow-time");

for (i=0:Per:flow_time) /* NOT sure how to define "for" or is this possible? */

{
<blockquote>

{

<blockquote>

if (flow_time <= i+Per/3.)

{

F_PROFILE(f,thread,nv) = fabs(A*sin(0.3*pi*flow_time)); /* What is an equivalent command for "hold on" in Fluent or is this possible?*/

}

else

{

}

</blockquote>

}

</blockquote>
}

end
*****END********

I am trying to model on-off pulsed jet with 1:2 ratio.

My real question is how to create a loop for the cycles in terms of flow_time. As in the matlab, I just defined this cycle (the fisrt loop, i = 0:0.1:0.5) where 0.5 being a chosen number, as in the FLUENT, it should be defined in "Interate" FLUENT GUI panel as "number of time step".

Is it possible to create a loop for flow_time?

Any inputs will be appreciated!

Thanks

sam

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