|
[Sponsors] |
December 4, 2009, 10:11 |
Problem of SOURCE term gradient in UDS
|
#1 |
New Member
Join Date: Dec 2009
Posts: 6
Rep Power: 17 |
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! |
|
March 2, 2010, 02:58 |
|
#2 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Quote:
ə[(rho*Ui+A)φ]/əxi You should write the UDS flux "rho*Ui+A" in your udf. |
||
March 4, 2010, 07:32 |
|
#3 |
New Member
Join Date: Dec 2009
Posts: 6
Rep Power: 17 |
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!
|
|
March 8, 2010, 03:51 |
|
#4 |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
||
March 11, 2010, 08:50 |
|
#5 | |
New Member
Join Date: Dec 2009
Posts: 6
Rep Power: 17 |
Quote:
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; } |
||
June 21, 2013, 06:39 |
|
#6 |
Member
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 13 |
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 |
|
December 1, 2022, 15:21 |
|
#7 | |
New Member
ahmed halabe
Join Date: Nov 2013
Posts: 2
Rep Power: 0 |
Quote:
did you find a solution |
||
|
|
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 |