pypbomb.tube

Tools for designing and determining operational parameters of a closed-end detonation tube with optical access. These are imported into pypbomb for convenience, but may also be accessed via pypbomb.tube.

Bolt

class pypbomb.tube.Bolt

Methods relating to bolt calculations and property lookup.

classmethod calculate_safety_factors(max_pressure, window_area, num_bolts, thread_size, thread_class, bolt_max_tensile, plate_max_tensile, engagement_length, unit_registry=<pint.registry.UnitRegistry object>)

Calculates bolt and plate safety factors for viewing window bolts

Parameters:
  • max_pressure (pint.Quantity or Tuple[float, str]) – Tube maximum pressure

  • window_area (pint.Quantity or Tuple[float, str]) – Window area exposed to high pressure environment

  • num_bolts (int or np.ndarray) – Number of bolts used to secure each viewing window

  • thread_size (str) – Size of threads to be evaluated, e.g. 1/4-20 or 1 1/2-6

  • thread_class (str) – Class of threads to be evaluated, "2" or "3". ("A" or "B" are automatically appended for internal/external threads)

  • bolt_max_tensile (pint.Quantity or Tuple[float, str]) – Pint quantity of bolt (ext. thread) tensile failure stress

  • plate_max_tensile (pint.Quantity or Tuple[float, str]) – Pint quantity of plate (int. thread) tensile failure stress

  • engagement_length (pint.Quantity or Tuple[float, str]) – Pint quantity of total thread engagement length

  • unit_registry (pint.UnitRegistry) – Keeps output consistent with parent registry, avoiding conflicts

Returns:

Dictionary giving factors of safety for window bolts and the plate

that they are screwed into. Keys:

  • "bolt"

  • "plate"

Return type:

dict

static calculate_stress_areas(thread_size, thread_class, bolt_max_tensile, plate_max_tensile, engagement_length, unit_registry)

Calculates internal and external thread stress areas using formulas in Machinery’s Handbook, 26th edition.

Parameters:
  • thread_size (str) – Size of threads to be evaluated, e.g. "1/4-20" or "1 1/2-6"

  • thread_class (str) – Class of threads to be evaluated, "2" or "3". ("A" or "B" are automatically appended for internal/external threads)

  • bolt_max_tensile (pint.Quantity or Tuple[float, str]) – Pint quantity of bolt (external thread) tensile failure stress

  • plate_max_tensile (pint.Quantity or Tuple[float, str]) – Pint quantity of plate (internal thread) tensile failure stress

  • engagement_length (pint.Quantity or Tuple[float, str]) – Pint quantity of total thread engagement length

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Dictionary with the following keys:

  • "plate area": Stress area of internal threads within the plate

  • "screw area": Stress area of external threads on the screw

  • "minimum engagement": Minimum engagement length causing screw to fail in tension rather than shear, thus preventing the plate from stripping.

Return type:

dict

static get_thread_property(thread_property, thread_size, thread_class, unit_registry)

Finds a thread property, such as minor diameter, using a dataframe from import_thread_specs(). import_thread_specs is not directly called here to save time by not reading from disk every time a property is requested.

Parameters:
  • thread_property (str) – Property that is desired, such as "minor diameter"

  • thread_size (str) – Thread size for desired property, such as "1/4-20" or "1 1/2-6"

  • thread_class (str) – Thread class: "2B" or "3B" for internal threads, "2A" or "3A" for external threads

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Property requested, as a pint quantity with units of inches

Return type:

pint.Quantity

DDT

class pypbomb.tube.DDT

Methods for estimating the deflagration-to-detonation transition (DDT).

static calculate_blockage_diameter(pipe_id, blockage_ratio, unit_registry=<pint.registry.UnitRegistry object>)

Calculates the diameter of a Shchelkin spiral corresponding to a given blockage ratio within a pipe of given inner diameter.

Parameters:
  • pipe_id (pint.Quantity or Tuple[float, str]) – Length scale representing the inner diameter of the pipe used for the detonation tube

  • blockage_ratio (float) – Ratio of blocked area to total cross-sectional area, \(0 < BR < 1\)

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Shchelkin spiral diameter inside a tube of pipe_id inner diameter giving a blockage ratio of blockage_ratio. Units are the same as pipe_id.

Return type:

pint.Quantity

static calculate_blockage_ratio(tube_inner_diameter, blockage_diameter, unit_registry=<pint.registry.UnitRegistry object>)

