When dealing with chemical reactions, molecules of one species of matter may react with the molecules of a second species, thus forming a third species i.e., a different substance. This has a number of implications for the behavior of systems including chemical reactions.Traditionally, the literature of chemical reaction dynamics has been divided into two main areas (not mentioning the large number of different application areas in chemistry)
1) Chemical reaction kinetics
2) Chemical thermodynamics
Chemical reaction kinetics traditionally deals with substance concentrations and their time derivatives. It typically ignores energy conservation, even though internal microscopic energy i.e., chemical potential usually has a large influence on the probability of a reaction to occur. On the other hand, the literature on chemical thermodynamics concentrates on the energy balance in chemical reactions, but usually covers only equilibrium thermodynamics and ignores dynamic behavior.
In this short example of modeling chemical reactions using Modelica, we will focus on the chemical reaction kinetics and ignore energy conservation. However, in large realistic models, especially when chemical reactions interact with other modeled phenomena, it is usually necessary to include energy related terms.
A chemical reaction represented by a reaction formula transforms the chemical species on the left-hand
side of the arrow, called reactants, to the species on the right-hand side of the arrow, called products:
reactants -> products
Consider a chemical reaction between hydrogen gas and iodine gas to form hydrogen iodine:
H2+I2 <-> 2HI
We can formulate the differential equations for the whole reaction system as below.
Now we put the above three reaction rate equations into a Modelica class to prepare for simulation