CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   C_UDSI_G in DEFINE_ADJUST (http://www.cfd-online.com/Forums/fluent-udf/98336-c_udsi_g-define_adjust.html)

OscarD March 8, 2012 10:55

C_UDSI_G in DEFINE_ADJUST
 
I'm a new user of fluent in the version included in ANSYS13. I've read a lot of posts related with the problem that I'm having while trying to run am already compiled UDF I built that requires the estimation of the gradient of a UDS that is running OK in a transient simulation.

I've tried solve/set/expert temporary solver memory [yes], giving a determined value to the UDS during a DEFINE_INIT, etc.

I read somewhere that by initializating the calculation without having hooked the ADJUST and doing the hook after a couple of iterations might solve the problem, but I have not managed to do so...

The UDF I built is:

++++++++++++++++++++++++++++++++++++
#include "udf.h"

DEFINE_ADJUST(E_field,d)
{
Thread *t;
cell_t c;
real conduct,tempe,d1;

d1=3.213e-034;

if (! Data_Valid_P())
return;*/

if(NULL!=THREAD_STORAGE(t,SV_UDS_I(0))&&NULL!=T_ST ORAGE_R_NV(t,SV_UDSI_G(0)))
{
thread_loop_c(t,d)
{
if (FLUID_THREAD_P(t))

{
begin_c_loop(c,t)
{
tempe=C_T(c,t);
conduct=d1*pow(tempe,9.);
C_UDMI(c,t,0)=conduct;
C_UDMI(c,t,1)=-conduct*C_UDSI_G(c,t,0)[0];
}
end_c_loop(c,t)
}
}
}
}
+++++++++++++++++++++++++++++++++++++

Thanks in advance for any clue you can give me about it.

Micael March 8, 2012 16:39

What is the problem?

Also, the */ here looks suspect:
Code:


return;*/


OscarD March 9, 2012 05:00

hi micael,
The problem I have is that the UDF where I include the C_UDSI_G belongs to a hooked DEFINE_ADJUST macro (i.e. it should run every iteration). Compiling the UDF gives no error, but once I started the calculation, I got the ACCESS_VIOLATION error.
As I mentioned, I've read about letting the program to run a few iterations and then hook the DEFINE_ADJUST macro so the UDS fully is allocated at the moment the C_UDSI_G requires it for the calculation. That is a procedure I don't know yet. Do you have any clue about it?

About the code, I just removed some comment lines I posted before for the sake of clarifying my problem.

++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++


#include "udf.h"

DEFINE_ADJUST(E_field,d)
{Thread *t;
cell_t c;
real conduct,tempe,d1;

d1=3.213e-034;

if (! Data_Valid_P())
return;


thread_loop_c(t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop(c,t)
{
tempe=C_T(c,t);
conduct=d1*pow(tempe,9.);
C_UDMI(c,t,0)=conduct;
C_UDMI(c,t,1)=C_UDSI(c,t,0);
C_UDMI(c,t,2)=C_UDSI_G(c,t,0)[0];
}
end_c_loop(c,t)
}
}
}

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++

Thanks!

Micael March 9, 2012 15:55

I am too busy to look into it, but here is an advice: first, you have to identify the line that cause problem by including message in your code. You code crash at some line and any message command put down further would not display. Playing around with message commands you should identify the line where the code crash.


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