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

temperature jump code

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

Like Tree1Likes
  • 1 Post By msaeedsadeghi

Reply
 
LinkBack Thread Tools Display Modes
Old   February 13, 2013, 07:00
Angry temperature jump code
  #1
New Member
 
rehan
Join Date: Feb 2013
Posts: 1
Rep Power: 0
KHAN REHAN WASIM is on a distinguished road
I encountered the following error "temperatuejump.c: line 66: coord_coeff: undeclared variable" while solving the problem using the code mention below

/* ================================================== ======
Temperature change at wall boundaries
================================================== ==== */
#include "udf.h" /* must be at the beginning of every UDF */
#include "sg.h" /*must be at the beginning of this UDF */
#include "math.h" /* must be at the beginning of this UDF */

# ifndef SCHEMESIGMASQUARE
# define sigma_square 1.35305239e-19
# endif
# ifndef SCHEMEAMPRESS
# define ambpress 101325
# endif

# ifndef SCHEMETMAC
# define TMAC 1.0
# endif
# ifndef SCHEMEThAC
# define ThAC 1.0
# endif
# ifndef SCHEMESpHR
# define SpHR 1.4

# endif

# ifndef SCHEMEUDRLXCOEFF
# define UDRLXCOEFF 0.02
# endif

# define Boltzmann 1.3806505e-23
# define PI 3.14159265358979323846
# define SQRT_2 1.41421356237309504880

DEFINE_PROFILE(temperature_jump,f_thread,index)
{
real MeanFreePath;
#ifdef SCHEMEMFP
MeanFreePath=RP_Get_Real("meanfreepath");
#endif

#ifdef SCHEMEThAC
real ThAC= 1;
ThAC=RP_Get_Real("thac");
#endif

#ifdef SCHEMEUDRLXCOEFF
real UDRLXCOEFF=O.2;
UDRLXCOEFF=RP_Get_Real("udrlxcoeff");
#endif

#ifdef SCHEMESpHR
real SpHR;
SpHR=RP_Get_Real("sphr");
#endif

face_t face;
cell_t cell;

Thread*c_thread;

real Coeff2[ND_ND];

real Prandtl,gamma,temp,normal;

/* call the routine that computes the transformation coefficients, once per iteration should be enough*/
coord_coeff(f_thread);

/* loops over all faces in the thread passed into the DEFINE macro argument */

begin_f_loop(face,f_thread);

{
cell=F_C0(face,f_thread);
c_thread=THREAD_T0(f_thread);

#ifndef SCHEMEMFP
MeanFreePath = Boltzmann*F_T(face,f_thread)/(sigma_square*(F_P(face,f_thread)+ambpress)* PI*SQRT_2);

#endif

Prandtl=(C_MU_L(cell,c_thread)*C_CP(cell,c_thread) )/C_K_L(cell,c_thread);

ND_SET(Coeff2[0],Coeff2[1],Coeff2[2],
F_UDMI(face,f_thread,3),
F_UDMI(face,f_thread,4),
F_UDMI(face,f_thread,5));

/* evaluate the dT/dn (normal to surface) term in the local coord. system */

normal=NV_DOT(Coeff2,C_T_G(cell,c_thread));

gamma=(2*SpHR)/(SpHR+1);
temp=((2-ThAC)/ThAC)*gamma*
MeanFreePath/Prandtl*normal;
/* in order to set wall temperature a user definedd scalar variahle F_UDSI( ....,0) has to be created (its transport is not important and won't effect ths result)*/

#ifdef UNDERRLX

F_PROFILE(face,f_thread,index)=
F_T(face,f_thread)*(l-UDRLXCOEFF)+
(F_UDSI(face,f_thread,0)+temp);
#else

F_PROFILE(face,f_thread,index)=(F_UDSI(face,f_thre ad,0)+temp);

#endif

}
end_f_loop(f,thread)

}

void coord_coeff(Thread *f_thread)
{
face_t face;
cell_t cell;
Thread *c_thread;
real y[ND_ND];
real u[ND_ND],a;
real A[ND_ND];
real dr0[ND_ND],es[ND_ND],ds,A_by_es;

begin_f_loop(face,f_thread)
{
F_CENTROID(y,face,f_thread);
cell=F_C0(face,f_thread);
c_thread=THREAD_T0(f_thread);

BOUNDARY_FACE_GEOMETRY(face,f_thread,A,ds,es,A_by_ es,dr0);

ND_SET(u[0],u[1],u[2],
C_U(face,f_thread),
C_V(face,f_thread),
C_W(face,f_thread));
a=NV_MAG(u);

ND_SET(F_UDMI(face,f_thread,0),
F_UDMI(face,f_thread,1),
F_UDMI(face,f_thread,2),
NVD_DOT(u,1,0,0)/a,
NVD_DOT(u,0,1,0)/a,
NVD_DOT(u,0,0,1)/a);

ND_SET(F_UDMI(face,f_thread,3),
F_UDMI(face,f_thread,4),
F_UDMI(face,f_thread,5),
NVD_DOT(A,1,0,0)/A_by_es,
NVD_DOT(A,0,1,0)/A_by_es,
NVD_DOT(A,0,0,1)/A_by_es);
}

end_f_loop(face,f_thread)

}

I will be grateful if someone can help in solving the issue
KHAN REHAN WASIM is offline   Reply With Quote

Old   February 14, 2013, 08:07
Default
  #2
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
send this function (void coord_coeff) to top of (DEFINE_PROFILE) function.
I have modeled microchannel flow before
KHAN REHAN WASIM likes this.
msaeedsadeghi is offline   Reply With Quote

Old   May 18, 2013, 05:54
Default
  #3
New Member
 
Soner Isik
Join Date: May 2013
Location: Bursa-Turkey
Posts: 1
Rep Power: 0
Soner_isik is on a distinguished road
Hi Guys

I am trying to use UDF given above for simulating temperature jump in a micro channel. as I understood, 1 user defined scalar and 6 user defined memory units should be allocated before assigning UDF to wall temp. but when I try to use it as thermal BC, fluent gives me Fatal Signal received access violation.what should I do?

please help me
Regards
Soner
Soner_isik is offline   Reply With Quote

Reply

Tags
microchannels, temperature jump

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
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Too low temperature at combustor outlet romekr FLUENT 2 February 6, 2012 11:02
difference of temperature HKH FLUENT 0 January 28, 2010 03:45
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 15:56
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 08:10


All times are GMT -4. The time now is 21:34.