Miscellaneous

RefinedMesh1D.create_refined_mesh(refinement_style: str, number_cells: int) Mesh

Creates a one-dimensional mesh with a refined region at the left boundary

Parameters:
  • refinement_style (str) – How the mesh should be refined. Options are ‘log’, ‘hard_log’, ‘hard_hard_log’

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

Returns:

One-dimensional mesh, ready for use in FEniCSx

Return type:

Mesh

Helper_DoubleLayerCapacity.C_DL_dim_ana(y_A_R: float, y_C_R: float, y_N_R: float, z_A: float, z_C: float, phi_L: float, phi_R: float, p_R: float, K: str | float, Lambda2: float, a2: float, nR_m: float, e0: float, LR: float, k: float, T: float, solvation: float) float

Calculates the double layer capacity of the system using the analytical method in dimensionless units

C_dl = ∂Q/∂ φᴸ

Parameters:
  • y_A_R (float) – Value of anion fraction at the right boundary

  • y_C_R (float) – Value of cation fraction at the right boundary

  • y_N_R (float) – Value of neutral fraction at the right boundary

  • z_A (float) – Charge number of anions

  • z_C (float) – Charge number of cations

  • phi_L (float) – Value of electric potential at the left boundary (dimensionless units)

  • phi_R (float) – Value of electric potential at the right

  • p_R (float) – Value of pressure at the right boundary

  • K (str | float) – Bulk modulus, use ‘incompressible’ for an incompress

  • Lambda2 (float) – Dimensionless parameter

  • a2 (float) – Dimensionless parameter

  • nR_m (float) – Reference number density in 1/m^3

  • e0 (float) – Dielectric constant

  • LR (float) – Reference length in m

  • k (float) – Boltzmann constant

  • T (float) – Temperature

  • solvation (float) – Solvation number

Returns:

Double layer capacity of the system in µAs/cm²

Return type:

float

Helper_DoubleLayerCapacity.C_DL_dimless_ana(y_A_R: float, y_C_R: float, y_N_R: float, z_A: float, z_C: float, phi_L: float, phi_R: float, p_R: float, K: str | float, Lambda2: float, a2: float, solvation: float) float

Calculates the double layer capacity of the system using the analytical method in dimensionless units

C_dl = ∂Q/∂ φᴸ

Parameters:
  • y_A_R (float) – Value of anion fraction at the right boundary

  • y_C_R (float) – Value of cation fraction at the right boundary

  • y_N_R (float) – Value of neutral fraction at the right boundary

  • z_A (float) – Charge number of anions

  • z_C (float) – Charge number of cations

  • phi_L (float) – Electric potential at the left boundary [V]

  • phi_R (float) – Electric potential at the right boundary

  • p_R (float) – Pressure at the right boundary

  • K (str | float) – Bulk modulus, use ‘incompressible’ for an incompressible mixture

  • Lambda2 (float) – Dimensionless parameter

  • a2 (float) – Dimensionless parameter

  • solvation (float) – Solvation number

Returns:

Double layer capacity of the system in dimensionless units

Return type:

float

Helper_DoubleLayerCapacity.C_dl(Q_DL: ndarray, Phi_pot: ndarray) ndarray

Double Layer Capacity

Parameters:
  • Q_DL (np.ndarray) – Charge of the system

  • Phi_pot (np.ndarray) – Electric potential values

Returns:

Double Layer Capacity

Return type:

np.ndarray

Helper_DoubleLayerCapacity.Phi_pot_center(Phi_pot: ndarray) ndarray

Returns vector with the center of the electric potential values.

Parameters:

Phi_pot (np.ndarray) – Input vector with electric potential values.

Returns:

Vector with the center of the electric potential values.

Return type:

np.ndarray

Helper_DoubleLayerCapacity.Q_DL_dim_ana(y_A_R: float, y_C_R: float, y_N_R: float, z_A: float, z_C: float, phi_L: float, phi_R: float, p_R: float, K: str | float, Lambda2: float, a2: float, nR_m: float, e0: float, LR: float, solvation: float) float

Calculates charge of the system using the analytical method in dimensionless units

Q = λ^2(∂ₓ φᴸ − ∂ₓ φᴿ)

