CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > 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 Search this Thread 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: 226
Rep Power: 14
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, 06: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

Old   May 28, 2016, 07:02
Default
  #4
New Member
 
Pengwei Chen
Join Date: May 2016
Posts: 8
Rep Power: 9
MichaelChan is on a distinguished road
Quote:
Originally Posted by Soner_isik View Post
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
I don't know how to use F_UDSI for temperature.
Could you help me?
Thx in advance
MichaelChan is offline   Reply With Quote

Old   January 17, 2021, 00:03
Default
  #5
New Member
 
zhangdongjie
Join Date: Jan 2021
Posts: 22
Rep Power: 5
zhangdongjie is on a distinguished road
Quote:
Originally Posted by msaeedsadeghi View Post
send this function (void coord_coeff) to top of (DEFINE_PROFILE) function.
I have modeled microchannel flow before
Hello, I'm studying wall slip and temperature jump. Would you please send me a UDF? Thank you very much. In addition, where is the temperature jump UDF loaded? Is it on the wall temperature?thanks。
zhangdongjie is offline   Reply With Quote

Old   January 17, 2021, 02:50
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by zhangdongjie View Post
Hello, I'm studying wall slip and temperature jump. Would you please send me a UDF? Thank you very much. In addition, where is the temperature jump UDF loaded? Is it on the wall temperature?thanks。
1. The UDF is shown in the first post.
2. You don't need this UDF (anymore), just use pressure based over and use low - pressure - boundary - slip. It has temperature jump, read the manual.
pakk is offline   Reply With Quote

Old   January 17, 2021, 03:08
Default
  #7
New Member
 
zhangdongjie
Join Date: Jan 2021
Posts: 22
Rep Power: 5
zhangdongjie is on a distinguished road
Quote:
Originally Posted by pakk View Post
1. The UDF is shown in the first post.
2. You don't need this UDF (anymore), just use pressure based over and use low - pressure - boundary - slip. It has temperature jump, read the manual.

Thank you very much for your reply. Low - pressure - Boundary - slip is only applicable to "pressure based", but I am based on "density based". When I choose "density based" instead of "pressure based". "Low pressure boundary slip" is not available. That's why I choose to use UDF, but I don't know where to load UDF with temperature jump?
zhangdongjie is offline   Reply With Quote

Old   January 17, 2021, 05:24
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by zhangdongjie View Post
Thank you very much for your reply. Low - pressure - Boundary - slip is only applicable to "pressure based", but I am based on "density based". When I choose "density based" instead of "pressure based". "Low pressure boundary slip" is not available. That's why I choose to use UDF, but I don't know where to load UDF with temperature jump?
Solution is extremely simple: don't use density-based!
pakk is offline   Reply With Quote

Old   January 17, 2021, 05:46
Default
  #9
New Member
 
zhangdongjie
Join Date: Jan 2021
Posts: 22
Rep Power: 5
zhangdongjie is on a distinguished road
Quote:
Originally Posted by pakk View Post
Solution is extremely simple: don't use density-based!
This is a very good method, but my simulated Mach number is more than 3. If you use "pressure based", it may not be very accurate
zhangdongjie is offline   Reply With Quote

Old   January 17, 2021, 08:28
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Modern pressure-based methods such as implemented in Fluent can do reasonably well with high Mach numbers, there is some benchmarking study in the manual.
pakk is offline   Reply With Quote

Reply

Tags
microchannels, temperature jump

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
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 16:56
What is the Better Way to Do CFD? John C. Chien Main CFD Forum 54 April 23, 2001 09:10


All times are GMT -4. The time now is 09:45.