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

Gradient of UDS

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gemini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2009, 14:56
Unhappy Gradient of UDS
  #1
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
gemini is on a distinguished road
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;
}
DaveD! likes this.
gemini is offline   Reply With Quote

Old   October 22, 2013, 22:16
Default search help
  #2
New Member
 
liu hongbo
Join Date: Jul 2013
Posts: 5
Rep Power: 13
biker is on a distinguished road
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
biker is offline   Reply With Quote

Old   December 24, 2013, 01:24
Default
  #3
Member
 
xingangzheng
Join Date: Jul 2009
Posts: 40
Rep Power: 17
ustbdynamic is on a distinguished road
Dear liu:
Do you have solve this problem?
I meet the same problem as yours.
thank you


Quote:
Originally Posted by biker View Post
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
ustbdynamic is offline   Reply With Quote

Reply


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
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


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