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:

Result
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:

Result
12.1481

Example 3: Medium open area (alpha=0.6)

Inputs:

alpha
0.6

Excel formula:

=SQ_EDGE_GRILL(0.6)

Expected output:

Result
2.3333

Example 4: High open area (alpha=0.8)

Inputs:

alpha
0.8

Excel formula:

=SQ_EDGE_GRILL(0.8)

Expected output:

Result
0.7187

Python Code

import micropip
await micropip.install(["fluids"])
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.
    """
    # 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."

    try:
        result = fluids_square_edge_grill(alpha=alpha, l=l, Dh=Dh, fd=fd)
        if result != result:  # NaN check
            return "nan"
        if result == float('inf'):
            return "inf"
        if result == float('-inf'):
            return "-inf"
        return float(result)
    except Exception as e:
        return f"Error computing square_edge_grill: {str(e)}"

Online Calculator