Question: Using C program: Hello, The UDF(C code)attached below is supposed to be used in my project. I'm using Ansys Fluent which needs UDF to impose
Using C program:
Hello,
The UDF(C code)attached below is supposed to be used in my project. I'm using Ansys Fluent which needs UDF to impose a desired time-dependent function in BC's. I've imposed this UDF and it worked out, but the thing I miss is that my function has to have a specific time range that controls its shape. The desired range that I need is (0:0.5). Also, the function is periodic so it is supposed to repeat itself back and forth. Obviously, I could use either (For... Loop) with whatever increment or (While). The other thing to put in your mind is that I cannot use (int) because my time range is between(0:0.5) which means it is not an integer. So instead I should use (float). Unfortunately, I'm not quite good at coding. I hope somebody can help me to rewrite the code with the desired time range mentioned previously.
Thanks in advance!!!
This is the code:
#include "udf.h"
DEFINE_PROFILE(transient_massflowrate, thread, position) { face_t f; real t = CURRENT_TIME; begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = 74690*pow(t,9)-163940*pow(t,8)+149770*pow(t,7)-74136*pow(t,6)+21756*pow(t,5)-3886.7*pow(t,4)+406.9*pow(t,3)-20.769*pow(t,2)+0.3634*t+0.0031965; } end_f_loop(f, thread) }
esornsitc thresd, pesicton) 20 21 end f_icop(, chreada esornsitc thresd, pesicton) 20 21 end f_icop(, chreada
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