Parameters:
  • y_A_R (float) – Value of anion fraction at the right boundary

  • y_C_R (float) – Value of cation fraction at the right boundary

  • y_N_R (float) – Value of neutral fraction at the right boundary

  • z_A (float) – Charge number of anions

  • z_C (float) – Charge number of cations

  • phi_L (float) – Value of electric potential at the left boundary (dimensionless units)

  • phi_R (float) – Value of electric potential at the right

  • p_R (float) – Value of pressure at the right boundary

  • K (str | float) – Bulk modulus, use ‘incompressible’ for an incompress

  • Lambda2 (float) – Dimensionless parameter

  • a2 (float) – Dimensionless parameter

  • nR_m (float) – Reference number density in 1/m^3

  • e0 (float) – Dielectric constant

  • LR (float) – Reference length in m

  • solvation (float) – Solvation number

Returns:

Charge of the system in µAs/cm³

Return type:

float

Helper_DoubleLayerCapacity.Q_DL_dimless_ana(y_A_R: float, y_C_R: float, y_N_R: float, z_A: float, z_C: float, phi_L: float, phi_R: float, p_R: float, K: str | float, Lambda2: float, a2: float, solvation: float) float

Calculates charge of the system using the analytical method in dimensionless units

Q = λ^2(∂ₓ φᴸ − ∂ₓ φᴿ)

Parameters:
  • y_A_R (float) – Value of anion fraction at the right boundary

  • y_C_R (float) – Value of cation fraction at the right boundary

  • y_N_R (float) – Value of neutral fraction at the right boundary

  • z_A (float) – Charge number of anions

  • z_C (float) – Charge number of cations

  • phi_L (float) – Electric potential at the left boundary [V]

  • phi_R (float) – Electric potential at the right boundary

  • p_R (float) – Pressure at the right boundary

  • K (str | float) – Bulk modulus, use ‘incompressible’ for an incompressible mixture

  • Lambda2 (float) – Dimensionless parameter

  • a2 (float) – Dimensionless parameter

  • solvation (float) – Solvation number

Returns:

Charge of the system in dimensionless units

Return type:

float

Helper_DoubleLayerCapacity.Q_num_(y_A: ndarray, y_C: ndarray, n: ndarray, x: ndarray, z_A: float = -1.0, z_C: float = 1.0) float

Calculates the charge of the system

Q = ∫_Ω n^F dΩ

Parameters:
  • y_A (np.ndarray) – Anion fraction

  • y_C (np.ndarray) – Cation fraction

  • n (np.ndarray) – Total number density

  • x (np.ndarray) – Spatial discretization

  • z_A (float, optional) – Charge number of anions, by default -1.0

  • z_C (float, optional) – Charge number of cations, by default 1.0

Returns:

Charge of the system

Return type:

float

Helper_DoubleLayerCapacity.Q_num_dim(y_A: ndarray, y_C: ndarray, n: ndarray, x: ndarray, z_A: float, z_C: float, nR_m: float, e0: float, LR: float) float

Calculates the charge of the system

Q = ∫_Ω n^F dΩ

Parameters:
  • y_A (np.ndarray) – Anion fraction

  • y_C (np.ndarray) – Cation fraction

  • n (np.ndarray) – Total number density

  • x (np.ndarray) – Spatial discretization

  • z_A (float, optional) – Charge number of anions, by default -1.0

  • z_C (float, optional) – Charge number of cations, by default 1.0

  • nR_m (float) – Reference number density in 1/m^3

  • e0 (float) – Dielectric constant

  • LR (float) – Reference length in m

Returns:

Charge of the system

Return type:

float

Helper_DoubleLayerCapacity.dx(Phi_pot: ndarray) float

Returns the difference between the first two electric potential values.

Assumes that the electric potential values are equally spaced.

Parameters:

Phi_pot (np.ndarray) – Input vector with electric potential values.

Returns:

Difference between the first two electric potential values.

Return type:

float

Helper_DoubleLayerCapacity.n(p: ndarray, K: str | float) ndarray

Calculates the total number density

Parameters:
  • p (np.ndarray) – Pressure

  • K (str | float) – Bulk modulus, use ‘incompressible’ for an incompressible mixture

Returns:

Total number density

Return type:

np.ndarray