NREL / electrolyzer

Other
20 stars 15 forks source link

Nernst Equation is incorrect #63

Open nRiccobo opened 1 year ago

nRiccobo commented 1 year ago

While tracking issue #61, I saw a bug in the Nernst Equation in calc_open_circuit_voltage().

The partial pressures inside in the ln() component are backwards.

** See equation 8 of (1).

E = E_rev + (RT/nF) ln((p_h2) sqrt(p_o2))

The partial pressures of each gas is calculated by Dalton's Law, in equation 5, 6. p_h2 is the partial pressure of hydrogen and is found with p_cathode and p_h2o_sat because hydrogen exits at the cathode. The partial pressure of oxygen is found with p_anode - p_h2o_sat. The code currently has these two quantities flipped.

To Reproduce See calc_open_circuit_voltage() in cell.py. Compare General Nernst Equation with equation 8 of the following reference.

(1) Vesa, Ruusskanen et al 2017. PEM Water Electrolyzer model for power hardware-in-the-loop. 10.1016/j.ijhydene.2017.03.046

Electrolyzer Version 0.1.0

System Information (please complete the following information):

nRiccobo commented 1 year ago

After reviewing the code and discussing, the only bug exists in the General Nernst equation are the partial pressure calculations within the ln().