class BiLangmuir(BindingBaseClass):
    """Parameters for Multi Component Bi-Langmuir binding model.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats. Length depends on n_comp.
        Adsorption rate constants.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants
    saturation_capacity : list of unsigned floats. Length depends on n_comp.
        Maximum adsorption capacities.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep=('n_comp', 'n_states'))
    desorption_rate = DependentlySizedUnsignedList(dep=('n_comp', 'n_states'),
                                                   default=1)
    saturation_capacity = DependentlySizedUnsignedList(dep=('n_comp',
                                                            'n_states'))
    n_states = UnsignedInteger()

    def __init__(self, *args, n_states=2, **kwargs):
        super().__init__(*args, **kwargs)
        self.n_states = n_states

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'saturation_capacity',
            'n_states'
        ]

    @property
    def n_total_states(self):
        return self.n_comp * self.n_states
class Spreading(BindingBaseClass):
    """Multi Component Spreading adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants.
    desorption_rate : Parameter
        Desorption rate constants.
    maximum_adsorption_capacity : Parameter
        Maximum adsoprtion capacities in state-major ordering.
    exchange_from_1_2 : Parameter
        Exchange rates from the first to the second bound state.
    exchange_from_2_1 : Parameter
        Exchange rates from the second to the first bound state.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)
    maximum_adsorption_capacity = DependentlySizedUnsignedList(dep='n_comp')
    exchange_from_1_1 = DependentlySizedUnsignedList(dep='n_comp')
    exchange_from_2_1 = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'activation_temp',
            'maximum_adsorption_capacity', 'exchange_from_1_2',
            'exchange_from_2_1'
        ]
class MobilePhaseModulator(BindingBaseClass):
    """Mobile Phase Modulator adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants.
    desorption_rate : Parameter
        Desorption rate constants.
    maximum_adsorption_capacity : Parameter
        Maximum adsorption capacities.
    ion_exchange_characteristic : Parameter
        Parameters describing the ion-exchange characteristics (IEX).
    hydrophobicity : Parameter
        Parameters describing the hydrophobicity (HIC).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    maximum_adsorption_capacity = DependentlySizedUnsignedList(dep='n_comp')
    ion_exchange_characteristic = DependentlySizedUnsignedList(dep='n_comp')
    beta = ion_exchange_characteristic
    hydrophobicity = DependentlySizedUnsignedList(dep='n_comp')
    gamma = hydrophobicity

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate',
            'desorption_rate',
            'maximum_adsorption_capacity',
            'ion_exchange_characteristic',
            'hydrophobicity',
        ]
class AntiLangmuir(BindingBaseClass):
    """Multi Component Anti-Langmuir adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats.
        Adsorption rate constants. Length depends on n_comp.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants. Length depends on n_comp.
    maximum_adsorption_capacity : list of unsigned floats.
        Maximum adsorption capacities. Length depends on n_comp.
    antilangmuir : list of unsigned floats, optional.
        Anti-Langmuir coefficients. Length depends on n_comp.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    maximum_adsorption_capacity = DependentlySizedUnsignedList(dep='n_comp')
    antilangmuir = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.adsorption_rate = [0.0] * self.n_comp
        self.desorption_rate = [0.0] * self.n_comp
        self.maximum_adsorption_capacity = [0.0] * self.n_comp
        self.antilangmuir = [0.0] * self.n_comp

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate',
            'maximum_adsorption_capacity', 'antilangmuir'
        ]
