Skip to content

Commit

Permalink
Add reference state profile plots to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jul 20, 2021
1 parent 56fcc60 commit d61c3cb
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
TurbulenceConvection = "8e072fc4-01f8-44fb-b9dc-f9336c367e6b"
19 changes: 19 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
using TurbulenceConvection, Documenter
using DocumenterCitations
import Glob

# https://github.com/jheinen/GR.jl/issues/278#issuecomment-587090846
ENV["GKSwstype"] = "nul"

bib = CitationBibliography(joinpath(@__DIR__, "bibliography.bib"))

#! format: off
pages = Any[
"Home" => "index.md",
"Reference states" => "ReferenceStates.md",
"References" => "References.md",
]

mathengine = MathJax(Dict(
Expand Down Expand Up @@ -41,3 +47,16 @@ deploydocs(
devbranch = "main",
forcepush = true,
)

# Clean up
build_dir = joinpath(@__DIR__, "build")
if isdir(build_dir)
cd(build_dir) do
for filename in Glob.glob("Output.*")
rm(filename; force = true, recursive = true)
end
for filename in Glob.glob("*.in")
rm(filename; force = true)
end
end
end
109 changes: 109 additions & 0 deletions docs/src/ReferenceStates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Reference States

```@example
import TurbulenceConvection
using Plots
using NCDatasets
tc_dir = dirname(dirname(pathof(TurbulenceConvection)))
include(joinpath(tc_dir, "integration_tests", "utils", "generate_namelist.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "generate_paramlist.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "Cases.jl"))
using .NameList
using .ParamList
import .Cases
function export_ref_profile(case_name::String)
namelist = default_namelist(case_name)
paramlist = default_paramlist(case_name)
grid = TurbulenceConvection.Grid(namelist)
ref_state = TurbulenceConvection.ReferenceState(grid)
Stats = TurbulenceConvection.NetCDFIO_Stats(namelist, paramlist, grid)
case = Cases.CasesFactory(namelist, paramlist, grid, ref_state)
Cases.initialize_reference(case, grid, ref_state, Stats)
Dataset(joinpath(Stats.path_plus_file), "r") do ds
zc = ds.group["profiles"]["z_half"][:]
zf = ds.group["profiles"]["z"][:]
ρc_0 = ds.group["reference"]["rho0_half"][:]
pc_0 = ds.group["reference"]["p0_half"][:]
αc_0 = ds.group["reference"]["alpha0_half"][:]
ρf_0 = ds.group["reference"]["rho0"][:]
pf_0 = ds.group["reference"]["p0"][:]
αf_0 = ds.group["reference"]["alpha0"][:]
p1 = plot(ρc_0, zc ./ 1000;label="centers")
plot!(ρf_0, zf ./ 1000;label="faces")
plot!(size=(1000,400))
plot!(margin=5Plots.mm)
xlabel!("ρ_0")
ylabel!("z (km)")
title!("ρ_0")
p2 = plot(pc_0 ./ 1000, zc ./ 1000;label="centers")
plot!(pf_0 ./ 1000, zf ./ 1000;label="faces")
plot!(size=(1000,400))
plot!(margin=5Plots.mm)
xlabel!("p_0 (kPa)")
ylabel!("z (km)")
title!("p_0 (kPa)")
p3 = plot(αc_0, zc ./ 1000;label="centers")
plot!(αf_0, zf ./ 1000;label="faces")
plot!(size=(1000,400))
plot!(margin=5Plots.mm)
xlabel!("α_0")
ylabel!("z (km)")
title!("α_0")
plot(p1,p2,p3; layout=(1,3))
savefig("$case_name.svg")
end
end
for case_name in (
"Bomex",
"life_cycle_Tan2018",
"Soares",
"Rico",
"TRMM_LBA",
"ARM_SGP",
"GATE_III",
"DYCOMS_RF01",
"GABLS",
"SP",
"DryBubble",
)
export_ref_profile(case_name)
end;
```

## Bomex
![](Bomex.svg)

## life\_cycle\_Tan2018
![](life_cycle_Tan2018.svg)

## Soares
![](Soares.svg)

## Rico
![](Rico.svg)

## TRMM\_LBA
![](TRMM_LBA.svg)

## ARM\_SGP
![](ARM_SGP.svg)

## GATE\_III
![](GATE_III.svg)

## DYCOMS\_RF01
![](DYCOMS_RF01.svg)

## GABLS
![](GABLS.svg)

## SP
![](SP.svg)

## DryBubble
![](DryBubble.svg)


5 changes: 5 additions & 0 deletions docs/src/References.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# References

```@bibliography
```

0 comments on commit d61c3cb

Please sign in to comment.