FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[WIP] Pressure Based Solver by thijsaalbers · Pull Request #2812 · su2code/SU2 · GitHub

/ SU2 Public

[WIP] Pressure Based Solver - #2812

Open
thijsaalbers wants to merge 43 commits into
developfrom
feature_pressure_based_2026
Open

[WIP] Pressure Based Solver#2812
thijsaalbers wants to merge 43 commits into
developfrom
feature_pressure_based_2026

Conversation

thijsaalbers commented May 7, 2026
edited
Loading

Copy link
Copy Markdown

Proposed Changes

The current work (part of GSoC) provides a working version of a pressure-based algorithm for the incompressible flow solver as an alternative to the existing Density-based solver. Below, the reader may find the algorithm which has been implemented, as well as the current progress of the code and challenges. All the way at the bottom one can find performance comparisons between the DB and PB solvers for some test cases.

Algorithm

A lot of versions of pressure-based algorithms exist, and many different versions can be implemented. Here, we opt for versions of the original SIMPLE/PISO algorithm, it is briefly defined here for clarity.

First, the momentum equations are solved, starting from the previous time step's momentum $\rho \vec{u}^{(0)}$, pressure $p^{(0)}$, and face flux $\rho \vec{u}_f^{(0)}$. The resulting momentum is the predicted momentum, here its discretized form is shown, as its coefficients are used in the subsequent equations

$A_p(\rho \vec{u})_p^{(1)}+\sum_n A_n (\rho \vec{u})^{(1)}_n=-V\nabla p^{(0)}+S_m$

The subsequent momentum is not necessarily incompressible, the pressure correction equation can be derived by rewriting it as follows, using a term often called H by A

$(\rho \vec{u})_p^{(1)}=-\frac{\sum_n A_n (\rho \vec{u})_n^{(1)}}{A_p}-\frac{V}{A_p}\nabla p+S_m=\frac{H\left(\rho \vec{u}^{(1)}\right)}{A}-\frac{V}{A_p}\nabla p^{(0)}+S_m$

$(\rho \vec{u})_p^{(2)}=\frac{H\left(\rho \vec{u}^{(1)}\right)}{A}-\frac{V}{A_p}\nabla p^{(1)}+S_m$

Note how a simplification is used here where the HbyA term is neglected. Subtracting these two equations yields the first pressure correction equation for $p'$ as

$\nabla \cdot \left( \frac{V}{A_p}\nabla p'\right)=\nabla \cdot (\rho \vec{u})^{(1)}$

Make note that for the divergence here, we require the face mass fluxes, which are computed using Rhie-Chow interpolation to avoid odd-even decoupling. After the equation is solved, using the pressure correction $p'$, the pressure and momentum are corrected according to

$p^{(1)} = p^{(0)} + p' ,\quad \rho u^{(2)} = \rho u^{(1)}+\rho u'.\quad \rho u'= -\frac{V}{A_p}\nabla p'$

So far, this is equal to a pseudo-transient version of the SIMPLE algorithm. This algorithm however suffers from a very tight stability condition on the time-step size. Therefore, multiple pressure corrections can be applied, which for two corrections is originally called the PISO algorithm.

The second pressure correction does not neglect the HbyA term, which then results in the equation

$\nabla \cdot \left( \frac{V}{A_p}\nabla p'\right)=\nabla \cdot (\rho \vec{u})^{(2)}+\nabla\cdot\left(\frac{H\left(\rho \vec{u}'\right)}{A}\right)$

And the new correction equations are defined as

$p^{(2)} = p^{(1)} + p' ,\quad \rho u^{(3)} = \rho u^{(2)}+\rho u'.\quad \rho u'= \frac{H\left(\rho \vec{u}'\right)}{A}-\frac{V}{A_p}\nabla p'$

Note that HbyA here uses the previous momentum correction and is thus the same quantity as the one used in the second pressure correction equation. Later pressure correction equations follow analogously.

Progress:

  • Pressure-based solver added as alternative to density-based solver for the incompressible flow equations.
  • The pressure-based solver has only been tested for constant density cases for basic Navier-Stokes and Euler flow.
  • The pressure-based solver is implemented based on a pseudo time-stepping approach to remain consistent with the other solvers in SU2. The pressure-based solver is currently set to the SIMPLE algorithm by default, with options for SIMPLEC and PISO available.
  • The Poisson solver is a major bottleneck in the computation speed. To account for this, an option was added to use a different linear solver and preconditioner for the poisson solver.
  • For details on the implementation of the algorithm and the responsibility distribution please see the file CPBFluidIteration.cpp.

Issues

