CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   External Chemistry Solvers and Internal Reaction Rates (http://www.cfd-online.com/Forums/openfoam/90509-external-chemistry-solvers-internal-reaction-rates.html)

mturcios777 July 12, 2011 14:04

External Chemistry Solvers and Internal Reaction Rates
 
Hello All,

I'm updating an in-house solver that uses an external library to solve the combustion chemistry in a fast and efficient manner (well, at least we think so ;) ). We're upgrading our systems to OF 2.0.x, and one problem is that with the change in solvers to sensible enthalpy the chemical enthalpy source terms aren't updated as we have external arrays that store the reaction rates that aren't updated.

I'm unsure the best way to make our system work with the new thermophysical models. I've tried making an public access function/member but am having trouble finding where it should be defined/implemented. I've also thought that maybe I should just define a new chemistry library (based on the code in ODEChemistry) with functions that call the external library and abstract it one level away from the base solver code).

Any suggestions/opinions would be appreciated. Long term compatibility with OpenFOAM is the primary consideration, with speed of implementation second. Thanks in advance!

nakul July 13, 2011 06:23

Hi,

It would be helpful if you could provide some more details. Based upon what you said, I would like to know if your solver is incapable of determining total enthalpy?

If it can determine that then there won't be much problem. Although the thermophysical model after OF-1.7 has been sensible enthalpy based, but the variable of total enthalpy still exists in the code of most solvers.

You may provide some more details regarding your solver and then we would see what can be done!

-Nakul

mturcios777 July 13, 2011 13:42

Thanks for your interest in my problem. The library itself is mainly for calculating the reaction rates, which then feeds into the OpenFOAM solver. I've partially solved the problem by introducting a public function to psiChemistry (virtual here) and ODEChemistry (we use the ODE solver for slow reactions involving nitrogen) that copies over the reaction rates calculated by the eternal library.

Actually this is the second "solution" I've come up with. This first was to create a version of psiChemistryModel that used hCombustionThermo instead of hsCombustionThermo (this may be overkill, but I couldn't figure out how to get access to h), and this replicates the exact behavior of our old solver.

However, I wanted to see what difference it would make to use the hsCombustionThermo instead, and while digging through the code found that I need to add
Code:

chemistry.Sh()()
to the enthalpy transport equations, and following function calls through that I find that the reaction rates are used in calculating chemical enthalpy all the way back in janafThermo. Now that I copy rate fields over and add the chemical source term my temperature field changes; in fact it overshoots and I get a temperature that crashes the solver, so I need to play with that.

If there is a cleaner way to handle this, especially for long term compatibility with FOAM, that would be great to hear.

hismother April 4, 2013 05:45

hi Marco,

I am also trying to use hCombustionThermo with psiChemistryModel instead of hsCombustionThermo. Can you show me how you defined the thermo model in createFields.H when you replace hsCombustionThermo by hCombustionThermo. I tried, but somehow openfoam doesn't understand hCombustionThermo that I defined.

charmc May 11, 2013 08:19

Hi Terrence:
I have the same question with you . Have you find the way to slove it.

hismother May 15, 2013 12:55

Hi charmc,

the problem is Openfoam doesn't include the total enthalpy class in the thermo class anymore. But the code for its class is still there, in the folder of src/thermophysicalModels/reactionThermo/combustionthermo/.... So what I did was I included the hCombustionThermo class in the class of psiChemistryModel. You will understand if you look at the file hCombustionThermos.C at the folder position I gave above. After that you can define the hCombustionThermo in createFields.H in the solver code.

Hope that helps,

Terrence

charmc May 17, 2013 07:11

Quote:

Originally Posted by hismother (Post 427800)
Hi charmc,

the problem is Openfoam doesn't include the total enthalpy class in the thermo class anymore. But the code for its class is still there, in the folder of src/thermophysicalModels/reactionThermo/combustionthermo/.... So what I did was I included the hCombustionThermo class in the class of psiChemistryModel. You will understand if you look at the file hCombustionThermos.C at the folder position I gave above. After that you can define the hCombustionThermo in createFields.H in the solver code.

Hope that helps,

Terrence

Hi Terrence:
Thank you for your reply!:) I think I can understand the question .But as a newbie , I have a little knowledge about Openfoam Source Code. I do not know how to " included the hCombustionThermo class in the class of psiChemistryModel" ? Do me a faver , please !

Best wishes !!


All times are GMT -4. The time now is 17:00.