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

Commit

Permalink
Improve SurfaceFluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jan 9, 2020
1 parent 40a8a35 commit 9a07595
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 398 deletions.
91 changes: 51 additions & 40 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ version = "0.3.2"

[[ArrayInterface]]
deps = ["LinearAlgebra", "Requires", "SparseArrays"]
git-tree-sha1 = "487fc79b7b77cef8391675c0000ccd8e933e3533"
git-tree-sha1 = "656fd4bcdf204ea96945d9bc1068c0056013438a"
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
version = "2.0.0"
version = "2.3.1"

[[ArrayLayouts]]
deps = ["FillArrays", "LinearAlgebra"]
Expand Down Expand Up @@ -93,9 +93,14 @@ uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"

[[Cassette]]
git-tree-sha1 = "da85d135b6048d3e78603e277cf9a4609f7e0673"
git-tree-sha1 = "36bd4e0088652b0b2d25a03e531f0d04258feb78"
uuid = "7057c7e9-c182-5462-911a-8362d720325c"
version = "0.2.6"
version = "0.3.0"

[[ChainRulesCore]]
git-tree-sha1 = "8f08bb658bdf59f311a416ca3b3c765a221aee8e"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "0.4.0"

[[CodecZlib]]
deps = ["BinaryProvider", "Libdl", "TranscodingStreams"]
Expand Down Expand Up @@ -146,19 +151,19 @@ version = "1.1.0"

[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "a1b652fb77ae8ca7ea328fa7ba5aa151036e5c10"
git-tree-sha1 = "f784254f428fb8fd7ac15982e5862a38a44523d3"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.17.6"
version = "0.17.7"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[DelayDiffEq]]
deps = ["DataStructures", "DiffEqBase", "LinearAlgebra", "Logging", "OrdinaryDiffEq", "Parameters", "Printf", "RecursiveArrayTools", "Reexport", "Roots"]
git-tree-sha1 = "afa98d9b36df419dbf9586e8f3aa0bf1f4f7cf1d"
git-tree-sha1 = "c88083ef22a570fc155802fc30e21e0d0112d28c"
uuid = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
version = "5.18.0"
version = "5.19.0"

[[DelimitedFiles]]
deps = ["Mmap"]
Expand All @@ -171,10 +176,10 @@ uuid = "39dd38d3-220a-591b-8e3c-4c3a8c710a94"
version = "0.4.1"

[[DiffEqBase]]
deps = ["ArrayInterface", "Compat", "DataStructures", "DiffEqDiffTools", "Distributed", "DocStringExtensions", "FunctionWrappers", "IterativeSolvers", "IteratorInterfaceExtensions", "LinearAlgebra", "MuladdMacro", "Parameters", "Printf", "RecipesBase", "RecursiveArrayTools", "RecursiveFactorization", "Requires", "Roots", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "TableTraits", "TreeViews"]
git-tree-sha1 = "a484bf139eb4e15df47b2ef82f6e2af0fbb4ad01"
deps = ["ArrayInterface", "ChainRulesCore", "Compat", "DataStructures", "DiffEqDiffTools", "Distributed", "DocStringExtensions", "FunctionWrappers", "IterativeSolvers", "IteratorInterfaceExtensions", "LinearAlgebra", "MuladdMacro", "Parameters", "Printf", "RecipesBase", "RecursiveArrayTools", "RecursiveFactorization", "Requires", "Roots", "SparseArrays", "StaticArrays", "Statistics", "SuiteSparse", "TableTraits", "TreeViews", "ZygoteRules"]
git-tree-sha1 = "2bb222b5dd4b138a3ce285693b1360c7b04e3fb8"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.7.0"
version = "6.10.2"

[[DiffEqCallbacks]]
deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "NLsolve", "OrdinaryDiffEq", "RecipesBase", "RecursiveArrayTools", "StaticArrays"]
Expand All @@ -184,9 +189,9 @@ version = "2.10.0"

[[DiffEqDiffTools]]
deps = ["ArrayInterface", "LinearAlgebra", "Requires", "SparseArrays", "StaticArrays"]
git-tree-sha1 = "6d83f9b2c2a552bf5ce29c20a526c0cbfd9e5270"
git-tree-sha1 = "a4ed8a740484627ea41b47f7e1a25dd909a28353"
uuid = "01453d9d-ee7c-5054-8395-0335cb756afa"
version = "1.5.0"
version = "1.7.0"

[[DiffEqFinancial]]
deps = ["DiffEqBase", "DiffEqNoiseProcess", "LinearAlgebra", "Markdown", "RandomNumbers"]
Expand All @@ -195,22 +200,22 @@ uuid = "5a0ffddc-d203-54b0-88ba-2c03c0fc2e67"
version = "2.2.1"

