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

how to access second derivative of velocity

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By zxaar

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2005, 14:28
Default how to access second derivative of velocity
  #1
Lichun Dong
Guest
 
Posts: n/a
hi, all:

Does anyone knows how to access second derivative of velocity in FLUENT (such like du2/d2x)?

I am thinking about calculating it using first derivative (we can access it in FLUENT). But I can not get the value of a specific cell and its neighbor cell.

Thanks very much

lichun
  Reply With Quote

Old   December 8, 2005, 04:26
Default Re: how to access second derivative of velocity
  #2
RoM
Guest
 
Posts: n/a
I have written an udf that claculates du/dx but i don think its 100% flawless. It uses equation 26.2-7 from the users guide. The calculated values for du/dx are always slightly different from the ones calculated by fluent so i guess the code needs some improvent or maybe fluents solver uses a different approach. You can alter the udf to calculate d2u/dx2 by replacing all C_U with C_DUDX.

Good luck, RoM

DEFINE_ON_DEMAND(calc_dudx)
{
Domain *d;
Thread *ct,*ft;
face_t f;
cell_t c;
int n;
real A[ND_ND],c_cen[ND_ND],f_cen[ND_ND],c_f[ND_ND];
real dudx,u_mean,sign;

d=Get_Domain(1);

thread_loop_c(ct,d)
{
begin_c_loop(c,ct)
{
dudx=0.;
C_CENTROID(c_cen,c,ct);
c_face_loop(c,ct,n)
{
f=C_FACE(c,ct,n);
ft=C_FACE_THREAD(c,ct,n);
F_AREA(A,f,ft);
F_CENTROID(f_cen,f,ft);
NV_VV(c_f,=,f_cen,-,c_cen);
if((NV_DOT(A,c_f)>0) sign = 1.; else sign -1.;
if(BOUNDARY_FACE_THREAD_P(ft))
u_mean=C_U(c,ct);
else
u_mean=0.5*(C_U(F_C0(f,ft),THREAD_T0(ft))+C_U(F_C1 (f,ft),THREAD_T1(ft)));
dudx+=(sign*u_mean*A[0]);
}
dudx/=C_VOLUME(c,ct);
C_UDMI(c,ct,0)=dudx;
}
end_c_loop(c,ct)
}
}
  Reply With Quote

Old   December 8, 2005, 04:34
Default Re: how to access second derivative of velocity
  #3
zxaar
Guest
 
Posts: n/a
fluent restricts these values of derivatives to use in the code, so they are multiplied by a factor alpha, calculated based on venkatakrishanans limiter. The derivatives that you have calculated are unbounded derivatives.

  Reply With Quote

Old   December 8, 2005, 04:50
Default Re: how to access second derivative of velocity
  #4
RoM
Guest
 
Posts: n/a
In my case the calculated values where lower (about 10%) than the ones from fluent. Dou you have ideas why this happens?

RoM
  Reply With Quote

Old   December 8, 2005, 05:59
Default Re: how to access second derivative of velocity
  #5
zxaar
Guest
 
Posts: n/a
I am not sure what exactly happened, but fluents gradient process is bit different, i will outline them for you,
[*] Calculate the gradients with face value taken as mean phi_f = 0.5 * (phi_0 + phi_1), as you have calculated[*] Restrict them, so that the face value calculated by them shall not exceed the local maxima minima, phi_f = phi_0 + grad . (delta r)[*] now calculate the face value as phi_f = 0.5 * (phi_f_0 + phi_f_1), where phi_f_0 = phi_0 + grad_0 . (delta r) and phi_f_1 = phi_1 + grad_1 . (delta r), now calculate the gradients again.

So there will be difference between what you calculate then what fluent does, wise thing is to use them directly, since it will not make the solution blow up
wond likes this.
  Reply With Quote

Old   December 8, 2005, 06:34
Default Re: how to access second derivative of velocity
  #6
RoM
Guest
 
Posts: n/a
Thanks you very much for this explanation. I find the time i will try it out just to see if the difference between the udf and the fluent values will go away.

Btw i had a typo in the source i posted above

"if((NV_DOT(A,c_f)>0) sign = 1.; else sign -1.;" should be "if((NV_DOT(A,c_f)>0)) sign = 1.; else sign =-1.;" , just in case someone trys to compile this mess.

Thanks again, RoM
  Reply With Quote

Old   December 8, 2005, 12:09
Default Re: how to access second derivative of velocity
  #7
Lichun Dong
Guest
 
Posts: n/a
Thanks for your response. really appreciate.

lichun
  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
Problem with assigned inlet velocity profile as a boundary condition Ozgur_ FLUENT 5 August 25, 2015 05:58
How to access mean velocity in LES by UDF sarah_ron2002 FLUENT 5 December 20, 2006 11:44
How to access first derivative of Udmi??? Asghari FLUENT 1 October 23, 2006 07:23
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13


All times are GMT -4. The time now is 00:10.