Skip to content

Turbulence kinetic energy calculation #3756

@mer1993

Description

@mer1993

What went wrong?

The tke function in turbulence.py returns the turbulent kinetic energy as: 0.5 * np.sqrt(u_cont + v_cont + w_cont)

However, with the square root applied, wouldn’t the unit be in m/s rather than m²/s²? My question is: wouldn't the final output be more similar to a velocity rather than an energy (in m²/s²)? Would the formula be: 0.5 * (u_cont + v_cont + w_cont)

Also, the calculation of perturbation velocities (u_prime, v_prime, and w_prime) uses the mean over the entire time dimension of the dataset. Would there be an option to choose the frequency? Currently, if the dataset spans 20 years, the script calculates perturbation velocities based on a 20-year mean, which would remove all variability and fluctuations, which might cause issues with the representation of perturbation velocity components.

Your guidance on the TKE formula and perturbation velocity calculations would be greatly appreciated.

Regards,

Operating System

Linux

Version

v1.6

Python Version

3.10.13

Code to Reproduce

def tke(u, v, w, perturbation=False, axis=-1):
    r"""Compute turbulence kinetic energy.

    Compute the turbulence kinetic energy (e) from the time series of the
    velocity components.

    Parameters
    ----------
    u : array-like
        The wind component along the x-axis
    v : array-like
        The wind component along the y-axis
    w : array-like
        The wind component along the z-axis
    perturbation : bool, optional
                   True if the `u`, `v`, and `w` components of wind speed
                   supplied to the function are perturbation velocities.
                   If False, perturbation velocities will be calculated by
                   removing the mean value from each component.

    Returns
    -------
    array-like
        The corresponding turbulence kinetic energy value

    Other Parameters
    ----------------
    axis : int
           The index of the time axis. Default is -1

    See Also
    --------
    get_perturbation : Used to compute perturbations if `perturbation`
                       is False.

    Notes
    -----
    Turbulence Kinetic Energy is computed as:

    .. math:: e = 0.5 \sqrt{\overline{u^{\prime2}} +
                            \overline{v^{\prime2}} +
                            \overline{w^{\prime2}}},

    where the velocity components

    .. math:: u^{\prime}, v^{\prime}, u^{\prime}

    are perturbation velocities. For more information on the subject, please
    see [Garratt1994]_.

    """
    if not perturbation:
        u = get_perturbation(u, axis=axis)
        v = get_perturbation(v, axis=axis)
        w = get_perturbation(w, axis=axis)

    u_cont = np.mean(u**2, axis=axis)
    v_cont = np.mean(v**2, axis=axis)
    w_cont = np.mean(w**2, axis=axis)

    return 0.5 * np.sqrt(u_cont + v_cont + w_cont)

Errors, Traceback, and Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething is not working like it should

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions