Page 1 of 1
k-epsilon constants modification
Posted: Wed Jul 30, 2025 1:52 pm
by MaximeO
Hello,
For a study about the flow and dispersion around a building, I would like to see the influence of the modifications of the k-epsilon (or k-epsilon linar production) model constants as shown in few articles that i found. The five constants are :

,

,

,

and

.
However, only the first three seem to appear in the cs_turbulence_model.c or in the setup.log file obtained after a computation (cf. extract of one of my setup.log file below).
Code: Select all
k-epsilon model with Linear Production (LP) correction constants:
ce1: 1.44000e+00 (Cepsilon 1: production coef.)
ce2: 1.92000e+00 (Cepsilon 2: dissipat. coef.)
cmu: 9.00000e-02 (Cmu constant)
I found "sigmak" and "sigmae" variables in src/base/clptrg.f90 and src/base/clptur.f90 which seem to correspond to the two other constants, but I don't know how and where are exactly declared the two sigma constants, and so if we can modify them by a user fonction.
I'm working on code_saturne v8.0.
Best regards,
Maxime
Re: k-epsilon constants modification
Posted: Fri Aug 01, 2025 3:08 pm
by louis.simvia
Hello Maxime,
Have you checked this page of the documentation ?
https://www.code-saturne.org/documentat ... sttur.html
Also be careful that code_saturne has two k-epsilon model (linearized or not). I believe the constants sigma_k and sigma_epsilon appears in both but you should probably check the documentation if you want to make some more specific modifications to the constants.
Re: k-epsilon constants modification
Posted: Tue Aug 05, 2025 9:47 am
by MaximeO
Hello Louis,
Thank you for your response.
I have checked this document, which if I'm not mistaken refers to the cs_turbulence.c file I was talking about, but it doesn't mention the sigma_k and sigma_e constants.
I think the two sigma constants should indeed appear in both standard and linearized k-epsilon model, but as I said I didn't find any information about these two. And as they don't appear in the setup.log file, I am wandering if and how we can use them.
Best regards,
Maxime
Re: k-epsilon constants modification
Posted: Wed Aug 06, 2025 6:27 am
by StandardRANSUser001
Not an expert on k-epsilon, however, aren't all model coefficients defined in cs_turbulence_model.c/cpp? They may be shared across several models perhaps?
https://github.com/code-saturne/code_sa ... _model.cpp
Best regards,
Sean Hanrahan
Re: k-epsilon constants modification
Posted: Thu Aug 07, 2025 4:34 pm
by Yvan Fournier
Hello,
If you modify any constant, I recommend checking the setup.log to make sure this worked as intended.
In v8.0, some constants might be duplicated in C and Fortran parts, though most should be shared.
In v9.0, since only the C definitions are used, changing them would be less risky, but note that in general, quite a few constants are not modifiable, as that amounts to changing the turbulence model, and we do not usually encourage this (we are fine with changing a model, as long as the result is considered a new model and not confused with the reference one).
Also, a few variables representing constants in C are shared between 2 models, and some constants may have different values (with the same name) in turbulence model variants. In this case, this is adjusted automatically in the setup, so if you change it too early, it may be overwritten (i.e. it may be better to force values in cs_user_parameters than in cs_user_model). In any case, checking the setup.log is important.
Best regards,
Yvan
Re: k-epsilon constants modification
Posted: Mon Aug 11, 2025 4:46 pm
by MaximeO
Hello,
Thank you for your answers.
Actually, this is not really a new model but just an adjustment of the standard k-epsilon apparently more adapted for atmospherical flows.
After searching a bit more, I found that the

and

constants of the

are defined as "turbulent_schmidt" for k_field and eps_field respectively.
So we can modify them in the cs_user_parameters.c as it follows :
Code: Select all
cs_user_parameters(cs_domain_t *domain)
{
cs_field_set_key_double(CS_F_(eps), cs_field_key_id("turbulent_schmidt"), 2.38);
/* where 2.38 in the constant value wanted for sigma_eps*/
}
And we can see the modification in the setup.log file (the standard value being 1.3) :
Code: Select all
Key: "turbulent_schmidt", values per field
----
k 1
epsilon 2.38
Best regards,
Maxime