# UDF Problem!

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

 July 15, 2010, 04:26 UDF Problem! #1 New Member   Andrè Hüllmann Join Date: Mar 2010 Posts: 10 Rep Power: 8 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 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!!

 July 15, 2010, 05:40 #2 Senior Member   Max Join Date: Mar 2009 Posts: 133 Rep Power: 9 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

 July 15, 2010, 15:32 #3 New Member   Steven Qhin Join Date: Jul 2010 Posts: 15 Rep Power: 8 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)

 July 23, 2010, 03:20 #4 New Member   Andrè Hüllmann Join Date: Mar 2010 Posts: 10 Rep Power: 8 Thank you for answer! But what I have to change in my UDF? Thank you!

May 8, 2015, 19:02
#5
New Member

Join Date: Oct 2014
Posts: 11
Rep Power: 3
Quote:
 Originally Posted by huela Thank you for answer! But what I have to change in my UDF? Thank you!
Could you solve the problem?

 Thread Tools Display Modes Linear Mode

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

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

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