|
[Sponsors] |
March 8, 2012, 10:55 |
C_UDSI_G in DEFINE_ADJUST
|
#1 |
New Member
OscarD
Join Date: Sep 2011
Posts: 4
Rep Power: 15 |
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. |
|
March 8, 2012, 16:39 |
|
#2 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
What is the problem?
Also, the */ here looks suspect: Code:
return;*/ |
|
March 9, 2012, 05:00 |
|
#3 |
New Member
OscarD
Join Date: Sep 2011
Posts: 4
Rep Power: 15 |
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! |
|
March 9, 2012, 15:55 |
|
#4 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
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.
|
|
Tags |
fluent, gradients, udf, udf issue |
|
|