class KumarMultiComponentLangmuir(BindingBaseClass):
    """Kumar Multi Component Langmuir adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants.
    desorption_rate : Parameter
        Desorption rate constants.
    maximum_adsorption_capacity : Parameter
        Maximum adsoprtion capacities.
    characteristic_charge: Parameter
        Salt exponents/characteristic charges.
    activation_temp : Parameter
        Activation temperatures.
    temperature : unsigned float.
        Temperature.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)
    maximum_adsorption_capacity = DependentlySizedUnsignedList(dep='n_comp')
    characteristic_charge = DependentlySizedUnsignedList(dep='n_comp',
                                                         default=1)
    activation_temp = DependentlySizedUnsignedList(dep='n_comp')
    temperature = UnsignedFloat()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate',
            'maximum_adsorption_capacity', 'characteristic_charge',
            'activation_temp', 'temperature'
        ]
Esempio n. 6
0
class LumpedRateModelWithoutPores(TubularReactor):
    """Parameters for a lumped rate model without pores.

    Attributes
    ----------
    total_porosity : UnsignedFloat between 0 and 1.
        Total porosity of the column.
    q : List of unsinged floats. Length depends on n_comp
        Initial concentration of the bound phase.
    
    Notes
    -----
    Although technically the LumpedRateModelWithoutPores does not have 
    particles, the particle reactions interface is used to support reactions 
    in the solid phase and cross-phase reactions.
    """
    supports_bulk_reaction = False
    supports_particle_reaction = True

    total_porosity = UnsignedFloat(ub=1)
    _parameters = TubularReactor._parameter_names + ['total_porosity']

    q = DependentlySizedUnsignedList(dep=('n_comp', '_n_bound_states'),
                                     default=0)
    _initial_state = TubularReactor._initial_state + ['q']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._discretization = LRMDiscretizationFV()
class Linear(BindingBaseClass):
    """Parameters for Linear binding model.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats. Length depends on n_comp.
        Adsorption rate constants.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=0)
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += ['adsorption_rate', 'desorption_rate']
class Saska(BindingBaseClass):
    """ Multistate Steric Mass Action adsoprtion isotherm.

    Attributes
    ----------
    henry_const : Parameter
        The Henry coefficient.
    quadratic_factor : Parameter
        Quadratic factors.
    """
    henry_const = DependentlySizedUnsignedList(dep='n_comp')
    quadratic_factor = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += ['henry_const', 'quadratic_factor']
class StericMassAction(BindingBaseClass):
    """Parameters for Steric Mass Action Law binding model.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats. Length depends on n_comp.
        Adsorption rate constants.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants.
    characteristic_charge : list of unsigned floats. Length depends on n_comp.
        The characteristic charge of the protein: The number sites v that
        protein interacts on the resin surface.
    steric_factor : list of unsigned floats. Length depends on n_comp.
        Steric factors of the protein: The number of sites o on the surface
        that are shileded by the protein and prevented from exchange with salt
        counterions in solution.
    capacity : unsigned float.
        Stationary phase capacity (monovalent salt counterions); The total
        number of binding sites available on the resin surface.
    reference_liquid_phase_conc : unsigned float.
        Reference liquid phase concentration (optional, default value = 1.0).
    reference_solid_phase_conc : unsigned float.
        Reference liquid phase concentration (optional, default value = 1.0).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)
    characteristic_charge = DependentlySizedUnsignedList(dep='n_comp')
    steric_factor = DependentlySizedUnsignedList(dep='n_comp')
    capacity = UnsignedFloat()
    reference_liquid_phase_conc = UnsignedFloat()
    reference_solid_phase_conc = UnsignedFloat()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'characteristic_charge',
            'steric_factor', 'capacity', 'reference_liquid_phase_conc',
            'reference_solid_phase_conc'
        ]
class Langmuir(BindingBaseClass):
    """Parameters for Multi Component Langmuir binding model.

    Attributes
    ----------
    adsorption_rate : list of unsigned floats. Length depends on n_comp.
        Adsorption rate constants.
    desorption_rate : list of unsigned floats. Length depends on n_comp.
        Desorption rate constants.
    saturation_capacity : list of unsigned floats. Length depends on n_comp.
        Maximum adsorption capacities.
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)
    saturation_capacity = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'saturation_capacity'
        ]
