|
[Sponsors] | |||||
|
|
|
#1 |
|
Member
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 6 ![]() |
Hi everyone,
I want to calculate the gradient of a UDS by using Green Gauss theorem using cell based approximation for face values of UDS. Below you can see the corresponding c code. However i created a simple test case which contains a square domain (in which UDS solved using dirichlet type BCs) and test whether my gradient function and C_UDSI_G(c, t, uds_no) gives the same values. The result is that my function gives totally different and unrealistic gradient values while C_UDSI_G gives correct values, So anybody can help me to correct the code below: I used both uniform and nonuniform structured grids. thanks so much Code:
real evaluate_gradient(cell_t c, Thread *t, int i_uds, real *x_vec, real *y_vec, real *z_vec)
{
int n;
face_t f;
Thread *tf;
Thread *t0, *t1;
cell_t c0, c1;
real A[ND_ND];
real grad_phi[ND_ND];
ND_SET(grad_phi[0],grad_phi[1],grad_phi[2],0.0,0.0,0.0);
c_face_loop(c, t, n)
{
f = C_FACE(c,t,n);
tf = C_FACE_THREAD(c,t,n);
c0 = F_C0(f,tf);
t0 = THREAD_T0(tf);
if (!BOUNDARY_FACE_THREAD_P(tf))
{
c1=F_C1(f,tf);
t1=THREAD_T1(tf);
}
else
{
c1=-1;
t1=NULL;
}
F_AREA(A,f,tf);
if (!BOUNDARY_FACE_THREAD_P(tf))
NV_V_VS(grad_phi,=,grad_phi,+,A,*,(0.5*(C_UDSI(c0,t0,i_uds)+C_UDSI(c1,t1,i_uds))));
else
NV_V_VS(grad_phi,=,grad_phi,+,A,*,C_UDSI(c0,t0,i_uds));
}
*x_vec = grad_phi[0]/C_VOLUME(c,t);
*y_vec = grad_phi[1]/C_VOLUME(c,t);
*z_vec = grad_phi[2]/C_VOLUME(c,t);
return 0.0;
}
|
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| reconstruction gradient of a UDS | gemini | Fluent UDF and Scheme Programming | 0 | June 7, 2009 16:03 |
| Gradient of UDS | ling | FLUENT | 0 | September 22, 2006 05:50 |
| Gradient UDS | tom | FLUENT | 1 | April 28, 2006 03:46 |
| UDS gradient | Arek | FLUENT | 0 | July 10, 2000 07:52 |
| Gradient of a UDS | Ilkay | FLUENT | 0 | March 8, 2000 13:42 |