Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Improve surface fluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Mar 4, 2020
1 parent 61e9cd6 commit d101ee7
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 359 deletions.
52 changes: 47 additions & 5 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ git-tree-sha1 = "68a90a692ddc0eb72d69a6993ca26e2a923bf195"
uuid = "68821587-b530-5797-8361-c406ea357684"
version = "3.5.0+2"

[[ArrayInterface]]
deps = ["LinearAlgebra", "Requires", "SparseArrays"]
git-tree-sha1 = "81e5dd1f5374aba2badfe967fc6a132c02ab471a"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "2.5.0"

[[ArrayLayouts]]
deps = ["FillArrays", "LinearAlgebra"]
git-tree-sha1 = "bc779df8d73be70e4e05a63727d3a4dfb4c52b1f"
Expand Down Expand Up @@ -176,6 +182,12 @@ git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"

[[Distances]]
deps = ["LinearAlgebra", "Statistics"]
git-tree-sha1 = "23717536c81b63e250f682b0e0933769eecd1411"
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
version = "0.8.2"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down Expand Up @@ -210,6 +222,12 @@ git-tree-sha1 = "85c6b57e2680fa28d5c8adc798967377646fbf66"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.8.5"

[[FiniteDiff]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "aa78e468afa6a0fde472c3dba0782d1ab60b203d"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.2.1"

[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "88b082d492be6b63f967b6c96b352e25ced1a34c"
Expand Down Expand Up @@ -298,6 +316,12 @@ git-tree-sha1 = "be855e3c975b89746b09952407c156b5e4a33a1d"
uuid = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
version = "0.8.1"

[[LineSearches]]
deps = ["LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "Printf", "Test"]
git-tree-sha1 = "54eb90e8dbe745d617c78dee1d6ae95c7f6f5779"
uuid = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
version = "7.0.1"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down Expand Up @@ -348,11 +372,23 @@ git-tree-sha1 = "2ca1db7b3ffb95bc7ff68df2c94ad5755ed6245b"
uuid = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
version = "0.10.0"

[[NLSolversBase]]
deps = ["DiffResults", "Distributed", "FiniteDiff", "ForwardDiff"]
git-tree-sha1 = "7c4e66c47848562003250f28b579c584e55becc0"
uuid = "d41bc354-129a-5804-8e4c-c37616107c6c"
version = "7.6.1"

[[NLsolve]]
deps = ["Distances", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport"]
git-tree-sha1 = "cce0463af83a0f36c7bfa5820e373ac090cc46ad"
uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
version = "4.3.0"

[[NNlib]]
deps = ["BinaryProvider", "Libdl", "LinearAlgebra", "Requires", "Statistics"]
git-tree-sha1 = "21a3c22bc197b6ae2f8d4d75631876e2b6506dbe"
git-tree-sha1 = "d9f196d911f55aeaff11b11f681b135980783824"
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
version = "0.6.5"
version = "0.6.6"

[[NaNMath]]
git-tree-sha1 = "928b8ca9b2791081dc71a51c55347c27c618760f"
Expand Down Expand Up @@ -383,14 +419,20 @@ git-tree-sha1 = "5f303510529486bb02ac4d70da8295da38302194"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.9.11"

[[Parameters]]
deps = ["OrderedCollections"]
git-tree-sha1 = "b62b2558efb1eef1fa44e4be5ff58a515c287e38"
uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
version = "0.12.0"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "0c16b3179190d3046c073440d94172cfc3bb0553"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "0.3.12"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Test", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[Polynomials]]
Expand Down Expand Up @@ -489,9 +531,9 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"]
git-tree-sha1 = "be5c7d45daa449d12868f4466dbf5882242cf2d9"
git-tree-sha1 = "19bfcb46245f69ff4013b3df3b977a289852c3a1"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.32.1"
version = "0.32.2"

[[StatsFuns]]
deps = ["Rmath", "SpecialFunctions"]
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
56 changes: 49 additions & 7 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ git-tree-sha1 = "68a90a692ddc0eb72d69a6993ca26e2a923bf195"
uuid = "68821587-b530-5797-8361-c406ea357684"
version = "3.5.0+2"

[[ArrayInterface]]
deps = ["LinearAlgebra", "Requires", "SparseArrays"]
git-tree-sha1 = "81e5dd1f5374aba2badfe967fc6a132c02ab471a"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "2.5.0"

[[ArrayLayouts]]
deps = ["FillArrays", "LinearAlgebra"]
git-tree-sha1 = "bc779df8d73be70e4e05a63727d3a4dfb4c52b1f"
Expand Down Expand Up @@ -69,7 +75,7 @@ uuid = "179af706-886a-5703-950a-314cd64e0468"
version = "0.1.0"

[[CLIMA]]
deps = ["ArgParse", "CUDAapi", "CUDAdrv", "CUDAnative", "Combinatorics", "Coverage", "CuArrays", "DataDeps", "Dates", "DelimitedFiles", "Distributions", "DocStringExtensions", "DoubleFloats", "FileIO", "ForwardDiff", "GPUifyLoops", "GaussQuadrature", "JLD2", "LazyArrays", "LinearAlgebra", "Literate", "Logging", "MPI", "NCDatasets", "Pkg", "Printf", "Random", "Requires", "SpecialFunctions", "StaticArrays", "Statistics", "WriteVTK"]
deps = ["ArgParse", "CUDAapi", "CUDAdrv", "CUDAnative", "Combinatorics", "Coverage", "CuArrays", "DataDeps", "Dates", "DelimitedFiles", "Distributions", "DocStringExtensions", "DoubleFloats", "FileIO", "ForwardDiff", "GPUifyLoops", "GaussQuadrature", "JLD2", "LazyArrays", "LinearAlgebra", "Literate", "Logging", "MPI", "NCDatasets", "NLsolve", "Pkg", "Printf", "Random", "Requires", "SpecialFunctions", "StaticArrays", "Statistics", "WriteVTK"]
path = ".."
uuid = "777c4786-024f-11e9-21a3-85d5d4106250"
version = "0.1.0"
Expand Down Expand Up @@ -229,6 +235,12 @@ git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"

[[Distances]]
deps = ["LinearAlgebra", "Statistics"]
git-tree-sha1 = "23717536c81b63e250f682b0e0933769eecd1411"
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
version = "0.8.2"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand Down Expand Up @@ -290,6 +302,12 @@ git-tree-sha1 = "85c6b57e2680fa28d5c8adc798967377646fbf66"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.8.5"

[[FiniteDiff]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "aa78e468afa6a0fde472c3dba0782d1ab60b203d"
uuid = "6a86dc24-6348-571c-b903-95158fe2bd41"
version = "2.2.1"

[[FixedPointNumbers]]
git-tree-sha1 = "4aaea64dd0c30ad79037084f8ca2b94348e65eaa"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
Expand Down Expand Up @@ -439,6 +457,12 @@ git-tree-sha1 = "be855e3c975b89746b09952407c156b5e4a33a1d"
uuid = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
version = "0.8.1"

[[LineSearches]]
deps = ["LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "Printf", "Test"]
git-tree-sha1 = "54eb90e8dbe745d617c78dee1d6ae95c7f6f5779"
uuid = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
version = "7.0.1"

[[LinearAlgebra]]
deps = ["Libdl"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down Expand Up @@ -494,11 +518,23 @@ git-tree-sha1 = "2ca1db7b3ffb95bc7ff68df2c94ad5755ed6245b"
uuid = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
version = "0.10.0"

[[NLSolversBase]]
deps = ["DiffResults", "Distributed", "FiniteDiff", "ForwardDiff"]
git-tree-sha1 = "7c4e66c47848562003250f28b579c584e55becc0"
uuid = "d41bc354-129a-5804-8e4c-c37616107c6c"
version = "7.6.1"

[[NLsolve]]
deps = ["Distances", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport"]
git-tree-sha1 = "cce0463af83a0f36c7bfa5820e373ac090cc46ad"
uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
version = "4.3.0"

[[NNlib]]
deps = ["BinaryProvider", "Libdl", "LinearAlgebra", "Requires", "Statistics"]
git-tree-sha1 = "21a3c22bc197b6ae2f8d4d75631876e2b6506dbe"
git-tree-sha1 = "d9f196d911f55aeaff11b11f681b135980783824"
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
version = "0.6.5"
version = "0.6.6"

[[NaNMath]]
git-tree-sha1 = "928b8ca9b2791081dc71a51c55347c27c618760f"
Expand Down Expand Up @@ -547,6 +583,12 @@ git-tree-sha1 = "5f303510529486bb02ac4d70da8295da38302194"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.9.11"

[[Parameters]]
deps = ["OrderedCollections"]
git-tree-sha1 = "b62b2558efb1eef1fa44e4be5ff58a515c287e38"
uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a"
version = "0.12.0"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "0c16b3179190d3046c073440d94172cfc3bb0553"
Expand Down Expand Up @@ -693,9 +735,9 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics"]
git-tree-sha1 = "be5c7d45daa449d12868f4466dbf5882242cf2d9"
git-tree-sha1 = "19bfcb46245f69ff4013b3df3b977a289852c3a1"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.32.1"
version = "0.32.2"

[[StatsFuns]]
deps = ["Rmath", "SpecialFunctions"]
Expand All @@ -715,9 +757,9 @@ version = "1.0.0"

[[Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
git-tree-sha1 = "a54b8ce702aa863eced47bade03123d4dca0db84"
git-tree-sha1 = "242b7fde70b8bc6a30d6476adf17ca3cf1ced6ee"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.0.2"
version = "1.0.3"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand Down
91 changes: 13 additions & 78 deletions docs/src/Atmos/SurfaceFluxes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,98 +4,33 @@
CurrentModule = CLIMA.SurfaceFluxes
```

Surface flux functions, e.g. for buoyancy flux, friction velocity, and exchange coefficients.
This module provides a means to compute surface fluxes given several variables, described in [`surface_conditions`](@ref).

## `Byun1990`

Compute surface fluxes using the approach in Byun (1990).

### Plots

```@example byun1990
using CLIMA.SurfaceFluxes.Byun1990
using Plots, LaTeXStrings
Ri_range = range(-1.2, stop=0.24, length=100)
scales = [50,200,600,1000,10_000]
z_0 = 1.0
γ_m, γ_h = 15.0, 9.0
β_m, β_h = 4.8, 7.8
Pr_0 = 0.74
plot(Ri_range,
[Byun1990.compute_exchange_coefficients(Ri,scale*z_0,z_0,γ_m,γ_h,β_m,β_h,Pr_0)[1]
for Ri in Ri_range, scale in scales],
xlabel="Bulk Richardson number (Ri_b)", ylabel="Drag coefficient", title="Momentum exchange coefficient",
labels=scales, legendtitle=L"z/z_0")
savefig("exchange_byun1990_fig4a.svg") # hide
nothing # hide
```
![](exchange_byun1990_fig4a.svg)

Recreation of Figure 4(a) from Byun (1990)

```@example byun1990
plot(Ri_range,
[Byun1990.compute_exchange_coefficients(Ri,scale*z_0,z_0,γ_m,γ_h,β_m,β_h,Pr_0)[2]
for Ri in Ri_range, scale in scales],
xlabel="Bulk Richardson number (Ri_b)", ylabel="Exchange coefficient", title="Heat exchange coefficient",
labels=scales, legendtitle=L"z/z_0")
savefig("exchange_byun1990_fig4b.svg") # hide
nothing # hide
```
![](exchange_byun1990_fig4b.svg)

Recreation of Figure 4(b) from Byun (1990)

## `Nishizawa2018`

### Plots
```@example
using CLIMA.SurfaceFluxes.Nishizawa2018
using Plots, LaTeXStrings
a = 4.7
θ = 350
z_0 = 10
u_ave = 10
flux = 1
Δz = range(10.0, stop=100.0, length=100)
Ψ_m_tol, tol_abs, iter_max = 1e-3, 1e-3, 10
u_star = Nishizawa2018.compute_friction_velocity.(
u_ave, θ, flux, Δz, z_0, a, Ψ_m_tol, tol_abs, iter_max)
plot(u_star, Δz, title = "Friction velocity vs dz", xlabel = "Friction velocity", ylabel = "dz")
savefig("friction_velocity.svg") # hide
nothing # hide
```
![](friction_velocity.svg)
## Interface
- [`surface_conditions`](@ref) computes
- Monin-Obukhov length
- Potential temperature flux (if not given) using Monin-Obukhov theory
- transport fluxes using Monin-Obukhov theory
- friction velocity/temperature scale/tracer scales
- exchange coefficients

## API

```@docs
compute_buoyancy_flux
Byun1990.compute_MO_len
Byun1990.compute_friction_velocity
Byun1990.compute_exchange_coefficients
Nishizawa2018.compute_MO_len
Nishizawa2018.compute_friction_velocity
Nishizawa2018.compute_exchange_coefficients
surface_conditions
```

## References

- Businger, Joost A., et al. "Flux-profile relationships in the atmospheric surface
layer." Journal of the atmospheric Sciences 28.2 (1971): 181-189.
doi: [10.1175/1520-0469(1971)028<0181:FPRITA>2.0.CO;2](https://doi.org/10.1175/1520-0469(1971)028<0181:FPRITA>2.0.CO;2)

- Nishizawa, S., and Y. Kitamura. "A Surface Flux Scheme Based on the Monin-Obukhov
Similarity for Finite Volume Models." Journal of Advances in Modeling Earth Systems
10.12 (2018): 3159-3175.
doi: [10.1029/2018MS001534](https://doi.org/10.1029/2018MS001534)

- Businger, Joost A., et al. "Flux-profile relationships in the atmospheric surface
layer." Journal of the atmospheric Sciences 28.2 (1971): 181-189.
doi: [10.1175/1520-0469(1971)028<0181:FPRITA>2.0.CO;2](https://doi.org/10.1175/1520-0469(1971)028<0181:FPRITA>2.0.CO;2)

- Byun, Daewon W. "On the analytical solutions of flux-profile relationships for the
atmospheric surface layer." Journal of Applied Meteorology 29.7 (1990): 652-657.
doi: [10.1175/1520-0450(1990)029<0652:OTASOF>2.0.CO;2](https://doi.org/10.1175/1520-0450(1990)029<0652:OTASOF>2.0.CO;2)
Expand Down
Loading

0 comments on commit d101ee7

Please sign in to comment.