|
1 | | -function ᶜcompute_eddy_diffusivity_coefficient( |
2 | | - ᶜρ, |
3 | | - vert_diff::DecayWithHeightDiffusion, |
4 | | -) |
| 1 | + |
| 2 | +""" |
| 3 | + ᶜcompute_eddy_diffusivity_coefficient(ᶜρ, (; D₀, H)::DecayWithHeightDiffusion) |
| 4 | +
|
| 5 | +Return lazy representation of the vertical profile of eddy diffusivity |
| 6 | +for the `DecayWithHeightDiffusion` model. |
| 7 | +
|
| 8 | +The profile is given by: |
| 9 | +``` |
| 10 | +K(z) = D₀ ⋅ exp(-(z - z_sfc) / H) |
| 11 | +``` |
| 12 | +
|
| 13 | +# Arguments |
| 14 | +- `ᶜρ`: Cell-centered field whose axes provide vertical coordinates. |
| 15 | +- Instance of `DecayWithHeightDiffusion` model, with fields: |
| 16 | + - `D₀`: Surface eddy diffusivity magnitude. |
| 17 | + - `H`: E-folding height for the exponential decay. |
| 18 | +
|
| 19 | +# See also |
| 20 | +- [`DecayWithHeightDiffusion`] for the model specification |
| 21 | +- [`vertical_diffusion_boundary_layer_tendency!`] where this coefficient is applied |
| 22 | +""" |
| 23 | +function ᶜcompute_eddy_diffusivity_coefficient(ᶜρ, (; D₀, H)::DecayWithHeightDiffusion) |
5 | 24 | (; ᶜz, ᶠz) = z_coordinate_fields(axes(ᶜρ)) |
6 | 25 | ᶠz_sfc = Fields.level(ᶠz, Fields.half) |
7 | | - return @. lazy( |
8 | | - eddy_diffusivity_coefficient_H(vert_diff.D₀, vert_diff.H, ᶠz_sfc, ᶜz), |
9 | | - ) |
| 26 | + return @. lazy(eddy_diffusivity_coefficient_H(D₀, H, ᶠz_sfc, ᶜz)) |
10 | 27 | end |
| 28 | +eddy_diffusivity_coefficient_H(D₀, H, z_sfc, z) = D₀ * exp(-(z - z_sfc) / H) |
11 | 29 |
|
12 | | -function ᶜcompute_eddy_diffusivity_coefficient( |
13 | | - ᶜuₕ, |
14 | | - ᶜp, |
15 | | - vert_diff::VerticalDiffusion, |
16 | | -) |
| 30 | +""" |
| 31 | + ᶜcompute_eddy_diffusivity_coefficient(ᶜuₕ, ᶜp, (; C_E)::VerticalDiffusion) |
| 32 | +
|
| 33 | +Return lazy representation of the vertical profile of eddy diffusivity |
| 34 | +for the `VerticalDiffusion` model. |
| 35 | +
|
| 36 | +The profile is given by: |
| 37 | +``` |
| 38 | +K(z) = K_E , if p > p_pbl |
| 39 | + = K_E * exp(-((p_pbl - p) / p_strato)^2), otherwise |
| 40 | +``` |
| 41 | +where `K_E` is given by: |
| 42 | +``` |
| 43 | +K_E = C_E ⋅ norm(ᶜuₕ(z_bot)) ⋅ Δz_bot / 2 |
| 44 | +``` |
| 45 | +where `z_bot` is the first interior center level of the model, |
| 46 | +and `Δz_bot` is the thickness of the surface layer. |
| 47 | +
|
| 48 | +# Arguments |
| 49 | +- `ᶜuₕ`: Cell-centered horizontal velocity field; its first interior level is used. |
| 50 | +- `ᶜp`: Cell-centered thermodynamic pressure field (or proxy) used by the closure. |
| 51 | +- Instance of `VerticalDiffusion` model, with field `C_E`: |
| 52 | + - `C_E`: Dimensionless eddy-coefficient factor. |
| 53 | +
|
| 54 | +# See also |
| 55 | +- [`VerticalDiffusion`] for the model specification |
| 56 | +""" |
| 57 | +function ᶜcompute_eddy_diffusivity_coefficient(ᶜuₕ, ᶜp, (; C_E)::VerticalDiffusion) |
17 | 58 | interior_uₕ = Fields.level(ᶜuₕ, 1) |
18 | 59 | ᶜΔz_surface = Fields.Δz_field(interior_uₕ) |
19 | 60 | return @. lazy( |
20 | | - eddy_diffusivity_coefficient( |
21 | | - vert_diff.C_E, |
22 | | - norm(interior_uₕ), |
23 | | - ᶜΔz_surface / 2, |
24 | | - ᶜp, |
25 | | - ), |
| 61 | + eddy_diffusivity_coefficient(C_E, norm(interior_uₕ), ᶜΔz_surface / 2, ᶜp), |
26 | 62 | ) |
27 | 63 | end |
| 64 | + |
| 65 | +function eddy_diffusivity_coefficient(C_E, norm_uₕ_bottom, Δz_bottom, p) |
| 66 | + p_pbl = 85000 |
| 67 | + p_strato = 10000 |
| 68 | + K_E = C_E * norm_uₕ_bottom * Δz_bottom |
| 69 | + return p > p_pbl ? K_E : K_E * exp(-((p_pbl - p) / p_strato)^2) |
| 70 | +end |
0 commit comments