|
[Sponsors] |
July 15, 2010, 04:26 |
UDF Problem!
|
#1 |
New Member
Andrè Hüllmann
Join Date: Mar 2010
Posts: 10
Rep Power: 16 |
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!! |
|
July 15, 2010, 05:40 |
|
#2 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
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: 15 |
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: 16 |
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: 14
Rep Power: 11 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM | Rizwan | Fluent UDF and Scheme Programming | 40 | March 18, 2018 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 00:31 |
udf compiling problem | akr | FLUENT | 3 | August 22, 2007 07:14 |
UDF problem | chiseung | FLUENT | 4 | January 10, 2002 09:58 |