Volume fractions calculation from mass fractions in elphyv

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Volume fractions calculation from mass fractions in elphyv

Post by rodion »

Hello everyone,

I have two questions about the formulas for mixture of gases in elphyv.F.

1. The volume fractions of different gases in elphyv are counted according to the formula:
Yvol(i) = Ym(i)* Ro(i)/Ro(full mixture)
where Yvol(i) is the volume fraction of gas i, Ym(i) is the mass fraction of gas i, Ro(i) is the density of the gas i.

I made some derivations in the attached file and as far as I can see this calculation should be much more complex: inversion of the matrix is required, volume fractions depend on molar masses of the gases.

2. The formula for dynamic viscosity of mixture of gases in elphyv doesn't take into account molar masses of gases.
According to VISCOSITY OF GAS MIXTURES by Richard S, Brokaw, 1968 molar masses and viscosity collision diameters of gases should be taken into account and the formula is more complex.

Densities of different gases have a bit different dependencies on molar masses.
So I suppose author of the code made some approximations.

Could you please explain, whether these approximations are valid for electric arc and plasma simulation and why?
Attachments
Mixture density from mass fraction - Copie.docx
(51.75 KiB) Downloaded 400 times
Mixture density from mass fraction - Copie.docx
(51.75 KiB) Downloaded 370 times
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Volume fractions calculation from mass fractions in elph

Post by Yvan Fournier »

Hello,

I am not a specialist for this part of the code, so my answer is not definitive. I assume the chosen formula provides a reasonably good approximation, while being simpler. It would be interesting to compare values obtained with the programmed formulas and the one you derived (either on a realistic sample of gas mixtures, or on a test case. I could provide an electric arcs test case if you need one. I'll remind colleagues who know this module better to check this forum.

This part of the code is not under active development (though it is used regularly), and most of the people who worked on it when the physical properties were coded are not active in the team anymore, though we can contact them. If there are not sufficient details in the documentation, we can try to check in old internal reports if I find anything about this, but it might take a bit of time, and it may be better to remind us in May (after the final rush with the coming user meeting, validation report, and 5.0 release this month).

Best regards,

Yvan
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Volume fractions calculation from mass fractions in elph

Post by rodion »

Thank you for your fast answer, Yvan.

I've decided to compare results of calculation according to formulas in elphyv and according to my formulas for the mixture of four gases:
Ar (w1 = 0.3, Ro=1.7839 g/l, M1=39.95 g/mol),
N2 (w2 = 0.4, Ro=1.2505 g/l, M2=28.02 g/mol),
O2 (w3 = 0.2, Ro=1.42895 g/l, M3=32.00 g/mol),
CO2(w4 = 0.1, Ro=1.9768 g/l, M4=44.01 g/mol).
where wi is the mass fraction of the gas i,
Roi is the density of the gas i,
Mi is the molar mass of the gas i.

Accourding to my derivations we can find volume fractions v1,v2,v3,v4 for every gas solving this linear equations set:
|M1*(1-w1^-1)_M2___________M3___________M4__________| |v1| |0|
|M1___________M2*(1-w2^-1)_M3___________M4__________| |v2| |0|
|M1___________M2___________M3*(1-w3^-1)_M4__________|*|v2|=|0|
|M1___________M2___________M3___________M4*(1-w4^-1)| |v2| |0|
Hense:
|-93,21667__28,02__32__44,01| |v1| |0|
|39,95_____-42,03__32__44,01| |v2| |0|
|39,95______28,02_-128_44,01|* |v3|=|0|
|1__________1______1____1__| |v4| |1|

This gives us volume fractions: v1=0.24778, v2=0.47103, v3=0.20622, v4=0.07497
That looks correct because the volume fraction of lighter gas should be bigger than its mass fraction and the volume fraction of heavier gas should be lower than its mass fraction.

But according to formulas in ELPHYV (without density relaxation) volume fractions are:
vi=wi*Roi/RoMixture
where RoMixture=1/(w1/Ro1+w2/Ro2+w3/Ro3+w4/Ro4) is the density of the mixture
This gives us v1=0.36316, v2=0.33943, v3=0.19393, v4=0.13414
Which means that the heaviest gas CO2 with mass fraction 10% has even bigger volume fraction 13.4%. As far as I can see it is not correct.

I would really appreciate it, if you provided an electric arcs test case. Unless it is PFENDER_CASE1.tar.gz(http://www.code-saturne.org/forum/viewt ... f=2&t=1984), which I've already investigated.

Is elphyv active at the moment? Maybe nobody use this feature for mixture of different gases?
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Volume fractions calculation from mass fractions in elph

Post by Yvan Fournier »

Hello,

The case I was thinking of is PFENDER... I don't think I have another one. I'll try to check with people who worked on the electric arcs option for more details, or ask them to check this discussion. I should see at least one or two of them at the user meeting next week.

There may be a good reason for the current code, or you may have exposed a possible bug...

Best regards,

Yvan
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Volume fractions calculation from mass fractions in elph

Post by rodion »

Thank you Yvan.

I hope it is possible to figure out what is going on in this part of the code.

By the way, could you please answer about different specific physics for different parts of the domain? I created this topic on the 17th of March.

Best regards,
Rodion
baudry
Posts: 2
Joined: Wed Apr 19, 2017 2:48 pm

Re: Volume fractions calculation from mass fractions in elph

Post by baudry »

Hi,

these interpolations are provided by :
  • - Mason E.A., Saxena S.C., Approximate Formula for the Thermal Conductivity of Gas ixtures , The Physics of Fluids, vol. 1, n° 5, p 361-369 (1958)
  • - Wilke C.R., A Viscosity Equation for Gas Mixtures, The Journal of Chemical Physics, vol. 18, n°4, p 517-519 (1950)
Approximations have been valided for gas mixture under 2000 K and with similar densities only. For electric arc, the best way is to use dp_ELE with only one gas or to modify elphyv.F. I develop this approach for thermal plasma spraying application but I consider an homogeneous composition for plasma gas even if it's not the case.
If you use the last version of code_saturne, this subroutine is in C langage and propably more simple to modify.

Best regards,

Cyril
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Volume fractions calculation from mass fractions in elph

Post by rodion »

Thank you for you answer and detailed explanations, Cyril.

The most modern version of subroutine elphyv which I have managed to find (http://code-saturne.org/viewvc/saturne/ ... threv=8341) contains notation call field_get_key_int (ivarfl(isca(ipotr)), kivisl, ifcsig) for obtaining access to electrical conductivity. And as far as I see this notation is not valid for CS 4.3.

Are you sure that elphyv.f90 is still active for CS 4.3?
Yvan Fournier
Posts: 4208
Joined: Mon Feb 20, 2012 3:25 pm

Re: Volume fractions calculation from mass fractions in elph

Post by Yvan Fournier »

Hello,

In versions 4.3 and 5.0, the field is accessed (in C) by:

cs_field_t *f = f = CS_F_(potr);

Or (in both Fortran and C) by the name elec_pot_r.

Also, elphyv is now defined as a C function (in src/elec/cs_elec_model.c) in versions 4.3 and above.

Best regards,

Yvan
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Volume fractions calculation from mass fractions in elph

Post by rodion »

Thank you for your answer, Yvan

I've tried following lines and compilation is successful. Thanks a lot.

call field_get_id('elec_pot_r',potr_id)
call field_get_key_int(potr_id, kivisl, ifcsig)
call field_get_val_s(ifcsig, cpro_sig)

Best regards
Rodion
Post Reply