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

Programming a F_UDMI

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 23, 2009, 04:25
Default Programming a F_UDMI
  #1
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 16
isabel is on a distinguished road
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 ???
isabel is offline   Reply With Quote

Old   November 30, 2009, 12:49
Default 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
Bocliff is on a distinguished road
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
Bocliff is offline   Reply With Quote

Old   November 30, 2009, 13:06
Default
  #3
New Member
 
Bocliff Sutter
Join Date: Jun 2009
Location: Tibet
Posts: 9
Rep Power: 16
Bocliff is on a distinguished road
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"
Bocliff is offline   Reply With Quote

Old   November 17, 2014, 18:07
Default
  #4
New Member
 
Join Date: Apr 2014
Posts: 13
Rep Power: 12
Farid is on a distinguished road
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)
}
}
Farid is offline   Reply With Quote

Reply


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


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


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