xcompact3d / Incompact3d

Current CPU version of our solver for the Navier-Stokes equations
https://xcompact3d.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
149 stars 130 forks source link

Query about the output pressure #171

Closed mattfalcone1997 closed 1 year ago

mattfalcone1997 commented 1 year ago

Hi,

I have a question relating to the pressure output in the visualisation subroutines. In particular, this relates to the pressure that is output compared with the physical pressure. This may be a misunderstanding on my part, but Kim and Moin (1985) states that $p = \phi + (\Delta t/2Re)\nabla^2 \phi$, and I believe the last bit comes from the use of the Crank-Nicolson Scheme in their paper. As a result, I was wondering if Xcompact3D takes the last part into account (or if it needs to) when outputting the pressure when implicit time schemes are used for the $y$ viscous terms.

Thanks in advance, Matthew

mathrack commented 1 year ago

Hello,

I think you are correct. With the implicit time scheme for the y viscous term, one gets : $p = \phi + \frac{\Delta t}{2 Re} \partial{yy} \phi$ when using Crank-Nicolson and $p = \phi + \frac{\Delta t}{Re} \partial{yy} \phi$ when using implicit Euler

mattfalcone1997 commented 1 year ago

Hi,

Thanks for your response. I was wondering whether this would subsequently require modification of the visualisation so that the pressure in the binary file corresponds to the physical pressure. This is also relevant for the statistics.

mathrack commented 1 year ago

This definition of the pressure is selected so that when summing prediction and correction and inserting $p$ instead of $\phi$, the predicted velocity does not appear in the viscous term.

Regarding the exact meaning of physical pressure in the framework of incompressible flows, ...

mattfalcone1997 commented 1 year ago

I am only concerned with whether the pressure output in postprocessing should be modified to account for the implicit scheme. I do not believe that this is done at the moment (it seems that $\phi$ is output rather than $p$, although I may be wrong).

mathrack commented 1 year ago

The current code outputs $\phi$ and not $p$ when using the implicit scheme.

mattfalcone1997 commented 1 year ago

Okay, thanks for the clarification. Is this something that should/will be updated at a future point? I am not sure how important this is as the difference is $O(\Delta t)$.

mathrack commented 1 year ago

I am not planning to open a PR for this modification. The estimation of $\partial_{yy} \phi$ could be inserted just before the call to transpose_y_to_x : https://github.com/xcompact3d/Incompact3d/blob/master/src/visu.f90#L245

mattfalcone1997 commented 1 year ago

Thanks for your help. I may have a play around with this. I am happy to close this now.