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

CFD/FDM in matlab

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 29, 2012, 22:12
Smile CFD/FDM in matlab
  #1
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 13
ckwollongong is on a distinguished road
How to apply dirichlet pressure boundaries for FDM 2D flow problem in MATLAB? My flow is pressure driven with known inlet and outlet pressures. I should calculate velocities at inlet and outlet with time. Initial velocities are zero. No slip boundaries are assumed.
ckwollongong is offline   Reply With Quote

Old   July 30, 2012, 01:00
Default
  #2
New Member
 
Join Date: Mar 2012
Posts: 6
Rep Power: 14
vanchanh123 is on a distinguished road
Quote:
Originally Posted by ckwollongong View Post
How to apply dirichlet pressure boundaries for FDM 2D flow problem in MATLAB? My flow is pressure driven with known inlet and outlet pressures. I should calculate velocities at inlet and outlet with time. Initial velocities are zero. No slip boundaries are assumed.
You can explain about the equations which use to simulation that phenomenon!
vanchanh123 is offline   Reply With Quote

Old   July 30, 2012, 20:08
Default
  #3
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 13
ckwollongong is on a distinguished road
Thanks vanchanh, its navier stokes equations. I followed the fractional step example here to develop pressure driven flow. This is driven cavity problem.

http://www.google.com.au/url?sa=t&rc...BVs6Y2d5hlLXiQ

when pressure is assigned to cell centers, I don't have a point to apply the pressure boundary conditions since the boundary points are never refered in calculations.
ckwollongong is offline   Reply With Quote

Old   July 30, 2012, 21:47
Default
  #4
New Member
 
Join Date: Mar 2012
Posts: 6
Rep Power: 14
vanchanh123 is on a distinguished road
del this comment

Last edited by vanchanh123; July 30, 2012 at 22:06.
vanchanh123 is offline   Reply With Quote

Old   July 30, 2012, 21:52
Default
  #5
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 13
ckwollongong is on a distinguished road
Because flow is driven by the pressure. A constant pressure is given to one end of a pipe and the other end is say zero pressure when open. Then those two pressure boundaries are constant always and should be accounted.
ckwollongong is offline   Reply With Quote

Old   July 30, 2012, 22:32
Default
  #6
New Member
 
Join Date: Mar 2012
Posts: 6
Rep Power: 14
vanchanh123 is on a distinguished road
Quote:
Originally Posted by ckwollongong View Post
Thanks vanchanh, its navier stokes equations. I followed the fractional step example here to develop pressure driven flow. This is driven cavity problem.

http://www.google.com.au/url?sa=t&rc...BVs6Y2d5hlLXiQ

when pressure is assigned to cell centers, I don't have a point to apply the pressure boundary conditions since the boundary points are never refered in calculations.
Sorry, I mistake.

I think you use (center or back or forward) difference at boundary. You will referen!
vanchanh123 is offline   Reply With Quote

Old   July 31, 2012, 00:02
Default
  #7
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 13
ckwollongong is on a distinguished road
Quote:
Originally Posted by vanchanh123 View Post
Sorry, I mistake.

I think you use (center or back or forward) difference at boundary. You will referen!

Thanks vanchanh..
ckwollongong is offline   Reply With Quote

Old   July 31, 2012, 10:16
Default
  #8
Senior Member
 
Join Date: Aug 2011
Posts: 272
Rep Power: 15
leflix is on a distinguished road
Quote:
Originally Posted by ckwollongong View Post
Because flow is driven by the pressure. A constant pressure is given to one end of a pipe and the other end is say zero pressure when open. Then those two pressure boundaries are constant always and should be accounted.
Hi ckwollongong

with the type of coupling algorithm you use to compute the pressure (chorin algorithm) usual boundary conditions for pressure are neumann BC.
In fact theonly thing you have to account in your poisson solver is to impose
P(0,J) = P(1,J) point I=0 being on the boundary.

To account for the pressure drop in your problem,you should calculate what is the mass flow rate which would be induced by this pressure drop, and then impose this mass flow rate. But it can be done only in a rectangular channel or in pipe. In other complex geometries you do not have such easy analytical relationship between pressure drop and mass flow rate.

But you can always try to impose dirichlet boundary condition in your poisson solver whith
P(0,J) = Pinlet
P(NI,J)=Poutlet

but I am afraid an inconsistency between this pressure BC and the velocity BC on the inlet and outlet may occur due tothis prescription following the chorin algorithm.
leflix is offline   Reply With Quote

Old   July 31, 2012, 19:51
Default
  #9
New Member
 
Join Date: Jul 2012
Posts: 10
Rep Power: 13
ckwollongong is on a distinguished road
Thanks leflix,
I understood imposing pressure boundaries to the first and last rows of pressure matrix. Here the velocities do not have boundary conditions at the inlet and outlet. Only no slip at walls. Inlet outlet velocities should be adjusted with time. So do you think there will still be inconsistencies?

