how to set up and write a cosine UDF
Hello everybody,
i ve got a problem with my inlet boundary conditions. i want to implement a cosine (or sine) function because, i got a pulsative flow at the inlet. my flow changes every second from 0 to 20 m/s. one possible function would be 10*cos(x*pi)+10 with 0<x<2. Now, i just dont know how to setup this function in fluent and how and where to wirte it. I know that i have to define this function somewhere and upload it after in fluent. and how can i tell fluent that one period is like 4 seconds? Would be really great if someone can help me with this. regards, chris |
You should read the Fluent UDF manual here:
http://hpce.iitm.ac.in/website/Manua...f/main_pre.htm Alternatively you can create a Profile file with discrete velocity vs. time data and use that. See here: http://hpce.iitm.ac.in/website/Manua...ug/node301.htm |
ok thanks i`ll try it!
|
Quote:
I don't understand very well: your function should be time dependent but there isn't time in your function..what is x?time? From what I understand I think you want to change velocity at inlet with a time dependent cos function. If so, try this udf. Code:
#include "udf.h" If so copy this udf in a textedit file and save it as somename.c (not txt extension but c extension) and put it in the folder of your cas and dat files. Open fluent and go to define->user-defined->functions->interpreted. Choose the c file and interpret it. Then in your velocity boundary condition choose your interpreted udf ("my_velocity"). Choose an appropriate time step for your unsteady simulation and stop it after some periods (you know 1 period is 2 seconds). Also, I don't understand this: ..and how can i tell fluent that one period is like 4 seconds? your period is 2 seconds not 4. If I don't understand post a sketch of your domain and explain better. Daniele |
Hey Daniele,
thanks a lot! You understood it absolute right. And really thanks for the code, my knowledge at C and C++ isnīt that big... So now, i made it like your proposal but the new problem is that "my_velocity" doesn`t appear at the boundary conditions. I think interpreting worked well but i can`t choose this condition. Do you know what kind of problem could be the reason for that? Thank you and regards, chris |
Quote:
after interpreting your udf, go to boundary condition panel, choose your inlet, then change from "constant" to udf my_velocity. PS: if you start your simulation with your function velocity at time=0 s is 20 m/s; you should perform a steady state simulation first, with v=constant=20 m/s than switch to unsteady and apply your cosine udf. Daniele |
ok great, thank you, now it works!!!
|
All times are GMT -4. The time now is 19:14. |