<!-- Template for calcualting Emf in carbon containing atomspheres -->
<h1>Calculate Emf in carbon containing atmosphere</h1>
<br>
<br>
<div style="display:flex;justify-content:center;gap:50px;">
<div>
<h2> Input parameters</h2>
<form method="post" action="/cgi-bin/celltest/utilities.cgi" enctype="multipart/form-data">
[% INCLUDE print_hidden.tt %]
<input type="hidden" name="action" value="calc_ch4">
<table class=ch4_input><tbody>
<tr><th>Gas </th><th> Mole fraction </th></tr>


<tr><th> Ar </th><th><input type="text" name="Ar" value="[% IF nav.Ar.defined %][% nav.Ar %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> CO2 </th><th><input type="text" name="CO2" value="[% IF nav.CO2.defined %][% nav.CO2 %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> CO </th><th><input type="text" name="CO" value="[% IF nav.CO.defined %][% nav.CO %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> CH4 </th><th><input type="text" name="CH4" value="[% IF nav.CH4.defined %][% nav.CH4 %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> O2 </th><th><input type="text" name="O2" value="[% IF nav.O2.defined %][% nav.O2 %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> H2 </th><th><input type="text" name="H2" value="[% IF nav.H2.defined %][% nav.H2 %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> H2O </th><th><input type="text" name="H2O" value="[% IF nav.H2O.defined %][% nav.H2O %][% ELSE %]0.1[% END %]" size="6" class=textfield></th></tr>
<tr><th> Rest gas </th><th><select name="calc" class=textfield>
<option selected="selected" value="Ar">Ar</option>
<option value="CO2">CO2</option>
<option value="CO">CO</option>
<option value="CH4">CH4</option>
<option value="O2">O2</option>
<option value="H2">H2</option>
<option value="H2O">H2O</option>
</select></th></tr>
<tr><th> Temperature (C) </th><th><input type="text" name="temp" value="[% IF nav.temp.defined %][% nav.temp %][% ELSE %]850[% END %]" size="6" class=textfield></th></tr>
<tr><th> Pressure (atm) </th><th><input type="text" name="P" value="[% IF nav.P.defined %][% nav.P %][% ELSE %]1[% END %]" size="6" class=textfield></th></tr>
<tr><td></td><td><input type="submit" class=textfield name="action" value="calculate emf"></td></tr>
</tbody></table>
</form>
</div>
[% IF data.action %]
<div>
<h2>Calculation resulted in the following<br> gas partial pressures and Emf:</h2>
<table class=ch4_input><tbody>

<tr><th>Gas </th><th> Partial pressures </th></tr>
<tr><th> Ar </th><th> [% FILTER format('%.4e') %][% data.Ar * data.P %][% END %]</th></tr>
<tr><th> CO2 </th><th> [% FILTER format('%.4e') %][% data.CO2 * data.P %][% END %]<th></tr>
<tr><th> CO </th><th> [% FILTER format('%.4e') %][% data.CO * data.P %][% END %]</th></tr>
<tr><th> CH4 </th><th> [% FILTER format('%.4e') %][% data.CH4 * data.P %][% END %]</th></tr>
<tr><th> O2 </th><th> [% FILTER format('%.4e') %][% data.O2 * data.P %][% END %]</th></tr>
<tr><th> H2 </th><th> [% FILTER format('%.4e') %][% data.H2 * data.P %][% END %]</th></tr>
<tr><th> H2O </th><th> [% FILTER format('%.4e') %][% data.H2O * data.P %][% END %]</th></tr>
<tr><th colspan=2>Oxygen partial pressures</th></tr>
<tr><th>Versus O2</th><th>[% data.OCV_O2 %]</th></tr>
<tr><th>Versus Air</th><th>[% data.OCV %]</th></tr>
<!--<tr><th>Carbon activity</th><th>[% data.C_a %]</th></tr>-->
</tbody></table>

</div>
[% END %]
</div>
<br>
<center>
<p>Use rest gas if the mole fractions do not themselves add up to 1</p>
<p>It is advisable to use Argon for this as it is an inert gas.</p>
<p><b>Remember that mole fractions must not add up to more than one!</b></p>
</center>

<style>

.ch4_input {
   margin:auto;
   text-align:left;
}

.textfield {
   width:100%;
}

</style>