CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDS to get the gradient (

Raymond.Leoi February 19, 2013 08:51

UDS to get the gradient
In the following UDF, the heat source, which depends on the gradient of a diffusivity, is trying to be calculated. One UDS2 is defined and updated to be the diffusivity at the end of each iteration through 'execute_at_end'. But I got error as

tx86\2ddp\fl1450s.exe received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f

any idea for this problem?

DEFINE_SOURCE(energy_source, cell, thread, dS, eqn)
real source;
real s_p;
real xc[ND_ND];

s_p = - NV_DOT(C_UDSI_G(cell,thread,2), C_UDSI_G(cell,thread,0));
s_p = -s_p*C_T(cell,thread)*C_UDSI_DIFF(cell,thread,0);

source = s_p;
dS[eqn] = 0.0;
return source;

Domain *domain;
cell_t cell;
Thread *thread;
int tec_zoneID;
int i;
for (i = 0; i < n_tec_zones; i++)
tec_zoneID = tec_solid_zone[i];
thread = Lookup_Thread(domain, tec_zoneID);
C_UDSI(cell,thread,2) = C_UDSI_DIFF(cell,thread,2);
C_UDSI(cell,thread,3) = C_UDSI_DIFF(cell,thread,2)*C_T_G(cell,thread)[0];

Raymond.Leoi February 19, 2013 10:52

I use domain = Get_Domain(1), and then it seems working even thought it's not perfect. But it's observed that the gradient of diffusivitity is not correct particularly at the two rows of cells attached with the boundaries. How to fix it?

NCle June 6, 2013 12:41

Same error
Hi Raymond,

I am also trying to use the DEFINE_EXECUTE_AT_END macro, and get the same exact "access-violation" error in Fluent. I think it is because of the UDF somehow, is this true?

A CFD free user June 25, 2013 03:54

Are you using UDM in your code as well? in this case, you have to first define them using Fluent user defined memory then execute your code. It'll vanish.

yashganatra July 2, 2013 01:03

try using solve-set-expert text command line and when asked keep temporary solver memory from being freed enter yes.
Also allocate number of user defined memories

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