Electrolytic Diode

Warning

If the Newton solver diverges for any of the solutions, you may try to reduce the relaxation parameter.

ElectrolyticDiode.ElectrolyticDiode(Bias_type: str, phi_bias: float, g_phi: float, z_A: float, z_C: float, y_A_bath: float, y_C_bath: float, K: float | str, Lambda2: float, a2: float, number_cells: list, solvation: float = 0, PoissonBoltzmann: bool = False, relax_param: float = None, Lx: float = 2, Ly: float = 10, rtol: float = 1e-08, max_iter: float = 500, return_type: str = 'Vector')

Solves the system of equations for the example of an electric diode

Solve the dimensionless system of equations presented in: Numerical Treatment of a Thermodynamically Consistent Electrolyte Model, B.Sc. Thesis Habscheid 2024

! If the Newton solver diverges, you may try to reduce the relaxation parameter.

Parameters:
  • Bias_type (str) – ForwardBias, NoBias, BackwardBias

  • phi_bias (float) – Bias in φ

  • g_phi (float) – Neumann boundary condition for φ

  • z_A (float) – Charge number of species A

  • z_C (float) – Charge number of species C

  • y_A_bath (float) – Bath concentration of anions

  • y_C_bath (float) – Bath concentration of cations

  • K (float | str) – Dimensioness bulk modulus of the electrolyte. If ‘incompressible’, the system is solved for an incompressible electrolyte ! Only implemented for incompressible mixtures, yet

  • Lambda2 (float) – Dimensionless parameter

  • a2 (float) – Dimensionless parameter

  • number_cells (int) – Number of cells in the mesh

  • solvation (float, optional) – solvation number, by default 0

  • PoissonBoltzmann (bool, optional) – Solve classical Nernst-Planck model with the use of the Poisson-Boltzmann formulation if True, else solve the presented model by Dreyer, Guhlke, Müller, by default False

  • relax_param (float, optional) – Relaxation parameter for the Newton solver xₙ₊₁ = γ xₙ f(xₙ)/f’(xₙ) with γ the relaxation parameter , by default None -> Determined automatically

  • Lx (float, optional) – Length of domain in x-direction, by default 2

  • Ly (float, optional) – Length of domain in y-direction, by default 10

  • rtol (float, optional) – Relative tolerance for Newton solver, by default 1e-8

  • max_iter (float, optional) – Maximum number of Newton iterations, by default 500

  • return_type (str, optional) – Type of return value, by default ‘Vector’ ‘Vector’ -> Returns the solution as a numpy array for triangle elements ‘Extended’ -> Returns the solution as both, a numpy array for triangle elements and the fenicsx function u

Returns:

Returns atomic fractions for species A and C, electric potential, pressure, and the mesh as numpy arrays for triangle elements. x_vector is a list of both dimensions [x, y] If return_type is ‘Extended’, also returns the fenicsx function u

Return type:

y_A_vector, y_C_vector, phi_vector, p_vector, x_vector