CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Discretization of advection-diffusion equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 26, 2012, 04:29
Default Discretization of advection-diffusion equation
  #1
Member
 
Thomas Hoffmann
Join Date: Oct 2012
Posts: 67
Rep Power: 14
Thomashoffmann is on a distinguished road
Hi All.
My supervisor told me to write the advection-diffusion equation in discrete form. I have found it carried out in Suhas Patankars Book 'Numerical heat transfer and fluid flow', and I have attached the pages here.
But I can't figure out how he integrated over the control volume and found equation (5.50). Can one of you guys show me how the terms Je, Jw, Jn and Js looks?

Thanks

Thomas
Attached Images
File Type: jpg Capture.jpg (52.9 KB, 32 views)
File Type: png Capture1.PNG (9.3 KB, 7 views)
Thomashoffmann is offline   Reply With Quote

Old   November 26, 2012, 06:40
Default
  #2
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 134
Rep Power: 16
michujo is on a distinguished road
Hi, performing the integration of the flux terms over the control volume you get:
\int_w^e\frac{\partial J_x}{\partial x}dx=\left. J_x\right|_w^e=J_e-J_w.
You just have to evaluate the flux terms at the boundaries of your control volume. So pick up expressions 5.49 (a) and (b) and evaluate them at the west. east, north and south boundaries of your cell.

Does it help?

Cheers.
michujo is offline   Reply With Quote

Old   November 26, 2012, 07:46
Default
  #3
Member
 
Thomas Hoffmann
Join Date: Oct 2012
Posts: 67
Rep Power: 14
Thomashoffmann is on a distinguished road
This far I understand, but I would like to write it out in more details. Would you say the following evaluation is correct?

J_e-J_w=(U_e\phi_e+\frac{\phi_e}{\Delta x})\Delta y-(U_w\phi_w+\frac{\phi_w}{\Delta y})\Delta x

Thanks
Thomashoffmann is offline   Reply With Quote

Old   November 26, 2012, 08:21
Default
  #4
Senior Member
 
Join Date: Dec 2011
Location: Madrid, Spain
Posts: 134
Rep Power: 16
michujo is on a distinguished road
Hi, regarding the convective terms they are correctly formulated. For a staggered grid you have velocity directly available at the cell faces so you already know Ue and Uw. For the value of phi at the cell faces you'll have to use a discretization scheme. For instance if you use and upwind approximation phi_e will be the value of phi at the cell located left to the control cell (for positive Ue) and the value of phi at the control cell (for negative value of Ue, so flow going to the left).

The diffusive terms you wrote are wrong. You have to calculate the gradient at the cell (for example by using a centered scheme based on finite differences). The way you wrote it suggests that diffusive transport is proportional to the value of phi, whereas you know the diffusive flux is proportional to the gradient at that location, right?

Also you can choose to discretize both convective and diffusive terms at once, making use of an analytical expression, by using the exponential, power law or hybrid schemes (remember this is only strictly valid for 1D problems without source terms).

Anyway, all this is thoroughly described in Patankar's so you just have to look it up.

Cheers.
michujo is offline   Reply With Quote

Old   November 26, 2012, 08:45
Default
  #5
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
Yes your gradient term is not right. Lets assume you interpolate correctly for \phi_e and you are using a non staggered grid. Then

J_e=\left(U_e\phi_e +\frac{\phi_E -\phi_P}{\Delta x}\right)\Delta y

Where e refers to the east integration point P refers to the cell centre and E refers to the neighbour to the east. Hope that helps.
cdegroot is offline   Reply With Quote

Old   November 26, 2012, 09:22
Default
  #6
Member
 
Thomas Hoffmann
Join Date: Oct 2012
Posts: 67
Rep Power: 14
Thomashoffmann is on a distinguished road
Thanks guys.
Thomashoffmann is offline   Reply With Quote

Old   March 28, 2013, 01:27
Default Advection term
  #7
tgb
New Member
 
tgb
Join Date: Feb 2013
Posts: 1
Rep Power: 0
tgb is on a distinguished road
Hi all,

I wrote code in Matlab but my advection term doesn't work.
I used FDM method, could u please help me.

It is said "Attempted to access q(37.95); index must be a positive integer or logical."
Probably, it is a parenthesis mistake, but i can't figure out, I am stuck here.
Could u please send me the original advection term for FDM?

In the class, we used adv as d(uu)/dx+d(uv)/dy in the x-dir and d(vu)/dx+d(vv)/dy in y-dir.

Please help!!!!!!



ad(iu(i,j))=((0.5.*(q(iu(i+1,j))+q(iu(i,j))))^2-(0.5.*(q(iu(i,j))+q(iu(i-1,j))))^2)/dx ...
+(0.25.*(q(iu(i,j+1))+q(iu(i,j))).*(q(iv(i,j+1)) + q(iv(i-1,j+1))) ...
-0.25.*(q(iu(i,j)+q(iu(i,j-1))).*(q(iv(i,j))+q(iv(i-1,j)))))/dy;
tgb is offline   Reply With Quote

Old   March 28, 2013, 08:36
Default
  #8
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
Quote:
Originally Posted by tgb View Post
Hi all,

I wrote code in Matlab but my advection term doesn't work.
I used FDM method, could u please help me.

It is said "Attempted to access q(37.95); index must be a positive integer or logical."
Probably, it is a parenthesis mistake, but i can't figure out, I am stuck here.
Could u please send me the original advection term for FDM?

In the class, we used adv as d(uu)/dx+d(uv)/dy in the x-dir and d(vu)/dx+d(vv)/dy in y-dir.

Please help!!!!!!



ad(iu(i,j))=((0.5.*(q(iu(i+1,j))+q(iu(i,j))))^2-(0.5.*(q(iu(i,j))+q(iu(i-1,j))))^2)/dx ...
+(0.25.*(q(iu(i,j+1))+q(iu(i,j))).*(q(iv(i,j+1)) + q(iv(i-1,j+1))) ...
-0.25.*(q(iu(i,j)+q(iu(i,j-1))).*(q(iv(i,j))+q(iv(i-1,j)))))/dy;
Well, the error is pretty clear. You are trying to use a real number (37.95) as an index to an array. My guess is that either iu or iv contains real numbers somewhere. What is the purpose of iu and iv? How do you define them?
cdegroot is offline   Reply With Quote

Old   March 28, 2013, 08:58
Default
  #9
Senior Member
 
andy
Join Date: May 2009
Posts: 327
Rep Power: 18
andy_ is on a distinguished road
Not sure if this thread is still alive but in response to the OP it is conventional to subtract phi_p * Continuity from the RHS in order for the coefficients to be in a more convenient form. Continuity of course should be zero. (Apologies if it says this in attached figure but it is too small for me to read.)
andy_ 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
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
Spectral Element DG and the Convection Diffusion Equation sspatelccny Main CFD Forum 0 June 30, 2012 18:35
WENO Code (1D Advection Equation) Carolyn Main CFD Forum 6 March 11, 2007 14:21
transport (advection) equation DJ Main CFD Forum 0 February 21, 2005 12:18


All times are GMT -4. The time now is 07:17.