CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   CFD/FDM in matlab (http://www.cfd-online.com/Forums/main/105389-cfd-fdm-matlab.html)

ckwollongong July 29, 2012 22:12

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.

vanchanh123 July 30, 2012 01:00

Quote:

Originally Posted by ckwollongong (Post 374240)
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!

ckwollongong July 30, 2012 20:08

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.

vanchanh123 July 30, 2012 21:47

del this comment

ckwollongong July 30, 2012 21:52

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.

vanchanh123 July 30, 2012 22:32

Quote:

Originally Posted by ckwollongong (Post 374436)
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!

ckwollongong July 31, 2012 00:02

Quote:

Originally Posted by vanchanh123 (Post 374449)
Sorry, I mistake.

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


Thanks vanchanh..

leflix July 31, 2012 10:16

Quote:

Originally Posted by ckwollongong (Post 374446)
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.

ckwollongong July 31, 2012 19:51

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.

leflix August 1, 2012 05:24

Quote:

Originally Posted by ckwollongong (Post 374701)
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.

FMDenaro August 1, 2012 05:39

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.

leflix August 1, 2012 05:57

Quote:

Originally Posted by FMDenaro (Post 374778)


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.

FMDenaro August 1, 2012 06:22

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 09:08.