multilayerpy.build

@author: Adam Milsom
 
    MultilayerPy - build, run and optimise kinetic multi-layer models for 
    aerosol particles and films.
    
    Copyright (C) 2022  Adam Milsom
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

 
Modules
       
multilayerpy

 
Classes
       
builtins.object
DiffusionRegime
ModelBuilder
ModelComponent
ModelType
Parameter
ReactionScheme

 
class DiffusionRegime(builtins.object)
    DiffusionRegime(model_type, model_components_dict, regime='vignes', diff_dict=None)
 
Calling this will build the diffusion regime and return a list of strings
defining the composition-dependent (or not) diffusion evolution for each 
component and the definition of kbb for each component.
 
Parameters
----------
model_type : multilayerpy.build.ModelType
    Defines the model type being considered.
model_components_dict : dict
    A dictionary of multilayer.build.Parameter objects representing each 
    model parameter.
regime : str
    Which diffusion regime to use. 
diff_dict : dict
    A dictionary defining how each component's diffusivity depends on composition.
    
    EXAMPLE:
    >>> diff_dict = {'1' : (2,3),
                     '2' : None,
                     '3' : None}
    
    This states that component 1 diffusivity depends on the amount of 
    component 2 and 3 and that the diffusivities of component 2 and 3 are
    not composition dependent.
 
  Methods defined here:
__call__(self)
Constructs the diffusion regime by making strings representing the rate of diffusion 
of model components between bulk layers and between the bulk and surface layers. 
 
The diffusion regime will then be ready to be used in multilayerpy.build.ModelBuilder.
__init__(self, model_type, model_components_dict, regime='vignes', diff_dict=None)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ModelBuilder(builtins.object)
    ModelBuilder(reaction_scheme, model_components_dict, diffusion_regime)
 
An object which constructs the model file from the reaction scheme, list
of model components and a diffusion regime.
    
Parameters
----------
reaction_scheme : multilayerpy.build.ReactionScheme
    The reaction scheme used in the model.
 
model_components_dict : dict
    A dictionary of multilayer.build.Parameter objects representing each 
    model parameter.
 
diffusion_regime : multilayerpy.build.DiffusionRegime
    The diffusion regime used in the model.
 
  Methods defined here:
__init__(self, reaction_scheme, model_components_dict, diffusion_regime)
Initialize self.  See help(type(self)) for accurate signature.
build(self, name_extention='', date_tag=False, use_scaled_k_surf=False, **kwargs)
Builds the model and saves it to a separate .py file
Different for different model types 
 
Parameters
----------
name_extention : str
    An extra tag added to the model filename.
 
date_tag : bool
    Whether to add a date tag to the filename with today's date.
 
use_scaled_k_surf : bool
    Whether to use a scale factor to convert from bulk second order rate
    constants to surface second order rate constants. 
    
returns
----------
Saves a .py file in the current working directory containing the model 
code defining the system of ODEs to be solved.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ModelComponent(builtins.object)
    ModelComponent(component_number, reaction_scheme, name=None, gas=False, comp_dependent_adsorption=False)
 
Model component class representing a model component (chemical) and key properties.
 
Parameters
----------
component_number : int
    The number given to the component. This is how the component is referred
    to in the model building process.
 
reaction_scheme : multilayerpy.build.ReactionScheme
    The reaction scheme object created for a model system. 
 
name : str 
    The name of the model component. 
 
gas : bool
    Whether or not the component is found in the gas phase (volatile)
 
comp_dependent_adsorption : bool
    Whether the adsorption of this component is dependent on the composition
    of the particle surface. 
 
EXAMPLE: 
# ozone as component number 1, no surface composition-dependent adsorption:
 
>>> from multilayerpy.build import ModelComponent
 
>>> ozone = ModelComponent(1, reaction_scheme, name='ozone', gas=True)
 
  Methods defined here:
__init__(self, component_number, reaction_scheme, name=None, gas=False, comp_dependent_adsorption=False)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ModelType(builtins.object)
    ModelType(model_type, geometry)
 
A class which contains information about the model type
 
Parameters
----------
model_type : str
    Defines the model type. Currently allowed types are 'km-sub'
    and 'km-gap'
geometry : str
    Defines the geometry of the model. Either 'spherical' or 'film'
 
  Methods defined here:
__init__(self, model_type, geometry)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Parameter(builtins.object)
    Parameter(value=inf, name='', bounds=None, vary=False)
 
A class which defines a parameter object along with its value, name, bounds (optional) and stats.
 
Parameters
----------
value : float
    The numerical value of the parameter
 
name : str
    The name of the parameter.
 
bounds : tup or list
    A tuple or list defining the lower and upper bounds for the parameter.
 
vary : bool
    Whether this parameter is to vary during model optimisation.
 
stats : dict
    A dictionary which holds statistics derived from MCMC sampling.
 
  Methods defined here:
__init__(self, value=inf, name='', bounds=None, vary=False)
Initialize self.  See help(type(self)) for accurate signature.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class ReactionScheme(builtins.object)
    ReactionScheme(model_type_object, name='rxn_scheme', reactants=[], products=[], reactant_stoich=[], product_stoich=[])
 
Defining the reaction scheme (what reacts with what)
 
Parameters
----------
model_type_object : multilayerpy.Build.ModelType
    Defines the model type necessary for naming conventions.
 
name : str
    Name of the reaction scheme
 
reactants : list
    List of tuples defining which components react with which.
    
    EXAMPLE: 
    >>> reactants = [(1,2),(1,3)]
    
    This states that the first reaction is between component 1 and 2 and 
    the second reaction is between component 1 and 3.
    
products : list
    List of tuples defining which components are reaction products.
    
    EXAMPLE: 
    >>> products = [(3,),(4,)]
    
    This states that component 3 is a product of reaction 1 and component 4
    is a product of reaction 2.
 
reactant_stoich : list
    List of tuples which define the stoichiometric coefficients (if any) 
    applied to each reactant. (Optional).
    
    EXAMPLE:
    >>> reactants = [(1,2)]
    >>> reactant_stoich = [(0.5,1.0)]
    
    This states that for reaction 1, reactant 1 reacts with reactant 2 and
    their stoichiometric coefficients are 0.5 and 1.0, respectively.
 
product_stoich : list
    List of tuples which define the stoichiometric coefficients (if any) 
    applied to each product. (Optional).
    
    EXAMPLE:
    >>> products = [(3,4)]
    >>> product_stoich = [(0.5,0.5)]
    
    This states that for reaction 1, the products 3 and 4 have stoichiometric
    coefficients (branching ratios) of 0.5.
 
  Methods defined here:
__init__(self, model_type_object, name='rxn_scheme', reactants=[], products=[], reactant_stoich=[], product_stoich=[])
Initialize self.  See help(type(self)) for accurate signature.
display(self)
Function which prints the reaction scheme to the console. Not including stoichiometry.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)