CFD/FDM in matlab
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.

Quote:

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. 
del this comment

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.

Quote:
I think you use (center or back or forward) difference at boundary. You will referen! 
Quote:
Thanks vanchanh.. 
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. 
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. 
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. 
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. 
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. 
yes, the issue is not simple, some years ago I explained here the problem
http://onlinelibrary.wiley.com/doi/1...d.598/abstract 
All times are GMT 4. The time now is 01:29. 