cideMOD.models.PXD.electrochemical.preprocessing

Classes

ElectrochemicalModelPreprocessing()

Base mixin class that contains the mandatory methods to be overrided related to the preprocessing of the model inputs.

class cideMOD.models.PXD.electrochemical.preprocessing.ElectrochemicalModelPreprocessing[source]

Bases: BasePXDModelPreprocessing

Base mixin class that contains the mandatory methods to be overrided related to the preprocessing of the model inputs.

compute_cell_properties(cell: BatteryCell)[source]

This method computes the general cell properties of the electrochemical model.

Parameters:

cell (BatteryCell) – Object where cell parameters are preprocessed and stored.

Notes

This method is called once the cell parameters has been preprocessed.

initial_guess(f: BlockFunction, var: ProblemVariables, cell: BatteryCell, problem) None[source]

This method initializes the state variables based on the initial conditions and assuming that the simulation begins after a stationary state.

Parameters:
  • f (BlockFunction) – Block function that contain the state variables to be initialized.

  • var (ProblemVariables) – Object that store the preprocessed problem variables.

  • cell (BatteryCell) – Object where cell parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

reset(problem, new_parameters=None, deep_reset=False) None[source]

This method resets the problem variables related with the electrochemical model in order to be ready for running another simulation with the same initial conditions, and maybe using different parameters.

Parameters:
  • problem (Problem) – Object that handles the battery cell simulation.

  • new_parameters (Dict[str, float], optional) – Dictionary containing the cell parameters that have already been updated.

  • deep_reset (bool) – Whether or not a deep reset will be performed. It means that the Problem setup stage will be run again as the mesh has been changed. Default to False.

set_active_material_parameters(am: BaseCellComponent, problem) None[source]

This method preprocesses the active material parameters of the electrochemical model.

Parameters:
  • am (BaseCellComponent) – Object where active material parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_cell_parameters(cell: BatteryCell, problem) None[source]

This method preprocesses the cell parameters of the electrochemical model.

Parameters:
  • cell (BatteryCell) – Object where cell parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_current_collector_parameters(cc, problem) None[source]

This method preprocesses the current collector parameters of the electrochemical model.

Parameters:
  • cc (BaseCellComponent) – Object where current collector parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_dependent_variables(var: ProblemVariables, cell: BatteryCell, DT: TimeScheme, problem)[source]

This method sets the dependent variables of the electrochemical model.

Parameters:
  • var (ProblemVariables) – Object that store the preprocessed problem variables.

  • cell (BatteryCell) – Object where cell parameters are preprocessed and stored.

  • DT (TimeScheme) – Object that provide the temporal derivatives with the specified scheme.

  • problem (Problem) – Object that handles the battery cell simulation.

set_electrode_parameters(electrode: BaseCellComponent, problem) None[source]

This method preprocesses the electrode parameters of the electrochemical model.

Parameters:
  • electrode (BaseCellComponent) – Object where electrode parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_electrolyte_parameters(electrolyte, problem) None[source]

This method preprocesses the electrolyte parameters of the electrochemical model.

Parameters:
  • electrolyte (BaseCellComponent) – Object where electrolyte parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_problem_variables(var: ProblemVariables, DT: TimeScheme, problem) None[source]

This method sets the problem variables of the electrochemical model.

Parameters:
  • var (ProblemVariables) – Object that store the preprocessed problem variables.

  • DT (TimeScheme) – Object that provide the temporal derivatives with the specified scheme.

  • problem (Problem) – Object that handles the battery cell simulation.

Notes

This method is called within ProblemVariables right after setting up the state variables and before the BatteryCell is created. In this class is meant to create the control variables and those ones that will help cell parameters preprocessing.

set_separator_parameters(separator, problem) None[source]

This method preprocesses the separator parameters of the electrochemical model.

Parameters:
  • separator (BaseCellComponent) – Object where separator parameters are preprocessed and stored.

  • problem (Problem) – Object that handles the battery cell simulation.

set_state_variables(state_vars: list, mesher, V, V_vec, problem) None[source]

This method sets the state variables of the electrochemical model.

Parameters:
  • state_vars (List(Tuple(str, numpy.ndarray, dolfinx.fem.FunctionSpace))) – List of tuples, each one containing the name, the subdomain and the function space of the state variable.

  • mesher (BaseMesher) – Object that contains the mesh information.

  • V (dolfinx.fem.FunctionSpace) – Common FunctionSpace to be used for each model.

  • V_vec (dolfinx.fem.VectorFunctionSpace) – Common VectorFunctionSpace to be used for each model.

Examples

>>> res = mesher.get_restrictions()
>>> state_vars.append(('new_var', res.electrolyte, V.clone()))
setup(problem)[source]

This method setup the electrochemical model.

Parameters:

problem (Problem) – Object that handles the battery cell simulation.

update_control_variables(var: ProblemVariables, problem, i_app=30.0, v_app=None)[source]

This method updates the control variables of the electrochemical model. Either CC and CV are supported. Varying current and voltage is supported via an expression dependant of the time.

Parameters:
  • var (ProblemVariables) – Object that store the preprocessed problem variables.

  • problem (Problem) – Object that handles the battery cell simulation.

  • i_app (Union[float,str], optional) – The applied current in Amperes. If CV use None. Default to 30.

  • v_app (Union[float,str], optional) – The applied voltage in Volts. If CC use None. Default to None.

update_reference_values(updated_values: dict, cell_parser: CellParser, problem=None) None[source]

This method updates the reference cell cell properties of the electrochemical model.

Parameters:
  • updated_values (Dict[str, float]) – Dictionary containing the cell parameters that have already been updated.

  • cell_parser (CellParser) – Parser of the cell dictionary.

  • problem (Problem, optional) – Object that handles the battery cell simulation.

Notes

This method is called each time a set of dynamic parameters have been updated. If problem is not given, then it is assumed that it have not been already defined.