Skip to content

Commit

Permalink
Merge pull request #544 from CliMA/js/seabreeze-plots
Browse files Browse the repository at this point in the history
add sea_breeze plots
  • Loading branch information
juliasloan25 authored Mar 4, 2024
2 parents 385ee23 + 95aa73d commit ab10ab9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ steps:

- label: "sea_breeze"
command: "julia --color=yes --project=experiments/ClimaCore/sea_breeze experiments/ClimaCore/sea_breeze/run.jl"
artifact_paths: "sea_breeze/"
artifact_paths: "experiments/ClimaCore/sea_breeze/output/*"
agents:
slurm_mem: 20GB

Expand Down
13 changes: 12 additions & 1 deletion experiments/ClimaCore/sea_breeze/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.1"
manifest_format = "2.0"
project_hash = "3410fb43c22f219f7d863bac9a2a7bee34357166"
project_hash = "e237b6466db7bb85f7730efc9e7650e946e179a5"

[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
Expand Down Expand Up @@ -296,6 +296,12 @@ weakdeps = ["Krylov"]
[deps.ClimaCore.extensions]
KrylovExt = "Krylov"

[[deps.ClimaCorePlots]]
deps = ["ClimaCore", "RecipesBase", "StaticArrays", "TriplotBase"]
git-tree-sha1 = "11b973227d09bbdeaaa191ab59f2338f3f11d118"
uuid = "cf7c7e5a-b407-4c48-9047-11a94a308626"
version = "0.2.6"

[[deps.ClimaCoreTempestRemap]]
deps = ["ClimaComms", "ClimaCore", "CommonDataModel", "Dates", "LinearAlgebra", "NCDatasets", "PkgVersion", "TempestRemap_jll"]
git-tree-sha1 = "2267e018c34f44fa8300b8d550d59f3eecef6094"
Expand Down Expand Up @@ -2162,6 +2168,11 @@ git-tree-sha1 = "eae1bb484cd63b36999ee58be2de6c178105112f"
uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
version = "0.1.8"

[[deps.TriplotBase]]
git-tree-sha1 = "4d4ed7f294cda19382ff7de4c137d24d16adc89b"
uuid = "981d1d27-644d-49a2-9326-4793e63143c3"
version = "0.1.0"

[[deps.TruncatedStacktraces]]
deps = ["InteractiveUtils", "MacroTools", "Preferences"]
git-tree-sha1 = "ea3e54c2bdde39062abf5a9758a23735558705e1"
Expand Down
1 change: 1 addition & 0 deletions experiments/ClimaCore/sea_breeze/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaCoupler = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaCore/sea_breeze/land_rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function lnd_init(; xmin = -1000, xmax = 1000, helem = 20, npoly = 0)

## initial condition
T_sfc = map(coords) do coord
T_sfc = 273.0
T_sfc = 283.0
end

## prognostic variable
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaCore/sea_breeze/ocean_rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function ocn_init(; xmin = -1000, xmax = 1000, helem = 20, npoly = 0)

## initial condition
T_sfc = map(coords) do coord
T_sfc = 267.0
T_sfc = 257.0
end

## prognostic variable
Expand Down
67 changes: 35 additions & 32 deletions experiments/ClimaCore/sea_breeze/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import SciMLBase #hide
import ClimaTimeSteppers as CTS #hide
import ClimaCore.Utilities: PlusHalf #hide
import ClimaCore.Spaces as Spaces
import Random #hide
using DiffEqCallbacks #hide

## enable broadcasting with mismatched spaces #hide
Expand All @@ -33,6 +34,9 @@ using ClimaCoupler #hide
#hide
const FT = Float64 #hide

# Set random seed for reproducibility
Random.seed!(1234)

#=
## Model Initialization
### Component Models
Expand Down Expand Up @@ -115,9 +119,9 @@ system before executing the simulation.
=#
@info "Init Models and Maps"

t_start, t_end = (0.0, 1.0)
t_start, t_end = (0.0, 1e4)
Δt_coupled = 0.1
saveat = 1e2
saveat = 10.0
atm_nsteps, ocn_nsteps, lnd_nsteps = (5, 1, 1)

## Initialize Models
Expand Down Expand Up @@ -293,33 +297,32 @@ cpl_run(sim)

# ### References
# - [Antonelli & Rotunno 2007](https://journals.ametsoc.org/view/journals/atsc/64/12/2007jas2261.1.xml?tab_body=pdf)
#hide
## sol = sim.atmos.integrator.sol #hide
#hide
## dirname = "sea_breeze_2d" #hide
## path = joinpath(@__DIR__, "output", dirname) #hide
## mkpath(path) #hide
#hide
## using JLD2 #hide
## save(joinpath(path, "last_sim.jld2"), "coupled_sim", sim) #hide
#hide
## post-processing #hide
## import Plots, ClimaCorePlots #hide
## Plots.GRBackend() #hide
## interp = 5 #hide
#hide
## anim = Plots.@animate for u in sol.u #hide
## Plots.contourf(u.Yc.ρθ ./ u.Yc.ρ) #hide
## end #hide
## Plots.mp4(anim, joinpath(path, "theta.mp4"), fps = 20) #hide
#hide
## If2c = Operators.InterpolateF2C() #hide
## anim = Plots.@animate for u in sol.u #hide
## Plots.contourf(If2c.(u.ρw) ./ u.Yc.ρ) #hide
## end #hide
## Plots.mp4(anim, joinpath(path, "vel_w.mp4"), fps = 20) #hide
#hide
## anim = Plots.@animate for u in sol.u #hide
## Plots.contourf(u.Yc.ρuₕ ./ u.Yc.ρ) #hide
## end #hide
## Plots.mp4(anim, joinpath(path, "vel_u.mp4"), fps = 20) #hide
## Post-processing
using JLD2 #hide
import Plots, ClimaCorePlots #hide

sol = sim.atmos.integrator.sol #hide
path = joinpath(@__DIR__, "output") #hide
mkpath(path) #hide
# save(joinpath(path, "last_sim.jld2"), "coupled_sim", sim) #hide

Plots.GRBackend() #hide

# Plot atmospheric potential temperature [K] throughout the simulation
anim = Plots.@animate for u in sol.u #hide
Plots.contourf(u.Yc.ρθ ./ u.Yc.ρ) #hide
end #hide
Plots.mp4(anim, joinpath(path, "theta.mp4"), fps = 20) #hide

If2c = Operators.InterpolateF2C() #hide
anim = Plots.@animate for u in sol.u #hide
Plots.contourf(If2c.(u.ρw) ./ u.Yc.ρ) #hide
end #hide

# Plot atmospheric vertical velocity [m/s] throughout the simulation
Plots.mp4(anim, joinpath(path, "vel_w.mp4"), fps = 20) #hide
anim = Plots.@animate for u in sol.u #hide
Plots.contourf(u.Yc.ρuₕ ./ u.Yc.ρ) #hide
end #hide
# Plot atmospheric longitudinal velocity [m/s] throughout the simulation
Plots.mp4(anim, joinpath(path, "vel_u.mp4"), fps = 20) #hide

0 comments on commit ab10ab9

Please sign in to comment.