CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

[OF 5.0] Add new reaction rate type in thermophysicalmodel

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 5 Post By Gerry Kan

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2018, 09:49
Default [OF 5.0] Add new reaction rate type in thermophysicalmodel
  #1
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11
Gerry Kan is on a distinguished road
Howdy folks:

I am thinking of adding a time dependent new reaction type (photolysis) into OpenFOAM. It should reside under

${FOAM_SRC}/thermophysicalModels/specie/reaction/reactionRate

as with other reaction rate types. At the moment I am not intending on changing any specific solver, so my (naive) plan is to recompile libthermophysicalmodel.so and have this change visible to all solvers that use this library.

My questions are:

1) Can I simply add a folder (photolysisRate, for instance) under the reactionRate folder (where other reaction rate type are present).

2) Is added the corresponding .H and I.H files into the Make/files file be sufficient to tell wallmake to pick them up.

3) Do I have to create a new solver (from reactingFoam, say) that uses this new library? Would the default solver otherwise be able to pick up the new library (or at least recompiled without explicitly using the new solver)?

Thanks in advance, GK.
Gerry Kan is offline   Reply With Quote

Old   May 17, 2018, 11:12
Default I figured it out
  #2
Senior Member
 
Gerry Kan's Avatar
 
Gerry Kan
Join Date: May 2016
Posts: 373
Rep Power: 11
Gerry Kan is on a distinguished road
Looks like I figured it out. Here is what I did:

say, my new reaction rate is called "xyzRate"

1) Make a directory "xyzRate" (it could be anywhere, but I placed it in ${FOAM_SRC}/thermophysicalModels/specie/reaction/reactionRate)

2) In this directory create two other files: xyzRate.H and xyzRateI.H. (I took the two .H files from ArrheniusReactionRate as template).

3) Soft link (i.e., ln -s) the two files from (2) to ${FOAM_SRC}/thermophysicalModels/specie/lnInclude

4) Make a backup to file ${FOAM_SRC}/thermophysicalModels/specie/reaction/reactions/makeReactions.C before modifying it. You need to locate the block starting

Code:
#define makeReactions(Thermo, Reaction) \
    defineTemplateTypeNameAndDebug(Reaction, 0);  \
    defineTemplateRunTimeSelectionTable(Reaction, dictionary); \
and add the following line (for irreversible reaction):

Code:
  makeReaction(Thermo, IrreversibleReaction, xyzRate) \
5) Implement the new reaction rate model in the two xyzRate .H files from step (2).

6) Compile and build (Allwmake), either at the root level ${FOAM_SRC}, or under ${FOAM_SRC}/thermophysicalModels/

7) If you have an example handy, change one of the reactions (under constants/) to a type that you know is not available (like "spontaneousCombustion"). When you run, say, reactingFoam, you should get the following error:

Code:
Unknown reaction type spontaneousCombustion

Valid reaction types are :

31
(
[skipped] ...
irreversibleXyzReaction
[skipped] ...
)
Now you know xyz is now there!

GK.

Last edited by Gerry Kan; May 24, 2018 at 04:13. Reason: Minor edit
Gerry Kan is offline   Reply With Quote

Old   August 25, 2019, 08:59
Default
  #3
New Member
 
Join Date: Aug 2019
Posts: 1
Rep Power: 0
narkab is on a distinguished road
Thank you for your explanations!

I have a question : How can I do, to have a reaction rate depending on the X-coordinate?
How to define a mesh dependence in the reaction rate.

Thank you in advance for your help.
narkab is offline   Reply With Quote

Reply

Tags
development, openfoam, reactionrate, thermophysicalmodels


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
activeBaffleVelocity boundary condition ? om3ro OpenFOAM Programming & Development 10 November 17, 2020 00:26
Problem with continuity simpleFoam kkl omega airfoils ibelunatic OpenFOAM Running, Solving & CFD 0 March 20, 2018 12:48
multiphaseEulerFoam/tank discharge ves OpenFOAM Running, Solving & CFD 8 December 31, 2017 15:59
Modified pimpleFoam solver to MRFPimpleFoam solver hiuluom OpenFOAM Programming & Development 12 June 14, 2015 22:22
LES supersonic free jet martyn88 OpenFOAM 22 April 17, 2015 07:00


All times are GMT -4. The time now is 06:10.