[[DiffEqJump]]
deps = ["Compat", "DataStructures", "DiffEqBase", "FunctionWrappers", "LinearAlgebra", "Parameters", "PoissonRandom", "Random", "RandomNumbers", "RecursiveArrayTools", "TreeViews"]
git-tree-sha1 = "d556c231a60f331a2468ee454f3b05afbb5a454b"
deps = ["Compat", "DataStructures", "DiffEqBase", "FunctionWrappers", "LinearAlgebra", "Parameters", "PoissonRandom", "Random", "RandomNumbers", "RecursiveArrayTools", "Statistics", "TreeViews"]
git-tree-sha1 = "b76e5511c2b6675445abb3b35892c18ade9abf74"
uuid = "c894b116-72e5-5b58-be3c-e6d8d4ac2b12"
version = "6.3.0"
version = "6.4.0"

[[DiffEqNoiseProcess]]
deps = ["DataStructures", "DiffEqBase", "LinearAlgebra", "Random", "RandomNumbers", "RecipesBase", "RecursiveArrayTools", "Requires", "ResettableStacks", "StaticArrays", "Statistics"]
git-tree-sha1 = "02eb7e2e202f23a5834727e05eeac40422f0165c"
git-tree-sha1 = "0641d5d6a1dda2a871698155a50c567526974040"
uuid = "77a26b50-5914-5dd7-bc55-306e6241c503"
version = "3.6.0"
version = "3.7.0"

[[DiffEqPhysics]]
deps = ["DiffEqBase", "DiffEqCallbacks", "ForwardDiff", "LinearAlgebra", "Printf", "Random", "RecipesBase", "RecursiveArrayTools", "Reexport", "StaticArrays"]
git-tree-sha1 = "3d7f15f2805bc2f95cfb06d10a920746d11c76d7"
git-tree-sha1 = "abc7d7767994ced55cd2b0caf3057548a8702021"
uuid = "055956cb-9e8b-5191-98cc-73ae4a59e68a"
version = "3.3.0"
version = "3.4.0"

[[DiffResults]]
deps = ["Compat", "StaticArrays"]
Expand Down Expand Up @@ -371,9 +376,9 @@ version = "0.21.0"

[[LLVM]]
deps = ["CEnum", "Libdl", "Printf", "Unicode"]
git-tree-sha1 = "74fe444b8b6d1ac01d639b2f9eaf395bcc2e24fc"
git-tree-sha1 = "1d08d7e4250f452f6cb20e4574daaebfdbee0ff7"
uuid = "929cbde3-209d-540e-8aea-75f648917ca0"
version = "1.3.2"
version = "1.3.3"

[[LazyArrays]]
deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "MacroTools", "StaticArrays"]
Expand Down Expand Up @@ -457,9 +462,9 @@ version = "0.2.1"

[[MultiScaleArrays]]
deps = ["DiffEqBase", "RecursiveArrayTools", "Statistics", "StochasticDiffEq", "TreeViews"]
git-tree-sha1 = "cf6bc444a74ddcb781b04d0be8988bbff83c91df"
git-tree-sha1 = "c69e4a0db8d482a825c7ac76a433759ade2a5af2"
uuid = "f9640e96-87f6-5992-9c3b-0743c6a49ffa"
version = "1.5.0"
version = "1.6.0"

[[NLSolversBase]]
deps = ["Calculus", "DiffEqDiffTools", "DiffResults", "Distributed", "ForwardDiff"]
Expand All @@ -474,10 +479,10 @@ uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
version = "4.2.0"

[[NNlib]]
deps = ["Libdl", "LinearAlgebra", "Requires", "Statistics", "TimerOutputs"]
git-tree-sha1 = "0c667371391fc6bb31f7f12f96a56a17098b3de8"
deps = ["BinaryProvider", "Libdl", "LinearAlgebra", "Requires", "Statistics"]
git-tree-sha1 = "135c0de4794d5e214b06f1fb4787af4a72896e61"
uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
version = "0.6.0"
version = "0.6.2"

[[NaNMath]]
git-tree-sha1 = "928b8ca9b2791081dc71a51c55347c27c618760f"
Expand All @@ -492,9 +497,9 @@ version = "1.1.0"

