cideMOD.models.base.base_models.preprocessing

Classes

BaseCellModelPreprocessing()

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

class cideMOD.models.base.base_models.preprocessing.BaseCellModelPreprocessing[source]

Bases: ABC

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

build_dimensionless_parameters(DA: DimensionalAnalysis, cell: CellParser) None[source]

This method computes the dimensionless numbers that arise from the dimensional analysis.

Parameters:
build_reference_parameters(DA: DimensionalAnalysis, cell: CellParser) None[source]

This method computes the reference parameters that will be used to perform the dimensional analysis.

Parameters:
compute_cell_properties(cell: BatteryCell) None[source]

This method computes the general cell properties of this specific 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, var, cell, 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 this specific 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.

scale_variables(variables: dict)[source]

This method scales the given variables.

Parameters:

variables (Dict[str, Any]) – Dictionary containing the names and the values of the variables to be scaled.

Returns:

Dictionary containing the scaled variables. If a variable is not recognized, then do not include it.

Return type:

dict

Examples

>>> variables = {'c_e': 1000, 'c_s_a': 28700}
>>> models.scale_variables(variables)
{'c_e': 0, 'c_s_a': 1}
set_dependent_variables(var: ProblemVariables, cell: BatteryCell, DT: TimeScheme, problem) None[source]

This method sets the dependent variables of this specific 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_problem_variables(var: ProblemVariables, DT: TimeScheme, problem) None[source]

This method sets the problem variables.

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_state_variables(state_vars: list, mesher: BaseMesher, V: dolfinx.fem.FunctionSpace, V_vec: dolfinx.fem.FunctionSpace, problem) None[source]

This method sets the state variables of this specific 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.

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

Examples

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

This method setup this specific model if needed.

Parameters:

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

unscale_variables(variables: dict)[source]

This method unscales the given variables.

Parameters:

variables (Dict[str, Any]) – Dictionary containing the names and the values of the variables to be unscaled.

Returns:

Dictionary containing the unscaled variables. If a variable is not recognized, then do not include it.

Return type:

dict

Examples

>>> variables = {'c_e': 0, 'c_s_a': 1}
>>> models.unscale_variables(variables)
{'c_e': 1000, 'c_s_a': 28700}
update_control_variables(var, problem, **kwargs)[source]

This method updates the control variables of this specific model.

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

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

  • kwargs (dict) – Dictionary containing the control variables to be updated by this specific model.

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

This method updates the reference cell cell properties of this specific model.

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

  • cell (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.