CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for density gradient (https://www.cfd-online.com/Forums/fluent/34242-udf-density-gradient.html)

Nandu Menon July 21, 2004 03:09

UDF for density gradient
 
Hi, this is a UDF that i am attempting to use to determine the magnitude of the gradient of density in the flowfield.

DEFINE_ON_DEMAND(dens_grad) { Domain *domain; cell_t c; Thread *t;

domain=Get_Domain(1);

/* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain)

{

begin_c_loop (c,t)

{

C_UDMI(c,t,0) = NV_MAG(C_R_G(c,t));

}

end_c_loop (c,t)

} }

but when i run the execute on demand option, Fluent displays the follwing error:

FLUENT 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: ()

Does any one have any idea why this is hapenning? I feel it might have something to do with the use fo the user defined memory. any help to this regard is greatly appreciated.

cheers Nandu


Ajay July 22, 2004 00:09

Re: UDF for density gradient
 
Hi In your UDF you are not defining your thread pointer t properly .Hence the error .

Include this before using begin_f_loop()

t=lookup_thread(d,id)

id= number you see for your fluid in the boundary condition panel window.

when you use

thread_loop_c (t,domain)

you get the thread for the whole domain which includes the boundaries .So when it tries to get the gradient you get that error Hope this helps .Mail me if you have additional trouble my email id is arao at uh dot edu

-Ajay

Peter July 22, 2004 08:57

Re: UDF for density gradient
 
In addition to what Ajay correctly pointed out, it is often necessary when trying to access data such as gradients to tell Fluent to save the data by typing the command "solve/set/expert" and answer 'yes' to the question "keep temporary solver memory from being freed?"


All times are GMT -4. The time now is 01:37.