Fuel cells/electrolyzers are efficient and clean electrochemical devices that convert chemical energy directly into electricity and vice versa. They have attracted sustainable attention over the past decade from multiple experimental and numerical studies. However, detailed experimental investigations are typically expensive and challenging for providing a number of operating conditions and designs. Computational analysis offers an alternative approach for these studies. With the steadily increasing high-performance computing resources available, the limitations of numerical simulations have substantially decreased. This contribution details the design choice and code structure of modern electrochemical devices, which have been implemented as a versatile C++ library named openFuelCell2 within the open-source platform OpenFOAM, allowing for large-scale parallel calculations to be performed. The solver considers the major transport phenomena in a typical electrochemical device, including fluid flow, heat and mass transfer, species and charge transfer, and electrochemical reaction. This enables numerical simulations on popular electrochemical devices, such as fuel cells and electrolyzers, to be conducted. The paper also describes the domain decomposition, and parallel performance issues, as well as future applications. Program summaryProgram Title:openFuelCell2CPC Library link to program files:https://doi.org/10.17632/cvmb5xgy7h.1Developer's repository link:https://github.com/openFuelCell2/openFuelCell2Licensing provisions: GPLv3Programming language: C++Journal reference of previous version: S.B. Beale, H.-W. Choi, J.G. Pharoah, H.K. Roth, H. Jasak, D.H. Jeon, Open-source computational model of a solid oxide fuel cell, Computer Physics Communications 200 (2016) 15–26.Does the new version supersede the previous version?: NoReasons for new version: This new version aims to account for additional electrochemical applications.Summary of revisions: The new version employs new code structure designs and is capable of considering two different electric potential fields and two-phase flows.Nature of problem: This software library provides a set of models for simulating electrochemical devices, such as fuel cells and electrolyzers, as well as other similar devices. These systems consist of multiple components with distinct features but are coupled through properties such as temperature, species concentrations, and electric current/potentials. This software utilizes a computational fluid dynamics (CFD) approach to enable the simulation of multiregion and multiphysics problems, accounting for heat and mass transfer, single and two-phase flow, multicomponent diffusion, electron and ion transfer, and electrochemical reactions. This toolbox provides researchers with a powerful tool for studying electrochemical devices in a comprehensive and efficient manner.Solution method: This software utilizes the finite volume method (FVM) to discretize and solve all conserved variables governed by partial differential equations. It employs a variant of the SIMPLE and PISO algorithms, known as PIMPLE, to solve the pressure-velocity coupling. All of the transport equations are solved sequentially, except for the enthalpy equation which is solved in an implicitly coupled manner within the global domain.Additional comments including restrictions and unusual features:•The two-phase flow consists of continuous and dispersed phases, without resolving the phase interfaces.•The two-phase flow is solved with an Eulerian-Eulerian approach.•A local-time-stepping method was typically used in the two-phase solution.•The electrochemical reactions take place in volumetric regions.•Species diffusion is described by Fick's law.