You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
deftke(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]_. """ifnotperturbation:
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)
return0.5*np.sqrt(u_cont+v_cont+w_cont)
Errors, Traceback, and Logs
The text was updated successfully, but these errors were encountered:
Hello @mer1993! Yes, that is a bug. It should be 0.5 * (u_cont + v_cont + w_cont). I will get that fixed asap.
For your second question regarding the perturbations, what you could do is compute the perturbation velocities and pass those into the tke function along with the perturbation=True parameter.
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
Errors, Traceback, and Logs
The text was updated successfully, but these errors were encountered: