Setting reference pressure position (xyzp0)

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
finzeo
Posts: 55
Joined: Fri Sep 09, 2022 4:23 pm

Setting reference pressure position (xyzp0)

Post by finzeo »

Hi,

I want to specify the position in my domain where I want to set the reference pressure, p0. After reviewing the guides and documentation, it seems that the recommended method is through the cs_user_parameters function, using

Code: Select all

cs_fluid_properties_t *fp = cs_get_glob_fluid_properties();
fp->xyzp0[0] = ...;
fp->xyzp0[1] = ...; 
fp->xyzp0[2] = ...;
However, upon running the simulation, I observed that the pressure value at that specified position differs from the reference value. I have attached the setup.xml file for your reference.

Additionally, I've encountered a peculiar situation: I understand that the aforementioned code should not significantly impact the overall results (as what matters are the pressure differences, not their absolute values). However, I noticed a relevant change in the results solely by incorporating the above lines of code, without any other modifications to the settings. Can you provide insights into why this might be happening?
Attachments
cs_user_parameters.c
(51.15 KiB) Downloaded 256 times
setup.xml
(14.49 KiB) Downloaded 248 times
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Setting reference pressure position (xyzp0)

Post by Yvan Fournier »

Hello,

I am not sure why the pressure would be different, unless we are comparing "solved" pressure and hydrostatic pressure.

In any case, changing the position of the point does have some influence, in part due to numerical sensitivity of the algorithm, and also because a P - P(x0) term appears in a pressure correction step's right-hand side, and this in turns influences the residue normalization used to check the linear solver's convergence (so if I remeber correctly, if you take a point far from the compute domain, you tend to reduce the required precision for that step).

Best regards,

Yvan
finzeo
Posts: 55
Joined: Fri Sep 09, 2022 4:23 pm

Re: Setting reference pressure position (xyzp0)

Post by finzeo »

Yvan Fournier wrote: Wed Nov 15, 2023 3:18 pm Hello,

I am not sure why the pressure would be different, unless we are comparing "solved" pressure and hydrostatic pressure.

In any case, changing the position of the point does have some influence, in part due to numerical sensitivity of the algorithm, and also because a P - P(x0) term appears in a pressure correction step's right-hand side, and this in turns influences the residue normalization used to check the linear solver's convergence (so if I remeber correctly, if you take a point far from the compute domain, you tend to reduce the required precision for that step).

Best regards,

Yvan
Hi Yvan,

Thanks. I don't have gravity activated here, so there should be no influence of hydrostatic pressure. The only thing that comes to mind is that the position I specify in the xyzp0 variable may not exactly correspond to the center of a face or cell, and perhaps something is failing because of that.

With regard to the influence on the results, it seems better to use the default reference position, which corresponds to a face automatically selected on the outlet boundary, doesn't it?
finzeo
Posts: 55
Joined: Fri Sep 09, 2022 4:23 pm

Re: Setting reference pressure position (xyzp0)

Post by finzeo »

I am keen on correctly setting this variable as I observe that it significantly influences the evolution of residuals. I have attached two cases in which I changed the value of the xyzp0 variable in cs_user_parameters.c (although, while monitoring the run, I still do not observe a null relative pressure where I set it). First, I would like to know how to set it to effectively register a null relative pressure at that location. I am running a case of external flow around a vehicle similar to the Ahmed body.

I understand that a certain oscillation in pressure residuals is to be expected, given that I am simulating turbulent flow with the DDES model. However, I believe that the oscillation in the pressure residuals in the attached images might not be accurate.

EDIT: Additionally, I noticed, when I save the pressure field at various time steps, that the absolute values seem to oscillate continuously, although the pressure differences are maintained. Obviously, there is a problem with the reference pressure setting.
Attachments
residuals1.png
residuals2.png
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Setting reference pressure position (xyzp0)

Post by Yvan Fournier »

Hello,

Pressure residuals tend to oscillate much more than those of other variables, and this is not surprising, given that the pressure is not a "true" physical variable, but more of a numerical variable solving for the incompressibility constraint.

I checked with a colleague, who recommended not changing the settings for the reference pressure position, though I agree it is a numerically sensitive point. That does not answer the question about the changing reference. I'll try to get an answer to that, but don't have it yet.

Best regards,

Yvan
finzeo
Posts: 55
Joined: Fri Sep 09, 2022 4:23 pm

Re: Setting reference pressure position (xyzp0)

Post by finzeo »

Thank you, Yvan. I look forward to any updates that may be helpful
Post Reply