Pressure solver?

123 views
Skip to first unread message

Manohar Teja

unread,
May 30, 2025, 5:56:53 AMMay 30
to dedalu...@googlegroups.com
Hi,

Can someone help me understand how the pressure is solved in Dedalus? Does it use any solver like the Pressure Poisson solver? I couldn't find the detailed information in the documents. Does it vary with the type of boundaries used in the domain? If so, how?

Regards.
Manohar Teja Kalluri
CGAFD, Univ of Exeter

Manohar Teja

unread,
Jun 2, 2025, 7:41:03 AMJun 2
to dedalu...@googlegroups.com
Hi,

Just in case this email got lost among other emails. Can someone help me explain this?

Regards
Manohar
CGAFD, Univ of Exeter

Geoffrey Vasil

unread,
Jun 2, 2025, 7:49:35 AMJun 2
to dedalu...@googlegroups.com
Hi Manohar, 

There isn’t a specific pressure solver. For hydrodynamics, the pressure is just another variable in the system of equations. Asking "where is the pressure solver" is like asking “where is the y solver” when considering a system of there linear equations for (x,y,z). Dose that make sense? 

Cheers,
Geoff 


On 2 Jun 2025, at 12:40, Manohar Teja <manohartej...@gmail.com> wrote:

Hi,

Just in case this email got lost among other emails. Can someone help me explain this?

Regards
Manohar
CGAFD, Univ of Exeter


On Fri, May 30, 2025 at 10:56 AM Manohar Teja <manohartej...@gmail.com> wrote:
Hi,

Can someone help me understand how the pressure is solved in Dedalus? Does it use any solver like the Pressure Poisson solver? I couldn't find the detailed information in the documents. Does it vary with the type of boundaries used in the domain? If so, how?

Regards.
Manohar Teja Kalluri
CGAFD, Univ of Exeter

--
You received this message because you are subscribed to the Google Groups "Dedalus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dedalus-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dedalus-users/CAGuRpfSQogsR%3DSKuA_9Xh-uUOJWRcNpOF50hm0L8BNd5z70-5A%40mail.gmail.com.

Manohar Teja

unread,
Jun 2, 2025, 8:40:08 AMJun 2
to dedalu...@googlegroups.com
Yes, that makes sense. Thanks for the explanation. 

Regards
Manohar
CGAFD, Univ of Exeter

Manohar Teja

unread,
Jun 12, 2025, 12:37:22 PMJun 12
to dedalu...@googlegroups.com
Hi Just to follow up on this, I am wondering how does a variable that doesn't have a seperate equation in time evolve over time?

For example, if I try to simulate a variable density system, the pressure term is a non-linear term, 1/rho \nabla P (where \rho is density). I can, indeed write it as a linear and non-linear terms (1/\rho \nabla P = \nabla Pmod - Pmod/\rho^2 \nabla \rho, where Pmod = P/\rho is the modified pressure). I would like to know how the pressure advances in time, since it doesnot have a separate equation (like u)?

Regards
Manohar
CGAFD, Univ of Exeter

Calum Skene

unread,
Jun 12, 2025, 2:57:50 PMJun 12
to Dedalus Users
Hi Manohar,
It is not a spectral methods paper, but I think equation (3) in this paper will help explain what you are asking. Here phi is the pressure term and G is the discretised gradient. You see that there is no time-derivative for phi (it only appears in the momentum equation), but by solving this linear system to obtain the velocity variables at the next time-step, you will also get pressure. Really, pressure here will be whatever it needs to be so that the velocity is divergence free. A pressure Poisson solver is a way to solve this type of linear system without inverting it (which can be costly). The sparse spectral methods Dedalus uses means that you can invert the LHS, and so no operator splitting scheme is needed.
Does this help a bit?
Best,
Calum

Manohar Teja

unread,
Jun 13, 2025, 2:49:34 AMJun 13
to dedalu...@googlegroups.com
Hi Calum,

Thanks for referring me to the paper and the explanation. It is quite useful. I do understand how the linear part of the pressure is obtained, but the pressure in the system should be the sum of the pressure coming from solving the linear part and the pressure coming from solving the nonlinear part (Pmod/\rho \nabla \rho). So, how is the nonlinear part of pressure obtained? I believe we can't just use the pressure obtained from solving the linear equation, because it effectively means we are not considering the nonlinear dynamics of pressure.

Regards
Manohar
CGAFD, Univ of Exeter

Calum Skene

unread,
Jun 13, 2025, 5:15:30 AMJun 13
to Dedalus Users
Hi Manohar,
If rho varies in time (e.g. compressible), then the pressure term can be put on the RHS and treated explicitly. You will need additional equations to close the system. The continuity equation gives the time evolution of rho, so you now need a thermodynamic equation and an equation of state. You can see from this that pressure could have a separate equation like u by using the equation of state and continuity equation to replace the thermodynamic variable with pressure. 
If rho only varies in space (e.g. anelastic), then the pressure term is still linear and must be on the LHS to obtain a solvable system.
It really depends on the full set of equations you are wanting to solve.
Does this help?
Best,
Calum

Manohar Teja

unread,
Jun 13, 2025, 6:00:53 AMJun 13
to dedalu...@googlegroups.com
Hi Calum,

Sorry, I should have mentioned this before and have given a more elaborate discussion of my case. At the moment I am trying to study the incompressible case, and I am able to run the problem by using NS equation, continuity equation, induction equation, div(u) = 0, and a pressure gauge condition (which I give as integ(p) = 0). The simulation runs and the instability evolves well as expected. But I am not understanding how the pressure calculation is working in this case.

Regards
Manohar
CGAFD, Univ of Exeter

Geoffrey Vasil

