mpet.config package
Submodules
mpet.config.configuration module
mpet.config.constants module
- mpet.config.constants.T_ref = 298.0
Reference temperature, K
- mpet.config.constants.k = 1.381e-23
Boltzmann constant, J/(K particle)
- mpet.config.constants.e = 1.602e-19
Electron charge, C
- mpet.config.constants.N_A = 6.022e+23
Avogadro constant, particle / mol
- mpet.config.constants.F = 96472.44
Reference flux, C/mol
- mpet.config.constants.two_var_types = ['diffn2', 'CHR2', 'homog2', 'homog2_sdn', 'ACR2']
General particle classification (1 var)
- mpet.config.constants.one_var_types = ['ACR', 'ACR_Diff', 'diffn', 'CHR', 'homog', 'homog_sdn']
General particle classification (2 var)
- mpet.config.constants.c_ref = 1000.0
Reference concentration, mol/m^3 = 1M
- mpet.config.constants.reactions_epsilon = 1e-12
Reaction rate epsilon for values close to zero
- mpet.config.constants.PARAMS_PER_TRODE = ['Nvol', 'Npart', 'mean', 'stddev', 'cs0', 'simBulkCond', 'sigma_s', 'simPartCond', 'G_mean', 'G_stddev', 'L', 'P_L', 'poros', 'BruggExp', 'specified_psd', 'specified_poros']
parameter that are defined per electrode with a
_{electrode}suffix
- mpet.config.constants.PARAMS_SEPARATOR = ['Nvol', 'L', 'poros', 'BruggExp', 'specified_poros']
subset of
PARAMS_PER_TRODE`that is defined for the separator as well
- mpet.config.constants.PARAMS_PARTICLE = {'D': <class 'float'>, 'E_A': <class 'float'>, 'E_D': <class 'float'>, 'N': <class 'int'>, 'Omega_a': <class 'float'>, 'Rfilm': <class 'float'>, 'beta_s': <class 'float'>, 'delta_L': <class 'float'>, 'gamma_con': <class 'float'>, 'k0': <class 'float'>, 'kappa': <class 'float'>}
parameters that are defined for each particle, and their type
mpet.config.derived_values module
- class mpet.config.derived_values.DerivedValues[source]
Bases:
objectDerivedValues holds the functions and equations required to calculate a parameter that is derived from other parameters. Results are cached, so each parameter is calculated only once. This class is meant to be used from within
mpet.config.configuration.Config.Like
mpet.config.configuration.Config, the[]operator can be used to access values.Each method of this class that does not start with an underscore is a derived value that can be calculated. If it has a
trodeargument, the parameter is electrode-specific and the name of the electrode should be specified (either ‘a’ or ‘c’).A list of the available parameters is stored in
self.available_values.Where applicable, all parameters are scaled to their non-dimensional values.
- __getitem__(args)[source]
Retrieve a derived parameter using the
[]operator.- Parameters:
args (tuple) – Tuple with 2 or 3 items: Config object, name of parameter to retrieve, optionally electrode to retrieve parameter for (system config is selected if no electrode is provided or value is set to None)
- Returns:
value of derived parameter
Example usage:
Initialize config and derived values objects: Note that
DerivedValuesis meant to be used from within thempet.config.configuration.Configclass. Passing the entireConfigobject is then achieved by passingself, instead ofconfigtoDerivedValues.>>> config = Config('/path/to/params_system.cfg') >>> dv = DerivedValues()
Parameter that does not need electrode,
t_ref:>>> dv[config, 't_ref', None] 7.792736808950305
Parameter that does need electrode:
>>> dv[config, 'csmax', 'c'] 22904.35071404849
If a parameter that needs and electrode is accessed without electrode, or vice-versa, an error is raised:
>>> dv[config, 'csmax', None] TypeError: csmax() missing 1 required positional argument: 'trode'
>>> dv[config, 't_ref', 'c'] TypeError: t_ref() takes 1 positional argument but 2 were given