Kinetics

Thermal analysis

The general principle of thermal analysis is to provide heat to a given amount of material and follow some integral quantity. In the case of thermogravimetry - TGA, we are usually heating the material at a constant rate (generally coupled to differential scanning calorimetr - DSC) and following the mass changes. It is a useful materials characterization method for situations where drying of solids is present or some decomposition of the material is expected. For research purposes, other than determining the mass loss of materials, it is interesting to establish a kinetic model of phase changes; such models can then be studied and maybe integrated to process simulations when applicable.

To help accelerating the testing of different kinetics, AuChimiste provides ThermalAnalysisModel. It provides an ODE system built upon ModelingToolkit to simulate the change of mass $m$, its integral enthalpy change $H$, and the mass fractions of different components $Y_k$. The modeled system - the sample material - is open in the sense it looses matter (generally water or decomposition by-products) to the environment - the carrier gas. Thus, it is necessary to add this contribution to the balance equations so that evaluated mass fractions remain right. From the definitions below

\[\frac{dm}{dt} = \dot{m} = \sum\dot{m}_k \qquad \frac{dm_k}{dt} = \dot{\omega} \qquad Y_k = \frac{m_k}{m}\]

and using the quotient rule of differentiation we can write

\[\frac{dY_k}{dt}=\frac{m\dot{\omega}-\dot{m}m_k}{m^2}\]

that can be simplified to

\[\frac{dY_k}{dt}=\frac{1}{m}\left(\dot{\omega}-\dot{m}Y_k\right)\]

For maintaining a (differentiable) user-defined heating cycle following a rate $\dot{\theta}$ one needs to account to sensible and chemical enthalpy terms. Sensible enthalpy accounts for the specific heat capacity $c_{P}$ role, while chemical terms arise from user-defined reactions. The following expression accounts for the enthalpy change of the sample, where $c_P$ is the mass average of the system components. It is important that the heating cycle be differentiable, otherwise a PID controller would need to be coupled to the system, what is beyond the scope of the present model.

\[\frac{dH}{dt} = mc_{P}\dot{\theta} + \dot{h} \qquad c_{P} = Y_{k}c_{P,k}\]

Notice that this is not the amount reported in DSC analyses, as it accounts for the mass change in the sample; the corresponding value for DSC is provided by a post-processing utility tabulate that can be called with a model and its solution. Putting it all together the following system of equations is assembled:

\[\begin{aligned} \frac{dm}{dt} &= \dot{m} \\[6pt] % \frac{dH}{dt} &= mc_{P}\dot{\theta} + \dot{h} \\[6pt] % m\frac{dY_k}{dt} &= \dot{\omega}-\dot{m}Y_k \end{aligned}\]

AuChimiste.ThermalAnalysisModelType
ThermalAnalysisModel(; kwargs...)

Provides simulation of coupled TGA/DSC analysis for mechanism investigation.

To-do

Since data holds all the information required here (as well as the type parameters of this structure), it is pretty clear that merging that field and eliminating ThermalAnalysisData is a cleaner design choice. There is some difficulty concerning the creation of this object, though; user-supplied functions require a data object to be supplied, and this object is not ready by the point it is necessary. Using reference values is not considered an alternative for now because this object is intended to be fully static.

Fields

  • data::ThermalAnalysisData: Handle containing all model data.

  • ode::ModelingToolkit.ODESystem: Problem differential formulation established with ModelingToolkit.

source

From a practical standpoint, a user needs to define a function for the computation the reaction rates of the different processes (units of $\mathrm{mol\cdotp{}s^{-1}}$), which is provided to a user-provided balance function for the net production rates $\dot{\omega}$ of sample compounds ($\mathrm{kg\cdotp{}s^{-1}}$) and the mass loss rates $\dot{m}_k$ ($\mathrm{kg\cdotp{}s^{-1}}$), and the temperature dependent heat release rate $\dot{h}$ ($\mathrm{J\cdotp{}s^{-1}}$). Those elements are stored on ThermalAnalysisData for use in ThermalAnalysisModel.

AuChimiste.ThermalAnalysisDataType
ThermalAnalysisData(; kwargs...)

Base building block of a thermal analysis (TGA/DSC) simulation.

The keyword arguments must specify the following:

  • data_file::String: thermodynamics database file, defaults to built-in.

  • selected_species::Vector{String}: vector of species names in initial sample.

  • released_species::Vector{String}: vector of species names in lost material.

  • n_reactions::Int64: number of reactions in system (also see To-do).

  • reaction_rates::Function: please, see Fields below.

  • netproductionrates::Function: please, see Fields below.

  • masslossrate::Function: please, see Fields below.

  • heatreleaserate::Function: please, see Fields below.

To-do

In the future reactions will be parsed by database reader and parameter n_reaction will be determined automatically; simple kinetics (at least) will be parsed from file and the related arguments will be kept in this interface for custom implementations.

Fields

  • sample::AuChimiste.ThermalAnalysisThermo: Thermodynamic properties of condensate (sample) components.

  • losses::AuChimiste.ThermalAnalysisThermo: Thermodynamic properties of evaporated (lost) components.

  • reaction_rates::Function: Function describing reaction rates in sample [mol/s].

  • net_production_rates::Function: Function describing net production rates of species in sample [kg/s].

  • mass_loss_rate::Function: Function describing the component mass loss rate in sample [kg/s].

  • heat_release_rate::Function: Function describing the overall reaction heat release rate [W].

source

Finally, a standard interface is provided for system solution:

CommonSolve.solveMethod
CommonSolve.solve(analysis::ThermalAnalysisModel, τ, m, Y, kwargs...)

Provide the integration of ThermalAnalysisModel by creating a problem (ODEProblem) and the base Common.solve implementation. The mandatory arguments must include:

  • τ: total analysis time in seconds [s].

  • m: initial sample mass in milligrams [mg].

  • Y: array of initial mass fractions (or propositions) of compounds in the sample; it will be normalized to ensure correctness and conservation.

Other arguments provided to Common.solve interface for ODEProblem are passed directly to the solver without any check.

source

An application tutorial is provided here; for development purposes or teaching the internals of the implementation, a tutorial independent of the implementation is provided.