Skip to content

Commit

Permalink
Merge #48
Browse files Browse the repository at this point in the history
48: Add EDMF parameters. r=charleskawczynski a=ilopezgp

This PR adds the EDMF parameters, which will then be removed from ClimateMachine.jl.

Co-authored-by: ilopezgp <ilopezgp@gmail.com>
  • Loading branch information
bors[bot] and ilopezgp authored Mar 8, 2021
2 parents cd8e22b + 0019712 commit 8fb34bc
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CLIMAParameters"
uuid = "6eacf6c3-8458-43b9-ae03-caf5306d3d53"
authors = ["Charles Kawczynski <kawczynski.charles@gmail.com>"]
version = "0.1.10"
version = "0.1.11"

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
33 changes: 33 additions & 0 deletions docs/src/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,39 @@ Atmos.SubgridScale.c_2_KASM
Atmos.SubgridScale.c_3_KASM
```

### EDMF

```@docs
Atmos.EDMF.c_λ
Atmos.EDMF.c_ε
Atmos.EDMF.c_δ
Atmos.EDMF.c_t
Atmos.EDMF.β
Atmos.EDMF.μ_0
Atmos.EDMF.χ
Atmos.EDMF.w_min
Atmos.EDMF.lim_ϵ
Atmos.EDMF.lim_amp
Atmos.EDMF.a_min
Atmos.EDMF.a_surf
Atmos.EDMF.κ_star²
Atmos.EDMF.ψϕ_stab
Atmos.EDMF.α_d
Atmos.EDMF.α_a
Atmos.EDMF.α_b
Atmos.EDMF.H_up_min
Atmos.EDMF.c_d
Atmos.EDMF.c_m
Atmos.EDMF.c_b
Atmos.EDMF.a1
Atmos.EDMF.a2
Atmos.EDMF.ω_pr
Atmos.EDMF.Pr_n
Atmos.EDMF.Ri_c
Atmos.EDMF.smin_ub
Atmos.EDMF.smin_rm
```

### Microphysics_0M

```@docs
Expand Down
117 changes: 117 additions & 0 deletions src/Atmos/Atmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,123 @@ function c_3_KASM end

end # module SubgridScale

module EDMF

export c_λ,
c_ε,
c_δ,
c_t,
β,
μ_0,
χ,
w_min,
lim_ϵ,
lim_amp,
a_min,
a_surf,
κ_star²,
ψϕ_stab,
α_d,
α_a,
α_b,
H_up_min,
c_d,
c_m,
c_b,
a1,
a2,
ω_pr,
Pr_n,
Ri_c,
smin_ub,
smin_rm

""" Entrainment TKE scale (dimensionless) """
function c_λ end

""" Entrainment factor (dimensionless) """
function c_ε end

""" Detrainment factor (dimensionless) """
function c_δ end

""" Turbulent Entrainment factor (dimensionless) """
function c_t end

""" Detrainment RH power (dimensionless) """
function β end

""" Logistic function scale (s``^{-1}``) """
function μ_0 end

""" Updraft mixing fraction (dimensionless) """
function χ end

""" Minimum updraft velocity (m/s) """
function w_min end

""" Exponential area limiter scale (dimensionless) """
function lim_ϵ end

""" Exponential area limiter amplitude(dimensionless) """
function lim_amp end

""" Minimum area fraction for any subdomain (dimensionless) """
function a_min end

""" Updraft surface area fraction (dimensionless) """
function a_surf end

""" Square ratio of rms turbulent velocity to friction velocity (dimensionless) """
function κ_star² end

""" Surface covariance stability coefficient (dimensionless) """
function ψϕ_stab end

""" Pressure drag factor (dimensionless) """
function α_d end

""" Advective pressure factor (dimensionless """
function α_a end

""" Buoyancy pressure factor (dimensionless) """
function α_b end

""" Minimum updraft height for closures (m) """
function H_up_min end

""" Environmental dissipation factor (dimensionless) """
function c_d end

""" Eddy viscosity factor (dimensionless) """
function c_m end

""" Static stability factor (dimensionless) """
function c_b end

""" Empirical stability function coefficient (dimensionless) """
function a1 end

""" Empirical stability function coefficient (dimensionless) """
function a2 end

""" Prandtl number empirical coefficient (dimensionless) """
function ω_pr end

""" Neutral Prandtl number (dimensionless) """
function Pr_n end

""" Critical Richardson number (dimensionless) """
function Ri_c end

""" Smooth minimum's fractional upper bound (dimensionless) """
function smin_ub end

""" Smooth minimum's regularization length minimum (m) """
function smin_rm end

end # module EDMF

module Microphysics_0M

export τ_precip,
Expand Down
47 changes: 44 additions & 3 deletions src/Atmos/atmos_parameters.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SubgridScale parameters
const AtmosSGS = CLIMAParameters.Atmos.SubgridScale

# SubgridScale parameters
AtmosSGS.C_smag(::AbstractEarthParameterSet) = 0.21
AtmosSGS.C_drag(::AbstractEarthParameterSet) = 0.0011
AtmosSGS.inv_Pr_turb(::AbstractEarthParameterSet) = 3
Expand All @@ -12,12 +12,53 @@ AtmosSGS.c_1_KASM(ps::AbstractEarthParameterSet) = AtmosSGS.c_a_KASM(ps)*
AtmosSGS.c_2_KASM(ps::AbstractEarthParameterSet) = AtmosSGS.c_e2_KASM(ps)+2*AtmosSGS.c_1_KASM(ps)
AtmosSGS.c_3_KASM(ps::AbstractEarthParameterSet) = AtmosSGS.c_a_KASM(ps)^(3/2)

