
[Sponsors] 
May 28, 2003, 11:45 
UDF variables F1, y / problem with UDF

#1 
Guest
Posts: n/a

Hello,
as I said a couple days ago, I just started programming UDFs for FLUENT. Therefore I'm looking for variables:  for the SSTkomegamodel: # blending function: F1 # the distance to the next surface: y My second problem is still the one with the temperaturegradient. Here is my little UDF: /************************************************** ******************/ /* UDF */ /************************************************** ******************/ #include "udf.h" DEFINE_ADJUST(my_adjust, d) { real dT_dz, dT_dy, dT_dx; real dp_dz; Thread *t; cell_t c; thread_loop_c (t,d) { begin_c_loop (c,t) //dT_dz = C_T_G(c,t)[2]; dT_dy = C_T_G(c,t)[1]; //dT_dx = C_T_G(c,t)[0]; dp_dz= C_DP(c,t)[2]; end_c_loop (c,t) } } I interpret the UDF in FLUENT and set the fuction hook for Adjust with no problems, but when I start calculating, FLUENT gives me this: ' FLUENT received fatal signal (ACCESS_VIOLATION) ' Does anybody can help me? Greetings Fabian 

May 29, 2003, 15:36 
Re: UDF variables F1, y / problem with UDF

#2 
Guest
Posts: n/a

You're trying to access to gradients at the first iteration, but they're not defined yet. Try putting all your commands which try to access to gradients in an if like this:
if (Data_Valid_P()) { ... } For example: DEFINE_ADJUST(my_adjust, d) { real dT_dz, dT_dy, dT_dx; real dp_dz; Thread *t; cell_t c; thread_loop_c (t,d) { begin_c_loop (c,t) { if (Data_Valid_P()) { //dT_dz = C_T_G(c,t)[2]; dT_dy = C_T_G(c,t)[1]; //dT_dx = C_T_G(c,t)[0]; dp_dz= C_DP(c,t)[2]; } } end_c_loop (c,t) } } 

May 30, 2003, 03:19 
Re: UDF variables F1, y / problem with UDF

#3 
Guest
Posts: n/a

Thanks a lot! The 'if (Data_Valid_P())' didn't work, but I put a countvariable in, so the calculation starts with the next step. But how come that I can get access to the Pressure Gradient a the first step?
Greetings Fabian 

May 30, 2003, 03:45 
Re: UDF variables F1, y / problem with UDF

#4 
Guest
Posts: n/a

The countvariable just helped, because the calculation in my UDF didn't start. To get the 'if(Data_Valid_P())' work, do I have to adjust any settings?
Greetings Fabian 

May 31, 2003, 14:41 
Re: UDF variables F1, y / problem with UDF

#5 
Guest
Posts: n/a

You don't have the gradient defined at the first iteration because the gradient is calculated using data obtained from two consecutive iterations.
You don't have to adjust anything to use Data_Valid_P(). Data_Valid_P() is generally used to do a check like: if (!Data_Valid_P()) return 0; followed by the commands which contain gradients. If I'm not wrong, there is an example of it's use in the UDF manual, among the examples about UDS, in the example of the implementation of the P1 model. 

June 2, 2003, 03:05 
Re: UDF variables F1, y / problem with UDF

#6 
Guest
Posts: n/a

Hi Fabian
I think your problem is that FLUENT does not keep the gradients in memory after having solved the respective equation for that variable. Try the text command : solve/set/expert  keep temporary memory from beind freed? yes. br Markus 

June 2, 2003, 10:22 
Re: UDF variables F1, y / problem with UDF

#7 
Guest
Posts: n/a

Hi, now it works (sovlve/set/expert and Data_Valid())! I didn't keep the data in memory.
Greetings Fabian 

Thread Tools  
Display Modes  


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 compiling problem  akr  FLUENT  3  August 22, 2007 07:14 
UDF problem on single computer with two procesor  Dmitry  FLUENT  3  May 18, 2005 12:44 
a problem about DEFINE_GEOM in dynamic mesh UDF  speedcat  FLUENT  1  May 16, 2005 03:09 