My flow domain is rectangular duct with larger length and width compared to its height. Thanks again.

Last edited by ckwollongong; July 31, 2012 at 21:08.
ckwollongong is offline   Reply With Quote

Old   August 1, 2012, 05:24
Default
  #10
Senior Member
 
Join Date: Aug 2011
Posts: 272
Rep Power: 15
leflix is on a distinguished road
Quote:
Originally Posted by ckwollongong View Post
Here the velocities do not have boundary conditions at the inlet and outlet. Only no slip at walls. Inlet outlet velocities should be adjusted with time. So do you think there will still be inconsistencies?
You need boundary conditions for every boundaries of your domain and for every variables. In your case, at I=0 inlet is required and at I=NI you must provide an outlet BC.
for I=0 you would need the mass flow rate that you can deduce from the pressure drop. As you are in the case of rectangular duct (Poiseuille flow) there exist an analytical relationship between the both. You should impose a parabolic profile at inlet. The maximum velocity on the axe is also related to the pressure drop.
At outlet use neumann boundary condition for the velocity corrected by the ratio between the mass flow rate at inlet and the mass flow rate at outlet.
More sophisticated boundary conditions for outlet are available in the litterature,but the previous one is a good starting point for moderate Reynolds.

The inconsistency I was speaking about was between the BC for the velocity and the BC for the pressure. In the case of the projection method or Chorin algorithm that you use, some authors (Peyret,Temam,Guermond,...) have indicated that a relationship between BC for pressure and velocity exists andmust be fulfilled.
When U.n=0 it leads to dp/dn=0,but in the case of inlet and outlet BC U.n is not anymore equal to zero.
So for no slip BC use indeed neumann BC for the pressure. With inlet and outlet it may become a bit tricky.
Some authors have used such boundary conditionfor pressure: dp/dn= (1/Re)(LapU).n
where Lap is the lapacian operator
You can try this.
leflix is offline   Reply With Quote

Old   August 1, 2012, 05:39
Default
  #11
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
the Chorin's projection method requires only one boundary condition in the projection step. That is, using the Hodge decomposition of the intermediate velocity field:

V* = Vn+1 + grad Phi

you derive the Poisson (pressure) equation

Div (Grad Phi) = Div (V*)

with BCs

n.V* = n. Vn+1 + d Phi/ dn

Therefore,

d Phi/ dn = n. ( V* - Vn+1)

and in the LHS you can insert your know pressure value for inlet and outlet. Be careful that the RHS must be somehow set to satisfy the continuity constraint
Div Vn+1 = 0

as well as the compatibility relation that ensures you have a solution of the Poisson problem (apart a constant, but you are fixing a value).

You must check that the continuity equation is satisfied in each cell at the end of the step.
FMDenaro is offline   Reply With Quote

Old   August 1, 2012, 05:57
Default
  #12
Senior Member
 
Join Date: Aug 2011
Posts: 272
Rep Power: 15
leflix is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post


Therefore,

d Phi/ dn = n. ( V* - Vn+1)

and in the LHS you can insert your know pressure value for inlet and outlet.
Inserting the expected pressure at inlet and at outlet in the previous expression won't help as ckwollongong is seeking for a boundary condition for pressure not for velocity

in the case where V.n=0 the previous expression leads to a boundary condition for pressure which is dPhi/dn=0

in the case where V.n is not zero as in the case of inlet and outlet.
the previous expression can not be taken as a BC for pressure.
except if you assume that BC for intermediate velocity V*, is the same than for V velocity.
Some people do that and it may work for moderate Reynolds. For higher Reynolds number dp/dn= (1/Re)(LapU).n has shown better accuracy.
leflix is offline   Reply With Quote

Old   August 1, 2012, 06:22
Default
  #13
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
yes, the issue is not simple, some years ago I explained here the problem

http://onlinelibrary.wiley.com/doi/1...d.598/abstract
FMDenaro is offline   Reply With Quote

Reply

Tags
fdm, matlab, pressure bc


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
How to start Fluent with Matlab?? Jay Hu FLUENT 8 November 9, 2022 06:30
Export/Import data contour plots with Matlab meangreen FLUENT 11 October 28, 2020 10:06
OpenFOAM command from inside MATLAB sega OpenFOAM Post-Processing 18 September 25, 2012 07:35
Live connection Matlab VS OF levka OpenFOAM Running, Solving & CFD 0 July 10, 2012 04:15
2-D Euler Solver for compressible flow in Matlab Volkan Main CFD Forum 1 October 28, 2007 01:40


All times are GMT -4. The time now is 19:45.