|
[Sponsors] |
November 23, 2009, 04:25 |
Programming a F_UDMI
|
#1 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 16 |
Hello everybody,
I want to program a F_UDMI with the value of 10*temperature. First, I programmed it as a C_UDMI and it worked Ok. But when I program it as a F_UDMI, I have this error: Error: FLUENT received fatal signal (ACCESS_VIOLATION) Note exact events leading to error. Save case/data under new name. Exit program and restart to continue. Report error to your distributor. The C++ program as C_UDMI (which works Ok) is this: #include "udf.h" DEFINE_ON_DEMAND(function) { Domain *d; Thread *t; cell_t c; d=Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,0)=10*C_T(c,t); } end_c_loop(c,t) } } The C++ program as F_UDMI (which fives the violation error) is this: #include "udf.h" DEFINE_ON_DEMAND(function) { Domain *d; Thread *t; face_t f; d=Get_Domain(1); thread_loop_f(t,d) { begin_f_loop(f,t) { F_UDMI(f,t,0)=10*F_T(f,t); } end_f_loop(f,t) } } Does anybody know why the code runs Ok as a C_UDMI and not as a F_UDMI ??? |
|
November 30, 2009, 12:49 |
F_T and F_UDMI are not stored on all face zones
|
#2 |
New Member
Bocliff Sutter
Join Date: Jun 2009
Location: Tibet
Posts: 9
Rep Power: 16 |
Greetings from Tibet,
I believe the problem is that while C_T and C_UDMI are stored by FLUENT on all cell zones, F_T and F_UDMI are not stored on all face zones (for example, they are not stored on interior face zone faces). You could add the following to avoid trying to access a null pointer in your code: thread_loop_f(t,d) { if (T_STORAGE_R(t, SV_T) != NULL) && T_STORAGE_R_XV(t, SV_UDM_I, 0) != NULL) { begin_f_loop(f,t) { F_UDMI(f,t,0)=10*F_T(f,t); } end_f_loop(f,t) } } This will fill the storage on zones on which it exists. Bocliff |
|
November 30, 2009, 13:06 |
|
#3 |
New Member
Bocliff Sutter
Join Date: Jun 2009
Location: Tibet
Posts: 9
Rep Power: 16 |
This workaround will certainly get you going as it will avoid NULL pointer but I was wondering if this is what you really want to do? Using DEFINE_ON_DEMAND to fill in some arrays is OK but I was wondering if you really wanted to operate on a particular thread? Maybe you just want to setup some boundary condition on a boundary or some source in interior?
Just a thought. Bocliff Sutter "May your yak keep front end in your tent" |
|
November 17, 2014, 18:07 |
|
#4 |
New Member
Join Date: Apr 2014
Posts: 13
Rep Power: 12 |
For those who faced the same problem.
You can't use F_UDMI and F_UDSI to store the information of interior, fan, and radiator. Instead of that use C_UDMI: #include "udf.h" DEFINE_ON_DEMAND(function) { Domain *d; Thread *t; face_t f; d=Get_Domain(1); thread_loop_f(t,d) { begin_f_loop(f,t) { C_UDMI(F_C0(f,t),t->t0,0)=10*F_T(f,t); } end_f_loop(f,t) } } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A book for a beginner wanting to learn programming | frank | Main CFD Forum | 9 | May 12, 2014 23:15 |
UDF programming for pressure 3D..HELP | coolyihao | Fluent UDF and Scheme Programming | 4 | July 15, 2010 15:28 |
OpenFoam programming | prapanj | OpenFOAM | 10 | March 18, 2010 07:23 |
Programming in OpenFOAM | vinu | OpenFOAM | 2 | July 11, 2009 10:16 |
new CFD Programming Forum | Thinker | Main CFD Forum | 14 | November 19, 2002 16:03 |