CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Evaporation model in dieselSpray (

Tag June 10, 2011 09:25

Evaporation model in dieselSpray
hii evrybody,

i want to implement a new evaporation model in dieselSpray, the are two models; standartEvaporation model and RutlandFlash boil model wich are both assuming the D2 law.

i want to implement a 0D model that calculate the equilibrium state of the droplet after evaporation, i have a c++ code that do this but the implimentation is not to be evident fo me


niklas June 10, 2011 10:20

formulate the problem in a way that it can be written as


d              m_d
-- m_d = - ------
dt              tau

the expression for tau is the evaporation model.

or relaxationTime in

Tag June 14, 2011 03:14

Thank you for your answer Niklas, have you an idea of what the Sevap in the Rho equation contains ?

Sevap += dieselSpray.evaporationSource(i);

My 0D model have not time for the moment, it caculate only the properties of droplets at the equilibrium state, it doesn't assume a D2 law or Abramzon model, i use the secant methode to calculate these properties.

So if i know what Sevap contains, i think that i can implement it..

thank you

niklas June 14, 2011 04:03

I suspected that you would say that :)

actually you can relate your model to a characteristic time and use the existing
framework to add your new evaporation model.

in FOAM the mass of the droplet is calculated/updated according to this equation


(m^n - m^{n-1})          m^n
---------------------  = -  --------    (1)
      dt                        tau

where m^n is the new mass that the drop will have at this time-step and m^{n-1} is the previous drop mass.
dt is the integration step and tau is the characteristic evaporation time (evaporation model)

if you know that the mass of the drop is updated according to this equation,
you can calculate the new mass, m^n, according to your equilibrium conditions and related that to tau.

like this:

according to (1) you will get


    m^n                                                      K*dt
 ------------ = 1/( 1 + dt/tau) = K  =>    tau = -----------
  m^{n-1}                                                    1 - K

where K is something that you can calculate with your model.

This way you dont have to calculate the source terms and bother with Sevap as it will be handled

Tag June 14, 2011 05:24

thank you Niklas,

I think it's easier to do that, I will keep you informed on the progress of my implementation.

i will haves somme questions about the mass fraction of the liquids phase and gazous phase, temperature, pressure modification and updating ...

Thank you again Niklas....


Tag June 24, 2011 10:32

Hii Niklas,

I have successfully implemented my 0D model in OpenFoam as you suggest.

for the case of standartEvaporationModel and my 0D evaporation model:
i want to know how the temperature and other properties like volume fraction and the diameter of the droplets are calculated and updated, I suspect that the B term in evaporation model is considered constant.

Thank you.

niklas June 25, 2011 08:00


Im not following, which B-term?

if you want to find out how these properties are updated, just check the updateProperties-function in parcel.C.

Tag June 29, 2011 07:55

Dear Niklas,

B is the Spalding mass number.

I have to give the initial mass fractions of the liquide, gaz, N2 and O2 (air) and their temperatures in cell to my 0Dmodel that calculate the equilibrium temperature and then the final mass fractions of these species in the same cell, in order to estimate the mass ratio of the liquide : m (n)/m(n-1)= Yl(n)/Yl(n-1) (Yl mass fraction of liquide). the problème that i don't found yet these propertise in openfoam.

Can you give me an idea to how i do that ?


Tag July 4, 2011 05:27


where can i find the total mass, the gas temperature, the fractions of different species in cell(i), i had to use these properties in one class that I've created in dieselSpray SubModels.

Thank U.

niklas July 4, 2011 05:59

Have you checked parcel.C?

All is in there.

if you want the mass of the cell you have to get the density and cell volume


    scalar cellV            = sDB.mesh().V()[celli];
    scalar rho              = sDB.rho()[celli];
    scalar cellMass        = rho*cellV;

temperature of the gas at parcel position

    scalar Tg0 = sDB.TInterpolator().interpolate(position(), celli, facei);
vapor mass fraction of liquid index i (which has index j among the gas species)


        label j = sDB.liquidToGasIndex()[i];
        const volScalarField& Yj = sDB.composition().Y()[j];
        scalar Yfg0 = Yj[celli];

Tag July 4, 2011 06:18

Hi Niklas,
thank you for your answer, i suspected that and you confirmed me thses information, what about the mass fraction of vapor ?

niklas July 4, 2011 06:20

vapor mass fraction of liquid index i (which has index j among the gas species)


        label j = sDB.liquidToGasIndex()[i];
        const volScalarField& Yj = sDB.composition().Y()[j];
        scalar Yfg0 = Yj[celli];

sDB.composition().Y() is the reference to the vapour mass fractions

Tag July 4, 2011 06:24

oops :)... thank you so much Mr Niklas.

Tag July 4, 2011 06:25

last question,

know you how the spalding number that used in the evaporation model (ys-y/1-ys) (somme thing lick that.) is calculated in openFoam?

niklas July 4, 2011 08:08


B = 1 + Xratio

        (pressure - partialFuelVaporPressure)/
        (pressure - pressureAtSurface)
      = 1 + Xratio

        if the pressure @ Surface > pressure
        this lead to boiling
        and Xratio -> infinity (as it should)
        ... this is numerically nasty

    NB! by N. Nordin
        X_v,s = (p_v,s/p) X_v,d
        where X_v,d = 1 for single component fuel
        according to eq (3.136)
        in D. Clerides Thesis

    scalar Xratio = (Xs - Xf)/max(SMALL, 1.0 - Xs);

    if (Xratio > 0.0)
        lgExpr = log(1.0 + Xratio);

Tag July 4, 2011 08:21

thank you Niklas,

i have already seen this in standardEvaporationModel.C, Xs is a variable of the relaxationTime function, but when this function is used we must give the Xs that is, i think is calculated by another function or expression, this is what i want to know.

thank you.

niklas July 5, 2011 02:27

Ah, OK.

Thats done in parcel/setRelaxationTimes.C

However, Xs just calls the function which is defined in the liquidMixture class

which just looks like this

Foam::scalarField Foam::liquidMixture::Xs
    const scalar p,
    const scalar Tg,
    const scalar Tl,
    const scalarField& xg,
    const scalarField& xl
) const
    scalarField xs(xl.size(), 0.0);

    // Raoult's Law
    forAll(xs, i)
        scalar Ti = min(TrMax*properties_[i].Tc(), Tl);
        xs[i] = properties_[i].pv(p, Ti)*xl[i]/p;
    return xs;

Tag July 5, 2011 08:44

Hi Niklas,

To use the molar fraction and gas temperature in my "model0D" class, i have to use an instance of the "spray" class, so what kind of inheritance can do that easily ?


niklas July 5, 2011 09:04

Im not sure I understand your question, but the access calls to those variables are posted in my previous mails.

Tag July 5, 2011 09:20

This is a part of a header of the class i created called model0D,

#ifndef model0D_H
#define model0D_H

namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
class spray; // line added to call the spray class
class model0D

And, in the model0D.C i added the properties lick gas temperature :
spray mysDB;
scalar Tg0 = mysDB.TInterpolator().interpolate(position(), celli, facei);

but it doesn't work!!, i suspect that i haven't made the necessary operations to make correct calling between the two classes .

Thank you....

All times are GMT -4. The time now is 20:09.