|
[Sponsors] |
June 13, 2009, 14:56 |
Gradient of UDS
|
#1 |
Member
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17 |
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; } |
|
October 22, 2013, 22:16 |
search help
|
#2 |
New Member
liu hongbo
Join Date: Jul 2013
Posts: 5
Rep Power: 13 |
hi, do you have solved the problem about how to get second order graident of UDS,i have the same problem now, and have no way to do it .could you give me some help ?,waiting for your reply,thanks
|
|
December 24, 2013, 01:24 |
|
#3 |
Member
xingangzheng
Join Date: Jul 2009
Posts: 40
Rep Power: 17 |
Dear liu:
Do you have solve this problem? I meet the same problem as yours. thank you |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
reconstruction gradient of a UDS | gemini | Fluent UDF and Scheme Programming | 0 | June 7, 2009 17:03 |
Gradient of UDS | ling | FLUENT | 0 | September 22, 2006 06:50 |
Gradient UDS | tom | FLUENT | 1 | April 28, 2006 04:46 |
UDS gradient | Arek | FLUENT | 0 | July 10, 2000 08:52 |
Gradient of a UDS | Ilkay | FLUENT | 0 | March 8, 2000 14:42 |