Performance:

  • Convergence issues with RANS (SA and SST) on fine meshes with high Reynolds numbers.
  • The Poisson solver can sometimes struggle a lot due to high Reynolds numbers and fine meshes, and thus require a ridiculous number of iterations to converge reasonably. Possible fixes include adding multigrid support or a DIC preconditioner (far less efficient). Multigrid support is tricky as SU2 currently only considers multigrid for the main (flow) solver and not for auxiliary solvers.
  • Periodic boundary conditions have not been implemented/tested at all as of yet.
  • Any code related to adjoints has not been considered at all either.

Code:

  • Parallelization with OMP gives wrong results, MPI however does work as expected.

TODO list

  • Fix issues mentioned above
  • Docs page

Related Work

This work is based on earlier attempts by Nitish Anand (2024) and Akshay Koodly (2021), see feature branches feature_PBFlow_V8 and feature_Pressure_based respectively. Also see PR #2210

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

Result showcase

Convergence history of the inviscid flow around a hydrofoil at a 5 degree aoa.

The pressure coefficient along the surface of the hydrofoil at a 5 degree aoa and the corresponding lift coefficients, X-FOIL predicts C_L=0.6.

Convergence history of the lid driven cavity problem, note that CFL=60 is the highest stable CFL for the PB solver, whereas the DB solver does not have this CFL related stability issue.

The skin friction coefficient for turbulent flow over a (rough) flat plate with SA.

thijsaalbers self-assigned this May 7, 2026

github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment thread SU2_CFD/src/numerics/poisson.cpp Outdated
Comment thread SU2_CFD/src/numerics/pbflow.cpp Outdated
Comment thread SU2_CFD/src/numerics/pbflow.cpp Outdated
Implements the full class structure required for the pressure-based solver in a minimal form.
The code compiles and runs but does not yet contain any numerical/physical implementation.

Future work will focus on implementing solver logic.

Note: In the previous attempts (see related work) there is noticeable code duplication between CIncEuler and CPBIncEuler.
The final architecture may be revised depending on how the implementation of CPBIncEuler evolves.
Comment thread SU2_CFD/src/drivers/CDriver.cpp Fixed
Comment thread SU2_CFD/src/drivers/CDriver.cpp Fixed
Comment thread SU2_CFD/src/drivers/CDriver.cpp Fixed
Centered residual is not yet implemented as the old code did not have a working version. Upwind residual is functional but requires cleanup and move to more appropiate file.
Variables are a work in progress and still include some commented out code related to energy and pressure
thijsaalbers reopened this Jul 3, 2026

Copy link
Copy Markdown
Author

I will have to review the code myself first, it is not ready for review as of yet.

thijsaalbers left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The current version of the solver is ready for review. It is however not yet finished and there is a list of known issues that I am still working through. I have updated the PR description with the current status and known limitations; please read that before reviewing the implementation.

su2double SemiSpan; /*!< \brief Wing Semi span. */
su2double MSW_Alpha; /*!< \brief Coefficient for blending states in the MSW scheme. */
su2double Roe_Kappa; /*!< \brief Relaxation of the Roe scheme. */
su2double RCFactor; /*!< \brief Relaxation for the Rhie-Chow interpolation contribution. */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should this variable still be named RCfactor? This factor is named RC to remain consistent with the thesis of Akshay, it however has no relation to Rhie-Chow at all and instead functions as a means of controlling the time dependent term on the momentum coefficients for the poisson equation... I do not know why he called it RC in his thesis, nor if we should keep this same name or change it.

Comment thread SU2_CFD/src/drivers/CDriver.cpp Outdated
Comment thread SU2_CFD/src/solvers/CPBIncNSSolver.cpp Outdated
Comment thread SU2_CFD/src/solvers/CPoissonSolver.cpp Outdated
thijsaalbers requested a review from pcarruscag July 21, 2026 12:29
thijsaalbers marked this pull request as ready for review July 24, 2026 14:21

pcarruscag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There are some errors in the implementation, which I made myself when I first implemented SIMPLE, and they are easy to make because certain simplifications look equivalent but are not.
For professional reasons I should discuss this only in terms of my prior work.
Here is an implementation that I think is mostly correct: https://github.com/pcarruscag/Flow-Solver-Experiments/blob/main/lib/flow/src/flow_simple.cpp
It's written in a funny way because it was my first exercise into porting something to GPUs, but follow the operations, and their order, not the code itself.
The main error here is that you do not carry nor correct the face velocities (or face mass flows), nor use them to discretize momentum and scalars.
You correct the nodal velocities (equivalent to cell centers) but that is not the same thing.
I was not nice enough to my future self to document why in my old code, but I'm somewhat confident an AI can explain the nuance.

Copy link
Copy Markdown
Author

@pcarruscag Thanks for the very usefull explanation of the issue. I think I now more or less fixed it. I also rewrote CPBFluidIteration.cpp, and I think the flow of the algorithm (and the changes I now made to it) should be clear in there.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL