Page 1 of 1

how does the periodic routine calculate pressure gradient

Posted: Wed Apr 24, 2019 1:19 pm
by asda9786
Hi everyone, I have incorporated a periodic subroutine for my simulation set at the inlet and outlet of my model provided by a colleague. I have attached the code below. It governs the fluid flow. I am trying to understand the code. I am unsure how it calculates the pressure gradient that can be seen at the end of the listing file. My question is how does it calculate the pressure gradient ?

Re: how does the periodic routine calculate pressure gradient

Posted: Wed Apr 24, 2019 2:11 pm
by Yvan Fournier
Hello,

I am not sure I understand correctly, but in the case of a uniform velocity source term applied to the whole domain, I understand such a source term is equivalent to a change of variable so that the "equivalent" pressure can be periodic. As the source term basically compensates for the pressure drop in the Navier-Stokes equations, the term computed/adjusted so as to provide a given flow rate is equivalent to an average pressure gradient.

Regards,

Yvan

Re: how does the periodic routine calculate pressure gradient

Posted: Wed Apr 24, 2019 5:00 pm
by asda9786
Hello Yvan,

I understand the flow rate is constant across the domain due to periodic conditions. But I was trying to understand how the pressure gradient is calculated in the listing file. Because I am comparing it to an experimental pressure drop value based on a frictional factor. The two values match well,

I just don't know how to explain how the Code saturne simulation calculates this value. I would like to understand the theory of how code saturne uses the source term subroutine to generate a pressure gradient, equivalent to the pressure gradient in the traditional navier stokes equation.
I may be overthinking this point, If I were to simulate using a different CFD package I would get a pressure drop based on the RANS eqautions. How does this deviate from the way Code-Saturne calculates the pressure drop using the source term. Or is it the exact same method.

Hope this made more sense

Re: how does the periodic routine calculate pressure gradient

Posted: Wed Apr 24, 2019 11:12 pm
by Yvan Fournier
Hello,

I suppose it is the same method. Code_Saturne does not compute the pressure drop based on the source term, but based on the differential operators used in the simulation. The source term allows to compensate for the pressure drop in the periodic domain due to viscous terms (the pressure needs to be periodic also; with no source term, the stable solution would be "uniform pressure/zero velocity").

Regards,

Yvan

Re: how does the periodic routine calculate pressure gradient

Posted: Wed Apr 24, 2019 11:33 pm
by asda9786
Okay that makes more sense thank you. I will try to investigate further maybe look through some documents.
Thanks for the help though!!!!

Re: how does the periodic routine calculate pressure gradient

Posted: Thu Apr 25, 2019 1:52 pm
by asda9786
Hi there,
I think I have overlooked this completely. But If you could just answer this question, that would be great. Essentially the pressure gradient is calculated by measuring the pressure at the inlet and outlet, then working out the difference. Is that correct?


Thank you

Re: how does the periodic routine calculate pressure gradient

Posted: Fri Apr 26, 2019 12:57 am
by Yvan Fournier
Hello,

No, the gradient is local to each cell, an not computed simply from the inlet and outlet.

So the "gradient" in the listing is not a real gradient, but probably an average gradient value.

If your really need to understand how the gradient is computed, check src/alge/cs_gradient.c and/or the theory manual.

Regards,

Yvan