def calc_percolation_flux(unsatStore, unsatStore_max, fieldCap, k_sat, beta):
    """ Calculate the percolation flux from the unsaturated to the saturated zone

    Parameters
    ----------
    unsatStore : int or float
        Storage in the unsaturated zone [mm]
    unsatStore_max : int or float
        Maximum storage in the unsaturated zone [mm]
    fieldCap : int or float
        Field capacity [mm]
    k_sat : int or float
        Maximum percolation rate [mm day^-1]
    beta : int or float
        Parameter to account for percolation non-linearity

    Returns
    -------
    percolation : int or float
        Percolation flux [mm day^-1]
    """

    if unsatStore < fieldCap:
        percolation = 0.0
    else:
        percolation = k_sat * ((unsatStore - fieldCap) / (unsatStore_max - fieldCap)) ** beta

    return percolation