# Advice regarding algorithm for solution of discretised equations in compressible flow

 Register Blogs Members List Search Today's Posts Mark Forums Read

 January 18, 2018, 08:11 Advice regarding algorithm for solution of discretised equations in compressible flow #1 Member   Join Date: Jan 2018 Posts: 31 Rep Power: 6 Hello all, I have recently began working with the Finite Volume Method, trying to solve a 1D pipe flow problem assuming compressible flow. The boundary conditions in this case are known values of all variables on one side and on the other the derivatives of all variables are zero. My question concerns the algorithm for solving the discretized equations in such a case. When I first derived the equations I considered a possible approach as:1) Assuming densities in all control volumes, 2) Solving the continuity equation to obtain velocities, 3) Solving the momentum equation to obtain pressure, 4) Solving the energy equation to obtain enthalpy, 5) Solving the equation of state to obtain new densities from the calculated pressure and enthalpy, 6) Taking the new densities into a new iteration (with a relaxation factor) until convergence.The algorithm I described gave me reasonable results for 1D gas flow which were comparable to some other references. However, after reviewing some literature in this field (Ferziger,Perić) the algorithms for solving compressible flow are different, relying on correction equations (like for incompressible flows) etc. At this point I would like to ask if there is something inherently wrong with how I imagined the algorithm to proceed, or are the "standard" algorithms just another way of solving these equations and are perhaps quicker/more robust/... but in principle give the same solution? I would be thankful for any sort of input from persons who might have any experience handling problems like this.

January 18, 2018, 08:15
#2
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,038
Rep Power: 64
Quote:
 Originally Posted by lorbekl Hello all, I have recently began working with the Finite Volume Method, trying to solve a 1D pipe flow problem assuming compressible flow. The boundary conditions in this case are known values of all variables on one side and on the other the derivatives of all variables are zero. My question concerns the algorithm for solving the discretized equations in such a case. When I first derived the equations I considered a possible approach as:1) Assuming densities in all control volumes, 2) Solving the continuity equation to obtain velocities, 3) Solving the momentum equation to obtain pressure, 4) Solving the energy equation to obtain enthalpy, 5) Solving the equation of state to obtain new densities from the calculated pressure and enthalpy, 6) Taking the new densities into a new iteration (with a relaxation factor) until convergence.The algorithm I described gave me reasonable results for 1D gas flow which were comparable to some other references. However, after reviewing some literature in this field (Ferziger,Perić) the algorithms for solving compressible flow are different, relying on correction equations (like for incompressible flows) etc. At this point I would like to ask if there is something inherently wrong with how I imagined the algorithm to proceed, or are the "standard" algorithms just another way of solving these equations and are perhaps quicker/more robust/... but in principle give the same solution? I would be thankful for any sort of input from persons who might have any experience handling problems like this.

Just a couple of doubts:

- are you solving only for supersonic inflow
- are you considering viscous or inviscid model?

 January 18, 2018, 08:27 #3 Member   Join Date: Jan 2018 Posts: 31 Rep Power: 6 - The flow is subsonic - Because I did not assume a velocity profile I model the change in pressure only through the darcy-weisbach equation (which I think includes both viscous and wall friction losses) and not with the div(Tau) term.

 January 18, 2018, 08:36 #4 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,038 Rep Power: 64 Your bc.s are wrong for subsonic conditions

 January 18, 2018, 08:40 #5 Member   Join Date: Jan 2018 Posts: 31 Rep Power: 6 How so? Would it be possible to elaborate this a little more? Perhaps I would also add that while the inlet is subsonic, the expected outlet conditions could approach Ma=1

 January 18, 2018, 10:19 #6 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,038 Rep Power: 64 The information travels in the domain according to the directions dictated by the slopes of the characteristic lines of the Euler system. For subsonic flows you have one direction coming from the interior of the domain moshe likes this.

January 18, 2018, 16:36
#7
Senior Member

Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,784
Rep Power: 56
Quote:
 Originally Posted by lorbekl 1) Assuming densities in all control volumes, 2) Solving the continuity equation to obtain velocities,3) Solving the momentum equation to obtain pressure