unread,
Jun 13, 2025, 6:05:59 AMJun 13
to dedalu...@googlegroups.com
You’re correct that the pressure becomes nonlinear if you have density evolution. I assume you still want divergence free velocity. In that case you’ll have to trick the equations into thinking there’s a linear pressure term. And like when you trick babies into not crying, everyone ends up better in the end. 

Define the volume density v = 1/rho. Then you have 

dt(u) + v * grad (p) = … 

Then imagine you have a best guess for the density and hence the volume say v0 = 1/rho0. A good start might be v0 = 1. 

Then you can do 

dt(u) + v0 * grad (p) = (v0 - v) grad (p) + …

Not there’s a linear pressure term in the lhs that will help keep the divergence free velocity. The rhs is nonlinear and calculated explicitly. The advantage to everyone is that the nonlinear stuff is now just the density (really volume) perturbations, so it’s less scary. 

Make sense as a general principle? 

Sent from my iPhone

Manohar Teja

unread,
Jun 13, 2025, 7:13:42 AMJun 13
to dedalu...@googlegroups.com
Hi Geoff,

Instead of considering rho0 as 1, which means that we move away from variable density problem, lets say I rewrite 1/rho grad(p) as grad(p') and p'/rho grad(rho), where p' is now p/rho. We now have a linear terms for (modified) pressure which goes on LHS and a nonlinear term with p' on RHS. I understand how the pressure on LHS is calculated. But note that we also have pressure on RHS. But how is this calculated is something I still haven't understood. Can you please be a bit more elaborate on this? How is the non-linear pressure (on RHS) calculated at every time iteration?

Regards
Manohar
CGAFD, Univ of Exeter

Calum Skene

unread,
Jun 16, 2025, 7:50:46 AMJun 16
to Dedalus Users
Hi Manohar,
It is computed the same way as any other term on the RHS. Do equations (85) and (88) from the Dedalus methods paper (https://arxiv.org/pdf/1905.10388) help?
For your equations there will be no contribution to matrix M from pressure (no time-derivative), but there is a contribution to L from your grad(p') term (LHS). The p'/rho grad(rho) term is in F (RHS).
Is rho a specified spatially varying field in your setup?
Calum

Geoffrey Vasil

unread,
Jun 16, 2025, 8:25:35 AMJun 16
to dedalu...@googlegroups.com
Manohar, 

Things on the LHS are calculated for the next time step. 

Things on the RHS are used from the previous time step. 

Also, the point I was making about rho0 is is not to “move away from the variable density problem”. It’s that ρ0 is a *reasonable guess* for the true density ρ.

Suppose you have ρ0 ~ ρ (fully variable)

Then doing what you would like:

p = P/ρ

Then as an identity:

(grad P) / ρ = grad p + p grad log( ρ0 ) + p grad log( ρ / ρ0 )

You can go even further. Suppose you have a *best guess* p0 ~ p. Then you can also have 

(grad P) / ρ = grad p + p grad log( ρ0 ) + p0 grad log( ρ / ρ0 ) + (p-p0) grad log( ρ / ρ0 )

Then you can solve: 

dt( u ) + grad p + p grad log( ρ0 ) + p0 grad log( ρ / ρ0 ) + …  = -  (p - p0) grad log( ρ / ρ0 ) + … 

Everything on the LHS is linear. If you set ρ0 = 1 and p0=0, then the 3rd and 4th terms will vanish. That’s fine. But if you have guesses RHS term smaller. Also, your guesses don’t have to be perfect. Anything you do to lessen the RHS will make your problems more stable for time stepping. 

However, you also want to balance making ρ0 and p0 simple. That’s because if they are too complicated then the LHS will become more expensive. So there’s a tradeoff between making the RHS more stable and making the LHS more expensive. But you can usually do this with some simple polynomial guesses.

Btw, since log( ρ / ρ0 ) is natural in the momentum equation, you can also possibly transform your density equation to use that variable. You’ll end up with non-constant and nonlinear terms where you didn’t have them before, but you can make similar manipulations to make that easier. 



Manohar Teja

unread,
Jul 18, 2025, 3:33:53 PMJul 18
to dedalu...@googlegroups.com
Hi all,

Just a follow-up question, I have submitted a manuscript to a journal which used Dedalus as the numerical framework. I was asked "Why are the authors not using classical algorithm like  generalized minimal residual (GMRES) or conjugate gradient (CG)? Is it not available in Dedalus?" 
I did not use them because I did not know about them. But are they available in Dedalus? Are these related to pressure-solving techniques?

Regards
Manohar
CGAFD, Univ of Exeter

Calum Skene

unread,
Jul 21, 2025, 4:54:09 AMJul 21
to Dedalus Users
Hi Manohar,
GMRES and CG are iterative methods for solving linear systems. They are often used to solve the pressure Poisson equation (if projection or splitting methods are used), or for solving the implicit part of timestepping schemes. These methods often require preconditioning to converge efficiently, especially for large or stiff systems.

Dedalus does not use iterative solvers, instead it uses direct solvers. Specifically, it performs an LU decomposition of the system matrices. Once the LU factors are computed (which can be reused unless the timestep or system changes), the linear system can be solved efficiently in a single step using forward and backward substitution.

In many applications, LU decomposition is impractical due to memory and computational cost, which is why iterative solvers are often preferred. However, Dedalus uses a sparse spectral discretisation, which makes LU decomposition feasible and efficient in its case. As a result, iterative solvers are not necessary in Dedalus.
Hope this helps,
Calum

Manohar Teja

unread,
Jul 21, 2025, 6:07:16 AMJul 21
to dedalu...@googlegroups.com
Thank you Calum. This is very useful.

Regards
Manohar
CGAFD, Univ of Exeter

Reply all
Reply to author
Forward
0 new messages