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 |
I was checking the file
Code:
$FOAM_SRC/thermophysicalModels/reactionThermo/combustionThermo/hsCombustionThermo/hsCombustionThermo.C Code:
correct() Hope this helps. |
Hi Adhiraj,
Thank you so much! Your answer exactly solve my problem. best regards, H |
Quote:
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. |
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 |
Quote:
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 |
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 |
Quote:
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 |
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 |
thermophysical properties
hello
i wonder if you can help me, i really don't know if for example i want to change EOS from perfect fluid to polynomial, which parameters should be deleted and which new parameters will be introduce, ill appreciate if you can help me, |
Dear Sir,
I am trying to customize reactingFoam solver, and above threads are very helpful for R and W. Well, I want to add new equations to the solver, which include R or W (each value varies every time and every cells according the concentration, doesn't it?). However, I don't understand how to access these values in specieI.H. I have tried "specie::R()" since I recognize "specie" as class, but the error: cannot call member function 'Foam::scalar Foam ::specie::R() const' without object has come. Could you teach me the way to refer the calculated R and W? Thanks in advance, KeiJun |
Hi,
you can get W in the mixture class (or at least write a function that gives you access to W) Christian |
Hi,
I'm sorry but I am not familiar with C++ and OpenFOAM programming. I don't understand what you say. I tried discribing such as: 1. volScalarField R = composition.species().R(); 2. specie& specie = composition.species(); volScalarField R = specie.R(); where composition is defined as basicMultiComponentMixture& composition = thermo.composition(); But the error has come in each trial: 1. 'const speciesTable' has no member named 'R' 2. invalid initialization of reference of type 'Foam::specie&' from expression of type 'const speciesTable {aka const Foam::hashedWordList}' What should I do to get W in the mixture class? Sincerely, KeiJun |
All times are GMT -4. The time now is 00:53. |