Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nernst Equation is incorrect #63

Open
nRiccobo opened this issue Aug 9, 2023 · 1 comment
Open

Nernst Equation is incorrect #63

nRiccobo opened this issue Aug 9, 2023 · 1 comment
Assignees
Labels
bug Something isn't working cleanup

Comments

@nRiccobo
Copy link
Collaborator

nRiccobo commented Aug 9, 2023

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):

  • OS: Mac
  • Python version: 3.8
@nRiccobo nRiccobo added bug Something isn't working cleanup labels Aug 9, 2023
nRiccobo added a commit to nRiccobo/electrolyzer that referenced this issue Aug 9, 2023
- added P_STD from scipy physical constants, which is 1 bar in Pascals
- mods to calc_open_circuit_voltage() include updated p_cathode, split up partial pressures for hydrogen/oxygen according to Dalton's law.

Issue NREL#63: Nernst equation was incorrect. This issue only became became apparent when adjusting cathode pressure.
- changed E_cell calculation to use the correct partial pressures and replaced R+T with R*T.
- Updated test_cell.py, test_stack.py, test_run_electrolyzer.py to account for the new model change.
- Incomplete is test_run_lcoh.py. Need assistance to adjust lcoh_breakdown.
@nRiccobo
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cleanup
Projects
None yet
Development

No branches or pull requests

2 participants