Closed zwei961120 closed 1 year ago
That's a good point. When I've used this script in the past I've used it in the form:
U = Average(model.velocities.u, dims=(1,2))
V = Average(model.velocities.v, dims=(1,2))
ZSP = ZShearProduction(model, u-U, v-V, w, U, V, 0)
Which passes what you'd call $u'$ directly and would therefore compute the correct quantity. It calls this method:
But you're right that if a user uses ths other method:
then the calculation isn't correct.
I'll open a PR about this!
It seems that the ZpressureRedistribution function has not been adjusted in Oceanostics.jl repo yet, right? So I tested on GPUs in the following way. The model setup is the same as the Langmuir Turbulence example setup in: https://clima.github.io/OceananigansDocumentation/stable/generated/langmuir_turbulence/.
The test codes and outputs in Jupyternotebook are attached here: https://github.com/zwei961120/TKE_test/blob/main/TKE_TEST.ipynb, and everything seems to be going well.
Besides, I am little confused, when calculating the Z-direction pressure redistribution term, why performing velocity and pressure averages in Y and Z directions like W = Field(Average(w, dims=(2, 3)))
rather than performing the horizontally averages like W = Field(Average(w, dims=(1, 2)))
?
Feel free to tell me your thoughts. Thanks!
It seems that the ZpressureRedistribution function has not been adjusted in Oceanostics.jl repo yet, right? So I tested on GPUs in the following way. The model setup is the same as the Langmuir Turbulence example setup in: https://clima.github.io/OceananigansDocumentation/stable/generated/langmuir_turbulence/.
The test codes and outputs in Jupyternotebook are attached here: https://github.com/zwei961120/TKE_test/blob/main/TKE_TEST.ipynb, and everything seems to be going well.
Just FYI the urls you passed aren't properly linked. The proper way to do it is:
[some text](https://github.com/zwei961120/TKE_test/blob/main/TKE_TEST.ipynb)
hope this helps in the future :)
Besides, I am little confused, when calculating the Z-direction pressure redistribution term, why performing velocity and pressure averages in Y and Z directions like
W = Field(Average(w, dims=(2, 3)))
rather than performing the horizontally averages likeW = Field(Average(w, dims=(1, 2)))
?Feel free to tell me your thoughts. Thanks!
Let's continue this discussion at https://github.com/tomchor/Oceanostics.jl/pull/104 since we're discussing the code there!
I'll answer you over there
In the TKE budget equation
∂_t E = - ∂_z ⟨w′e′ + w′p′⟩ - ⟨w′u′⟩ ∂_z U - ⟨w′v′⟩ ∂_z V + ⟨w′b′⟩ - ϵ
, for example, when calculating the shear production term in x-direction, in my opinion, one need to calculate the horizontally averaged variables (U, V and W) and the fluctuation variables (u'= u-U, v'= v-V, w'= w-W) first, then calculate the shear production term [-(u’u’∂xU + v’u’∂xV + w’u’∂xW)], but in the script TKEBudgetTerms.jl, it seems like the model.velocities (u, v and w) is directly used for calculating the shear production terms:Also, when calculating the pressure redistribution term, the pressure p is directly used without any operations. I don't know if my understanding is correct, and if not, are there any special considerations for doing in that way?