Problem of SOURCE term gradient in UDS
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! 
Quote:
ə[(rho*Ui+A)φ]/əxi You should write the UDS flux "rho*Ui+A" in your udf. 
Quote:

Quote:

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("physicaltimestep"); 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; } 
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 
All times are GMT 4. The time now is 07:01. 