In general, the continuity equation is a scalar equation, you can't simply solve for a vector quantity. In layman's terms, there's 1 continuity equation but 3 velocity components. You got lucky because you are solving a 1D flow.

In transient solvers: one usually solves the continuity equation for the density at the new time (since it's wrong to assume that density is unchanged). Then one solves the momentum equation for the velocity. Then solve the energy equation. Then do the pressure correction. Finally there is also a density correction at the end based on the final T,P to get the correct density.

For steady solvers: assuming properties as in 1) you solve the momentum equation for velocity. Then the energy equation. With the updated energy solution (temperature / internal energy / enthalpy) you can now update the density. Then finish it off with the pressure correction.

The seemingly unused continuity equation is hiding in the pressure correction part. The pressure correction is just a fancy way of saying I use the continuity and momentum equation to solve for velocity and pressure. This pressure correction is needed for incompressible and compressible flows.

Btw this is a segregated approach where you solve the equations sequentially and hence you run into this pressure correction equation. You could (more impressively?) solve all the equations (a coupled approach) at once for all variables. Or slightly less impressive you could solve the continuity and momentum equations together for velocity and pressure. But if you are already comfortable using one approach, I would not try to switch to another.

 January 19, 2018, 07:15 #8 Member   Join Date: Jan 2018 Posts: 31 Rep Power: 6 Thank you both for your inputs. If I may, I would like to ask for another opinion. The 1D compressible gas flow was my first step, building towards the real problem which I am trying to describe. This is flash evaporation due to the pressure dropping below the saturation pressure. Assuming homogenous flow, the differential equations (cont., mom., energy) are in essence the same, with the density and viscosity being a function of quality. So now I am wondering about two things:a) Since incompressibility is an assumption, is it wrong (from a numerical point of view) to model both the one-phase liquid and the two-phase part of the domain as compressible? Because in this way I could retain just one set of equations and one solution algorithm. b) Do you have any first guess as to what good boundary conditions might be in this case? Is it perhaps okay to specify all variables on one side, like I did at first?

 January 19, 2018, 10:27 #9 Senior Member   Julio Mendez Join Date: Apr 2009 Location: Fairburn, GA. USA Posts: 287 Rep Power: 16 This is an endless discussion and somehow represents the corner stone in CFD. Depending upon the flow type (subsonic or supersonic) the boundary conditions must be properly set. In addition to this, you may need to use certain preconditioning or a dispersion preservative scheme. In fact, this is quite difficult to explain but the bottom line is that you are using a incompressible approach to solve for a compressible flows (you are computing pressure and correcting using pressure). In compressible flows you don’t solve for pressure, you solve for density and temperature along with the equation of state. moshe likes this.

January 19, 2018, 15:44
#10
Senior Member

Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,784
Rep Power: 56
Quote:
 Originally Posted by lorbekl a) Since incompressibility is an assumption, is it wrong (from a numerical point of view) to model both the one-phase liquid and the two-phase part of the domain as compressible? Because in this way I could retain just one set of equations and one solution algorithm.
If by incompressibility you mean that div(u)= 0, then it is quite common to even in fully incompressible solvers (i.e. constant density solvers) to solve the momentum equation assuming div(u) is not-zero (akin to injecting it as a source term) and then constraining the solution. The extra div(u) terms can even stabilize numerics. So yes I would agree it might be preferable to model both as compressible and then apply the appropriate constraints to the incompressible part.

Quote:
 Originally Posted by lorbekl Is it perhaps okay to specify all variables on one side, like I did at first?
That is how you treat a supersonic inlet. For subsonic flows you shouldn't do it this way. i.e. you shouldn't specify both velocity and pressure at a subsonic inlet.

 January 22, 2018, 01:59 #11 Member   Join Date: Jan 2018 Posts: 31 Rep Power: 6 I see, thank you all for your help. I will try to work my way on my own from here. Hopefully with success

 Tags compressible flow, finite volume method, solution