Questions regarding the use of Code_Saturne: head loss coefficient

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Stéphane Blanchet

Questions regarding the use of Code_Saturne: head loss coeff

Post by Stéphane Blanchet »

Hello,
Thanks for the tips again!
I have one question regarding the head loss coefficient:
Is it possible to add the viscous loss term when defining the head loss coefficient?
Regards,
Stéphane
David Monfort

Re: Questions regarding the use of Code_Saturne

Post by David Monfort »

Hello,
I'm not sure to understand your question...
Defining a head-loss coefficient in Code_Saturne corresponds to the following tensor K definition:
d(rho.u)/dt + div[rho.u x u] = -grad[p] + div[mu.(grad(u)+transp(grad(u))] - rho.K.u
Does it fulfill your needs ?
David
Stéphane Blanchet

Re: Questions regarding the use of Code_Saturne

Post by Stéphane Blanchet »

Sorry, my question was not really clear.
What I meant is: in a general case, the pressure drop can be expressed as follow: dP= alpha*v + beta*v²  with the first term being the viscous loss term and the second the inertial loss term (correct me if I am wrong).
In Code_Saturne, it seems we can only set the second term.
But maybe I am completely wrong...
Stéphane
David Monfort

Re: Questions regarding the use of Code_Saturne

Post by David Monfort »

As far as I'm concerned, I always expressed the (linear) head loss like this (without a term in alpha*v):
H2 - H1 = lambda . L / Dh . v²/(2.g)
Nevertheless, you can always set the source term you want in Code_Saturne with the ustsns.f90 subroutine. The only diffference with the head-loss management is that part of the head-loss is automatically made implicit (numerically speaking).
But even with the uskpdc.f90 subroutine, you can set tensor coefficient independantly of the velocity, thus you can have what you call a "viscous term" (I would be interested in having an example of such an expression).
Hope this helps you clarify what is done in Code_Saturne.
David
Stéphane Blanchet

Re: Questions regarding the use of Code_Saturne

Post by Stéphane Blanchet »

Yes, it helped me to clarify what is done in Code_Saturne.
For the "viscous term" term, I was not sure of the exact word... I have seen this term on the Fluent User's guide once, but I am not sure if it is correct.
Anyway, thanks for your answer.
Stéphane
David Monfort

Re: Questions regarding the use of Code_Saturne

Post by David Monfort »

Ok... I've looked at the Fluent manual and now understand why you meant (sorry not to have understood before ;)) and here is the relevant page of the manual. What they call viscous loss is a Darcy term for porous media and can be expressed as something like:
grad(p) = mu/alpha . v

We don't have a specific subroutine in Code_Saturne for such a term, but you can add one in the ustsns.f90 subroutine (in which you can add any source term to the momentum equations).
David
Stéphane Blanchet

Re: Questions regarding the use of Code_Saturne

Post by Stéphane Blanchet »

Thank you for the information! I came up with a code, and it seems to work. but I have still one problem when selecting the cells thanks to getcel: it works fine when I use: getcel('Z<=... and Z>=...',...), but when I try to select the cells using a color, it does not work.
Here is my code:

ipcvisc = ipproc(iviscl(iphas))    //extraction of the viscosity
iphas=1

call getcel('179',nlelt,lstelt)        // I select the cells in the volume 179 if (ivar.eq.iw(iphas)) then           //The flow is in the Z-direction   alpha  = 10.d-5     do ilelt = 1, nlelt      iel= lstelt(ilelt)      crvimp(iel) = - volume(iel)*propce(iel,ipcvisc)/alpha    //definition of the implicit part   enddo endif
Furthermore, if I use this code and
the head loss defined in the GUI, is it equivalent to the momentum equation defined as a viscous loss term + inertial loss term (Fluent manual)?
Thanks,
Stéphane
 
David Monfort

Re: Questions regarding the use of Code_Saturne

Post by David Monfort »

Hi Stéphane,
What do you mean by "it doesn"t work" ? Do you have any error message that you could post here ? To check whether you have cells with color 179, you can have a look at the preprocessor log (listpre in this version IIRC).
As regards what you want to do (head loss setup via the interface and Darcy term via ustsns.f90), this is indeed equivalent to what is written in the Fluent manual (with the disclaimer that I don't know what they do internally ;))
David
Yvan Fournier

Re: Questions regarding the use of Code_Saturne

Post by Yvan Fournier »

Hello,
Could you post your "listpre" preprocessor output to check how color 179 is handled ?
Regards,
  Yvan
Stéphane Blanchet

Re: Questions regarding the use of Code_Saturne

Post by Stéphane Blanchet »

Hello,
Sorry, I now realize I was completely unclear about my problem. What
I meant by "it doesn't work" is: Code_Saturne ran the calculation as if
it did not take into account the selection of the cells. I didn't have
any error messages, but I had exactly the same result as if I did not
used the subroutine.
I hope it is clearer.
But anyway, I've just tried again and it works fine. Alpha was not enough low to see what happened. I am sorry for the disturbance.
Thank you,
Stéphane
Post Reply