
[Sponsors] 
July 29, 2012, 22:12 
CFD/FDM in matlab

#1 
New Member
Join Date: Jul 2012
Posts: 10
Rep Power: 5 
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.


July 30, 2012, 01:00 

#2  
New Member
Join Date: Mar 2012
Posts: 6
Rep Power: 5 
Quote:


July 30, 2012, 20:08 

#3 
New Member
Join Date: Jul 2012
Posts: 10
Rep Power: 5 
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. 

July 30, 2012, 21:47 

#4 
New Member
Join Date: Mar 2012
Posts: 6
Rep Power: 5 
del this comment
Last edited by vanchanh123; July 30, 2012 at 22:06. 

July 30, 2012, 21:52 

#5 
New Member
Join Date: Jul 2012
Posts: 10
Rep Power: 5 
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.


July 30, 2012, 22:32 

#6  
New Member
Join Date: Mar 2012
Posts: 6
Rep Power: 5 
Quote:
I think you use (center or back or forward) difference at boundary. You will referen! 

July 31, 2012, 00:02 

#7 
New Member
Join Date: Jul 2012
Posts: 10
Rep Power: 5 

July 31, 2012, 10:16 

#8  
Senior Member
Join Date: Aug 2011
Posts: 251
Rep Power: 6 
Quote:
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. 

July 31, 2012, 19:51 

#9 
New Member
Join Date: Jul 2012
Posts: 10
Rep Power: 5 
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. 

August 1, 2012, 05:24 

#10  
Senior Member
Join Date: Aug 2011
Posts: 251
Rep Power: 6 
Quote:
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. 

August 1, 2012, 05:39 

#11 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,642
Rep Power: 23 
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. 

August 1, 2012, 05:57 

#12  
Senior Member
Join Date: Aug 2011
Posts: 251
Rep Power: 6 
Quote:
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. 

August 1, 2012, 06:22 

#13 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,642
Rep Power: 23 
yes, the issue is not simple, some years ago I explained here the problem
http://onlinelibrary.wiley.com/doi/1...d.598/abstract 

Tags 
fdm, matlab, pressure bc 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to start Fluent with Matlab??  Jay Hu  FLUENT  5  October 9, 2013 14:20 
OpenFOAM command from inside MATLAB  sega  OpenFOAM PostProcessing  18  September 25, 2012 07:35 
Export/Import data contour plots with Matlab  meangreen  FLUENT  3  August 21, 2012 01:28 
Live connection Matlab VS OF  levka  OpenFOAM Running, Solving & CFD  0  July 10, 2012 04:15 
2D Euler Solver for compressible flow in Matlab  Volkan  Main CFD Forum  1  October 28, 2007 01:40 