SQ_EDGE_GRILL

Overview

Calculate the loss coefficient for a square edged grill or perforated plate.

Excel Usage

=SQ_EDGE_GRILL(alpha, l, Dh, fd)
  • alpha (float, required): Fraction of grill open to flow, [-]
  • l (float, optional, default: null): Thickness of the grill or plate, [m]
  • Dh (float, optional, default: null): Hydraulic diameter of gap in grill, [m]
  • fd (float, optional, default: null): Darcy friction factor, [-]

Returns (float): Loss coefficient K, [-], or error message (str) if input is invalid.

Examples

Example 1: Basic case (alpha=0.45)

Inputs:

alpha
0.45

Excel formula:

=SQ_EDGE_GRILL(0.45)

Expected output:

5.2963

Example 2: With friction correction (l, Dh, fd provided)

Inputs:

alpha l Dh fd
0.45 0.15 0.002 0.0185

Excel formula:

=SQ_EDGE_GRILL(0.45, 0.15, 0.002, 0.0185)

Expected output:

12.1481

Example 3: Medium open area (alpha=0.6)

Inputs:

alpha
0.6

Excel formula:

=SQ_EDGE_GRILL(0.6)

Expected output:

2.3333

Example 4: High open area (alpha=0.8)

Inputs:

alpha
0.8

Excel formula:

=SQ_EDGE_GRILL(0.8)

Expected output:

0.7187

Python Code

from fluids.filters import square_edge_grill as fluids_square_edge_grill

def sq_edge_grill(alpha, l=None, Dh=None, fd=None):
    """
    Calculate the loss coefficient for a square edged grill or perforated plate.

    See: https://fluids.readthedocs.io/fluids.filters.html#fluids.filters.square_edge_grill

    This example function is provided as-is without any representation of accuracy.

    Args:
        alpha (float): Fraction of grill open to flow, [-]
        l (float, optional): Thickness of the grill or plate, [m] Default is None.
        Dh (float, optional): Hydraulic diameter of gap in grill, [m] Default is None.
        fd (float, optional): Darcy friction factor, [-] Default is None.

    Returns:
        float: Loss coefficient K, [-], or error message (str) if input is invalid.
    """
    try:
      # Validate and convert alpha
      try:
        alpha = float(alpha)
      except (ValueError, TypeError):
        return "Error: alpha must be a number."

      # Validate alpha range
      if alpha <= 0 or alpha > 1:
        return "Error: alpha must be between 0 and 1."

      # Validate and convert optional parameters
      if l is not None:
        try:
          l = float(l)
        except (ValueError, TypeError):
          return "Error: l must be a number."
        if l <= 0:
          return "Error: l must be positive."

      if Dh is not None:
        try:
          Dh = float(Dh)
        except (ValueError, TypeError):
          return "Error: Dh must be a number."
        if Dh <= 0:
          return "Error: Dh must be positive."

      if fd is not None:
        try:
          fd = float(fd)
        except (ValueError, TypeError):
          return "Error: fd must be a number."
        if fd <= 0:
          return "Error: fd must be positive."

      result = fluids_square_edge_grill(alpha=alpha, l=l, Dh=Dh, fd=fd)
      if result != result or result in (float('inf'), float('-inf')):
        return "Error: Result is not finite."
      return float(result)
    except Exception as e:
      return f"Error: {str(e)}"

Online Calculator