class MultistateStericMassAction(BindingBaseClass):
    """ Multistate Steric Mass Action adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants of the components to different bound states
        in component-major ordering.
    desorption_rate : Parameter
        Desorption rate constants of the components to different bound states
        in component-major ordering.
    characteristic_charge : Parameter
        Characteristic charges of the components to different bound states in
        component-major ordering.
    steric_factor : Parameter
        Steric factor of the components to different bound states in
        component-major ordering.
    conversion_rate : Parameter
        Conversion rates between different bound states in
        component-major ordering.
    capacity : Parameter
        Stationary phase capacity (monovalent salt counterions): The total
        number of binding sites available on the resin surface.
    reference_liquid_phase_conc : Parameter
        Reference liquid phase concentration (optional, default value = 1.0).
    reference_solid_phase_conc : Parameter
        Reference solid phase concentration (optional, default value = 1.0).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp', default=1)
    characteristic_charge = DependentlySizedUnsignedList(dep='n_comp')
    steric_factor = DependentlySizedUnsignedList(dep='n_comp')
    conversion_rate = DependentlySizedUnsignedList(dep='n_comp')
    capacity = DependentlySizedUnsignedList(dep='n_comp')
    reference_liquid_phase_conc = DependentlySizedUnsignedList(dep='n_comp',
                                                               default=1)
    reference_solid_phase_conc = DependentlySizedUnsignedList(dep='n_comp',
                                                              default=1)

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'characteristic_charge',
            'steric_factor', 'conversion_rate', 'capacity',
            'reference_liquid_phase_conc', 'reference_solid_phase_conc'
        ]
class BiStericMassAction(BindingBaseClass):
    """ Bi Steric Mass Action adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants in state-major ordering.
    desorption_rate : Parameter
        Desorption rate constants in state-major ordering.
    characteristic_charge : Parameter
        Characteristic charges v(i,j) of the it-h protein with respect to the
        j-th binding site type in state-major ordering.
    steric_factor : Parameter
        Steric factor o (i,j) of the it-h protein with respect to the j-th
        binding site type in state-major ordering.
    capacity : Parameter
        Stationary phase capacity (monovalent salt counterions): The total
        number of binding site types.
    reference_liquid_phase_conc : Parameter
        Reference liquid phase concentration for each binding site type or one
        value for all types (optional, default value = 1.0).
    reference_solid_phase_conc : Parameter
        Reference solid phase concentration for each binding site type or one
        value for all types (optional, default value = 1.0).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep=('n_comp', 'n_states'))
    adsorption_rate_dimerization = DependentlySizedUnsignedList(
        dep=('n_comp', 'n_states'))
    desorption_rate = DependentlySizedUnsignedList(dep=('n_comp', 'n_states'))
    characteristic_charge = DependentlySizedUnsignedList(dep=('n_comp',
                                                              'n_states'))
    steric_factor = DependentlySizedUnsignedList(dep=('n_comp', 'n_states'))
    capacity = DependentlySizedUnsignedList(dep='n_states')
    reference_liquid_phase_conc = DependentlySizedUnsignedList(dep='n_states',
                                                               default=1)
    reference_solid_phase_conc = DependentlySizedUnsignedList(dep='n_states',
                                                              default=1)

    def __init__(self, *args, n_states=2, **kwargs):
        super().__init__(*args, **kwargs)
        self.n_states = n_states

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate', 'characteristic_charge',
            'steric_factor', 'capacity', 'reference_liquid_phase_conc',
            'reference_solid_phase_conc'
        ]
