Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reference state and move ref variables to grid mean #1004

Merged
merged 1 commit into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 15 additions & 29 deletions docs/src/PlotReferenceStates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,39 @@ function export_ref_profile(case_name::String)
surf_ref_state = Cases.surface_ref_state(case, param_set, namelist)
ts_g = surf_ref_state

aux_vars(FT) = (; ρ0 = FT(0), α0 = FT(0), p0 = FT(0))
aux_vars(FT) = (; ρ = FT(0), p = FT(0))
cent = TC.FieldFromNamedTuple(TC.center_space(grid), aux_vars(FT))
face = TC.FieldFromNamedTuple(TC.face_space(grid), aux_vars(FT))

p0_c = cent.p0
ρ0_c = cent.ρ0
α0_c = cent.α0
p0_f = face.p0
ρ0_f = face.ρ0
α0_f = face.α0
compute_ref_state!(p0_c, ρ0_c, α0_c, p0_f, ρ0_f, α0_f, grid, param_set; ts_g)
p_c = cent.p
ρ_c = cent.ρ
p_f = face.p
ρ_f = face.ρ
compute_ref_state!(p_c, ρ_c, p_f, ρ_f, grid, param_set; ts_g)

zc = vec(grid.zc)
zf = vec(grid.zf)
ρ0_c = vec(cent.ρ0)
p0_c = vec(cent.p0)
α0_c = vec(cent.α0)
ρ0_f = vec(face.ρ0)
p0_f = vec(face.p0)
α0_f = vec(face.α0)

p1 = Plots.plot(ρ0_c, zc ./ 1000; label = "centers")
Plots.plot!(ρ0_f, zf ./ 1000; label = "faces")
ρ_c = vec(cent.ρ)
p_c = vec(cent.p)
ρ_f = vec(face.ρ)
p_f = vec(face.p)

p1 = Plots.plot(ρ_c, zc ./ 1000; label = "centers")
Plots.plot!(ρ_f, zf ./ 1000; label = "faces")
Plots.plot!(size = (1000, 400))
Plots.plot!(margin = 5 * Plots.mm)
Plots.xlabel!("ρ_0")
Plots.ylabel!("z (km)")
Plots.title!("ρ_0")

p2 = Plots.plot(p0_c ./ 1000, zc ./ 1000; label = "centers")
Plots.plot!(p0_f ./ 1000, zf ./ 1000; label = "faces")
p2 = Plots.plot(p_c ./ 1000, zc ./ 1000; label = "centers")
Plots.plot!(p_f ./ 1000, zf ./ 1000; label = "faces")
Plots.plot!(size = (1000, 400))
Plots.plot!(margin = 5 * Plots.mm)
Plots.xlabel!("p_0 (kPa)")
Plots.ylabel!("z (km)")
Plots.title!("p_0 (kPa)")

p3 = Plots.plot(α0_c, zc ./ 1000; label = "centers")
Plots.plot!(α0_f, zf ./ 1000; label = "faces")
Plots.plot!(size = (1000, 400))
Plots.plot!(margin = 5 * Plots.mm)
Plots.xlabel!("α_0")
Plots.ylabel!("z (km)")
Plots.title!("α_0")
Plots.plot(p1, p2, p3; layout = (1, 3))
Plots.savefig("$case_name.svg")

end

Logging.with_logger(Logging.NullLogger()) do # silence output
Expand Down
Loading