CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Pressure correction for compressible gas (https://www.cfd-online.com/Forums/main/188892-pressure-correction-compressible-gas.html)

lstum June 9, 2017 05:08

Pressure correction for compressible gas
 
Hi everyone,

I'm trying to set up a solver in matlab for gas flowing through a fixed bed reactor. The equations i have are the momentum balances in axial and in radial direction and the mass continuity equation. So far, so good...

My proceeding is as follows:
  1. Guess pressure field and velocity field
  2. Calculate axial velocity using the momentum balance in axial direction
  3. Calculate radial velocity using the momentum balance in radial direction
  4. Calcultate density field from continuity equation
  5. Calculate new pressure field using ideal gas law (I assume constant high temperatures, later i will solve the energy equation as well)
  6. Check for convergence
  7. If no convergence, go back to step 2 using the new calculated pressure field or only parts of it (e.g. p_{new} = p_{old} + 0.5 (p_{new} -  p_{old}))

Obviously, the steps 1-3 are the same as in nearly all algorithms. But since my algorithm does not work (oscillating residuals) i am not sure if steps 4 - 7 are correct.
Does anyone has an advice for me? I'm thankful for every answer.
Have a nice weekend,
Cheers, Leo

PS: Here are the equations i'm using:
Momentum balance radial direction:

- \frac{\partial p}{\partial r} - f_1 u - f_2 \sqrt{u^2 + v^2} u + \eta _{eff} (\frac{\partial}{\partial r} (\frac{1}{r} \frac{\partial ru}{\partial r}) + \frac{\partial^2 u}{\partial r^2}) - \rho ( u \frac{\partial u}{\partial r} + v \frac{\partial u}{\partial z} ) = 0

Momentum balance axial direction:

- \frac{\partial p}{\partial z} - f_1 v - f_2 \sqrt{u^2 + v^2} v +  \eta _{eff} (\frac{1}{r} \frac{\partial}{\partial r} (r\frac{\partial v}{\partial r}) + \frac{\partial^2 v}{\partial r^2}) - \rho ( u  \frac{\partial v}{\partial r} + v \frac{\partial v}{\partial z} ) = 0

Continuity equation:

\frac{1}{r} \frac{\partial r\rho u}{\partial r} + \frac{\partial \rho v}{\partial z} = 0

Ideal gas law:
p = \rho \cdot R \cdot T

mprinkey June 11, 2017 00:41

Are your linear solutions for velocity components and density converging well at all stages of convergence?
Are your velocity components collocated with your pressure and density data?
Are you under-relaxing your velocity and pressure corrections?

If your fields are collocated, you may have a pressure-velocity-density coupling problem. That can be fixed with either staggered grid configurations or Rhie-Chow interpolation for pressure.

If you are not under-relaxing your pressure and velocity corrections, you likely need to. Or, perhaps, you need to use a pseudo-transient formulation and pseudo-time march to your solution. This is a common solution procedure for steady compressible flows.

If your linear systems solutions are not converging well, you may need to do implicit under-relaxation to effectively solve for the relaxed velocity/density correction and generate a more diagonal dominate linear system that converges more quickly/robustly.

Good luck.

LuckyTran June 11, 2017 13:23

Leo, you have basically written down how to solve the continuity & momentum equations in a segregated approach (there's no energy equation). The approach is sound but you will likely have convergence difficulties due to the pressure-velocity coupling problem. Your steps 1-7 will become much more complicated. It's non-trivial how you go about solving this problem, but basically you need lots of under-relaxation.

The problem is that after step #5, you momentum equation will no longer be satisfied (it is almost guaranteed, unless your simulation has already converged). This is why there are algorithms like SIMPLE & PISO to make an additional velocity/pressure adjustment. Or you will have to solve steps 2-6 iteratively.

Btw in step #5, actually you also assume an initial temperature field in step #1. Solving the energy equation and any other transport equations should not be in the loop of steps 1-7 but a separate routine altogether. As soon as you try to bring in the energy equation, your problem becomes coupled and you have to solve one big matrix and solve for u, rho, p, and T simultaneously. The steps for solving that big system are very different.

leflix August 5, 2017 13:59

1 Attachment(s)
Hi Istum,

In your model you do not solve the energy equation which is a relevant part of the compressible fluid flow model. I'm not sure you can solve an isothermal compressible flow, because as density and pressure change, the temperature should change too. In case the flow is really isothermal, the energy equation should simulate this characteristic. Thus it might explain your convergence problem.

If you aim to solve a compresssible flow you do not need to staggered your velocity. You can work with colocated variables and without the necessity to use RC interpolation.

the overall algorithm reads as follow see the attached jpg file:


Writting a code based on this algorithm is really simple. Less than 1000 lines using finite differences. You do not need internal sweeping between two consecutive time steps. This is very efficient.

Leflix


All times are GMT -4. The time now is 01:07.