cideMOD.models.base.base_models.outputs

Classes

BaseCellModelOutputs()

Base mixin class that contains the mandatory methods to be overrided related to the outputs of cideMOD.models.BaseCellModel.

class cideMOD.models.base.base_models.outputs.BaseCellModelOutputs[source]

Bases: ABC

Base mixin class that contains the mandatory methods to be overrided related to the outputs of cideMOD.models.BaseCellModel.

get_cell_state(cell_state: OrderedDict, problem) None[source]

This method updates the cell state dictionary with the current cell state variables of this specific model.

Parameters:
  • cell_state (OrderedDict) – Dictionary containing the current cell state variables

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

Notes

The name of the cell state variables should be the ones registered in the triggers in order to be detected.

get_outputs_info(warehouse: Warehouse) None[source]

This method modifies a dictionary containing the information of both the global and internal variables that can be outputed by this specific model.

Parameters:

warehouse (Warehouse) – Object that postprocess, store and write the outputs.

Examples

To add information about a new global variable:

>>> warehouse.add_global_variable_info(
    'voltage', fnc = self.get_voltage, default = True,
    header = "Voltage [V]")

To add information about a new internal variable:

>>> warehouse.add_internal_variable_info(
    'ionic_current', subdomains = 'electrolyte',
    function_space = 'P1', dtype = 'vector')
prepare_outputs(warehouse: Warehouse, var: ProblemVariables, cell: BatteryCell, mesher: BaseMesher, DA: DimensionalAnalysis, problem) None[source]

This method computes the expression of the requested internal variables to be ready for being evaluated and stored.

Parameters:
  • warehouse (Warehouse) – Object that postprocess, store and write the outputs.

  • var (ProblemVariables) – Object containing the problem variables.

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

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

  • DA (DimensionalAnalysis) – Object where the dimensional analysis is performed.

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

Examples

To add the source of an specific variable:

>>> warehouse.setup_internal_variable('temperature', var.temp)

If it is defined in different subdomains:

>>> warehouse.setup_internal_variable('phi_s', {
        'anode': var.phi_s,
        'cathode': var.phi_s,
        'negativeCC': var.phi_s_cc,
        'positiveCC': var.phi_s_cc,
    })