CliMA / LESbrary.jl

📚Generating Oceananigans large eddy simulation (LES) data for calibrating parameterizations
MIT License
28 stars 10 forks source link

Factor of two missing in ViscousDissipation #38

Closed glwagner closed 3 years ago

glwagner commented 3 years ago

The appears to be a factor of 2 missing in this expression:

https://github.com/CliMA/LESbrary.jl/blob/6cfe60cf44031f9357936058f08eed0f1bb5f9fc/src/TurbulenceStatistics/viscous_dissipation.jl#L63

Which I believe should be

 @inbounds ϵ[i, j, k] = νₑ[i, j, k] * 2 * (Σˣˣ^2 + Σʸʸ^2 + Σᶻᶻ^2 + 2 * (Σˣʸ^2 + Σˣᶻ^2 + Σʸᶻ^2))

This is because the strain-rate sum arises from a contraction of the strain rate tensor. The strain rate tensor has 9 components, but only 6 are independent. Thus this sum can be written in terms of the 6 independent components, counting off-diagonal components twice.

I think @qingli411 has fixed this somewhere but it hasn't made its way into master... ? @qingli411 let me know if the code in master is still incorrect (people may start using it soon, like @tomchor, so its imperative that it gets fixed ASAP).

We should come up with tests for this, and other terms in the turbulent kinetic energy budget.

qingli411 commented 3 years ago

@glwagner Yes. Just created a PR for this https://github.com/CliMA/LESbrary.jl/pull/39

tomchor commented 3 years ago

Thanks for keeping me in mind, guys!

Also, while we're talking about this, calling this term ViscousDissipation is misleading, since it has nothing to do with viscosity. It's the transfer of energy from resolved to unresolved motion completely due to inviscid inertial processes. You can read about this in section 13.3.3 of Stephen Pope's book (right after Eq. (13.123)).

The actual viscous dissipation is of course similar, but with the molecular coefficient. (Which may be a good idea to calculate too?)

glwagner commented 3 years ago

Ah. But because we don't have backscatter, the rate at which energy is transferred to subfilter motions is equivalent to the viscous dissipation rate, eh?

Happy to use a different name if there's one that's more clear and explicit, though. On the other hand, I don't want to imply something incorrect, eg, that this quantity is somehow not equal to the rate of viscous dissipation...

tomchor commented 3 years ago

I see. But theoretically that should not be exactly equal to the viscous dissipation, which should that term plus the same term with molecular viscosity, right? Unless Oceananigans doesn't include the molecular term. Is that the case?

Happy to use a different name if there's one that's more clear and explicit, though.

I mean, it's obviously up to you guys, but I'd call it for what it is: energy transfer to SGS motion (or a shorter version of that name haha!). Or even SGS dissipation (even though that name isn't 100% appropriate also).

glwagner commented 3 years ago

You're correct: we don't obtain the total viscous dissipation unless we include both the component representing the rate of energy transfer to subfilter motions as well as the molecular dissipation of the resolved motions. For the problems I usually run the subfilter eddy viscosity is orders of magnitude larger than the molecular viscosity, so that second component is negligible.

If we include the molecular component, then the object currently being computed is equal to the total rate of viscous dissipation, due to the assumptions made in deriving the LES model. In other words, the rate of energy transfer to subfilter motions is exactly equal to the rate at which subfilter motions are dissipated by molecular viscosity --- according to the arguments used to derive all of the LES models we currently support.

It's possible we'll support LES models in the future for which is not the case, however. I think that the rate of transfer to subfilter motions could differ from the total rate of viscous dissipation for the "Deardorff" LES closure --- at least in principle (?)

tomchor commented 3 years ago

Yeah, for most applications the viscous dissipation of energy due to resolved motions should be much smaller than the energy transfer to SGS motions, but that might not be the case always. Which is why, imo, it's best not to make that assumption in an ocean model that as flexible as oceananigans.

Just to clear, by default all turbulence closures implemented have a constant background viscosity/diffusivity that's equal to the molecular value, correct? So unless I explicitly set those to zero, the molecular viscosity is being added to the eddy one, right?

I think that the rate of transfer to subfilter motions could differ from the total rate of viscous dissipation for the "Deardorff" LES closure --- at least in principle (?)

That seems reasonable to me, although I'd have to read more about it (I'm not very familiar with the intricacies of their model). Which is why I think transfer to subfilter motions should be the preferred term, since it's unambiguously correct for what you're calculating I think. (Although it's a mouthful, I know.)

glwagner commented 3 years ago

Yeah, but the other possibility is to include the molecular component, so that it's the total rate of viscous dissipation, right?

glwagner commented 3 years ago

I think for what this quantity was intended to represent, the total rate of viscous dissipation is what we wanted. Do you need something else for the science you're trying to do? @qingli411 do you have an opinion?

tomchor commented 3 years ago

Yeah, but the other possibility is to include the molecular component, so that it's the total rate of viscous dissipation, right?

That would certainly be the easy way to deal with it and I think that might be the best. Although we'd have to check that point of yours about that not being exactly true for the Deardorff closure I think.

glwagner commented 3 years ago

Issues like this are one reason why it'd be really nice to resolve https://github.com/CliMA/Oceananigans.jl/issues/1241 !

I'd like to add a few thoughts. First, if we can't resolve Oceananigans 1241, then we probably ultimately want separate objects for MolecularViscousDissipation and "EddyViscousDissipation". I also think that considering the possibility that we'll have an explicit model for subfilter energy (eg, the Deardorff closure) is a good idea, since this is somewhere on my long todo list. We may not actually need a custom kernel for SubfilterDissipation in that case, since it's a simple function of the subfilter TKE for the Deardorff model (we'll see).

As for the name, I think SubfilterEnergyTransfer might be more confusing or less literal than referring to this term as a "dissipation" of some kind. It is literally a dissipation of the energy of the resolved flow. Note that "dissipation" can refer to the destruction of any kind of variance c^2. This word is not limited to apply to viscous dissipation by molecular viscosity.

The mathematical fact that this quantity represents "dissipation" of some kind does not conflict with @tomchor's point that --- depending on the subfilter model --- the dissipation of the resolved flow might differ from the dissipation of the total system if "subfilter energy" is non-stationary. I think staying close to sure mathematical facts, rather than layering on physical interpretations or hypotheses, is appropriate in some circumstances.