# EDMF parameters
const EDMF = CLIMAParameters.Atmos.EDMF

# Entrainment - detrainment model
EDMF.c_λ(::AbstractEarthParameterSet) = 0.3
EDMF.c_ε(::AbstractEarthParameterSet) = 0.13
EDMF.c_δ(::AbstractEarthParameterSet) = 0.52
EDMF.c_t(::AbstractEarthParameterSet) = 0.1
EDMF.β(::AbstractEarthParameterSet) = 2
EDMF.μ_0(::AbstractEarthParameterSet) = 4e-4
EDMF.χ(::AbstractEarthParameterSet) = 0.25
EDMF.w_min(::AbstractEarthParameterSet) = 0.1
EDMF.lim_ϵ(::AbstractEarthParameterSet) = 1e-4
EDMF.lim_amp(::AbstractEarthParameterSet) = 10

# Subdomain model
EDMF.a_min(::AbstractEarthParameterSet) = 0.001

# Surface model
EDMF.a_surf(::AbstractEarthParameterSet) = 0.1
EDMF.κ_star²(::AbstractEarthParameterSet) = 3.75
EDMF.ψϕ_stab(::AbstractEarthParameterSet) = 8.3

# Pressure model
EDMF.α_d(::AbstractEarthParameterSet) = 10.0
EDMF.α_a(::AbstractEarthParameterSet) = 0.1
EDMF.α_b(::AbstractEarthParameterSet) = 0.12
EDMF.H_up_min(::AbstractEarthParameterSet) = 500

# Mixing length model
EDMF.c_d(::AbstractEarthParameterSet) = 0.22
EDMF.c_m(::AbstractEarthParameterSet) = 0.14
EDMF.c_b(::AbstractEarthParameterSet) = 0.63
EDMF.a1(::AbstractEarthParameterSet) = 0.2
EDMF.a2(::AbstractEarthParameterSet) = 100
EDMF.ω_pr(::AbstractEarthParameterSet) = 53.0 / 13.0
EDMF.Pr_n(::AbstractEarthParameterSet) = 0.74
EDMF.Ri_c(::AbstractEarthParameterSet) = 0.25
EDMF.smin_ub(::AbstractEarthParameterSet) = 0.1
EDMF.smin_rm(::AbstractEarthParameterSet) = 1.5

# 0-moment microphysics parameters
const Microphysics_0M = CLIMAParameters.Atmos.Microphysics_0M

Microphysics_0M.τ_precip(::AbstractEarthParameterSet) = 1000
Microphysics_0M.qc_0(::AbstractEarthParameterSet) = 5e-3
Microphysics_0M.S_0(::AbstractEarthParameterSet) = 0.02
Microphysics_0M.qc_0(::AbstractEarthParameterSet) = 5e-3
Microphysics_0M.S_0(::AbstractEarthParameterSet) = 0.02

# 1-moment microphysics parameters
const Microphysics = CLIMAParameters.Atmos.Microphysics
Expand Down
39 changes: 39 additions & 0 deletions test/edmf.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Test
using CLIMAParameters
using CLIMAParameters.Atmos.EDMF

@testset "EDMF" begin

struct EarthParameterSet <: AbstractEarthParameterSet end
ps = EarthParameterSet()

@test !isnan(EDMF.c_λ(ps))
@test !isnan(EDMF.c_ε(ps))
@test !isnan(EDMF.c_δ(ps))
@test !isnan(EDMF.c_t(ps))
@test !isnan(EDMF.β(ps))
@test !isnan(EDMF.μ_0(ps))
@test !isnan(EDMF.χ(ps))
@test !isnan(EDMF.w_min(ps))
@test !isnan(EDMF.lim_ϵ(ps))
@test !isnan(EDMF.lim_amp(ps))
@test !isnan(EDMF.a_min(ps))
@test !isnan(EDMF.a_surf(ps))
@test !isnan(EDMF.κ_star²(ps))
@test !isnan(EDMF.ψϕ_stab(ps))
@test !isnan(EDMF.α_d(ps))
@test !isnan(EDMF.α_a(ps))
@test !isnan(EDMF.α_b(ps))
@test !isnan(EDMF.H_up_min(ps))
@test !isnan(EDMF.c_d(ps))
@test !isnan(EDMF.c_m(ps))
@test !isnan(EDMF.c_b(ps))
@test !isnan(EDMF.a1(ps))
@test !isnan(EDMF.a2(ps))
@test !isnan(EDMF.ω_pr(ps))
@test !isnan(EDMF.Pr_n(ps))
@test !isnan(EDMF.Ri_c(ps))
@test !isnan(EDMF.smin_ub(ps))
@test !isnan(EDMF.smin_rm(ps))

end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

include("planet.jl")
include("subgrid_scale.jl")
include("edmf.jl")
include("microphysics.jl")
include("atmos_subgrid_scale.jl")
include("surface_fluxes.jl")
Expand Down

2 comments on commit 8fb34bc

@charleskawczynski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/31504

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.11 -m "<description of version>" 8fb34bc6d8141e23b457d6369e8b073e239bfd9f
git push origin v0.1.11

Please sign in to comment.