API Reference
Main Classes
|
|
|
Modules
Constants and unit conversions. |
|
Handles the calculation of the viscosity and density of a variety of pure gases. |
|
Handles the calculation of the diffusion coefficient of a binary gas mixture. |
|
Conversion functions for flow rates and concentrations in flowtube package. |
|
Kinetics calculations for flow tube experiments. |
Detailed Documentation
flowtube - A Python package for transport and diffusion calculations in cylindrical flow reactors.
This package provides tools and utilities for flow reactor analysis including coated wall reactor (CWR), boat reactor, viscosity/density, and binary diffusion coefficients calculations for atmospheric chemistry research.
- class flowtube.CoatedWallReactor(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, insert_ID=0, insert_length=0)[source]
Bases:
object- Parameters:
FT_ID (float)
FT_length (float)
injector_ID (float)
injector_OD (float)
reactant_gas (str)
carrier_gas (str)
reactant_MR (float)
insert_ID (float)
insert_length (float)
- __init__(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, insert_ID=0, insert_length=0)[source]
Handles calculations relevant to flow rate, flow diagnostics, transport, and uptake for a coated wall reactor. By default assumes no insert and a fully coated flow tube. To calculate terms for a fully-coated cylindrical insert or for a partially coated flow tube, simply pass values for the insert length and ID.
- Parameters:
FT_ID (float) – Inner diameter (cm) of flow tube.
FT_length (float) – Length (cm) of flow tube.
injector_ID (float) – Inner diameter (cm) of reactant injector.
injector_OD (float) – Outer diameter (cm) of reactant injector.
reactant_gas (str) – Molecular formula of reactant gas (supported Ar, He, Air, Br2, Cl2, HBr, HCl, HI, H2O, I2, NO, N2, and O2).
carrier_gas (str) – Molecular formula of carrier gas (supported: Ar, He, N2, O2).
reactant_MR (float) – Reactant mixing ratio (mol mol-1).
insert_ID (float, optional) – Inner diameter (cm) of insert.
insert_length (float, optional) – Length (cm) of insert.
- Returns:
None
- Return type:
None
- calculate_gamma(concentrations, exposure, exposure_units)[source]
Fits the observed loss to the boat to a first order kinetic model to extract the uptake coefficient.
- Parameters:
concentrations (numpy.ndarray) – Reactant concentrations (arbitrary units).
exposure (numpy.ndarray) – Reactant exposure (s or cm).
exposure_units (str) – Units of exposure (s or cm).
- Returns:
k, first order loss rate (s-1). float: r_value, correlation coefficient of the fit. float: gamma, uptake coefficient. tuple[float, float]: 95% confidence interval for gamma
- Return type:
float
- carrier_flow(radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Performs and displays carrier gas transport calculations.
- Parameters:
delta_T_radial (float) – Radial temperature gradient (K).
delta_T_axial (float) – Axial temperature gradient (K).
disp (bool) – Display calculated values.
radial_delta_T (float)
axial_delta_T (float)
- Returns:
None
- flows(reactant_FR, reactant_carrier_FR, carrier_FR, disp=True)[source]
Calculates Flow Tube flows.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- initialize(reactant_FR, reactant_carrier_FR, carrier_FR, P, P_units, T, reactant_diffusion_rate=nan, radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Sets experimental conditions and calls calculation functions for numerous flow and diffusion parameters.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
P (float) – Pressure.
P_units (str) – Pressure units.
T (float) – Temperature (C).
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
radial_delta_T (float) – Radial temperature gradient (K) (default = 1 K).
axial_delta_T (float) – Axial temperature gradient (K) (default = 1 K).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_diffusion(reactant_diffusion_rate=nan, disp=True)[source]
Performs and displays reactant diffusion calculations.
- Parameters:
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_uptake(hypothetical_gamma, gamma_wall=5e-06, disp=True)[source]
Calculates reactant uptake to coated wall or insert and loss to flow tube walls.
- Parameters:
hypothetical_gamma (float or numpy.ndarray) – Hypothetical uptake coefficient to calculate diffusion correction factor.
gamma_wall (float) – Wall uptake coefficient (default: 5e-6 for halocarbon wax coating - Ivanov et al., J. Mass Spectrom., 2021).
disp (bool) – Display calculated values.
- Return type:
None- Returns:
None.
- class flowtube.BoatReactor(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, boat_width, boat_height, boat_length, boat_wall_thickness)[source]
Bases:
object- Parameters:
FT_ID (float)
FT_length (float)
injector_ID (float)
injector_OD (float)
reactant_gas (str)
carrier_gas (str)
reactant_MR (float)
boat_width (float)
boat_height (float)
boat_length (float)
boat_wall_thickness (float)
- __init__(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, boat_width, boat_height, boat_length, boat_wall_thickness)[source]
Handles calculations relevant to flow rate, flow diagnostics, transport, and uptake for a boat reactor (partial cylinder (less than half) inside of a cylinder). Since there is no diffusion correction for the boat reactor geometry, the assumption is that gas-phase diffusion is negligible. Assumes that the boat reactor is filled to the brim with a liquid. The injector is assumed to be above the boat reactor at all times. All calculations are for over the boat.
- Parameters:
FT_ID (float) – Inner diameter (cm) of flow tube.
FT_length (float) – Length (cm) of flow tube.
injector_ID (float) – Inner diameter (cm) of reactant injector.
injector_OD (float) – Outer diameter (cm) of reactant injector.
reactant_gas (str) – Molecular formula of reactant gas (supported Ar, He, Air, Br2, Cl2, HBr, HCl, HI, H2O, I2, NO, N2, and O2 or other if manually inputting the diffusion coefficient).
carrier_gas (str) – Molecular formula of carrier gas (supported: Ar, He, N2, O2).
reactant_MR (float) – Reactant mixing ratio (mol mol-1).
boat_width (float) – Width (cm) of boat reactor.
boat_height (float) – Height (cm) of boat reactor.
boat_length (float) – Length (cm) of boat reactor.
boat_wall_thickness (float) – Wall thickness (cm).
- Returns:
None
- Return type:
None
- calculate_gamma(concentrations, exposure, exposure_units)[source]
Fits the observed loss to the boat to a first order kinetic model to extract the uptake coefficient.
- Parameters:
concentrations (numpy.ndarray) – Reactant concentrations (arbitrary units).
exposure (numpy.ndarray) – Reactant exposure (s or cm).
exposure_units (str) – Units of exposure (s or cm).
- Returns:
k, first order loss rate (s-1). float: r_value, correlation coefficient of the fit. float: gamma, uptake coefficient. tuple[float, float]: 95% confidence interval for gamma
- Return type:
float
- carrier_flow(radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Performs and displays carrier gas transport calculations.
- Parameters:
delta_T_radial (float) – Radial temperature gradient (K).
delta_T_axial (float) – Axial temperature gradient (K).
disp (bool) – Display calculated values.
radial_delta_T (float)
axial_delta_T (float)
- Returns:
None
- flows(reactant_FR, reactant_carrier_FR, carrier_FR, disp=True)[source]
Calculates Flow Tube flows.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- initialize(reactant_FR, reactant_carrier_FR, carrier_FR, P, P_units, T, reactant_diffusion_rate=nan, radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Sets experimental conditions and calls calculation functions for numerous flow and diffusion parameters.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
P (float) – Pressure.
P_units (str) – Pressure units.
T (float) – Temperature (C).
reactant_diffusion_rate (float, optional) – Reactant diffusion rate (cm2 s-1).
radial_delta_T (float) – Radial temperature gradient (K) (default = 1 K).
axial_delta_T (float) – Axial temperature gradient (K) (default = 1 K).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_diffusion(reactant_diffusion_rate=nan, disp=True)[source]
Performs and displays reactant diffusion calculations.
- Parameters:
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_uptake(hypothetical_gamma, gamma_wall=5e-06, disp=True)[source]
Calculates reactant uptake to the boat and loss to flow tube walls.
- Parameters:
hypothetical_gamma (float or numpy.ndarray) – Hypothetical uptake coefficient to calculate diffusion correction factor.
gamma_wall (float) – Wall uptake coefficient (default: 5e-6 for halocarbon wax coating - Ivanov et al., 2021).
disp (bool) – Display calculated values.
- Return type:
None- Returns:
None
CoatedWallReactor
- class flowtube.CoatedWallReactor(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, insert_ID=0, insert_length=0)[source]
Bases:
object- Parameters:
FT_ID (float)
FT_length (float)
injector_ID (float)
injector_OD (float)
reactant_gas (str)
carrier_gas (str)
reactant_MR (float)
insert_ID (float)
insert_length (float)
- __init__(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, insert_ID=0, insert_length=0)[source]
Handles calculations relevant to flow rate, flow diagnostics, transport, and uptake for a coated wall reactor. By default assumes no insert and a fully coated flow tube. To calculate terms for a fully-coated cylindrical insert or for a partially coated flow tube, simply pass values for the insert length and ID.
- Parameters:
FT_ID (float) – Inner diameter (cm) of flow tube.
FT_length (float) – Length (cm) of flow tube.
injector_ID (float) – Inner diameter (cm) of reactant injector.
injector_OD (float) – Outer diameter (cm) of reactant injector.
reactant_gas (str) – Molecular formula of reactant gas (supported Ar, He, Air, Br2, Cl2, HBr, HCl, HI, H2O, I2, NO, N2, and O2).
carrier_gas (str) – Molecular formula of carrier gas (supported: Ar, He, N2, O2).
reactant_MR (float) – Reactant mixing ratio (mol mol-1).
insert_ID (float, optional) – Inner diameter (cm) of insert.
insert_length (float, optional) – Length (cm) of insert.
- Returns:
None
- Return type:
None
- initialize(reactant_FR, reactant_carrier_FR, carrier_FR, P, P_units, T, reactant_diffusion_rate=nan, radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Sets experimental conditions and calls calculation functions for numerous flow and diffusion parameters.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
P (float) – Pressure.
P_units (str) – Pressure units.
T (float) – Temperature (C).
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
radial_delta_T (float) – Radial temperature gradient (K) (default = 1 K).
axial_delta_T (float) – Axial temperature gradient (K) (default = 1 K).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- flows(reactant_FR, reactant_carrier_FR, carrier_FR, disp=True)[source]
Calculates Flow Tube flows.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- carrier_flow(radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Performs and displays carrier gas transport calculations.
- Parameters:
delta_T_radial (float) – Radial temperature gradient (K).
delta_T_axial (float) – Axial temperature gradient (K).
disp (bool) – Display calculated values.
radial_delta_T (float)
axial_delta_T (float)
- Returns:
None
- reactant_diffusion(reactant_diffusion_rate=nan, disp=True)[source]
Performs and displays reactant diffusion calculations.
- Parameters:
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_uptake(hypothetical_gamma, gamma_wall=5e-06, disp=True)[source]
Calculates reactant uptake to coated wall or insert and loss to flow tube walls.
- Parameters:
hypothetical_gamma (float or numpy.ndarray) – Hypothetical uptake coefficient to calculate diffusion correction factor.
gamma_wall (float) – Wall uptake coefficient (default: 5e-6 for halocarbon wax coating - Ivanov et al., J. Mass Spectrom., 2021).
disp (bool) – Display calculated values.
- Return type:
None- Returns:
None.
- calculate_gamma(concentrations, exposure, exposure_units)[source]
Fits the observed loss to the boat to a first order kinetic model to extract the uptake coefficient.
- Parameters:
concentrations (numpy.ndarray) – Reactant concentrations (arbitrary units).
exposure (numpy.ndarray) – Reactant exposure (s or cm).
exposure_units (str) – Units of exposure (s or cm).
- Returns:
k, first order loss rate (s-1). float: r_value, correlation coefficient of the fit. float: gamma, uptake coefficient. tuple[float, float]: 95% confidence interval for gamma
- Return type:
float
BoatReactor
- class flowtube.BoatReactor(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, boat_width, boat_height, boat_length, boat_wall_thickness)[source]
Bases:
object- Parameters:
FT_ID (float)
FT_length (float)
injector_ID (float)
injector_OD (float)
reactant_gas (str)
carrier_gas (str)
reactant_MR (float)
boat_width (float)
boat_height (float)
boat_length (float)
boat_wall_thickness (float)
- __init__(FT_ID, FT_length, injector_ID, injector_OD, reactant_gas, carrier_gas, reactant_MR, boat_width, boat_height, boat_length, boat_wall_thickness)[source]
Handles calculations relevant to flow rate, flow diagnostics, transport, and uptake for a boat reactor (partial cylinder (less than half) inside of a cylinder). Since there is no diffusion correction for the boat reactor geometry, the assumption is that gas-phase diffusion is negligible. Assumes that the boat reactor is filled to the brim with a liquid. The injector is assumed to be above the boat reactor at all times. All calculations are for over the boat.
- Parameters:
FT_ID (float) – Inner diameter (cm) of flow tube.
FT_length (float) – Length (cm) of flow tube.
injector_ID (float) – Inner diameter (cm) of reactant injector.
injector_OD (float) – Outer diameter (cm) of reactant injector.
reactant_gas (str) – Molecular formula of reactant gas (supported Ar, He, Air, Br2, Cl2, HBr, HCl, HI, H2O, I2, NO, N2, and O2 or other if manually inputting the diffusion coefficient).
carrier_gas (str) – Molecular formula of carrier gas (supported: Ar, He, N2, O2).
reactant_MR (float) – Reactant mixing ratio (mol mol-1).
boat_width (float) – Width (cm) of boat reactor.
boat_height (float) – Height (cm) of boat reactor.
boat_length (float) – Length (cm) of boat reactor.
boat_wall_thickness (float) – Wall thickness (cm).
- Returns:
None
- Return type:
None
- initialize(reactant_FR, reactant_carrier_FR, carrier_FR, P, P_units, T, reactant_diffusion_rate=nan, radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Sets experimental conditions and calls calculation functions for numerous flow and diffusion parameters.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
P (float) – Pressure.
P_units (str) – Pressure units.
T (float) – Temperature (C).
reactant_diffusion_rate (float, optional) – Reactant diffusion rate (cm2 s-1).
radial_delta_T (float) – Radial temperature gradient (K) (default = 1 K).
axial_delta_T (float) – Axial temperature gradient (K) (default = 1 K).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- flows(reactant_FR, reactant_carrier_FR, carrier_FR, disp=True)[source]
Calculates Flow Tube flows.
- Parameters:
reactant_FR (float) – Reactant flow rate (sccm).
reactant_carrier_FR (float) – Carrier flow rate (sccm) used to dilute the reactant.
carrier_FR (float) – Carrier flow rate (sccm) typically injected near the start of the flow tube.
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- carrier_flow(radial_delta_T=1, axial_delta_T=1, disp=True)[source]
Performs and displays carrier gas transport calculations.
- Parameters:
delta_T_radial (float) – Radial temperature gradient (K).
delta_T_axial (float) – Axial temperature gradient (K).
disp (bool) – Display calculated values.
radial_delta_T (float)
axial_delta_T (float)
- Returns:
None
- reactant_diffusion(reactant_diffusion_rate=nan, disp=True)[source]
Performs and displays reactant diffusion calculations.
- Parameters:
reactant_diffusion_rate (float) – Reactant diffusion rate (cm2 s-1).
disp (bool) – Display calculated calculated values.
- Return type:
None- Returns:
None
- reactant_uptake(hypothetical_gamma, gamma_wall=5e-06, disp=True)[source]
Calculates reactant uptake to the boat and loss to flow tube walls.
- Parameters:
hypothetical_gamma (float or numpy.ndarray) – Hypothetical uptake coefficient to calculate diffusion correction factor.
gamma_wall (float) – Wall uptake coefficient (default: 5e-6 for halocarbon wax coating - Ivanov et al., 2021).
disp (bool) – Display calculated values.
- Return type:
None- Returns:
None
- calculate_gamma(concentrations, exposure, exposure_units)[source]
Fits the observed loss to the boat to a first order kinetic model to extract the uptake coefficient.
- Parameters:
concentrations (numpy.ndarray) – Reactant concentrations (arbitrary units).
exposure (numpy.ndarray) – Reactant exposure (s or cm).
exposure_units (str) – Units of exposure (s or cm).
- Returns:
k, first order loss rate (s-1). float: r_value, correlation coefficient of the fit. float: gamma, uptake coefficient. tuple[float, float]: 95% confidence interval for gamma
- Return type:
float
Utility Modules
Constants and unit conversions.
- flowtube.tools.T_in_K(T)[source]
Convert celcius to Kelvin.
- Parameters:
T (float) – Temperature in Celcius.
- Returns:
Temperature in Kelvin.
- Return type:
float
- flowtube.tools.P_in_Pa(P, units)[source]
Convert pressure to Pa.
- Parameters:
P (float) – Pressure.
units (float) – Supported pressure units: Torr, bar, mbar, or hPa.
- Returns:
Pressure in Pa.
- Return type:
float
- flowtube.tools.cross_sectional_area(diameter)[source]
Calculate cross sectional area.
- Parameters:
diameter (float) – Diameter.
- Returns:
Cross sectional area.
- Return type:
float
- flowtube.tools.partial_cylinder_area(height, width)[source]
Calculate the cross-sectional area and perimeter of a partial cylinder (“boat”) given its height and width. Assumes the partial cylinder is a segment of a circle with given width as chord length and that the height is less than the diameter of the circle. Calculations based on: https://mathworld.wolfram.com/CircularSegment.html and https://www.vcalc.com/wiki/KurtHeckman/Circle-area-of-an-arc-segment-h.
- Parameters:
height (float) – Height of the segment (cm).
width (float) – Chord length of the segment (cm).
- Returns:
Outer perimeter (cm). float: Cross-sectional area (cm^2).
- Return type:
float
- flowtube.tools.table(title, var_names, var, var_fmts, units)[source]
Print a formatted table of variables.
- Parameters:
title (str) – Title of the table.
var_names (list) – List of variable names.
var (list) – Variable values.
var_fmts (list) – List of formats for each variable.
units (list) – List of units for each variable.
- Return type:
None- Returns:
None
Conversion functions for flow rates and concentrations in flowtube package.
- class flowtube.flow_calc.basic_attrs(*args, **kwargs)[source]
-
P:
float
-
T:
float
- __init__(*args, **kwargs)
-
P:
- class flowtube.flow_calc.carrier_attrs(*args, **kwargs)[source]
-
carrier_dynamic_viscosity:
float
-
carrier_density:
float
-
P:
float
-
T:
float
-
carrier_dynamic_viscosity:
- class flowtube.flow_calc.full_attrs(*args, **kwargs)[source]
-
reactant_diffusion_rate:
float
-
reactant_molec_velocity:
float
-
carrier_dynamic_viscosity:
float
-
carrier_density:
float
-
P:
float
-
T:
float
-
reactant_diffusion_rate:
- flowtube.flow_calc.sccm_to_ccm(obj, FR)[source]
Convert sccm to cm3 per min.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
FR (float) – Flow rate in sccm.
- Returns:
Flow rate in cm3 min-1
- Return type:
float
- flowtube.flow_calc.ccm_to_sccm(obj, FR)[source]
Convert cm3 per min to sccm
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
FR (float) – Flow rate in cm3 min-1.
- Returns:
Flow rate to sccm.
- Return type:
float
- flowtube.flow_calc.sccm_to_velocity(obj, FR, diameter)[source]
Calculate flow velocity.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
FR (float) – Flow rate in sccm.
diameter (float) – Diameter in cm.
- Returns:
Flow velocity in cm s-1.
- Return type:
float
- flowtube.flow_calc.MR_to_molec(obj, conc)[source]
Convert mixing ratio in ppb to molecules cm-3.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
conc (float) – Mixing ratio (ppb - mol mol-1).
- Returns:
Concentration in molec. cm-3.
- Return type:
float
- flowtube.flow_calc.molec_velocity(obj, molar_mass)[source]
Calculate thermal molecular velocity. Formula matched to values from Knopf et al., Anal. Chem., 2015
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
molar_mass (float) – Molar mass of the gas (g mol-1).
- Returns:
Thermal molecular velocity in cm s-1.
- Return type:
float
- flowtube.flow_calc.reynolds_number(obj, FR, diameter)[source]
Calculate Reynolds number for a gas flowing through a cylinder.
- Parameters:
obj (carrier_attrs) – Object with full attributes (P in Pa, T in K, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
FR (float) – Total flow rate in sccm.
diameter (float) – Diameter of the cylinder (cm).
- Returns:
Reynolds number.
- Return type:
float
- flowtube.flow_calc.reynolds_number_irregular(obj, cross_sectional_area, wetted_perimeter, FR)[source]
Calculate Reynolds number for a gas flowing through a cylinder. Formula 6-14 from Holman and Bhattacharyya 2011.
- Parameters:
obj (carrier_attrs) – Object with full attributes (P in Pa, T in K, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
cross_sectional_area (float) – Cross sectional area of the flow passage (cm2).
wetted_perimeter (float) – Wetted perimeter of the flow passage (cm).
FR (float) – Total flow rate in sccm.
- Returns:
Reynolds number.
- Return type:
float
- flowtube.flow_calc.conductance(obj, diameter, length)[source]
Calculate conductance through cylinder - eq. 3.17 from Moore et al., 2009.
- Parameters:
obj (carrier_attrs) – Object with full attributes (P in Pa, T in K, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
diameter (float) – Inner diameter (cm).
length (float) – Length (cm).
- Returns:
Conductance in L s-1.
- Return type:
float
- flowtube.flow_calc.pressure_gradient(obj, conductance, FR)[source]
Calculate pressure gradient - eqs. 3.9 & 3.10 from Moore et al., 2009.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
conductance (float) – Conductance in L s-1.
flow_rate (float) – Flow rate in sccm.
FR (float)
- Returns:
Pressure gradient ratio.
- Return type:
float
- flowtube.flow_calc.buoyancy_parameters(obj, delta_T, distance, Re)[source]
Calculate buoyancy parameters.
- Parameters:
obj (carrier_attrs) – Object with full attributes (P in Pa, T in K, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
delta_T (float) – Temperature difference (K).
distance (float) – Distance over which the temperature difference is measured (cm) (typically axial or radial).
Re (float) – Reynolds number of the flow tube.
- Returns:
- Buoyancy parameter (>1 indicates the flow being driven by
buoyancy).
- Return type:
float
- flowtube.flow_calc.length_to_laminar(diameter, Re)[source]
Entrance length (cm) - length to achieve laminar profile - Bird et al., 2002, page 52. Note that the scalar term can vary depending on the source. Keyser, 1994 gives a value of 0.0565 for 99% attainment of parabolic profile while Hanson and Kosciuch, 2003 provide a value of 0.05 for 95% attainment. Using an exponential fit of the values, it seems that the 0.035 figure that Bird et al., 2002 gives is for a 85% attainment. Choose whichever value is most appropriate for your purposes.
- Parameters:
diameter (float) – Diameter of the cylinder (cm).
Re (float) – Reynolds number of the flow tube.
- Returns:
Length to laminar profile (cm).
- Return type:
float
- flowtube.flow_calc.mixing_time(obj, diameter)[source]
Calculate mixing time (s) - Hanson and Lovejoy, Geophys. Res. Lett., 1994.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
diameter (float) – Diameter of the cylinder (cm).
- Returns:
Mixing time in seconds.
- Return type:
float
- flowtube.flow_calc.N_eff_Shw(obj, length, FR)[source]
Calculate the effective Sherwood number - eq. 11 from Knopf et al., 2015.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
length (float) – Length of the flow tube (cm).
FR (float) – Total flow rate in cm3 min-1.
- Returns:
Effective Sherwood number.
- Return type:
float
- flowtube.flow_calc.Kn(mean_free_path, char_length)[source]
Calculate Knudsen number - eq. 8 from Knopf et al., 2015.
- Parameters:
mean_free_path (float) – Mean free path of the reactant (cm).
char_length (float) – Characteristic length: diameter of cylinder for a coated wall reactor (cm).
- Returns:
Knudsen number.
- Return type:
float
Kinetics calculations for flow tube experiments.
- flowtube.kinetics.diffusion_limited_rate_constant(obj, N_eff_Shw, diameter)[source]
Calculate diffusion limited rate constant (s-1) - eq. 10 from Knopf et al., 2015.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
N_eff_Shw (float) – Effective Sherwood number.
diameter (float) – Diameter of the cylinder (cm).
- Returns:
Diffusion limited rate constant (s-1).
- Return type:
float
- flowtube.kinetics.diffusion_limited_uptake_coefficient(obj, diameter, k_diff)[source]
Calculate diffusion limited effective uptake coefficient - eq. 19 from Knopf et al., 2015.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
diameter (float) – Diameter of the cylinder (cm).
k_diff (float) – Diffusion limited rate constant (s-1).
- Returns:
Diffusion limited effective uptake coefficient (cm s-1).
- Return type:
float
- flowtube.kinetics.correction_factor(N_eff_Shw, Kn, gamma)[source]
Calculate correction factor for uptake coefficient - eq. 20 from Knopf et al., 2015.
- Parameters:
N_eff_Shw (float) – Effective Sherwood number (unitless).
Kn (float) – Knudsen number (unitless).
hypothetical_gamma (float) – Hypothetical uptake coefficient (unitless).
gamma (ndarray[tuple[Any, ...], dtype[float64]] | float)
- Returns:
Correction factor (unitless).
- Return type:
float
- flowtube.kinetics.observed_loss_rate(obj, diameter, gamma_eff)[source]
Calculate observed loss rate (s-1) - eq. 19 from Knopf et al., 2015.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
diameter (float) – Diameter of the cylinder (cm).
gamma_eff (float) – Effective uptake coefficient (unitless).
- Returns:
Observed loss rate (s-1).
- Return type:
float
- flowtube.kinetics.cylinder_loss(obj, diameter, N_eff_Shw, Kn, gamma, time)[source]
Calculate penetration (unitless) - eq. 21 from Knopf et al., 2015.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
time (float) – Residence time in cylinder (s).
diameter (float)
N_eff_Shw (float)
Kn (float)
gamma (ndarray[tuple[Any, ...], dtype[float64]] | float)
- Returns:
- Penetration - fraction of initial reactant after passing
through cylinder (unitless).
- Return type:
float
- flowtube.kinetics.gamma_from_k(obj, k, diameter)[source]
Calculate effective uptake coefficient from rate constant.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
k (float) – Rate constant (s-1).
diameter (float) – Diameter of the cylinder (cm).
- Returns:
Effective uptake coefficient (unitless).
- Return type:
float
- flowtube.kinetics.fit_first_order_kinetics(obj, concentrations, exposure, exposure_units)[source]
Fits the observed loss to a first order kinetic model to extract the uptake coefficient.
- Parameters:
obj (full_attrs) – Object with full attributes (P in Pa, T in K, reactant_diffusion_rate in cm2 s-1, carrier_dynamic_viscosity in kg m-1 s-1, carrier_density in kg m-3).
concentrations (NDArray[np.float64]) – Array of observed concentrations (unitless).
exposure (NDArray[np.float64]) – Array of exposures (s or cm).
exposure_units (str) – Units of exposure (“s”, “sec”, “second”, “seconds”, “cm”, “centimeter”, “centimeters”).
- Returns:
- Tuple containing the
slope, intercept, r-value, p-value, and standard error of the regression.
- Return type:
tuple[float, float, float, float, float]
Handles the calculation of the diffusion coefficient of a binary gas mixture.
- class flowtube.diffusion_coef.required_attrs(*args, **kwargs)[source]
-
P:
float
-
T:
float
-
reactant_gas:
str
-
carrier_gas:
str
- __init__(*args, **kwargs)
-
P:
- flowtube.diffusion_coef.non_polar_Lennard_Jones_potential(e_k, T)[source]
Calculation of non-polar Lennard-Jones Potential for a binary gas mixture. Formulas 11-3.4 to 11-3.6 in Reid et al., 1987
- Parameters:
e_k (float) – Lennard-Jones Energy (K).
T (float) – Temperature in K.
- Returns:
Non-polar Lennard Jones potential.
- Return type:
float
- flowtube.diffusion_coef.binary_diffusion_coefficient(obj)[source]
Calculation of non-polar diffusion coefficient for a low pressure binary gas mixture. Supported gases: Ar, He, Air, Br2, Cl2, HBr, HCl, HI, H2O, I2, NO, N2, and O2. Formulas 11-3.1 to 11-3.2 in Reid et al., 1987
- Parameters:
object (required_attrs) – Object with required attributes
Pa ((P in)
K (T in)
reactant_gas
carrier_gas).
obj (required_attrs)
- Returns:
Diffusion coefficient for binary gas mixture (cm2 s-1)
- Return type:
float
Handles the calculation of the viscosity and density of a variety of pure gases.
- class flowtube.viscosity_density.basic_attrs(*args, **kwargs)[source]
-
P:
float
-
T:
float
- __init__(*args, **kwargs)
-
P:
- flowtube.viscosity_density.real_density(obj, gas)[source]
Calculates the real density of a gas using van der Waal’s equation of state.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
gas (str) – Molecular formula of gas (supported: Ar, He, N2, O2).
- Returns:
Real density of gas in kg m-3.
- Return type:
float
- flowtube.viscosity_density.dynamic_viscosity(obj, gas)[source]
Estimate absolute/dynamic viscosity of pure gases using the corresponding states method from Reid et al., 1987.
- Parameters:
obj (basic_attrs) – Object with basic attributes (P in Pa, T in K).
gas (str) – Molecular formula of gas (supported: Ar, He, N2, O2).
- Returns:
Gas viscosity (kg m-1 s-1).
- Return type:
float