CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Equation of State in Openfoam (http://www.cfd-online.com/Forums/openfoam/111537-equation-state-openfoam.html)

hz283 January 9, 2013 09:54

Equation of State in Openfoam
 
Hi All,

I have a question about the equation of state in Openfoam when the combustion or multi-gas simulation situation. I take the solver reactingFoam as example:

In this solver, thermodyanmic related is defined as follows:

00001 Info<< "Creating combustion model\n" << endl;
00002
00003 autoPtr<combustionModels::psiChemistryCombustionMo del> combustion
00004 (
00005 combustionModels::psiChemistryCombustionModel::New
00006 (
00007 mesh
00008 )
00009 );
00010
00011 psiChemistryModel& chemistry = combustion->pChemistry();
00012
00013 hsCombustionThermo& thermo = chemistry.thermo();

The desntiy is updated through EoS using thermo.rho(). Since hsCombustionThermo is the object, whose class is detrived from basicPsiThermo. So we can say that rho is calculated through psi_*p in basicPsiThermo. psi=/R()*T. For combustion or multi-gas situation, the composition in each cell should be different, I think this is directly shown in the gas constant (p=rho*Ru*T/W, W is average mocular weight of the mixture for each cell). In Openfoam, this influence should be related to psi=1/R()*T. I check the code, i.e., perfectgas.C, but I failed to find some information about if this treatment is made. Is calculation of psi_ totally the same for combsution case and single gas case in Openfoam?

Does anyboby know something about this:confused:? Your any suggestion and comments are very welcome. Thank you very much.

best regards,
H

adhiraj January 9, 2013 10:15

I was checking the file
Code:

$FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C
it seems that if you follow the call to
Code:

correct()
from the reactingFOAM solver you get to a point where at the cell level, the psi values for the mixture are computed.
Hope this helps.

hz283 January 9, 2013 11:26

Hi Adhiraj,

Thank you so much! Your answer exactly solve my problem.

best regards,
H

hz283 January 9, 2013 11:41

Quote:

Originally Posted by adhiraj (Post 400973)
I was checking the file
Code:

$FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C
it seems that if you follow the call to
Code:

correct()
from the reactingFOAM solver you get to a point where at the cell level, the psi values for the mixture are computed.
Hope this helps.

Hi Adhiraj,

Can I ask you another question about EoS:

In specieI.H, the molecular weight, gas constant and mole amount is defined/calculated as follows:

00085 inline scalar specie::W() const
00086 {
00087 return molWeight_;
00088 }
00089
00090
00091 inline scalar specie::nMoles() const
00092 {
00093 return nMoles_;
00094 }
00095
00096
00097 inline scalar specie::R() const
00098 {
00099 return RR/molWeight_;
00100 }

My question is where is molWeight_ is calculated ? As you know, for tutorials of reactingFoam, the fuel and oxidizer's molecular weight are given in the file thermo.compressibleGas. How is the molWeight_ calculated using these given molecular weight of individual species? Is molWeight_ the molecular of the mixture or single species?

Thank you very much.

Chris Lucas January 11, 2013 03:49

Hi,

you define the molar mass of your mixture components in the thermalphysicalProperties file in your case folder.

The operator* and operator+ function in the specie class calculate the mixture molar mass.

Kind Regards,

Christian

hz283 January 11, 2013 10:25

Quote:

Originally Posted by Chris Lucas (Post 401325)
Hi,

you define the molar mass of your mixture components in the thermalphysicalProperties file in your case folder.

The operator* and operator+ function in the specie class calculate the mixture molar mass.

Kind Regards,

Christian

Hi Christian,

Thank you very much for your reply. In specieI.H, the operator * is defined as follows:

00149 inline specie operator+(const specie& st1, const specie& st2)
00150 {
00151 scalar sumNmoles = max(st1.nMoles_ + st2.nMoles_, SMALL);
00152
00153 return specie
00154 (
00155 sumNmoles,
00156 st1.nMoles_/sumNmoles*st1.molWeight_
00157 + st2.nMoles_/sumNmoles*st2.molWeight_
00158 );
00159 }

I have another question, here is the variable nMoles fixed during the run time? Because it is read into from the dictionary. Actually, for example, in combustion case, the composition (for example mass fraction, molar fraction and molar concentration of the major species) changes with the time for each point. This will directly make the average molecualr weight W change and thus the return values of R() changes. Do the quantities W and R change for each point with the time?

Is my unstanding correct? If not, I really appreciate it if you can point it out.

best regards,
H

Chris Lucas January 11, 2013 10:51

Hi,

R and W can change if the concentration changes.

Have a look at the mixture class you are using (e.g. homogenousMixture). Here, the mixture "object" is created.

However, you can find the way the mixture is created in the operator+ and operator* (of the classes in your thermo model e.g.the species class)

Kind Regards
Christian

hz283 January 11, 2013 12:12

Quote:

Originally Posted by Chris Lucas (Post 401405)
Hi,

R and W can change if the concentration changes.

Have a look at the mixture class you are using (e.g. homogenousMixture). Here, the mixture "object" is created.

However, you can find the way the mixture is created in the operator+ and operator* (of the classes in your thermo model e.g.the species class)

Kind Regards
Christian

Hi Christian,

Thank you very much for your help. I check these classess about the mixture and indeed the two quantities R and W are defined. Do you mind if ask you another question? For instance, in reactingFoam, the mass fraction of these species will be calculated through spcies governing equations. How these mass fractions at each time step affact the nMoles? Is nMoles is molar amount of the individual species at each cell center for each time step? Because as you know the composition at each cell center will be affected by these mass fractions.

Thank you very much if you can give me some hints about this question.

best regads,
H

Chris Lucas January 15, 2013 11:15

Hi,

nMoles depends on the concentration.

The answer to your question is in the mixture class e.g. "homogenousMixture" in the function mixture.

Kind Regards,
Christian


All times are GMT -4. The time now is 05:32.