[[OrdinaryDiffEq]]
deps = ["ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqDiffTools", "ExponentialUtilities", "ForwardDiff", "GenericSVD", "LinearAlgebra", "Logging", "MacroTools", "MuladdMacro", "Parameters", "RecursiveArrayTools", "Reexport", "SparseArrays", "SparseDiffTools", "StaticArrays"]
git-tree-sha1 = "d75c2b12afed168d5ebd60170ebbf46746beac77"
git-tree-sha1 = "143b4d228d3a2e84c45a4acf937f1b0d6788da65"
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
version = "5.26.4"
version = "5.26.8"

[[PDMats]]
deps = ["Arpack", "LinearAlgebra", "SparseArrays", "SuiteSparse", "Test"]
Expand Down Expand Up @@ -556,9 +561,9 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[RandomNumbers]]
deps = ["Random", "Requires"]
git-tree-sha1 = "1417be19c15706c1584d01e32662eb640a4cc908"
git-tree-sha1 = "441e6fc35597524ada7f85e13df1f4e10137d16f"
uuid = "e6cf234a-135c-5ec9-84dd-332b85af5143"
version = "1.3.0"
version = "1.4.0"

[[RecipesBase]]
git-tree-sha1 = "7bdce29bc9b2f5660a6e5e64d64d91ec941f6aa2"
Expand All @@ -567,9 +572,9 @@ version = "0.7.0"

[[RecursiveArrayTools]]
deps = ["ArrayInterface", "RecipesBase", "Requires", "StaticArrays", "Statistics"]
git-tree-sha1 = "cb0fcf68e2e19e76b84c892b22887f02f10f3d9a"
git-tree-sha1 = "35a01ee8529e84d1ca4c7131fee30e7f61047fc8"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "1.2.0"
version = "1.2.1"

[[RecursiveFactorization]]
deps = ["LinearAlgebra"]
Expand Down Expand Up @@ -637,10 +642,10 @@ deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[SparseDiffTools]]
deps = ["Adapt", "ArrayInterface", "Compat", "DataStructures", "DiffEqDiffTools", "ForwardDiff", "LightGraphs", "LinearAlgebra", "Requires", "SparseArrays", "VertexSafeGraphs"]
git-tree-sha1 = "15d981e62c77b117887c30c38976c3f5c8e168e5"
deps = ["Adapt", "ArrayInterface", "Compat", "DataStructures", "DiffEqDiffTools", "ForwardDiff", "InteractiveUtils", "LightGraphs", "LinearAlgebra", "Requires", "SparseArrays", "VertexSafeGraphs"]
git-tree-sha1 = "2efd0a78e58302caedf3aed0b5a9daaa7bca7439"
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
version = "1.0.0"
version = "1.2.0"

[[SpecialFunctions]]
deps = ["BinDeps", "BinaryProvider", "Libdl"]
Expand All @@ -666,9 +671,9 @@ version = "0.32.0"

[[StatsFuns]]
deps = ["Rmath", "SpecialFunctions"]
git-tree-sha1 = "938f2520e6c093aaf5a7e7c38489e03c27a8c136"
git-tree-sha1 = "79982835d2ff3970685cb704500909c94189bde9"
uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
version = "0.9.2"
version = "0.9.3"

[[SteadyStateDiffEq]]
deps = ["DiffEqBase", "DiffEqCallbacks", "LinearAlgebra", "NLsolve", "Reexport"]
Expand All @@ -678,9 +683,9 @@ version = "1.5.0"

[[StochasticDiffEq]]
deps = ["ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqDiffTools", "DiffEqNoiseProcess", "FillArrays", "ForwardDiff", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "Parameters", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SparseArrays", "SparseDiffTools", "StaticArrays"]
git-tree-sha1 = "1fda79b9919ae2310e969c4000784858abf32f45"
git-tree-sha1 = "238db5de41192bf9695539c6eea528cd8b10f6df"
uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0"
version = "6.15.0"
version = "6.16.1"

[[SuiteSparse]]
deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"]
Expand Down Expand Up @@ -744,3 +749,9 @@ deps = ["Base64", "CodecZlib", "LightXML", "Random", "TranscodingStreams"]
git-tree-sha1 = "3ecc73f1c3175218b7ab37fe487dbe4cb1148e40"
uuid = "64499a7a-5c06-52f2-abe2-ccb03c286192"
version = "1.2.2"

[[ZygoteRules]]
deps = ["MacroTools"]
git-tree-sha1 = "b3b4882cc9accf6731a08cc39543fbc6b669dca8"
uuid = "700de1a5-db45-46bc-99cf-38207098b444"
version = "0.2.0"
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,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"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
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](http://dx.doi.org/10.1175/1520-0450(1990)029<0652:OTASOF>2.0.CO;2)
Expand Down
Loading

0 comments on commit 9a07595

Please sign in to comment.