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

C_UDSI_G in DEFINE_ADJUST

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2012, 10:55
Unhappy C_UDSI_G in DEFINE_ADJUST
  #1
New Member
 
OscarD
Join Date: Sep 2011
Posts: 4
Rep Power: 14
OscarD is on a distinguished road
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.
OscarD is offline   Reply With Quote

Old   March 8, 2012, 16:39
Default
  #2
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 156
Rep Power: 18
Micael is on a distinguished road
What is the problem?

Also, the */ here looks suspect:
Code:
 
return;*/
Micael is offline   Reply With Quote

Old   March 9, 2012, 05:00
Default
  #3
New Member
 
OscarD
Join Date: Sep 2011
Posts: 4
Rep Power: 14
OscarD is on a distinguished road
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!
OscarD is offline   Reply With Quote

Old   March 9, 2012, 15:55
Default
  #4
Senior Member
 
Micael
Join Date: Mar 2009
Location: Canada
Posts: 156
Rep Power: 18
Micael is on a distinguished road
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.
Micael is offline   Reply With Quote

Reply

Tags
fluent, gradients, udf, udf issue

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



All times are GMT -4. The time now is 04:46.