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

Problem of SOURCE term gradient in UDS

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2009, 10:11
Wink Problem of SOURCE term gradient in UDS
  #1
New Member
 
Join Date: Dec 2009
Posts: 6
Rep Power: 17
wind is on a distinguished road
Dear all,
I meet problems of defining source term in UDS. I want to solve a UDS, and the scalar equation has four terms. Beside the unsteady term, the convective term, the diffusion term, and a extra term expressed as -ə(Aφ)/əxi is left, where φ is the unknown variable to be solved, A is the constant. My questions are:

1. whether the extra term -ə(Aφ)/əxi could be treated as the source term of UDS?

2. If so, how to give the source and ds[eqn] in UDF?

source= -A*(C_UDSI_G(c,t,0)[0]+C_UDSI_G(c,t,0)[1]+C_UDSI_G(c,t,0)[2]); /*is it right?*/
dS[eqn] = ?;

thanks!
wind is offline   Reply With Quote

Old   March 2, 2010, 02:58
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by wind View Post
Dear all,
I meet problems of defining source term in UDS. I want to solve a UDS, and the scalar equation has four terms. Beside the unsteady term, the convective term, the diffusion term, and a extra term expressed as -ə(Aφ)/əxi is left, where φ is the unknown variable to be solved, A is the constant. My questions are:

1. whether the extra term -ə(Aφ)/əxi could be treated as the source term of UDS?

2. If so, how to give the source and ds[eqn] in UDF?

source= -A*(C_UDSI_G(c,t,0)[0]+C_UDSI_G(c,t,0)[1]+C_UDSI_G(c,t,0)[2]); /*is it right?*/
dS[eqn] = ?;

thanks!
You can put this item into the convection term. The convection term then becomes:
ə[(rho*Ui+A)φ]/əxi
You should write the UDS flux "rho*Ui+A" in your udf.


gearboy is offline   Reply With Quote

Old   March 4, 2010, 07:32
Default
  #3
New Member
 
Join Date: Dec 2009
Posts: 6
Rep Power: 17
wind is on a distinguished road
Quote:
Originally Posted by gearboy View Post
You can put this item into the convection term. The convection term then becomes:
ə[(rho*Ui+A)φ]/əxi
You should write the UDS flux "rho*Ui+A" in your udf.

Dear gearboy, thank you very much for your reply, and I will try it. Could you kindly give me your email? so that I could contact you directly. thank you!
wind is offline   Reply With Quote

Old   March 8, 2010, 03:51
Default
  #4
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by wind View Post
Dear gearboy, thank you very much for your reply, and I will try it. Could you kindly give me your email? so that I could contact you directly. thank you!
I will visit this forum frequently. Just show your problem on this forum.
gearboy is offline   Reply With Quote

Old   March 11, 2010, 08:50
Default
  #5
New Member
 
Join Date: Dec 2009
Posts: 6
Rep Power: 17
wind is on a distinguished road
Quote:
Originally Posted by gearboy View Post
I will visit this forum frequently. Just show your problem on this forum.
Deat Gearboy,
Could you help me check whether the following UDS especially for the convective term is right? thanks!

if the equation is expressed as below:
--------------------------------------------
əφ/ət+uj əφuj/əxj- ə[mu(əφ/əxj]/əxj = -əAφ/əx3
--------------------------------------------

UDF according to Fluent help:

#include "udf.h"
static real A_constant= 0.20;

DEFINE_UDS_FLUX(Vf_uds_flux, f, t, i)
{
cell_t c0, c1 = -1;
Thread *t0, *t1 = NULL;

real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0;
real dens;

c0 = F_C0(f,t);
t0 = F_C0_THREAD(f,t);
F_AREA(A, f, t);

/* If face lies at domain boundary, use face values; */
/* If face lies IN the domain, use average of adjacent cells. */

if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/
{

if (NNULLP(THREAD_STORAGE(t,SV_DENSITY)))
dens = F_R(f,t); /* Set dens to face value if available */
else
dens = C_R(c0,t0); /* else, set dens to cell value */

NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t)+A_constant, *, dens);

if (ND_ND==2) /*for 2D simulation*/
psi_vec[1]=psi_vec[1];
else if (ND_ND==3) /*for 3D simulation*/
psi_vec[2]=psi_vec[2];

flux = NV_DOT(psi_vec, A); /* flux through Face */
}
else
{
c1 = F_C1(f,t); /* Get cell on other side of face */
t1 = F_C1_THREAD(f,t);

NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0)+A_constant,*,C_R( c0,t0));
NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1)+A_constant,*,C_R( c1,t1));

