|
[Sponsors] |
September 19, 2018, 06:04 |
UDF don't work
|
#1 |
New Member
Join Date: Sep 2018
Posts: 2
Rep Power: 0 |
Hi everybody,
I'm new in this forum, and I'm not really able with UDF. In my case study, I have 2 inlets and I need to define 4 UDF (2 for velocity, 2 for epslon). I know that I can interpret only one UDF, so I write them in one file, but the software interpret only the first two. Attached the UDF file (note that until now I used them without problems, and that the software don't give me any message error). # include "udf.h" DEFINE_PROFILE(inlet_velocity_first, thread, index) { real p[ND_ND]; real y, u0=3.56, yref=10.0; face_t f; begin_f_loop (f, thread) { F_CENTROID (p,f,thread); y=p[1]; F_PROFILE(f,thread,index)=-u0*pow(y/yref,0.14); } end_f_loop(f, thread) } # include "udf.h" DEFINE_PROFILE(inlet_epson_first, thread, index) { real p[ND_ND]; real y, y0=0.03, u0=0.257; face_t f; begin_f_loop (f, thread) { F_CENTROID (p,f,thread); y=p[1]; F_PROFILE(f,thread,index)=(1/0.42)*pow(u0,3.0)/(y+y0); } end_f_loop(f, thread) } # include "udf.h" DEFINE_PROFILE(inlet_velocity_second, thread, index) { real p[ND_ND]; real y, u0=1.47, yref=10.0; face_t f; begin_f_loop (f, thread) { F_CENTROID (p,f,thread); y=p[1]; F_PROFILE(f,thread,index)=u0*pow(y/yref,0.14); } end_f_loop(f, thread) } # include "udf.h" DEFINE_PROFILE(inlet_epson_second, thread, index) { real p[ND_ND]; real y, y0=0.03, u0=0.106; face_t f; begin_f_loop (f, thread) { F_CENTROID (p,f,thread); y=p[1]; F_PROFILE(f,thread,index)=(1/0.42)*pow(u0,3.0)/(y+y0); } end_f_loop(f, thread) } Thanks a lot! |
|
September 19, 2018, 21:28 |
|
#2 |
Senior Member
|
There are some non-printing characters after the last "}" in the second and fourth DEFINE_PROFILE macro, and one of them is the NULL character. Please delete any thing from the last "}" line of the second macro and the #include line of the third macro, and retype the "}". You only need to include "udf.h" once.
|
|
September 20, 2018, 05:12 |
|
#3 |
New Member
Join Date: Sep 2018
Posts: 2
Rep Power: 0 |
Now it works, thanks a lot for your help!
|
|
October 4, 2018, 11:08 |
|
#4 |
Member
Oula
Join Date: Apr 2015
Location: United Kingdom
Posts: 81
Rep Power: 11 |
Dear nicoletta90 and blackmask
I also want to write a UDF of transient mass flow rate for inlet boundary. I want to inject a gas with flow rate of 1.5 Cubic meter per hour, i.e. same flow rate to be injected every one hour of the physical flow-time. Do you have any experience with this? do you think the code below might fit the case? #include "udf.h“ DEFINE_PROFILE(transient_mf, thread, position) { face_t f ; real t = RP_Get_Real("flow-time"); /* to calculate the physical time step*/ begin_f_loop(f, thread) { if (t==0,3600, 2*3600, 3*3600, 4*3600, 5*3600) { F_PROFILE(f, thread, position) = 53; } else { F_PROFILE(f, thread, position) = 0; } } end_f_loop(f, thread) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Having trouble adapting serial UDF to work in parallel | muyuntao | Fluent UDF and Scheme Programming | 1 | November 10, 2015 14:42 |
UDF "DEFINE CONTACT" How does it work? | kpestov | FLUENT | 0 | November 29, 2014 06:20 |
udf doesn't work | blaid | FLUENT | 0 | March 6, 2012 13:29 |
udf - c++ compiler does not work | Matthias | FLUENT | 1 | January 9, 2009 01:44 |
Will the UDF work?? | H.S.Fang | FLUENT | 0 | December 27, 2001 22:21 |