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

Urgent UDF Problem ....

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 28, 2013, 18:40
Exclamation Urgent UDF Problem ....
  #1
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
Friends,
I have a proble with my UDF. There is no problem about compilation and interpreting but I can not apply my udf to the boundaries. I get error message:

Error: cx-set-real-entry: wta[2] (float)
Error Object : ((constant .1) (profile """""")

Could you please help me about the case?
my UDF is like that:




#include "udf.h"
#define Tm 938
Domain *d;
DEFINE_PROFILE(wall_temp, thread, nv)
{
real T2solid=0.;
real T2liquid=0.;
real temp=0.;
real tmax=0.;
real tmin=0.;
real y=0.;
Thread *t;
cell_t c;
/* Loop over all cell threads in the domain */
thread_loop_c(t,d)
{

/* Compute max, min, volume-averaged temperature */

/* Loop over all cells */
begin_c_loop(c,t)
{
temp = C_T(c,t); /* get cell temperature */

if (temp < tmin || tmin == 0.) tmin = temp;
if (temp > tmax || tmax == 0.) tmax = temp;


}
end_c_loop(c,t)
printf("\n Tmin = %g Tmax = %g",tmin,tmax);
T2solid=Tm+100.0*y ;
T2liquid=Tm+40.0*y ;
begin_c_loop(c,t)
{
temp = C_T(c,t);
}
end_c_loop(c,t)
}
}

thanks alot....
angelicapeygo is offline   Reply With Quote

Old   May 28, 2013, 20:42
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
Why do you use DEFINE_PROFILE(name, thread, nv) if your functions body does not involve 'thread' at all?
blackmask is offline   Reply With Quote

Old   May 29, 2013, 06:11
Default
  #3
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
what do you advise me to do? I am new with the UDFs ..
angelicapeygo is offline   Reply With Quote

Old   May 29, 2013, 06:16
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
It depends, DEFINE_ON_DEMAND or DEFINE_EXECUTE_AT_END could be an option.
blackmask is offline   Reply With Quote

Old   May 29, 2013, 06:29
Default
  #5
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
I changed it to DEFINE_ON_DEMAND but the result is same. what can be the other reason :S
angelicapeygo is offline   Reply With Quote

Old   May 29, 2013, 06:36
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
You Domain pointer are not initialized. Add a line
d = Get_Domain(1);
blackmask is offline   Reply With Quote

Old   May 29, 2013, 06:49
Default
  #7
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
I realized it and add it but nothing changed.
/************************************************** *********************
vprofile.c
UDF for specifying steady-state temperature profile boundary condition
************************************************** **********************/
#include "udf.h"
#define Tm 938
Domain *d;
DEFINE_ON_DEMAND(wall_temp)
{
real T2solid=0.;
real T2liquid=0.;
real temp=0.;
real tmax=0.;
real tmin=0.;
real y=0.;
Thread *t;
cell_t c;
d = Get_Domain(1); /* Get the domain using Fluent utility */
/* Loop over all cell threads in the domain */
thread_loop_c(t,d)
{

/* Compute max, min, volume-averaged temperature */

/* Loop over all cells */
begin_c_loop(c,t)
{
temp = C_T(c,t); /* get cell temperature */

if (temp < tmin || tmin == 0.) tmin = temp;
if (temp > tmax || tmax == 0.) tmax = temp;


}
end_c_loop(c,t)
printf("\n Tmin = %g Tmax = %g",tmin,tmax);
T2solid=Tm+100.0*y ;
T2liquid=Tm+40.0*y ;
begin_c_loop(c,t)
{
temp = C_T(c,t);
}
end_c_loop(c,t)
}
}
angelicapeygo is offline   Reply With Quote

Old   May 29, 2013, 06:53
Default
  #8
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
Replace
Code:
printf
with
Code:
Message0
blackmask is offline   Reply With Quote

Old   May 29, 2013, 07:01
Default
  #9
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
it says:
CX_message not found. Do you know the reason?
thanks alot.
angelicapeygo is offline   Reply With Quote

Old   May 29, 2013, 07:06
Default
  #10
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
Then simply comment out that line and try again. If the error still persist, then I suggest you save you case, restart FLUENT and reread the case file.
blackmask is offline   Reply With Quote

Old   May 29, 2013, 07:11
Default
  #11
New Member
 
angelicapeygo
Join Date: May 2013
Posts: 7
Rep Power: 4
angelicapeygo is on a distinguished road
it still does not work ..
do you think the other parts of my UDF is correct?
thanks alot.
angelicapeygo is offline   Reply With Quote

Old   May 29, 2013, 09:27
Default
  #12
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 11
blackmask will become famous soon enough
I think the UDF is fine.
blackmask is offline   Reply With Quote

Old   May 29, 2013, 09:29
Default
  #13
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 6
JimKnopf is on a distinguished road
What is the current error?

Printing is done via:
Code:
double var = 0.;
Message("text %g",var);
found one:

Code:
#define TM 938
is not really the same then defining a global variable. If you really sure that you what to define a global constant you should use:
Code:
static const double var = 4.5;
But still remind that global variables are bad and evil

Greetz
Jim
JimKnopf is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pressure profile UDF for unsteady-state problem? Mohsen Keshavarzian FLUENT 2 August 20, 2008 04:22
parallel UDF problem kerem FLUENT 2 June 20, 2006 06:56
Switch problem! using 2 custom udf laws at the same time HP FLUENT 0 September 15, 2004 09:48
UDF Problem ozgur FLUENT 15 March 11, 2004 13:52
UDF variables F1, y / problem with UDF Fabian FLUENT 6 June 2, 2003 10:22


All times are GMT -4. The time now is 23:51.