Previous topic

Integrated Model

Next topic

Surface Form

This Page

Full Model

class pybamm.electrolyte_conductivity.Full(param)

Full model for conservation of charge in the electrolyte employing the Stefan-Maxwell constitutive equations. (Full refers to unreduced by asymptotic methods)

Parameters:
check_algebraic_equations(post_discretisation)

Check that the algebraic equations are well-posed. Before discretisation, each algebraic equation key must appear in the equation After discretisation, there must be at least one StateVector in each algebraic equation

check_default_variables_dictionaries()

Check that the right variables are provided.

check_ics_bcs()

Check that the initial and boundary conditions are well-posed.

check_no_repeated_keys()

Check that no equation keys are repeated.

check_well_determined(post_discretisation)

Check that the model is not under- or over-determined.

check_well_posedness(post_discretisation=False)

Check that the model is well-posed by executing the following tests: - Model is not over- or underdetermined, by comparing keys and equations in rhs and algebraic. Overdetermined if more equations than variables, underdetermined if more variables than equations. - There is an initial condition in self.initial_conditions for each variable/equation pair in self.rhs - There are appropriate boundary conditions in self.boundary_conditions for each variable/equation pair in self.rhs and self.algebraic

Parameters:post_discretisation (boolean) – A flag indicating tests to be skipped after discretisation
default_solver

Return default solver based on whether model is ODE model or DAE model.

export_casadi_objects(variable_names, input_parameter_order=None)

Export the constituent parts of the model (rhs, algebraic, initial conditions, etc) as casadi objects.

Parameters:
  • variable_names (list) – Variables to be exported alongside the model structure
  • input_parameter_order (list, optional) – Order in which the input parameters should be stacked. If None, the order returned by BaseModel.input_parameters() is used
Returns:

casadi_dict – Dictionary of {str: casadi object} pairs representing the model in casadi format

Return type:

dict

generate(filename, variable_names, input_parameter_order=None, cg_options=None)

Generate the model in C, using CasADi.

Parameters:
  • filename (str) – Name of the file to which to save the code
  • variable_names (list) – Variables to be exported alongside the model structure
  • input_parameter_order (list, optional) – Order in which the input parameters should be stacked. If None, the order returned by BaseModel.input_parameters() is used
  • cg_options (dict) – Options to pass to the code generator. See https://web.casadi.org/docs/#generating-c-code
get_coupled_variables(variables)

A public method that creates and returns the variables in a submodel which require variables in other submodels to be set first. For example, the exchange current density requires the concentration in the electrolyte to be created before it can be created. If a variable can be created independent of other submodels then it should be created in ‘get_fundamental_variables’ instead of this method.

Parameters:variables (dict) – The variables in the whole model.
Returns:The variables created in this submodel which depend on variables in other submodels.
Return type:dict
get_external_variables()

A public method that returns the variables in a submodel which are supplied by an external source.

Returns:A list of the external variables in the model.
Return type:list
get_fundamental_variables()

A public method that creates and returns the variables in a submodel which can be created independent of other submodels. For example, the electrolyte concentration variables can be created independent of whether any other variables have been defined in the model. As a rule, if a variable can be created without variables from other submodels, then it should be placed in this method.

Returns:The variables created by the submodel which are independent of variables in other submodels.
Return type:dict
info(symbol_name)

Provides helpful summary information for a symbol.

Parameters:parameter_name (str) –
input_parameters

Returns all the input parameters in the model

new_copy()

Creates an identical copy of the model, using the functionality of pybamm.SymbolReplacer but without performing any replacements

new_empty_copy()

Create an empty copy of the model with the same name and “parameters” (convert_to_format, etc), but empty equations and variables. This is usually then called by pybamm.ParameterValues, pybamm.Discretisation, or pybamm.SymbolReplacer.

parameters

Returns all the parameters in the model

set_algebraic(variables)

A method to set the differential equations which do not contain a time derivative. Note: this method modifies the state of self.algebraic. Unless overwritten by a submodel, the default behaviour of ‘pass’ is used as implemented in pybamm.BaseSubModel.

Parameters:variables (dict) – The variables in the whole model.
set_boundary_conditions(variables)

A method to set the boundary conditions for the submodel. Note: this method modifies the state of self.boundary_conditions. Unless overwritten by a submodel, the default behaviour of ‘pass’ is used a implemented in pybamm.BaseSubModel.

Parameters:variables (dict) – The variables in the whole model.
set_events(variables)

A method to set events related to the state of submodel variable. Note: this method modifies the state of self.events. Unless overwritten by a submodel, the default behaviour of ‘pass’ is used a implemented in pybamm.BaseSubModel.

Parameters:variables (dict) – The variables in the whole model.
set_initial_conditions(variables)

A method to set the initial conditions for the submodel. Note: this method modifies the state of self.initial_conditions. Unless overwritten by a submodel, the default behaviour of ‘pass’ is used a implemented in pybamm.BaseSubModel.

Parameters:variables (dict) – The variables in the whole model.
set_initial_conditions_from(solution, inplace=True)

Update initial conditions with the final states from a Solution object or from a dictionary. This assumes that, for each variable in self.initial_conditions, there is a corresponding variable in the solution with the same name and size.

Parameters:
  • solution (pybamm.Solution, or dict) – The solution to use to initialize the model
  • inplace (bool) – Whether to modify the model inplace or create a new model
set_rhs(variables)

A method to set the right hand side of the differential equations which contain a time derivative. Note: this method modifies the state of self.rhs. Unless overwritten by a submodel, the default behaviour of ‘pass’ is used as implemented in pybamm.BaseSubModel.

Parameters:variables (dict) – The variables in the whole model.
timescale

Timescale of model, to be used for non-dimensionalising time when solving

update(*submodels)

Update model to add new physics from submodels

Parameters:submodel (iterable of pybamm.BaseModel) – The submodels from which to create new model