CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF variables F1, y / problem with UDF (https://www.cfd-online.com/Forums/fluent/31562-udf-variables-f1-y-problem-udf.html)

 Fabian May 28, 2003 11:45

UDF variables F1, y / problem with UDF

Hello,

as I said a couple days ago, I just started programming UDFs for FLUENT. Therefore I'm looking for variables: - for the SST-k-omega-model:

# blending function: F1

# the distance to the next surface: y

My second problem is still the one with the temperature-gradient. Here is my little UDF:

/************************************************** ******************/ /* UDF */ /************************************************** ******************/

#include "udf.h"

real dT_dz, dT_dy, dT_dx; real dp_dz; Thread *t; cell_t c;

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

 ap May 29, 2003 15:36

Re: UDF variables F1, y / problem with UDF

if (Data_Valid_P()) { ... }

For example:

real dT_dz, dT_dy, dT_dx; real dp_dz; Thread *t; cell_t c;

{

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)

}

}

 Fabian May 30, 2003 03:19

Re: UDF variables F1, y / problem with UDF

Thanks a lot! The 'if (Data_Valid_P())' didn't work, but I put a count-variable 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

 Fabian May 30, 2003 03:45

Re: UDF variables F1, y / problem with UDF

The count-variable 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

 ap May 31, 2003 14:41

Re: UDF variables F1, y / problem with UDF

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.

 Markus June 2, 2003 03:05

Re: UDF variables F1, y / problem with UDF

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

 Fabian June 2, 2003 10:22

Re: UDF variables F1, y / problem with UDF

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

Greetings Fabian

 All times are GMT -4. The time now is 04:09.