Closed ali-ramadhan closed 2 years ago
My decision to use Sigma rather than S was not to avoid confusion in the code, but to avoid confusion in documentation and papers, where it will not be possible to use S for both salinity and strain rate.
I support changes 1-4. 1 may also be important for future turbulence closures in IncompressibleModel.
One approach we came up is for all turbulence closures to define functions for the SGS stress tensor like ∂ⱼτᵢⱼ
With you here.
where τᵢⱼ = νˢᵍˢSᵢⱼ and where νˢᵍˢ will dispatch on the type of closure while the strain-rate tensor Sᵢⱼ will dispatch on whether the model is compressible or incompressible.
I don't think this needs to be pre-ordained somehow. Each turbulence closure can act as needed. What's being pointed out is that it's easy to use type information with the turbulence closure so that it can be used as a valid closure for either incompressible or compressible systems. For this I think we should add type information to the turbulence closure itself, eg:
struct VerstappenAnisotropicMinimumDissipation{FT, PK, PN, K} <: AbstractAnisotropicMinimumDissipation{FT, S}
Cν :: PN
Cκ :: PK
Cb :: FT
ν :: FT
κ :: K
strain_rate :: S
function VerstappenAnisotropicMinimumDissipation{FT}(Cν, Cκ, Cb, ν, κ, strain_rate) where FT
return new{FT, typeof(Cκ), typeof(Cν), typeof(κ)}(Cν, Cκ, Cb, ν, convert_diffusivity(FT, κ), strain_rate)
end
end
where strain_rate = Traceless()
would inform the turbulence closure to use the traceless rate of strain.
Stress divergences are computed here:
For example, one component of the stress divergence is:
@inline ∂x_2ν_Σ₁₁(i, j, k, grid, closure, U, diffusivities) =
2 * ∂xᶠᵃᵃ(i, j, k, grid, ν_σᶜᶜᶜ, diffusivities.νₑ, Σ₁₁, U.u, U.v, U.w)
We can thus extend functionality via dispatch:
@inline ∂x_2ν_Σ₁₁(i, j, k, grid, ::TracelessStrainRateClosure, U, diffusivities) =
2 * ∂xᶠᵃᵃ(i, j, k, grid, ν_σᶜᶜᶜ, diffusivities.νₑ, traceless_Σ₁₁, U.u, U.v, U.w)
where TracelessStrainRateClosure
is an alias for a closure that requires the traceless strain rate.
A turbulence closure can define ∂ⱼτᵢⱼ directly to elide or short circuit computations or in case the SGS stress tensor is not of the form ∂ⱼτᵢⱼ = νˢᵍˢSᵢⱼ.
This is how the system already works for closures that don't have eddy diffusivities. Is something different from the current system being proposed?
@thabbott suggested that νˢᵍˢ might have to dispatch on the thermodynamic variable as well. Is this true for the viscosity or only the diffusivities κˢᵍˢ? I.e. do we have to treat SGS fluxes of moisture and energy in a special way?
Currently, the calculate_diffusivities!
functions receives buoyancy
, velocities
, and tracers
, as arguments:
If a different abstraction is needed we can change the calculate_diffusivities
function appropriately.
As for ensuring that compressible models always use the correct strain rate, this can be handled within the CompressibleModel
constructor.
We don't have a compressible model so I'm closing this.
@thabbott and I have been thinking about potential ways we can reuse LES/turbulence closures between incompressible and compressible models.
One approach we came up is for all turbulence closures to define functions for the SGS stress tensor like ∂ⱼτᵢⱼ where τᵢⱼ = νˢᵍˢSᵢⱼ and where νˢᵍˢ will dispatch on the type of closure while the strain-rate tensor Sᵢⱼ will dispatch on whether the model is compressible or incompressible. For compressible models, Sᵢⱼ will instead compute and return the traceless strain-rate tensor Sᵢⱼ - ⅓Sₖₖδᵢⱼ.
A turbulence closure can define ∂ⱼτᵢⱼ directly to elide or short circuit computations or in case the SGS stress tensor is not of the form ∂ⱼτᵢⱼ = νˢᵍˢSᵢⱼ.
Still learning more about this topic but it seems that as a start, just using the traceless strain-rate tensor for compressible models allows us to reuse a closure from an incompressible model.
@thabbott suggested that νˢᵍˢ might have to dispatch on the thermodynamic variable as well. Is this true for the viscosity or only the diffusivities κˢᵍˢ? I.e. do we have to treat SGS fluxes of moisture and energy in a special way?
Couple of useful references for compressible LES (mostly with dynamic Smagorinsky):
Some notational and misc. changes I'd like to make:
Rename
∂ⱼ_2ν_Σ₁ⱼ
to∂ⱼτ₁ⱼ
as τᵢⱼ = 2νSᵢⱼ is would no longer be true forCompressibleModel
, it's τᵢⱼ = 2νSᵢⱼ + λSₘₘδᵢⱼ where λ is the second viscosity, or τᵢⱼ = 2μ(Sᵢⱼ - ⅓Sₖₖδᵢⱼ) + μᵥSₖₖδᵢⱼ where μᵥ is the bulk or volume viscosity.For constant isotropic viscosity: rename
∂ⱼνᵢⱼ∂ᵢu
toν∇²u
. For constant isotropic diffusivity: rename∂ⱼκᵢⱼ∂ᵢc
toκ∇²c
.For constant anistropic viscosity: rename
∂ⱼνᵢⱼ∂ᵢu
toνⱼ∂ⱼ²u
. For constant anistropic diffusivity: rename∂ⱼκᵢⱼ∂ᵢc
toκⱼ∂ⱼ²c
. Potentially a misuse of summation notation but should be a valid and understandable use of it.For
ConstantAnisotropicDiffusivity
andAnisotropicBiharmonicDiffusivity
should we generalize it to be truly anisotropic with three diagonal components?Use
Sᵢⱼ
instead ofΣᵢⱼ
to denote the strain-rate tensor, following a common convention in most books, papers, and Wikipedia. I believe Σ was used initially to not conflict with salinity S but I think the use of salinity has is now mainly restricted toOceananigans.Buoyancy
so there is a very small chance for confusion inOceananigans.TurbulenceClosures
.