def solve_hcr(q0, g):
    """Calculate the critical h.

    For 1D problem, q is theoretically constant everywhere if no mass gain/loss.
    So the q at the left boundary can be treated as the q everywhere.

    Args:
    -----
        q0: a scalar; the conservative quantity hu at x = 0 (the left) boundary.
        g: gravity.

    Returns:
    --------
        hcr: the critical h.
    """

    hcr = (q0 * q0 / g)**(1. / 3.)

    return hcr