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/)
-   -   time dependent boundary condition (https://www.cfd-online.com/Forums/fluent-udf/214662-time-dependent-boundary-condition.html)

yehia ismail February 8, 2019 16:04

time dependent boundary condition
 
Hi,
I am trying to model turbulent pulsed jet flow and I am trying to plot cycle average centerline velocity and the flow has a ratio of on and off equal 1:2.
I want to write a UDF for the t inlet velocity varying with time 172.47*sin(94.248*t) with 0<t<0.033 so anyone can help me in this?Thanks in advance

AlexanderZ February 11, 2019 01:28

ansys fluent customization manual

look for define_profile macro

best regards

yehia ismail February 12, 2019 11:28

Thank you for your help.I managed to write this udf
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
t-local= t - int(t/0.1)*0.1;
begin_f_loop(f, thread)
{
if (t-local < 0.033)
Uin=36.6*sin(94.24*t-local)
esle
Uin=0
else
F_PROFILE(f, thread, position) = Uin;
}
end_f_loop(f, thread)
}

however I received an error saying "line 6: local: undeclared variable" which is the line defining the t-local so do you an idea on how could I fix this?Thank you for your help

AlexanderZ February 12, 2019 21:47

log describes your error
Quote:

"line 6: local: undeclared variable"
it means you have undeclared variable at line 6

t-local is not defined ( no type)

best regards

yehia ismail February 22, 2019 14:29

Udf
 
I wrote this code but I get a parse error in line 7 where the t_local=t - 0.1*int(t/0.1) .Do you have any idea why could be the reason for that?
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real t_local;
t_local = t - 0.1*int(t/0.1);

begin_f_loop(f, thread)
{
if ( t_local < 0.033 )
F_PROFILE(f, thread, position) = 172.47*sin(94.25*t_local);
else
F_PROFILE(f, thread, position) = 0;
}
end_f_loop(f, thread)
}

AlexanderZ February 24, 2019 21:47

Code:

(int)number
not
int(number)

best regards


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