CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF don't work

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By nicoletta90

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2018, 05:04
Default UDF don't work
  #1
New Member
 
Join Date: Sep 2018
Posts: 2
Rep Power: 0
nicoletta90 is on a distinguished road
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!
Oula likes this.
nicoletta90 is offline   Reply With Quote

Old   September 19, 2018, 20:28
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
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.
blackmask is offline   Reply With Quote

Old   September 20, 2018, 04:12
Default
  #3
New Member
 
Join Date: Sep 2018
Posts: 2
Rep Power: 0
nicoletta90 is on a distinguished road
Now it works, thanks a lot for your help!
nicoletta90 is offline   Reply With Quote

Old   October 4, 2018, 10:08
Default
  #4
Member
 
Oula
Join Date: Apr 2015
Location: United Kingdom
Posts: 81
Rep Power: 11
Oula is on a distinguished road
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)
}
Oula is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 13:42
UDF "DEFINE CONTACT" How does it work? kpestov FLUENT 0 November 29, 2014 05:20
udf doesn't work blaid FLUENT 0 March 6, 2012 12:29
udf - c++ compiler does not work Matthias FLUENT 1 January 9, 2009 00:44
Will the UDF work?? H.S.Fang FLUENT 0 December 27, 2001 21:21


All times are GMT -4. The time now is 12:59.