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

UDF variables F1, y / problem with UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 28, 2003, 12:45
Default UDF variables F1, y / problem with UDF
  #1
Fabian
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 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"

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
  Reply With Quote

Old   May 29, 2003, 16:36
Default Re: UDF variables F1, y / problem with UDF
  #2
ap
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)

}

}

  Reply With Quote

Old   May 30, 2003, 04:19
Default Re: UDF variables F1, y / problem with UDF
  #3
Fabian
Guest
 
Posts: n/a
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
  Reply With Quote

Old   May 30, 2003, 04:45
Default Re: UDF variables F1, y / problem with UDF
  #4
Fabian
Guest
 
Posts: n/a
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
  Reply With Quote

Old   May 31, 2003, 15:41
Default Re: UDF variables F1, y / problem with UDF
  #5
ap
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.

  Reply With Quote

Old   June 2, 2003, 04:05
Default Re: UDF variables F1, y / problem with UDF
  #6
Markus
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
  Reply With Quote

Old   June 2, 2003, 11:22
Default Re: UDF variables F1, y / problem with UDF
  #7
Fabian
Guest
 
Posts: n/a
Hi, now it works (sovlve/set/expert and Data_Valid())! I didn't keep the data in memory.

Greetings Fabian
  Reply With Quote

Reply


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 Off
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 40 March 18, 2018 07:05
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56
udf compiling problem akr FLUENT 3 August 22, 2007 08:14
UDF problem on single computer with two procesor Dmitry FLUENT 3 May 18, 2005 13:44
a problem about DEFINE_GEOM in dynamic mesh UDF speedcat FLUENT 1 May 16, 2005 04:09


All times are GMT -4. The time now is 15:19.