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

rp-var-define problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 13, 2012, 01:46
Default rp-var-define problem
  #1
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Hi Guys,

I have written a UDF as below: no problem in compiling but when i run Fluent, there is an error message,

DEFINE_EXECUTE_AT_END(heat_flux)
{
Domain *d;
Thread *t;
face_t f;
real A[ND_ND];
real q;
real T_W;
real htc;
real q_t;
real TT = RP_Get_Real("T-ref");
d = Get_Domain(1);
t = Lookup_Thread(d,3);

begin_f_loop (f,t)
{
F_AREA(A,f,t);
q = WALL_HEAT_FLUX(f,t); /* gets the TOTAL Heat flux vector at the surface */
q_t = q / NV_MAG(A);
T_W = F_T(f,t);
htc = ABS(q_t / (T_W - TT));
C_UDMI(F_C0(f,t),THREAD_T0(t),0) = q_t;
C_UDMI(F_C0(f,t),THREAD_T0(t),1) = htc;
}
end_f_loop (f,t)
}

The following error message appears:

Error: rpgetvar: T-ref: undefined variable
Error Object: ()

I have already defined T-ref using
(if (not (rp-var-object ‘T-ref))(rp-var-define ‘T-ref 290 ‘real #f)) in TUI so I think there should be no problems!
I will appreciate if you can help me resolve this problem,
tnx
syavash is offline   Reply With Quote

Old   August 13, 2012, 03:32
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
That means the scheme variable "T-ref" has not been defined.

I believe the sentence RP_Get_Real("T-ref") is to get the reference temperature, commonly, 298.15K. If the scheme variable is not defined in your system, you can also use
real TT = T_REF;
to get the reference temperature.


Quote:
Originally Posted by syavash View Post
Hi Guys,

I have written a UDF as below: no problem in compiling but when i run Fluent, there is an error message,

DEFINE_EXECUTE_AT_END(heat_flux)
{
Domain *d;
Thread *t;
face_t f;
real A[ND_ND];
real q;
real T_W;
real htc;
real q_t;
real TT = RP_Get_Real("T-ref");
d = Get_Domain(1);
t = Lookup_Thread(d,3);

begin_f_loop (f,t)
{
F_AREA(A,f,t);
q = WALL_HEAT_FLUX(f,t); /* gets the TOTAL Heat flux vector at the surface */
q_t = q / NV_MAG(A);
T_W = F_T(f,t);
htc = ABS(q_t / (T_W - TT));
C_UDMI(F_C0(f,t),THREAD_T0(t),0) = q_t;
C_UDMI(F_C0(f,t),THREAD_T0(t),1) = htc;
}
end_f_loop (f,t)
}

The following error message appears:

Error: rpgetvar: T-ref: undefined variable
Error Object: ()

I have already defined T-ref using
(if (not (rp-var-object ‘T-ref))(rp-var-define ‘T-ref 290 ‘real #f)) in TUI so I think there should be no problems!
I will appreciate if you can help me resolve this problem,
tnx
gearboy is offline   Reply With Quote

Old   August 13, 2012, 15:30
Default
  #3
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by gearboy View Post
That means the scheme variable "T-ref" has not been defined.

I believe the sentence RP_Get_Real("T-ref") is to get the reference temperature, commonly, 298.15K. If the scheme variable is not defined in your system, you can also use
real TT = T_REF;
to get the reference temperature.
Tnx for you reply.
Actually I don't understand you point "if the scheme variable is not defined in yor system".
As you mentioned there is no problem when i write TT=T-ref. But i need to change this value frequently and that's why i have to use rp- var-define.
Is there any solution?
syavash is offline   Reply With Quote

Old   March 15, 2015, 08:20
Default
  #4
New Member
 
yuemeng
Join Date: Oct 2011
Posts: 1
Rep Power: 0
yuemeng is on a distinguished road
Quote:
Originally Posted by syavash View Post
Tnx for you reply.
Actually I don't understand you point "if the scheme variable is not defined in yor system".
As you mentioned there is no problem when i write TT=T-ref. But i need to change this value frequently and that's why i have to use rp- var-define.
Is there any solution?
hi,i has the same problem, can you how you deal with the problem, thanks.
yuemeng is offline   Reply With Quote

Old   March 15, 2015, 16:14
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Have you tried gearboy's recommendation above? Otherwise, you could hard code the reference temperature into your script, T_reference = 298.15; or similar.
`e` is offline   Reply With Quote

Old   March 16, 2015, 10:20
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Worth a try: avoid capital letters in scheme.
So not "T-ref", but "t-ref".
pakk 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
problem to define a baffle mojtaba Siemens 2 January 21, 2008 12:19
ReleaseNotes13 website link problem maka OpenFOAM 2 November 22, 2006 05:32
some problem about "define boudary" ztdep Siemens 4 October 11, 2005 07:57
UDF problem : inlet velocity in cyl. coord. system Jongdae Kim FLUENT 0 June 15, 2004 12:21
Problem on boundry of two phase flow youngan CFX 0 June 30, 2003 03:32


All times are GMT -4. The time now is 03:33.