|
[Sponsors] |
![]() |
![]() |
#1 |
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 |
|
![]() |
![]() |
![]() |
#2 |
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 |
|
![]() |
![]() |
![]() |
#3 |
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 |
|
![]() |
![]() |
![]() |
#4 |
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 |
|
![]() |
![]() |
![]() |
#5 |
Guest
Posts: n/a
|
Thank you very much, Ale !!
You have solved my troubles. The control you suggest works very well. Regards, Pietro |
|
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
accessing solver data with UDF macros | Dushan | FLUENT | 1 | April 22, 2017 21:05 |
Accessing profile data from a UDF | ral007 | Fluent UDF and Scheme Programming | 1 | October 14, 2015 09:21 |
UDF - Derivatives for User Defined Memory Variable | Sandilya Garimella | FLUENT | 0 | January 14, 2008 10:39 |
Accessing node values using a UDF | Nico | FLUENT | 2 | December 20, 2007 02:50 |
Accessing function definitions for UDF | Karl | FLUENT | 2 | February 14, 2002 08:29 |