Calculates the blockage ratio of a Shchelkin spiral within a detonation tube.

Parameters:
  • tube_inner_diameter (pint.Quantity or Tuple[float, str]) – Inner diameter of the detonation tube

  • blockage_diameter (pint.Quantity or Tuple[float, str]) – Outer diameter of the blockage used to create the Shchelkin spiral (i.e. a Shchelkin spiral made from 1/2” round stock would be blockage_diameter=quant(0.5, "inch")

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Ratio of blocked to open area (between 0 and 1)

Return type:

float

static calculate_run_up(blockage_ratio, tube_diameter, initial_temperature, initial_pressure, species_dict, mechanism, unit_registry=<pint.registry.UnitRegistry object>, phase_specification='')

Calculates the runup distance needed for a detonation to develop from a deflagration for a given blockage ratio, tube diameter, and mixture. This is accomplished using equations collected by Ciccarelli and Dorofeev [1] for blockage ratios <= 0.75. If the desired blockage ratio is less than 0.3, the mixture viscosity is needed, and the phase_specification option may be necessary depending on the mechanism.

[1] G. Ciccarelli and S. Dorofeev, Flame acceleration and transition to detonation in ducts, Progress in Energy and Combustion Science, vol. 34, no. 4, pp. 499–550, Aug. 2008. https://doi.org/10.1016/j.pecs.2007.11.002

Parameters:
  • blockage_ratio (float) – Ratio of blocked area to total cross-sectional area, \(0 < BR < 1\)

  • tube_diameter (pint.Quantity or Tuple[float, str]) – Internal diameter of the detonation tube

  • initial_temperature (pint.Quantity or Tuple[float, str]) – Mixture initial temperature

  • initial_pressure (pint.Quantity or Tuple[float, str]) – Mixture initial pressure

  • species_dict (dict) – Dictionary containing the species in the mixture as keys, with total moles or mole fractions as values

  • mechanism (str) – Mechanism file name for Cantera. See thermochem.find_mechanisms() for a list of installed mechanisms.

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

  • phase_specification (str, optional) – Phase specification within the mechanism file used to evaluate thermophysical properties. If gri30.yaml is used with no phase specification viscosity calculations will fail, resulting in an error for all blockage ratios less than 0.3.

Returns:

Predicted DDT distance

Return type:

pint.Quantity

Flange

class pypbomb.tube.Flange

Methods pertaining to flange class and max pressure calculations

For a list of available materials see Flange.available_materials

static get_class(max_pressure, temperature, material, unit_registry=<pint.registry.UnitRegistry object>)

Finds the minimum allowable flange class per ASME B16.5 for a given flange temperature and tube pressure.

Parameters:
  • max_pressure (pint.Quantity or Tuple[float, str]) – Maximum pressure within the system as a quantity or tuple of (magnitude, "units")

  • temperature (pint.Quantity or Tuple[float, str]) – Flange temperature as a quantity or tuple of (magnitude, "units")

  • material (str) – Flange material (see Flange.available_materials)

  • unit_registry (pint.UnitRegistry, optional) – Pint unit registry, if output within a particular registry is desired

Returns:

Minimum allowable flange class

Return type:

str

static get_max_pressure(flange_class, temperature, material)

Finds the max allowable pressure for a flange of a given material and class at the desired temperature.

Parameters:
  • flange_class (str) – Class of the flange to evaluate, e.g. "900"

  • temperature (pint.Quantity or Tuple[float, str]) – Flange temperature

  • material (str) – Flange material (see Flange.available_materials)

Returns:

Maximum allowable pressure

Return type:

pint.Quantity

static get_max_temperature(flange_class, pressure, material)

Finds the max allowable temperature for a flange of a given material and class at the desired pressure.

Parameters:
  • flange_class (str) – Class of the flange to evaluate, e.g. "900"

  • pressure (pint.Quantity or Tuple[float, str]) – System pressure

  • material (str) – Flange material (see Flange.available_materials)

Returns:

Max allowable flange temperature

Return type:

pint.Quantity

Tube

class pypbomb.tube.Tube

Methods for designing and determining operational limits of a detonation tube.

For a list of available materials see Tube.available_materials

classmethod calculate_max_initial_pressure(tube_id, tube_od, initial_temperature, species_dict, mechanism, max_pressure, elastic_modulus, density, poisson_ratio, plus_or_minus=0.1, use_dynamic_load_factor=True, unit_registry=<pint.registry.UnitRegistry object>, error_tol=0.0001, max_iterations=500, use_multiprocessing=False, max_pressure_state='reflected', return_dlf=False)
Parameters:
  • tube_id (pint.Quantity or Tuple[float, str]) – Inner diameter of tube

  • tube_od (pint.Quantity or Tuple[float, str]) – Outer diameter of tube Internal diameter of the detonation tube

  • initial_temperature (pint.Quantity or Tuple[float, str]) – Mixture initial temperature

  • species_dict (dict) – Dictionary containing the species in the mixture as keys, with total moles or mole fractions as values

  • mechanism (str) – Mechanism file name for Cantera

  • max_pressure (pint.Quantity or Tuple[float, str]) – Maximum allowable pressure within the tube

  • elastic_modulus (pint.Quantity or Tuple[float, str]) – Elastic modulus of tube material

  • density (pint.Quantity or Tuple[float, str]) – Density of tube material

  • poisson_ratio (float) – Poisson ratio of tube material

  • plus_or_minus (float) – For dynamic load factor calculation, plus_or_minus defines the band about the critical velocity which is considered “approximately equal to.” The default value of 0.1 means plus or minus ten percent.

  • use_dynamic_load_factor (bool) – True to use dynamic load factor, False to ignore it.

  • unit_registry (pint unit registry) – Unit registry for managing units to prevent conflicts with parent unit registry

  • error_tol (float) – Relative error tolerance below which initial pressure calculations are considered ‘good enough’

  • max_iterations (int) – Maximum number of loop iterations before exit, defaults to 500

  • use_multiprocessing (bool) – True to use multiprocessing. Defaults to False.

  • max_pressure_state (str) – Which state to use as the tube’s maximum pressure. Must be either "reflected" (closed tube) or "cj" (open tube).

  • return_dlf (bool) – If True, dynamic load factor will be returned

Returns:

Initial mixture pressure corresponding to the tube’s maximum allowable pressure.

If return_dlf is set to True, this will be a list, with item 0 being the initial pressure and item 1 being DLF

Return type:

pint.Quantity or Tuple[pint.Quantity, float]

static calculate_max_pressure(tube_id, tube_od, max_stress, safety_factor=1)

Calculates the maximum allowable pressure from the tube dimensions and stress limits using the basic longitudinal joint formula [1].

[1] E. F. Megyesy, Pressure vessel handbook, Oklahoma City, OK: PV Publishing, Inc., 2001, p. 14.

Parameters:
  • tube_id (pint.Quantity or Tuple[float, str]) – Inner diameter of tube

  • tube_od (pint.Quantity or Tuple[float, str]) – Outer diameter of tube

  • max_stress (pint.Quantity or Tuple[float, str]) – Maximum allowable stress in tube material (e.g. from ASME B31.1)

  • safety_factor (float, optional) – Desired safety factor

Returns:

Pressure resulting in maximum allowable stress

Return type:

pint.Quantity

classmethod calculate_max_stress(initial_temperature, material, welded, unit_registry=<pint.registry.UnitRegistry object>)

Finds the maximum allowable stress of a tube material at the tube’s initial temperature

Parameters:
  • initial_temperature (pint.Quantity or Tuple[float, str]) –

  • material (str) – Pipe material (see Tube.available_materials)

  • welded (bool) – True for welded pipe; False for seamless

  • unit_registry (pint.UnitRegistry) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Maximum allowable tube stress

Return type:

pint.Quantity

static dynamic_load_factor(tube_id, tube_od, cj_velocity, elastic_modulus, density, poisson_ratio, plus_or_minus=0.1)

Calculates the dynamic load factor (DLF) by which a detonation tube’s static analysis should be scaled in order to account for the tube’s response to transient pressures. DLF calculation is based on the work of Shepherd [1]. Since the limits of “approximately equal to” are not defined in the paper, a default value of plus or minus ten percent is assumed, thus plus_or_minus=0.1.

[1] Shepherd, J. E. (2009). Structural Response of Piping to Internal Gas Detonation. Journal of Pressure Vessel Technology, 131(3), 031204. https://doi.org/10.1115/1.3089497

Parameters:
  • tube_id (pint.Quantity or Tuple[float, str]) – Inner diameter of tube

  • tube_od (pint.Quantity or Tuple[float, str]) – Outer diameter of tube

  • cj_velocity (pint.Quantity or Tuple[float, str]) – CJ velocity

  • elastic_modulus (pint.Quantity or Tuple[float, str]) – Elastic modulus of tube material

  • density (pint.Quantity or Tuple[float, str]) – Density of tube material

  • poisson_ratio (float) – Poisson ratio of tube material

  • plus_or_minus (float, optional) – Defines the band about the critical velocity which is considered “approximately equal to” – the default value of 0.1 means plus or minus ten percent

Returns:

Factor by which the tube’s static maximum pressure should be de-rated to account for transient response to detonation waves

Return type:

float

static get_available_pipe_schedules(pipe_size)

Gets available pipe schedules for a given nominal size

Parameters:

pipe_size (str) – Nominal pipe size (see Tube.available_pipe_sizes)

Returns:

List of available pipe schedules

Return type:

list

classmethod get_density(material, unit_registry=<pint.registry.UnitRegistry object>)

Gets the density for a valid tube material. For valid materials see Tube.available_materials.

Parameters:
  • material (str) – Pipe material (see Tube.available_materials)

  • unit_registry (pint.UnitRegistry, optional) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Density

Return type:

pint.Quantity

classmethod get_dimensions(pipe_size, pipe_schedule, unit_registry=<pint.registry.UnitRegistry object>)
Parameters:
  • pipe_size (str) – Nominal pipe size (see Tube.available_pipe_sizes)

  • pipe_schedule (str) – Pipe schedule (see Tube.get_available_pipe_schedules for a list of available schedules for pipe_size)

  • unit_registry (pint.UnitRegistry, optional) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Dictionary of pipe dimensions with the keys:

  • "inner_diameter"

  • "outer_diameter"

  • "wall_thickness"

Return type:

dict

classmethod get_elastic_modulus(material, unit_registry=<pint.registry.UnitRegistry object>)

Gets the elastic modulus for a valid tube material. For valid materials see Tube.available_materials.

Parameters:
  • material (str) – Pipe material (see Tube.available_materials)

  • unit_registry (pint.UnitRegistry, optional) – Unit registry for managing units to prevent conflicts with parent unit registry

Returns:

Elastic modulus

Return type:

pint.Quantity

classmethod get_poisson(material)

Gets the Poisson ratio for a valid tube material. For valid materials see Tube.available_materials.

Parameters:

material (str) – Pipe material (see Tube.available_materials)

Returns:

Poisson ratio (unitless)

Return type:

float

Window

class pypbomb.tube.Window

Methods for the design of viewing windows for optical access.

classmethod minimum_thickness(length, width, safety_factor, pressure, rupture_modulus, unit_registry=<pint.registry.UnitRegistry object>)

Calculates the thickness of a clamped rectangular window which gives the desired safety factor

Parameters:
  • length (pint.Quantity or Tuple[float, str]) – Window unsupported (viewing) length

  • width (pint.Quantity or Tuple[float, str]) – Window unsupported (viewing) width

  • safety_factor (float) – Safety factor

  • pressure (pint.Quantity or Tuple[float, str]) – Design pressure differential across window at which factor of safety is to be calculated

  • rupture_modulus (pint.Quantity or Tuple[float, str]) – Rupture modulus of desired window material

  • unit_registry (pint.UnitRegistry) – Keeps output consistent with parent registry, avoiding conflicts

Returns:

Window thickness

Return type:

pint.Quantity

classmethod safety_factor(length, width, thickness, pressure, rupture_modulus, unit_registry=<pint.registry.UnitRegistry object>)

Calculates the safety factor of a clamped rectangular window given window dimensions, design pressure, and material rupture modulus

Parameters:
  • length (pint.Quantity or Tuple[float, str]) – Window unsupported (viewing) length

  • width (pint.Quantity or Tuple[float, str]) – Window unsupported (viewing) width

  • thickness (pint.Quantity or Tuple[float, str]) – Window thickness

  • pressure (pint.Quantity or Tuple[float, str]) – Design pressure differential across window at which factor of safety is to be calculated

  • rupture_modulus (pint.Quantity or Tuple[float, str]) – Rupture modulus of desired window material

  • unit_registry (pint.UnitRegistry) – Keeps output consistent with parent registry, avoiding conflicts

Returns:

Window factor of safety

Return type:

float