taufactor.electrode

Main module.

Classes

ElectrodeSolver(img[, conductive_label, ...])

Default solver for two phase images.

ImpedanceSolver(img[, conductive_label, ...])

Electrode Solver - solves the electrode tortuosity factor system (migration and capacitive current between current collector and solid/electrolyte interface) Once solve method is called, tau, D_eff and D_rel are available as attributes.

PeriodicElectrodeSolver(img[, ...])

Solver with periodic boundary conditions in y and z direction.

PeriodicImpedanceSolver(img[, ...])

Solver with periodic boundary conditions in y and z direction.

class taufactor.electrode.ElectrodeSolver(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, device='cuda')[source]

Default solver for two phase images. Once solve method is called, tau, D_eff and D_rel are available as attributes.

__init__(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, device='cuda')[source]

Initialise parameters, solution field and other tools that can be re-used for multiple solves.

Parameters:
  • img – input img with 1s conductive and 0s non-conductive

  • bc – Upper and lower boundary conditions. Leave as default.

  • D_0 – reference material diffusivity

  • device – pytorch device, can be cuda or cpu

compute_metrics()[source]

Defines tau and relative error

init_conductive_neighbours(img)[source]

N_i: amount of conductive neighbours (cond_nn)

init_field(mask)[source]

Return initial padded field [bs,Nx+2,Ny+2,Nz+2].

init_reactive_neighbours(img)[source]

S_i: amount of reactive neighbours (reac_nn)

plot_stats(relative_error)[source]

Default: No plotting output.

return_mask(img)[source]

Return conductive mask.

class taufactor.electrode.ImpedanceSolver(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, mode='tau_e', device='cuda')[source]

Electrode Solver - solves the electrode tortuosity factor system (migration and capacitive current between current collector and solid/electrolyte interface) Once solve method is called, tau, D_eff and D_rel are available as attributes.

__init__(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, mode='tau_e', device='cuda')[source]
calc_input_impedance()[source]
compute_metrics()[source]

Defines tau and relative error

count_neighbours(img, mask)[source]

Initialise factor based on conductive and capacitive neighbours factor = (N_i + 2*S_i* j*r*w*c / (1 + j*r*frequency*c) N_i: amount of conductive neighbours (cond_nn) S_i: amount of capacitive neighbours (reac_nn)

Parameters:

img (cp.array) – input image, with 1s conductive and 0s non-conductive

Returns:

prefactor

Return type:

cp.array

init_conductive_neighbours(img)[source]

N_i: amount of conductive neighbours (cond_nn)

init_field(img)[source]

Return initial padded field [bs,Nx+2,Ny+2,Nz+2].

init_field_internal(mask)[source]

Initialise field with analytical solution :param img: input image, with 1s conductive and 0s non-conductive :type img: torch.array :return: initial field :rtype: torch.array

plot_stats(relative_error)[source]

Default: No plotting output.

return_mask(img)[source]

Return conductive mask.

solve(iter_limit=10000, verbose=True, conv_crit=0.001, plot_interval=10)[source]

run a solve simulation

Parameters:

iter_limit – max iterations before aborting, will attemtorch double for the same no. iterations

if initialised as singles :param verbose: Whether to print tau. Can be set to ‘per_iter’ for more feedback :param conv_crit: convergence criteria - running standard deviation of tau_e :param conv_crit_2: convergence criteria - maximum difference between tau_e in consecutive frequency solves :return: tau

class taufactor.electrode.PeriodicElectrodeSolver(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, device='cuda')[source]

Solver with periodic boundary conditions in y and z direction.

apply_boundary_conditions()[source]

Default: Dirichlet in x and no-flux in y and z direction.

init_conductive_neighbours(img)[source]

N_i: amount of conductive neighbours (cond_nn)

init_reactive_neighbours(img)[source]

S_i: amount of reactive neighbours (reac_nn)

class taufactor.electrode.PeriodicImpedanceSolver(img, conductive_label=1, reactive_label=0, omega=None, spacing=None, mode='tau_e', device='cuda')[source]

Solver with periodic boundary conditions in y and z direction.

apply_boundary_conditions()[source]

Default: Dirichlet in x and no-flux in y and z direction.

count_neighbours(img, mask)[source]

Initialise factor based on conductive and capacitive neighbours factor = (N_i + 2*S_i* j*r*w*c / (1 + j*r*frequency*c) N_i: amount of conductive neighbours (cond_nn) S_i: amount of capacitive neighbours (reac_nn)

Parameters:

img (cp.array) – input image, with 1s conductive and 0s non-conductive

Returns:

prefactor

Return type:

cp.array