class SelfAssociation(BindingBaseClass):
    """Self Association adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate : Parameter
        Adsorption rate constants.
    adsorption_rate_dimerization : Parameter
        Adsorption rate constants of dimerization.
    desorption_rate : Parameter
        Desorption rate constants.
    characteristic_charge : Parameter
        The characteristic charge v of the protein.
    steric_factor : Parameter
        Steric factor of of the protein.
    capacity : Parameter
        Stationary phase capacity (monovalent salt counterions); The total
        number of binding sites available on the resin surface.
    reference_liquid_phase_conc : Parmater
        Reference liquid phase concentration (optional, default value = 1.0).
    reference_solid_phase_conc : Parmater
        Reference liquid phase concentration (optional, default value = 1.0).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    adsorption_rate_dimerization = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    characteristic_charge = DependentlySizedUnsignedList(dep='n_comp')
    steric_factor = DependentlySizedUnsignedList(dep='n_comp')
    capacity = DependentlySizedUnsignedList(dep='n_comp')
    reference_liquid_phase_conc = DependentlySizedUnsignedList(dep='n_comp')
    reference_solid_phase_conc = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'adsorption_rate_dimerization',
            'desorption_rate', 'characteristic_charge', 'steric_factor',
            'capacity', 'reference_liquid_phase_conc',
            'reference_solid_phase_conc'
        ]
Esempio n. 14
0
class TubularReactor(UnitBaseClass):
    """Class for tubular reactors.
    
    Class can be used for a regular tubular reactor. Also serves as parent for
    other tubular models like the GRM by providing methods for calculating
    geometric properties such as the cross section area and volume, as well as
    methods for convective and dispersive properties like mean residence time
    or NTP.
    
    Notes
    -----
    For subclassing, check that the total porosity and interstitial cross 
    section area are computed correctly depending on the model porosities!

    Attributes
    ----------
    length : UnsignedFloat
        Length of column.
    diameter : UnsignedFloat
        Diameter of column.
    axial_dispersion : UnsignedFloat
        Dispersion rate of compnents in axial direction.
    c : List of unsinged floats. Length depends on n_comp
        Initial concentration of the reactor.
             
    """
    supports_bulk_reaction = True
    length = UnsignedFloat(default=0)
    diameter = UnsignedFloat(default=0)
    axial_dispersion = UnsignedFloat()
    total_porosity = 1
    flow_direction = Switch(valid=[-1, 1], default=1)
    _parameter_names = UnitBaseClass._parameter_names + [
        'length', 'diameter', 'axial_dispersion', 'flow_direction'
    ]
    _section_dependent_parameters = UnitBaseClass._section_dependent_parameters + [
        'axial_dispersion', 'flow_direction'
    ]

    c = DependentlySizedUnsignedList(dep='n_comp', default=0)
    _initial_state = UnitBaseClass._initial_state + ['c']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._discretization = LRMDiscretizationFV()

    @property
    def cross_section_area(self):
        """float: Cross section area of a Column.
        
        See also
        --------
        volume
        cross_section_area_interstitial
        cross_section_area_liquid
        cross_section_area_solid
        """
        return math.pi / 4 * self.diameter**2

    @cross_section_area.setter
    def cross_section_area(self, cross_section_area):
        self.diameter = (4 * cross_section_area / math.pi)**0.5

    def set_diameter_from_interstitial_velicity(self, Q, u0):
        """Set diamter from flow rate and interstitial velocity.
        
        In literature, often only the interstitial velocity is given.
        This method, the diameter / cross section area can be inferred from 
        the flow rate, velocity, and porosity.
        

        Parameters
        ----------
        Q : float
            Volumetric flow rate.
        u0 : float
            Interstitial velocity.

        Notes
        -----
        Needs to be overwritten depending on the model porosities!

        """
        self.cross_section_area = Q / (u0 * self.total_porosity)

    @property
    def cross_section_area_interstitial(self):
        """float: Interstitial area between particles.
        
        Notes
        -----
        Needs to be overwritten depending on the model porosities!
        
        See also
        --------
        cross_section_area
        cross_section_area_liquid
        cross_section_area_solid
        """
        return self.total_porosity * self.cross_section_area

    @property
    def cross_section_area_liquid(self):
        """float: Liquid fraction of column cross section area.
        
        See also
        --------
        cross_section_area
        cross_section_area_interstitial
        cross_section_area_solid
        volume
        """
        return self.total_porosity * self.cross_section_area

    @property
    def cross_section_area_solid(self):
        """float: Liquid fraction of column cross section area.
        
        
        See also
        --------
        cross_section_area
        cross_section_area_interstitial
        cross_section_area_liquid
        """
        return (1 - self.total_porosity) * self.cross_section_area

    @property
    def volume(self):
        """float: Volume of the TubularReactor.

        See also
        --------
        cross_section_area
        """
        return self.cross_section_area * self.length

    @property
    def volume_interstitial(self):
        """float: Interstitial volume between particles.

        See also
        --------
        cross_section_area
        """
        return self.cross_section_area_interstitial * self.length

    @property
    def volume_liquid(self):
        """float: Volume of the liquid phase.
        """
        return self.cross_section_area_liquid * self.length

    @property
    def volume_solid(self):
        """float: Volume of the solid phase.
        """
        return self.cross_section_area_solid * self.length

    def t0(self, flow_rate):
        """Mean residence time of a (non adsorbing) volume element.
        
        Parameters
        ----------
        flow_rate : float
            volumetric flow rate

        Returns
        -------
        t0 : float
            Mean residence time    

        See also
        --------
        u0
        """
        return self.volume_interstitial / flow_rate

    def u0(self, flow_rate):
        """Flow velocity of a (non adsorbint) volume element.

        Parameters
        ----------
        flow_rate : float
            volumetric flow rate

        Returns
        -------
        u0 : float
            interstitial flow velocity
            
        See also
        --------
        t0
        NTP
        """
        return self.length / self.t0(flow_rate)

    def NTP(self, flow_rate):
        """Number of theoretical plates.
        
        Parameters
        ----------
        flow_rate : float
            volumetric flow rate

        Calculated using the axial dispersion coefficient:
        :math: NTP = \frac{u \cdot L_{Column}}{2 \cdot D_a}

        Returns
        -------
        NTP : float
            Number of theretical plates
        """
        return self.u0(flow_rate) * self.length / (2 * self.axial_dispersion)

    def set_axial_dispersion_from_NTP(self, NTP, flow_rate):
        """
        Parameters
        ----------
        NTP : float
            Number of theroetical plates
        flow_rate : float
            volumetric flow rate

        Calculated using the axial dispersion coefficient:
        :math: NTP = \frac{u \cdot L_{Column}}{2 \cdot D_a}

        Returns
        -------
        NTP : float
            Number of theretical plates
            
        See also
        --------
        u0
        NTP
        """
        self.axial_dispersion = self.u0(flow_rate) * self.length / (2 * NTP)
class SimplifiedMultistateSteric_Mass_Action(BindingBaseClass):
    """ Simplified multistate Steric Mass Action adsoprtion isotherm.

    Attributes
    ----------
    adsorption_rate :Parameter
        Adsorption rate constants of the components to different bound states
        in component-major ordering.
    desorption_rate : Parameter
        Desorption rate constants of the components to different bound states
        in component-major ordering.
    characteristic_charge_first : Parameter
        Characteristic charges of the components in the first (weakest) bound
        state.
    characteristic_charge_last : Parameter
        Characteristic charges of the components in the last (strongest) bound
        state.
    quadratic_modifiers_charge : Parameter
        Quadratic modifiers of the characteristic charges of the different
        components depending on the index of the bound state.
    steric_factor_first : Parameter
        Steric factor of the components in the first (weakest) bound state.
    steric_factor_last : Parameter
        Steric factor of the components in the last (strongest) bound state.
    quadratic_modifiers_steric : Parameter
        Quadratic modifiers of the sterif factors of the different components
        depending on the index of the bound state.
    capacity : Parameter
        Stationary phase capacity (monovalent salt counterions): The total
        number of binding sites available on the resin surface.
    exchange_from_weak_stronger : Parameter
        Exchangde rated from a weakly bound state to the next stronger bound
        state.
    linear_exchange_ws : Parameter
        Linear exchange rate coefficients from a weakly bound state to the next
        stronger bound state.
    quadratic_exchange_ws : Parameter
        Quadratic exchange rate coefficients from a weakly bound state to the
        next stronger bound state.
    exchange_from_stronger_weak : Parameter
        Exchange rate coefficients from a strongly bound state to the next
        weaker bound state.
    linear_exchange_sw : Parameter
        Linear exchange rate coefficients from a strongly bound state to the
        next weaker bound state.
    quadratic_exchange_sw : Parameter
        Quadratic exchange rate coefficients from a strongly bound state to the
        next weaker bound state.
    reference_liquid_phase_conc : Parameter
        Reference liquid phase concentration (optional, default value = 1.0).
    reference_solid_phase_conc : Parameter
        Reference solid phase concentration (optional, default value = 1.0).
    """
    adsorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    desorption_rate = DependentlySizedUnsignedList(dep='n_comp')
    characteristic_charge_first = DependentlySizedUnsignedList(dep='n_comp')
    characteristic_charge_last = DependentlySizedUnsignedList(dep='n_comp')
    quadratic_modifiers_charge = DependentlySizedUnsignedList(dep='n_comp')
    steric_factor_first = DependentlySizedUnsignedList(dep='n_comp')
    steric_factor_last = DependentlySizedUnsignedList(dep='n_comp')
    quadratic_modifiers_steric = DependentlySizedUnsignedList(dep='n_comp')
    capacity = DependentlySizedUnsignedList(dep='n_comp')
    exchange_from_weak_stronger = DependentlySizedUnsignedList(dep='n_comp')
    linear_exchange_ws = DependentlySizedUnsignedList(dep='n_comp')
    quadratic_exchange_ws = DependentlySizedUnsignedList(dep='n_comp')
    exchange_from_stronger_weak = DependentlySizedUnsignedList(dep='n_comp')
    linear_exchange_sw = DependentlySizedUnsignedList(dep='n_comp')
    quadratic_exchange_sw = DependentlySizedUnsignedList(dep='n_comp')
    reference_liquid_phase_conc = DependentlySizedUnsignedList(dep='n_comp')
    reference_solid_phase_conc = DependentlySizedUnsignedList(dep='n_comp')

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._parameter_names += [
            'adsorption_rate', 'desorption_rate',
            'characteristic_charge_first', 'characteristic_charge_last',
            'quadratic_modifiers_charge', 'steric_factor_first',
            'steric_factor_last', 'quadratic_modifiers_steric', 'capacity',
            'exchange_from_weak_stronger', 'linear_exchange_ws',
            'quadratic_exchange_ws', 'exchange_from_stronger_weak',
            'linear_exchange_sw', 'quadratic_exchange_sw',
            'reference_liquid_phase_conc', 'reference_solid_phase_conc'
        ]
Esempio n. 16
0
class GeneralRateModel(TubularReactor):
    """Parameters for the general rate model.

    Attributes
    ----------
    bed_porosity : UnsignedFloat between 0 and 1.
        Porosity of the bed
    particle_porosity : UnsignedFloat between 0 and 1.
        Porosity of particles.
    particle_radius : UnsignedFloat
        Radius of the particles.
    pore_diffusion : List of unsinged floats. Length depends on n_comp.
        Diffusion rate for components in pore volume.
    surface_diffusion : List of unsinged floats. Length depends on n_comp.
        Diffusion rate for components in adsrobed state.
    pore_accessibility : List of unsinged floats. Length depends on n_comp.
        Accessibility of pores for components.
    cp : List of unsinged floats. Length depends on n_comp
        Initial concentration of the pores
    q : List of unsinged floats. Length depends on n_comp
        Initial concntration of the bound phase.
    """
    supports_bulk_reaction = True
    supports_particle_reaction = True

    bed_porosity = UnsignedFloat(ub=1)
    particle_porosity = UnsignedFloat(ub=1)
    particle_radius = UnsignedFloat()
    film_diffusion = DependentlySizedUnsignedList(dep='n_comp')
    pore_diffusion = DependentlySizedUnsignedList(dep='n_comp')
    surface_diffusion = DependentlySizedUnsignedList(dep=('n_comp',
                                                          '_n_bound_states'))
    pore_accessibility = DependentlySizedUnsignedList(dep='n_comp')
    _parameters = \
        TubularReactor._parameter_names + \
        ['bed_porosity', 'particle_porosity', 'particle_radius',
        'film_diffusion', 'pore_diffusion', 'surface_diffusion']
    _section_dependent_parameters = \
        TubularReactor._section_dependent_parameters + \
        ['film_diffusion', 'pore_diffusion', 'surface_diffusion']

    _cp = DependentlySizedUnsignedList(dep='n_comp')
    q = DependentlySizedUnsignedList(dep=('n_comp', '_n_bound_states'),
                                     default=0)
    _initial_state = TubularReactor._initial_state + ['cp', 'q']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._discretization = GRMDiscretizationFV()

    @property
    def total_porosity(self):
        """float: Total porosity of the column
        """
        return self.bed_porosity + \
            (1 - self.bed_porosity) * self.particle_porosity

    @property
    def cross_section_area_interstitial(self):
        """float: Interstitial area between particles.
        
        See also
        --------
        cross_section_area
        cross_section_area_liquid
        cross_section_area_solid
        """
        return self.bed_porosity * self.cross_section_area

    def set_diameter_from_interstitial_velicity(self, Q, u0):
        """Set diamter from flow rate and interstitial velocity.
        
        In literature, often only the interstitial velocity is given.
        This method, the diameter / cross section area can be inferred from 
        the flow rate, velocity, and bed porosity.
        

        Parameters
        ----------
        Q : float
            Volumetric flow rate.
        u0 : float
            Interstitial velocity.

        Notes
        -----
        Overwrites parent method.

        """
        self.cross_section_area = Q / (u0 * self.bed_porosity)

    @property
    def cp(self):
        if self._cp is None:
            return self.c

    @cp.setter
    def cp(self, cp):
        self._cp = cp
Esempio n. 17
0
class Cstr(UnitBaseClass, SourceMixin, SinkMixin):
    """Parameters for an ideal mixer.

    Parameters
    ----------
    c : List of unsinged floats. Length depends on n_comp
        Initial concentration of the reactor.
    q : List of unsinged floats. Length depends on n_comp
        Initial concentration of the bound phase.
    V : Unsinged float
        Initial volume of the reactor.
    total_porosity : UnsignedFloat between 0 and 1.
        Total porosity of the column.
    flow_rate_filter: np.Array 
        Flow rate of pure liquid without components to reduce volume.
    """
    supports_bulk_reaction = True
    supports_particle_reaction = True

    porosity = UnsignedFloat(ub=1, default=1)
    flow_rate_filter = Polynomial(dep=('_n_poly_coeffs'), default=0)
    _parameter_names = \
        UnitBaseClass._parameter_names + \
        SourceMixin._parameter_names + \
        ['porosity', 'flow_rate_filter']
    _section_dependent_parameters = \
        UnitBaseClass._section_dependent_parameters + \
        SourceMixin._section_dependent_parameters + \
        ['flow_rate_filter']
    _polynomial_parameters = \
        UnitBaseClass._polynomial_parameters + \
        SourceMixin._polynomial_parameters + \
        ['flow_rate_filter']

    c = DependentlySizedUnsignedList(dep='n_comp', default=0)
    q = DependentlySizedUnsignedList(dep=('n_comp', '_n_bound_states'),
                                     default=0)
    V = UnsignedFloat(default=0)
    volume = V
    _initial_state = \
        UnitBaseClass._initial_state + \
        ['c', 'q', 'V']

    @property
    def volume_liquid(self):
        """float: Volume of the liquid phase.
        """
        return self.porosity * self.V

    @property
    def volume_solid(self):
        """float: Volume of the solid phase.
        """
        return (1 - self.porosity) * self.V

    def t0(self, flow_rate):
        """Mean residence time of a (non adsorbing) volume element.
        
        Parameters
        ----------
        flow_rate : float
            volumetric flow rate

        Returns
        -------
        t0 : float
            Mean residence time    

        See also
        --------
        u0
        """
        return self.volume_liquid / flow_rate