1 s2.0 S2772508124000383 Main
1 s2.0 S2772508124000383 Main
Original Article
A R T I C L E I N F O A B S T R A C T
Keywords: The calculation of chemical equilibria in detailed reactor simulations frequently requires elaborate numerical
Ammonia synthesis solution of the governing equations in an iterative way, which is often computationally expensive and can
Ammonia cracking significantly increase the overall computation time. In order to reduce these computational costs, we introduce a
Machine learning
ready-to-use tool, ANNH3, for calculation of equilibrium composition for synthesis and cracking of ammonia
Neural networks
based on a neural network. This tool provides excellent agreement with the conventional approach in the range
Chemical equilibrium
Shortcut modeling tool of 135–1000 ◦ C and 1–100 bar and is ca. 100 times faster than conventional stoichiometry-based concepts by
replacing the iterative solution process with neural network inference. While speed-up is significant even for the
relatively simple case of ammonia synthesis and decomposition, we expect an even higher performance gain for
the equilibrium calculation in reaction systems where more components and multiple reactions are involved.
are fulfilled (Leal et al., 2013). One major drawback of this approach is
that all possible reactions of a system as well as their thermodynamic
1. Introduction equilibrium constants must be known (Massa et al., 2020; Swapnesh
et al., 2014). While this may seem straightforward for simple systems
The importance of modeling chemical reactors on different scales like the ammonia synthesis equilibrium, it quickly becomes problematic
and domains has ever grown over the decades since its emergence. From for more complex systems with more species, e.g., the methanation or
1D models to complex 3D transient CFD methods, complexity is rising the biomass gasification system (Ajorloo et al., 2022; Swapnesh et al.,
and with it the number of computational operations to execute. While 2014). Thus, simultaneous equilibria are often calculated using the
the local information gained from this approach is invaluable, dis- non-stoichiometric method of Gibbs energy minimization (Ajorloo et al.,
cretization of space and time leads to the need to evaluate the model 2022; Gao et al., 2012; Mendiburu et al., 2014). This method is based on
equations at an increasing number of nodes that can quickly escalate the total Gibbs energy of a system being minimal at equilibrium (Gao
into the thousands or millions. This in term means having to solve those et al., 2012; Leal et al., 2017; Massa et al., 2020; Roos and Zietsman,
equations thousands or even millions of times. Thus, saving time at 2022). Calculation of the total Gibbs energy of a system does not require
complex calculations is a huge improvement for simulation driven any knowledge about possible reactions and their stoichiometries, but
engineering. only the species and components that can occur in the system (Massa
One chemical phenomenon to account for is the calculation of et al., 2020). This method is also applicable when dealing with
chemical equilibrium, be it for transient or steady-state simulations. condensed or non-reacting species (Gao et al., 2012; Mendiburu et al.,
Conventionally, chemical equilibria are calculated by stoichiometric or 2014).
non-stoichiometric methods (Massa et al., 2020; Mendiburu et al., Both the stoichiometric and the non-stoichiometric equilibrium
2014). By this definition, the stoichiometric method refers to calculation calculation methods are hereinafter referred to as conventional equilib-
of the equilibrium extent of reaction, ξeq , of one or more linearly inde- rium calculation methods. One common drawback is that their solutions
pendent simultaneous equilibrium reactions from their respective ther- might be conditional upon the initial guess, that is, local minima may be
modynamic equilibrium constants (Leal et al., 2017; Massa et al., 2020; found instead of the correct solution (Leal et al., 2017; Liu et al., 2020;
Mendiburu et al., 2014). The resulting set of one or more polynomial Paz-García et al., 2013; Riel et al., 2022). Additionally, more complex
equations can be solved by root finding in a way that all single equilibria
* Corresponding author.
E-mail address: [email protected] (R. Güttel).
1
These authors contributed equally to this work.
https://doi.org/10.1016/j.dche.2024.100176
Received 13 June 2024; Received in revised form 24 July 2024; Accepted 7 August 2024
Available online 8 August 2024
2772-5081/© 2024 The Authors. Published by Elsevier Ltd on behalf of Institution of Chemical Engineers (IChemE). This is an open access article under the CC BY
license (http://creativecommons.org/licenses/by/4.0/).
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
systems tend to cause convergence issues (Liu et al., 2020; Riel et al., and root finding based on iteration) in favor of fast but possibly less
2022). accurate results which are obtained by algebraic calculations. One
In both conventional methods, the solutions are inherently obtained further benefit is the ability to tune these methods to one’s liking. They
iteratively, either by root finding or minimization, which, in general, is can be constructed to match experimental data in favor of thermody-
computationally expensive (Leal et al., 2020, 2014, 2013; Roos and namic calculations. Thus, when constructed carefully, they might even
Zietsman, 2022). Thus, solving the complex system of equations neces- prove useful in scenarios where thermodynamic first-principle data –
sary for prediction of equilibrium composition is estimated to be about and conventional methods with it – are not available.
10–10,000 times more computationally expensive than evaluating the With the advent of cheap computational power and ease of access,
equations for kinetic or transport phenomena (Leal et al., 2017). This neural network (NN) driven shortcut models have gained ever
becomes especially prominent for systems involving multiple compo- increasing attention, despite the idea being far from new. NNs rely on
nents, since the computation time for equilibrium models shows a composition of multiple nonlinear functions with highly parameterized
high-order non-linear relationship with the amount of species consid- linear mappings (layers). The universal approximation theorem collo-
ered (Roos and Zietsman, 2022). This means that for realistic quially states that NNs of sufficient capacity are (at least in theory) able
multi-component mixtures direct integration of these models into, e.g., to approximate virtually any function to any desired accuracy on a given
dynamic reactor simulations is oftentimes infeasible due to extreme region (Hornik et al., 1989). For the use case at hand this means that the
calculation times (Roos and Zietsman, 2022). functional dependence between equilibrium and initial composition of a
Breaking the non-linear relationship between number of species and chemical system (and many other deterministic dependencies) can be
computation time calls for a disruptive approach, a so-called accelerator captured by neural networks (Hornik et al., 1989).
(Roos and Zietsman, 2022). In the context of modeling, an accelerator is To this day this concept has been applied to (among others)
a system with (saved) precalculated data able to interpolate in a analytical, astro-, thermo- and geochemistry with great success. The
meaningful way at any arbitrary state requested without solving the applications range from the calculation of calibration data based on
equilibrium in a conventional way. In the case discussed here, this re- stability constants (Havel et al., 2002) over the modeling of chemical
sults in an algebraic model not in need of minimization or root finding processes in conjunction with transport processes inside the geosphere
routines to estimate the equilibrium composition at any state. A simple (Demirer et al., 2023) and the prediction of thermodynamic properties
example of such a model might be a lookup table with linear interpo- in equilibrium (Strandlund, 2004) to the prediction of chemical equi-
lation between equidistantly spaced and saved grid points. libria in stellar atmospheres (Asensio Ramos and Socas-Navarro, 2005).
Since both minimization and root finding at their core rely on iter- Generally, it has been found that agreement is good (error has been
ations, an iteration free model can be called a shortcut model. Such a found to be < 10 % in all stated cases) on the desired operating range
piece of code skips computationally expensive operations (minimization with NN models regularly outperforming more traditional regression
2
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
methods (Laloy and Jacques, 2022; Roos and Zietsman, 2022). Usage is At the reference temperature Tref = 298.15 K, the standard enthalpy
also easily accessible and reasonably robust, since no numeric solvers is arbitrarily defined as the standard enthalpy of formation (Eq. (4))
are involved. Speedups of up to a factor of 70 have been reported using (McBride et al., 2002).
this methodology (Strandlund, 2004). Although popular, NN shortcut ( ) ( )
H∘ i Tref = Δf H∘ i Tref (4)
models have not been applied to the efficient calculation of chemical
equilibria for reactor design to the degree we propose. For ammonia, the standard enthalpy of formation can be calculated
To both demonstrate the applicability of NN shortcut models to from the standard enthalpies of H2 and N2 according to Eq. (5) (McBride
chemical equilibrium calculations and provide a useful tool for an et al., 2002).
important application, the ammonia synthesis and cracking equilibrium
as shown in Eq. (1) (enthalpy of reaction from Linstrom, 1997) is chosen Δf H∘ NH3 (T) = H∘ NH3 (T) − 0.5 H∘ N2 (T) − 1.5 H∘ H2 (T) (5)
as the example of use of this study for two reasons: The standard enthalpy of the ammonia synthesis reaction is calcu-
lated from the standard enthalpies of formation of reactants and product
1. It is simple: For this rather simple example system the thermody- (Eq. (6)). Note that the standard enthalpy of formation of elements in
namics are well known, chemical equilibrium is easy to calculate and their reference states, i.e., H2 and N2, is 0 by definition.
experimental validation data is available (Larson, 1924; Larson and ∑
Dodge, 1923). Δr H∘ (T) = νi Δf Hi ∘ (T) = 2 Δf H∘ NH3 (T) − Δf H∘ N2 (T) − 3 Δf H∘ H2 (T)
2. It is relevant: While ammonia is one of the most produced base i
chemicals worldwide (Hosono, 2023), it lately also draws increasing = 2 Δf H∘ NH3 (T)
interest as a potential hydrogen carrier (Lucentini et al., 2021; Spa- (6)
tolisano et al., 2023; Spatolisano and Pellegrini, 2023). Therefore,
Similarly, the reaction entropy is described by Eq. (7).
both the forward synthesis and the backward cracking reactions are ∑
important. Δr S∘ (T) = νi Si ∘ (T) = 2 S∘ NH3 (T) − S∘ N2 (T) − 3 S∘ H2 (T) (7)
i
kJ
N2 + 3 H2 ⇌ 2 NH3 , Δr H∘ = − 91.8 (1) The Gibbs-Helmholtz equation (Eq. (8)) then yields the standard
mol
Gibbs energy of reaction, which is used to calculate the thermodynamic
equilibrium constant (Eq. (9)).
Δr G∘ (T) = Δr H∘ (T) − TΔr S∘ (T) (8)
Conventionally, ammonia is produced using the Haber-Bosch process
at 400 – 600 ◦ C (Hosono, 2023; Lucentini et al., 2021) and up to 400 bar ( ) ∏( )ν
− Δr G∘ (T) peq,i i
(Hosono, 2023; Lucentini et al., 2021) over iron-based catalysts K∘ (T) = exp = (9)
RT p∘
(Hosono, 2023; Lucentini et al., 2021; Spatolisano and Pellegrini, 2023). i
However, novel processes operating at much lower pressures of only 20 Here, the standard pressure is p∘ = 1bar. By transforming the equi-
– 100 bar have been discussed recently (Cholewa et al., 2022; Spatoli- librium constant (Eq. 10) and inserting neq,i = n0,i + νi ξeq , Eq. (9) can be
sano and Pellegrini, 2023). In the application as hydrogen carrier, rewritten as Eq. (11).
ammonia needs to be cracked so that hydrogen is released. This reaction
( ∘ )− 2
is endothermal and volume expanding and thus benefits from high xeq,NH3 2 p
Kx (T) = = K∘
(T) (10)
temperatures of up to 1000 ◦ C (Spatolisano et al., 2023) and low or even xeq,N2 xeq,H2 3 p
atmospheric pressure (Lucentini et al., 2021; Spatolisano et al., 2023).
( )2
This range of realistic operating parameters shall be the basis of this
n0,NH3 +2 ξeq
study, as we aim to provide a freely available and ready-to-use tool for a ( ∘ )− 2 n0 − 2 ξeq
p
common and relevant application that the reader can intuitively and K∘ (T) = ( )3 (11)
easily use to speed up equilibrium calculations with an average error of p n0,N2 − ξeq n0,H2 − 3 ξeq
less than 5 %. n0 − 2 ξeq n0 − 2 ξeq
/
1 tSh 2 tSh 3 tSh 4 ESh,i
H∘ i (T) kJ mol− = ASh,i tSh + BSh,i + CSh,i + DSh,i − + FSh,i − HSh,i + H∘i,Tref (3)
2 3 4 tSh
3
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
(
( ) of the input to the desired output by chaining multiple layers. The
values of ξeq are excluded, i.e., ξeq < − 0.5 n0,NH3 or ξeq > min n0,N2 ,
output of the l-th such general layer Ll takes the form
)
1
3
n0,H2 . From ξeq , the equilibrium composition is calculated according yl+1 = Ll (yl ) = σ (Wl yl + bl ). (15)
to Eq. (14). The molar fractions of hydrogen and ammonia are chosen as target
(network output) values. The missing molar fraction of the mixture can
ni,eq n0,i + νi ξeq
xi,eq = = (14) be inferred by closing the mass balance since molar fractions sum to
neq n0 − 2 ξeq
unity. Prediction of the more general and interpretable extent of reac-
For the training of the neural network, different training data sets are tion ξ has been abandoned in preparation of more complex reaction
generated. Sampling of the initial compositions is common to all systems in which stoichiometric methods for calculating chemical
generated data sets. Therefor molar fractions of all three components equilibria fail or for which the stoichiometry of not all reactions is
(N2 , H2 , NH3 ) are picked according to the Dirichlet distribution from the known.
range (0, 1) (Vlad et al., 2001). This means all training data sets contain Extensive hyperparameter search was performed and results are
not only stoichiometric but mainly random compositions that add to available in the SI. Based on this, a rather large network structure was
unity. chosen to encourage good interpolation capabilities and because no
With respect to temperature and pressure ranges, further distinction overfitting was observed. Thus, a network consisting of three hidden
into a “large” and “small” data set can be made. The “large” data set layers with 200 nodes each and GELU activation function was identified
covers a parameter range of 135 – 1000 ◦ C and 1 – 500 bar in order to as suitable. The output layer consists of two nodes and is not activated.
cover both typical ammonia synthesis (conventional and novel pro- The network is depicted in Fig. 1 and the network setup is compiled in
cesses) and ammonia decomposition conditions (Spatolisano and Pel- Table 2.
legrini, 2023; Cholewa et al., 2022; Lucentini et al., 2021). Additionally, All input quantities (x0 , p, T) are normalized to their respective
by staying above 135 ◦ C, liquid ammonia will not occur (Brunner, means and variances within the training data set. The general normal-
1988). The “small” data set covers a smaller pressure range of 1 – 100 ization is, exemplary for pressure p, described by
bar, whereas the temperature range of 135 – 1000 ◦ C is the same. On
p − E[ptrain ]
both data sets, uniform and log-uniform sampling strategies are applied, p = √̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅̅
̃ (16)
Var[ptrain ]
yielding a total of four training data sets as summarized in Table 1. The
amount of training data per set was set to N = 106 samples, which has
and maps any unnormalized input to the Gaussian distribution with
proven to be sufficient in preliminary experiments. In other words,
mean 0 and variance 1. This is known to increase training success
further increasing the amount of training data did not lead to different
significantly (Ioffe and Szegedy, 2015) and comes at no additional
results. Each data set is divided into training, validation and test data
computational cost since respective means and variances are calculated
sets with a ratio of 7/1/2.
on the training data set once and then saved as non-trainable parameters
In order to validate the training data calculated using Shomate
within the network.
equations, the results are compared to experimental ammonia synthesis
Each tuple of input values (x0 , p, T) is wrapped in a tensor. 256 of
equilibrium data obtained by Larson and Dodge (1923) and Larson
these are grouped together to form a mini-batch of size B = 256. Mini-
(1924) for near stoichiometric initial composition at temperatures of
batching allows for the use of parallelization during network training
325 – 500 ◦ C and pressures of 10 – 1000 atm.
without having to hold the whole training data set in memory and also
Unfortunately, using the available experimental data for training is
promises improved generalization performance (Masters and Luschi,
not feasible, since the amount of data in general and especially at
2018). Error for backpropagation (also called loss, TBCambriaScriptl) is
different conditions is not sufficient to train multi-parameter aNNs.
calculated between all K entries in the network output x̂ eq and expected
value xeq according to
2.2. Neural network construction and training
K
1∑ ( )2
TBCambriaScriptl = xeq,i − ̂
x eq,i . (17)
During preliminary studies, different machine learning methods K i=1
have been compared based on their performance for the problem at
hand. The results are reported in the SI for brevity. Ultimately, neither a In this case, that means calculating the squared error for a single
k-nearest neighbor (kNN) algorithm nor a gradient boosted decision tree prediction of hydrogen and nitrogen (indices i = 1 and i = 2 ) molar
(XGBoost) were able to compete with NNs. Still, a plethora of NN ar- fraction in equilibrium and averaging them (K = 2 for the network
chitectures are imaginable for tackling the problem at hand. It is construction presented in this work). Further aggregating
generally understood that, e.g., autoencoders are useful for reconstruc- TBCambriaScriptl over one minibatch (Eq. (18)) yields the so called MSE
tion problems containing information in high-dimensional spaces (i.e., (mean square error) loss often used in fitting problems (Wang et al.,
denoising), recurrent networks perform well when network output de- 2022).
pends on former output (i.e., in text synthesis), while convolutional
1 ∑B
networks excel at identifying recurring patterns in multidimensional MSE = TBCambriaScriptlb (18)
B b =1
data (i.e., in sound or image recognition). Compared to these uses, the
prediction of equilibrium composition from input quantities constitutes Judging the model performance based only on the MSE can be
a rather simple regression problem which lends itself to the use of the deceiving and thus two more easily interpretable error measures,
general-purpose feed-forward NNs (ffNNs). ffNNs build transformations
Table 1
Training data sets with their respective temperature and pressure ranges and applied sampling strategies.
data set temperature range pressure range sampling strategy
4
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
Fig. 1. Network architecture; GELU activations of the hidden layers and normalization on the input layer are not depicted.
5
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
Fig. 3. MSE loss of network with uniform (SU) and log-uniform (SL) sampling.
Note the minor differences between errors on training, validation and test
data set.
6
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
Fig. 4. Comparison of different error measures of the network trained on SU and SL data sets. Both networks have been tested on test data sets acquired through both
sampling methods (uniform and log-uniform).
Fig. 5. Parity plots for network trained on a) SU data set and b) SL data set.
remain constant. After training, the proposed ffNN shortcut model The developed neural network acts as a shortcut method to any
performs within tolerances of, e.g., empirical correlations for physical or conventional equilibrium calculation (stoichiometric or non-
thermodynamic properties.2 stoichiometric). Because of that, calculation of equilibrium composi-
tions in, e.g., a Python script is as easy as calling the model instance, as
4. Validation by application depicted in Code Example 1 (Stagge et al., 2024).
From this point forward, only results for the best candidate networks
on the small and the large data sets are displayed. In other words, the
following section focusses on the nets trained on SU and LL data sets. All
analyses were carried out in the same manner for the models not dis-
played and the results are provided in the SI.
2
The authors acknowledge the vast amount of empirical correlations and do
not attempt to extensively assess their accuracy. However, studying reference
Code Example 1: Usage of the ffNN shortcut model. Note the * syntax
(Kleiber and Joh, 2013) revealed estimated errors of calculation methods for unpacking the elements of x_initial into individual elements.
thermodynamic properties from 1 % up to 15 % depending on the use case and Herein the variable name p denotes pressure, T temperature,
used equation – this is in line with the presented results. x_initial the initial composition of the mixture and x_eq the
7
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
Fig. 6. Equilibrium lines (equilibrium composition over temperature) for different pressures at stoichiometric initial compositions. Network trained on (a) SU data
set and (b) LL data set. Dots represent network predictions, lines represent conventionally obtained values. The shaded area represents states contained in the training
data set.
composition after reaching equilibrium. All these variables can be given higher for the LL data than the SU data (compare red and pink curves in
as arrays to enable parallel calculation. Fig. 6). This effect might be explained by the fact that high values are
underrepresented in the training set with uniform sampling and thus
larger errors occur when extrapolating.
4.1. Calculation of equilibrium curves Despite that, the stated accuracy can only be guaranteed for values
within the training data range indicated by the shaded areas in Fig. 6.
To show applicability, the frequent task of calculating equilibrium Users are strongly advised to check whether their use case falls within
lines (equilibrium compositions as a function of temperature) at stoi- the stated temperature and pressure range.
chiometric initial composition is performed both with the conventional Turning the attention to the comparison between network pre-
stoichiometric method and the shortcut model. The chosen operating dictions and experimental data, it is apparent that the network model is
conditions span a range in which both ammonia synthesis and decom- no better at predicting the experimental values than the data used for
position occur predominantly. Thus, the performance of the model for training, as shown in Fig. 7. This intuitive result can be interpreted in
both processes can be evaluated. light of the general approximation capabilities of NNs: Although
The results are shown in Fig. 6. Both plots show extraordinary agreement between experimental data and ffNN prediction is poor, so is
agreement between values obtained by conventional calculation and agreement between training data (conventionally obtained) and exper-
shortcut calculation on the trained range. It is not surprising to see that imental data. At the same time, network predictions meet the training
the model trained on the LL data fits the training data for a wider range data nearly perfectly within the trained range. It is thus demonstrated
of operating conditions. Note, that extrapolation capabilities seem to be
8
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
the larger data set adequately matches the training data even up to 500
bar, but does not correctly predict the measured equilibrium, as the
training data does not match the experimental data in this pressure
range.
It can thus be conjectured that neither the network architecture nor
the training process is limiting for the reproducibility of experimental
data but the available training data is. More sophisticated methods for
calculating chemical equilibria are needed to provide more accurate
training data matching experimental data more closely. This training
data in turn enables more accurate network predictions. These methods,
however, are beyond the scope of the presented work.
Fig. 8. 2D error plots (MRE) of the ammonia molar fraction for network trained on (a) SU data set and (b) LL data set. Contour line represents 10 % parity, dashed
rectangle represents the trained range.
9
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
using GPU acceleration, one may assign varying batch sizes for the
evaluation batch passed into the network for prediction. Here, we show
speedups for batch sizes of B = 100 and B = 1000 since further
increasing B does not yield any significant speedup (for full results see
SI). It is apparent that ffNN execution on CPU is by far the fastest of the
depicted methods. Interestingly, GPU execution does not seem to ach-
ieve any speed-up, even for higher numbers of samples. This might be
explained by the network size, as GPU calculations typically cause
resource overhead which limit achievable speed-ups on smaller prob-
lems. Parallelization of calculations is in effect during network inference
as can be seen from the plateau in network execution times, t, between
N = 101 and N = 103 in Fig. 10a). This supports the idea that the GPU
might not be sufficiently utilized. However, speed-up between conven-
tional methods and ffNN is in the range of one to two orders of magni-
tude – regardless whether executed on CPU or GPU – making the method
accessible for users without access to a dedicated GPU on their machine.
The speedup factors found in this work are in good agreement with
typical values of around 70 reported by Strandlund (2004). The pre-
sented method thus allows for significant speedup in equilibrium
calculation.
It should be noted again that neither network inference nor con-
ventional calculation has been sped up using sophisticated methods like
pre- or just-in-time-compilation. For the simple case of ammonia syn-
thesis, conventional calculation of equilibrium composition is not
particularly numerically expensive – one of the reasons it was chosen as
a case study. A properly optimized conventional method (i.e., a
commercially available process simulator) might be as fast or faster than
the reported network inference times. However, it is in the nature of
conventional methods for the calculation times to scale non-linearly
with reaction system size (Roos and Zietsman, 2022). In contrast, NN
inference times do not scale with reaction system size at all, as long as
the number of parameters in the model does not drastically change.
Thus, speedup is expected to be more significant for more complex
systems.
5. Conclusions
4.3. Speedup
Firstly, it should once again be noted that execution times are not
universal and might differ drastically between machines executing the Code Example 2: Instantiation of the SU model from saved
timing script (execution times on the authors’ workstations can be found configuration.
in SI). Thus, the depicted execution times (Fig. 10) must be taken as The authors would like to address some words of caution as well: All
relative measures. Next to the times for the conventional method, users are advised to check for applicability on their process parameter
execution of the shortcut model on CPU and GPU are depicted. When range as is common for working with empirical correlations. Using the
10
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
Fig. 10. (a) Measured code execution times at one of the authors’ workstations and (b) calculated speedup factors Φ according to Eq. (19). The number of samples for
aNN inference on GPU refers to the number of the grouped together input data pairs evaluated in parallel (the batchsize, B ).
network outside its specified range is typically not advisable and can CRediT authorship contribution statement
yield all sorts of unphysical, unexpected and oftentimes surprising re-
sults. Every such use should be validated and documented by the users. Hannes Stagge: Writing – original draft, Visualization, Validation,
A strategy for dynamically rejecting out of range predictions has been Software, Methodology, Investigation, Formal analysis, Data curation,
sketched out. With this at hand extrapolation is verifiable and thus Conceptualization. Theresa Kunz: Writing – original draft, Visualiza-
possible. Furthermore, the proposed algorithm can be used to derive a tion, Validation, Software, Methodology, Investigation, Data curation,
dynamic resampling strategy for improving out of range prediction ca- Conceptualization. Sina Ramsayer: Visualization, Software, Method-
pabilities tailored to the user’s specific use case. ology, Investigation, Formal analysis, Data curation. Robert Güttel:
Although only demonstrated for ammonia synthesis and cracking in Writing – review & editing, Supervision, Funding acquisition,
this work, the outlined approach is far more general and in principle Conceptualization.
applicable to all chemical equilibria with any number of species and
parallel reactions so long as training data is available or can be gener- Declaration of competing interest
ated. To fit the model to the user’s specific use case, one would simply
have to: 1) Generate new training data as outlined here. The authors are The authors declare the following financial interests/personal re-
aware that this may be more complicated than demonstrated for this lationships which may be considered as potential competing interests:
work’s application. 2) Slightly alter the network architecture, specif- Robert Güttel reports financial support was provided by Federal
ically the number of nodes in the in- and output layers. 3) Retrain the Ministry of Education and Research Berlin Office. Hannes Stagge reports
network and possibly adjust hyperparameter settings if training results financial support was provided by German Federal Environmental
are not satisfying. With these steps, especially users who already have Foundation. If there are other authors, they declare that they have no
access to a working equilibrium model are able to speed up their cal- known competing financial interests or personal relationships that could
culations applying this approach. have appeared to influence the work reported in this paper.
While speed-up is significant even for the relatively simple case of
ammonia synthesis and decomposition, the inclusion of more compo- Acknowledgements
nents and even multiple reactions quickly increases calculation times of
(non-) stoichiometric methods (Roos and Zietsman, 2022). In those The contribution was partially financially supported by the German
cases, speeding up the equilibrium calculation with a shortcut method as Federal Environmental Foundation DBU and the German Federal Min-
presented here will be even more favorable, especially considering the istry of Education and Research BMBF (project PICASO, 03SF0634B).
near-constant evaluation times.
Supplementary materials
Data and software availability
Supplementary material associated with this article can be found, in
The ready-to-use short-cut ANNH3 model can be obtained from Zen- the online version, at doi:10.1016/j.dche.2024.100176.
odo (Stagge et al., 2024): All presented models are freely available there
and come with the general network structure, the full training data sets
and the training methods to allow for adjustment.
11
H. Stagge et al. Digital Chemical Engineering 12 (2024) 100176
12