## 3 Materials and Methods: Thermodynamic Model and Simulation
### Model of the SOFC  
SOFC systems can be classified into two main types: oxygen-ion-conducting electrolytes (SOFC-O) and proton-conducting electrolytes (SOFC-H) [23]. The SOFC-O requires oxygen ion-conducting electrolytes, such as YSZ or SDC, and water formation at the anode side, whereas a proton-conducting ceramic electrolyte, for example barium cerate, is required for the SOFC-H, in addition to water formation at the cathode.  
Since ammonia is unstable at high temperatures, it begins to decompose into H\({}_{2}\) and N\({}_{2}\)[24] from 200 \({}^{\circ}\)C [25], when supplied to the anode. The working temperature increases to 425 \({}^{\circ}\)C, and 98-99% of the ammonia will be converted. Complete conversion occurs above 600 \({}^{\circ}\)C (873 K) [26]. However, the conversion rate depends strongly on the catalyst and the working temperature.  
\[2\text{NH}_{3}\leftrightarrow\text{ N}_{2}+3\text{H}_{2} \tag{12}\]  
\[2\text{H}_{2}\leftrightarrow\text{ 4H}^{+}+4e^{-} \tag{13}\]  
After the first crack of NH\({}_{3}\) into N\({}_{2}\) and H\({}_{2}\) over the Ni-based catalyst, the generated H\({}_{2}\) was utilized for generating electricity electrochemically. Hydrogen is then oxidized to H\({}_{2}\)O by oxide ions [26].  
\[\text{O}_{2}+4e^{-}+4\text{H}^{+}\rightarrow\text{ 2H}_{2}\text{O} \tag{14}\]  
The overall reaction representing ammonia completed combustion can be summarized as:  
\[4\text{NH}_{3}+3\text{O}_{2}\rightarrow\text{ 6H}_{2}\text{O }+2\text{N}_{2} \tag{15}\]  
During the conversion of NH\({}_{3}\), nitrogen oxide (NO) might be generated by the oxidation of N\({}_{2}\) and oxygen ions.  
\[\text{N}_{2}+2\text{O}^{2-}\rightarrow\text{ 2 NO }+4e^{-} \tag{16}\]  
[PERSON] et al. [13] proved that the partial pressure of NO increases with the increase in NH3 conversion rate. However, the partial pressure of NO is counted as only \(10^{-12}\) atm with a conversion rate of ammonia of 0.99 and the operating temperature of SOFCs at 800 \({}^{\circ}\)C. So, negligible amounts of NO can be produced in the case of ammonia cracks completely over the YSZ electrolyte [15].  
Reaction (12) is endothermic, and influenced by factors such as the pressure and temperature. The reaction changes to the right side as the temperature rises, and to the left side as the pressure rises, producing less hydrogen. To achieve thermodynamic equilibrium of ammonia, the overall Gibbs energy of the process can be minimized [24; 27; 28]:  
\[\left(\Delta G_{system}\right)_{T,P}=0 \tag{17}\]  
Here, the Gibbs energy of the system is the total of the product of the moles of chemical species \(i\) multiplied by the appropriate specific Gibbs energy under constant temperature and pressure:  
\[G_{system}=\sum n_{i}\overline{g}_{i} \tag{18}\]  
The ratio of the fugacity of a species in the system to its fugacity at standard temperature and pressure (STP) for actual gases is defined as its activity:  
\[\overline{g}_{i}=\overline{g}_{fi}^{0}+RT\ ln\frac{f_{i}}{f_{i}^{0}} \tag{19}\]  
The total Gibbs energy of the system can be calculated as:  
\[G_{system}=\left(\sum n_{i}[\overline{g}_{fi}^{0}+RT\ln(y_{i}P)]\right)_{g_{ gas}}+\left(\sum n_{i}\overline{g}_{fi}^{0}\right)_{condensed} \tag{20}\]