Skip to content

Add support for mass flow rate in control valve sizing #92

@Unmask06

Description

@Unmask06

Summary

Added the parameter m (mass flow rate) to size_control_valve_g. If m is provided, the function automatically calculates the required standard volumetric flow Q based on the gas molecular weight and standard conditions (, ).

Changes

  • New Parameter: m (mass flow rate in ).
  • Logic: If m is specified and Q is None, is derived using the Ideal Gas Law at standard conditions.

Technical Implementation

The conversion follows this simple logic:

  1. Standard Density:
  2. Conversion:

Example Usage

from fluids.control_valve import size_control_valve_g

# Old way (Manual conversion to standard m^3/s)
# Q_std = 0.5 
# Kv = size_control_valve_g(..., Q=Q_std)

# New way (Directly using mass flow)
Kv = size_control_valve_g(T1=300, MW=28.97, mu=1.8e-5, gamma=1.4, Z=0.99, 
                           P1=1e6, P2=8e5, m=2.5) # m in kg/s

Why this is better

  • Reduced Error: Users often confuse "Standard" () and "Normal" ( or ) conditions. Handling this internally ensures the math matches the ISA-75.01.01 standard used by the library.
  • Cleaner Code: Removes the need for the user to import constants () and perform density calculations before calling the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions