CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

UDF Problem!

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 15, 2010, 04:26
Default UDF Problem!
  #1
New Member
 
Andrè Hüllmann
Join Date: Mar 2010
Posts: 10
Rep Power: 8
huela is on a distinguished road
Hello,
I have a problem with my udf. I want if the Pressure falls under 0 that the value of Pressure would be set 0.

#include <udf.h>
DEFINE_ON_DEMAND(hallo)
{
Domain *d;

real patm = 101325.0;
real pmin = 0.0;
real pressure = 0;
Thread *t;
cell_t c;
d = Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{

pressure = C_P(c,t);

if (pressure < 0.)
pressure = 0.0;
}
end_c_loop(c,t)

begin_c_loop(c,t)
{
pressure = C_P(c,t);
C_UDMI(c,t,0) = pressure;
}
end_c_loop(c,t)
}

}


Thank you for help!!
huela is offline   Reply With Quote

Old   July 15, 2010, 05:40
Default
  #2
Senior Member
 
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 9
coglione is on a distinguished road
DEFINE_PROFILE() is the way to go to fix a flow variable to a certain value for any cell in your grid.
Have a look at the UDF-Userguid section 2.3.15, there is also an example that might be helpful.

BTW, what is the reason for your intention to prevent negative pressure values? If it seems to you that this is unphysical, keep in mind that in Fluent pressures are always defined as gauge pressure to an operating pressure defined by you and static pressure may drop significantly for high speed flows and may become negative which does not necessarily mean that your solution is wrong.

cheers
coglione is offline   Reply With Quote

Old   July 15, 2010, 15:32
Default
  #3
New Member
 
Steven Qhin
Join Date: Jul 2010
Posts: 15
Rep Power: 8
chaozhong.qin is on a distinguished road
Hi,

I found a small mistake in your UDF, as follows:

begin_c_loop(c,t)
{

pressure = C_P(c,t);

if (pressure < 0.)
pressure = 0.0;
(note that: C_P(c,t) = pressure;
return the value to C_P(c,t)
)

}
end_c_loop(c,t)
chaozhong.qin is offline   Reply With Quote

Old   July 23, 2010, 03:20
Default
  #4
New Member
 
Andrè Hüllmann
Join Date: Mar 2010
Posts: 10
Rep Power: 8
huela is on a distinguished road
Thank you for answer!

But what I have to change in my UDF?

Thank you!
huela is offline   Reply With Quote

Old   May 8, 2015, 19:02
Default
  #5
New Member
 
Join Date: Oct 2014
Posts: 11
Rep Power: 3
sozen is on a distinguished road
Quote:
Originally Posted by huela View Post
Thank you for answer!

But what I have to change in my UDF?

Thank you!
Could you solve the problem?
sozen is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56
UDF problem mansha goraya FLUENT 0 October 29, 2007 01:31
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
UDF problem chiseung FLUENT 4 January 10, 2002 10:58


All times are GMT -4. The time now is 14:08.