if (ND_ND==2)
psi_vec[1]=psi_vec[1];
else if (ND_ND==3)
psi_vec[2]=psi_vec[2];

flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */
}

return flux;
}


DEFINE_UDS_UNSTEADY(Vf_uns_time, c, t, i, apu, su)
{
real physical_dt, vol, rho, phi_old;
physical_dt = RP_Get_Real("physical-time-step");
vol = C_VOLUME(c,t);

rho = C_R_M1(c,t);
*apu = -air_density*vol / physical_dt; /*implicit part*/
phi_old = C_STORAGE_R(c,t,SV_UDSI_M1(i));
*su = air_density*vol*phi_old/physical_dt; /*explicit part*/

}


DEFINE_DIFFUSIVITY(Vf_diffusivity, c, t, i)
{

return C_MU_T(c,t); /*turbulent viscosity*/

}

DEFINE_SOURCE(Vf_source, c, t, dS, eqn)
{
dS[eqn] = 0;
return 0;
}
wind is offline   Reply With Quote

Old   June 21, 2013, 06:39
Default
  #6
Member
 
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 13
yashganatra is on a distinguished road
Hi,

I have a similar problem. The energy equation in FLUENT is in form of enthalpy h and I want to solve it in terms of temperature. So i need to define a UDS.
The equation goes as:

∂ρT/∂T+ ∇(ρuT)= ∇(k∇T)+ ∂/∂t(ρ(lfrac)∆H+ ∇(ρu∆H)

the scalar variable is temperature.

u- velocity;
The last two terms are the source terms and i can use DEFINE_SOURCE, but they are not dependent on T, so can i include them? In the above thread the source term was dependent on 'phi'

Thanks
Yash
yashganatra is offline   Reply With Quote

Old   December 1, 2022, 15:21
Default
  #7
New Member
 
ahmed halabe
Join Date: Nov 2013
Posts: 2
Rep Power: 0
ahmedcfd2013 is on a distinguished road
Quote:
Originally Posted by yashganatra View Post
Hi,

I have a similar problem. The energy equation in FLUENT is in form of enthalpy h and I want to solve it in terms of temperature. So i need to define a UDS.
The equation goes as:

∂ρT/∂T+ ∇(ρuT)= ∇(k∇T)+ ∂/∂t(ρ(lfrac)∆H+ ∇(ρu∆H)

the scalar variable is temperature.

u- velocity;
The last two terms are the source terms and i can use DEFINE_SOURCE, but they are not dependent on T, so can i include them? In the above thread the source term was dependent on 'phi'

Thanks
Yash
Dir Yash Ganatra;
did you find a solution
ahmedcfd2013 is offline   Reply With Quote

Reply

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
gradient source term UDF ak6g08 Fluent UDF and Scheme Programming 0 July 9, 2009 07:37
a problem of the scalar source term (sorsca.f) josephlo Siemens 0 July 15, 2007 02:21
The source term of UDF summer FLUENT 0 August 24, 2006 18:44
problem with pump as source term hari FLUENT 1 September 19, 2005 12:38
pressure gradient term in low speed flow Atit Koonsrisuk Main CFD Forum 2 January 10, 2002 11:52


All times are GMT -4. The time now is 13:24.