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

How accessing derivatives in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2003, 06:50
Default How accessing derivatives in UDF
  #1
Pietro Asinari
Guest
 
Posts: n/a
Hello everybody,

I'm writing a source terms by UDFs which need to access temperature derivatives C_T_G[i]. I have prevented the solver from freeing gradient data (solve/set/expert). In the code, I have inserted a control to verify the availability of gradient data:

if(!Data_Valid_P()) { source = 0; return source; }

The calculation works well and I save the results. When I try to load the DAT file, Fluent crashes for "Access Violation". It looks like "Data_Valid_P()" doesn't work.

What's the matter ?

Thank you in advance,

Pietro
  Reply With Quote

Old   October 13, 2003, 08:17
Default Re: How accessing derivatives in UDF
  #2
ap
Guest
 
Posts: n/a
You say the calculation works well, so Data_Valid_P() works, because it allows you to do the first iteration without errors when you try to access to gradients.

It's difficult to tell why this happens without looking to the code.

Do you use user defined memories or scalars?

Does the problems happens also when you load .cas and .dat files together?

Hi

ap
  Reply With Quote

Old   October 13, 2003, 09:30
Default Re: How accessing derivatives in UDF
  #3
Pietro Asinari
Guest
 
Posts: n/a
If I do some iterations without the source terms modelled by UDFs and then I turn on them, the calculation works well because temperature gradients have been correctly calculated. Saving the calculation, my UDFs are automatically linked to CASE file.

Restarting Fluent, the error occurs because temperature gradients are not stored into DATA file. The function "Data_Valid_P()" probably verifies the loading of DATA file but not what there is in. The starting check doesn't find temperature gradients into DATA file and crashes.

That's the code:

DEFINE_SOURCE(source_continuity, c, t, dS, eqn) {

/* ... code ... */

dT_dx_P = C_T_G(c,t)[0];

dT_dr_P = C_T_G(c,t)[1];

source=cost*sqrt(dT_dx_P*dT_dr_P);

return source; }

How can I add temperature gradients to DATA file ?

Thanks a lot,

Pietro

  Reply With Quote

Old   October 13, 2003, 10:13
Default Re: How accessing derivatives in UDF
  #4
Ale
Guest
 
Posts: n/a
Hi!

Try to add this control:

if (NULL != THREAD_STORAGE(t,SV_T_G))

{

....

} else

{

source=0.0;

}

I hope this helps. Regards,

Ale
  Reply With Quote

Old   October 13, 2003, 12:30
Default Re: How accessing derivatives in UDF
  #5
Pietro Asinari
Guest
 
Posts: n/a
Thank you very much, Ale !!

You have solved my troubles. The control you suggest works very well.

Regards,

Pietro
  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
accessing solver data with UDF macros Dushan FLUENT 1 April 22, 2017 22:05
Accessing profile data from a UDF ral007 Fluent UDF and Scheme Programming 1 October 14, 2015 10:21
UDF - Derivatives for User Defined Memory Variable Sandilya Garimella FLUENT 0 January 14, 2008 11:39
Accessing node values using a UDF Nico FLUENT 2 December 20, 2007 03:50
Accessing function definitions for UDF Karl FLUENT 2 February 14, 2002 09:29


All times are GMT -4. The time now is 05:24.