Density for user scalar equation

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
xiaoxue123
Posts: 29
Joined: Fri Mar 02, 2018 11:50 am

Density for user scalar equation

Post by xiaoxue123 »

Hi,

In Code Saturne, can I define a density for the user scalar equation, instead of using the density employed by the continuity, momentum and energy equations?

In my simulation, I have set up several user scalars, and I want to use constant densities for different scalar equations, however the fluid density is a variable as a function of the temperature and pressure. So I'm wondering if I can specify different densities for the user scalars, but didn't manage to find where can I do that. I've just found that I can edit the diffusivities for each user scalar through field_get_val_s, can I do the same to the density through it?

Thanks,
Xiaoxue
Yvan Fournier
Posts: 4209
Joined: Mon Feb 20, 2012 3:25 pm

Re: Density for user scalar equation

Post by Yvan Fournier »

Hello,

I don't believe this is possible, as we solve a single Navier-Stokes eaquation, considering a single velocity and pressure field.

For different scalars such as a gas mix, the usual approach is to use scalars to define the or fraction of each gas (since the sum of fractions must be 1, solving for n-1 scalars might be better), and compute the mixture density based on the relative fractions and densities.

We do need to make this easier to use, as there already is a "gas mix" model in the code, but only usable through user subroutines, and only with constant species properties.

Regards,

Yvan
xiaoxue123
Posts: 29
Joined: Fri Mar 02, 2018 11:50 am

Re: Density for user scalar equation

Post by xiaoxue123 »

Hi Yvan,

I'm using the user subroutines for my simulation.

The different scalars I've mentioned are not for the fluid mixture, but for additional fields I need to solve. The fluid density in my simulation is defined variable as a function of the temperature and the pressure, however I want the density for the user scalars are constant.

Actually I've just learned from the doxygen there is a variable "kromsl" serves as the "variable density field id key for scalars", but it is only available in version 5, and I'm using version 4 now. I'm wondering if that means I can define variable densities for each scalar through the field id "kromsl"? I'll try it after installing a version 5.

Thanks for your reply.

Regards,
Xiaoxue
Post Reply