Skip to content

Commit

Permalink
parent fcb4232
Browse files Browse the repository at this point in the history
author LenkaNovak <lenka@caltech.edu> 1711486536 -0700
committer LenkaNovak <lenka@caltech.edu> 1713181226 -0700

slab ocean cpu + GPU

add CAD plots, short

1d

1d

inst

proj

cmakie to amip project

100d

init hs

fix config for hs

paths

up

hs diagnostics

turn off hourly_checkpoint

fix comms ctx

hs gorcing and 200d

hs gorcing and 200d ttsecs
  • Loading branch information
LenkaNovak committed Apr 15, 2024
1 parent fcb4232 commit faacbf2
Show file tree
Hide file tree
Showing 13 changed files with 1,074 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .buildkite/longruns/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,4 @@ steps:
- |
find experiments/AMIP/output/amip/amip_target_topo_diagedmf_artifacts/ -type f -name 'bias*.png' -print0 | while IFS= read -r -d '' file; do
slack-upload -c "#coupler-report" -f "$$file" -m png -n "$$(basename "$$file" .png)" -x "$$(basename "$$file" .png)"
done
done
414 changes: 414 additions & 0 deletions .buildkite/longruns/pipeline_main.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion experiments/AMIP/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3291,4 +3291,4 @@ version = "3.5.0+0"
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Wayland_jll", "Wayland_protocols_jll", "Xorg_libxcb_jll", "Xorg_xkeyboard_config_jll"]
git-tree-sha1 = "9c304562909ab2bab0262639bd4f444d7bc2be37"
uuid = "d8fb68d0-12a3-5cfd-a85a-d49703b185fd"
version = "1.4.1+1"
version = "1.4.1+1"
1 change: 1 addition & 0 deletions experiments/AMIP/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ClimaAnalysis = "29b5916a-a76c-4e73-9657-3c8fd22e65e6"
ClimaAtmos = "b2c96348-7fb7-4fe0-8da9-78d88439e717"
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCoreMakie = "908f55d8-4145-4867-9c14-5dad1a479e4d"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaCoreSpectra = "c2caaa1d-32ae-4754-ba0d-80e7561362e9"
ClimaCoreTempestRemap = "d934ef94-cdd4-4710-83d6-720549644b70"
Expand Down
11 changes: 4 additions & 7 deletions experiments/AMIP/components/atmosphere/climaatmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ struct ClimaAtmosSimulation{P, Y, D, I} <: Interfacer.AtmosModelSimulation
end
Interfacer.name(::ClimaAtmosSimulation) = "ClimaAtmosSimulation"

function atmos_init(::Type{FT}, atmos_config_dict::Dict) where {FT}
# By passing `parsed_args` to `AtmosConfig`, `parsed_args` overwrites the default atmos config
atmos_config_dict["surface_albedo"] = "CouplerAlbedo"
atmos_config = CA.AtmosConfig(atmos_config_dict)
function atmos_init(::Type{FT}, atmos_config) where {FT}
simulation = CA.get_simulation(atmos_config)
(; integrator) = simulation
Y = integrator.u
Expand Down Expand Up @@ -235,12 +232,12 @@ FluxCalculator.get_surface_params(sim::ClimaAtmosSimulation) = CAP.surface_fluxe
### ClimaAtmos.jl model-specific functions (not explicitly required by ClimaCoupler.jl)
###
"""
get_atmos_config(coupler_dict::Dict)
get_atmos_config_dict(coupler_dict::Dict)
Returns the specified atmospheric configuration (`atmos_config_dict`) overwitten by arguments
in the coupler dictionary (`config_dict`).
"""
function get_atmos_config(coupler_dict)
function get_atmos_config_dict(coupler_dict)
atmos_config_file = coupler_dict["atmos_config_file"]
# override default or specified configs with coupler arguments, and set the correct atmos config_file
if isnothing(atmos_config_file)
Expand Down Expand Up @@ -416,4 +413,4 @@ function FluxCalculator.water_albedo_from_atmosphere!(
direct_albedo .= CA.surface_albedo_direct(α_model).(λ, μ, LinearAlgebra.norm.(CC.Fields.level(Y.c.uₕ, 1)))
diffuse_albedo .= CA.surface_albedo_diffuse(α_model).(λ, μ, LinearAlgebra.norm.(CC.Fields.level(Y.c.uₕ, 1)))

end
end
105 changes: 105 additions & 0 deletions experiments/AMIP/components/atmosphere/climaatmos_extra_diags.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,108 @@ CAD.add_diagnostic_variable!(

end,
)

###
# Add the mass streamfunction diagnostic variable
###

# TODO: this should be integrated from top-down
add_diagnostic_variable!(
short_name = "mass_streamfunction",
long_name = "Meridional Mass Streamfunction: vertical integral of meridional mass flux, rho v",
standard_name = "meridional_mass_streamfunction",
units = "kg m^-1 s^-1",
compute! = (out, state, cache, time) -> begin
ρv = ClimaCore.Geometry.UVVector.(state.c.uₕ).components.data.:2 .* state.c.ρ
ᶠ∫_0_z_ρv = cache.scratch.ᶠtemp_scalar
ClimaCore.Fields.bycolumn(axes(ρv)) do colidx
ClimaCore.Operators.column_integral_indefinite!(ᶠ∫_0_z_ρv[colidx], ρv[colidx])
end
if isnothing(out)
return copy(ᶠ∫_0_z_ρv)
else
out .= ᶠ∫_0_z_ρv
end
end,
)

add_diagnostic_variable!(
short_name = "stab",
long_name = "Static Stability: N^2 = -g/theta dtheta/dz",
standard_name = "static_stability",
units = "s^-2",
compute! = (out, state, cache, time) -> begin
dθdz = ClimaCore.Geometry.WVector.(cache.precomputed.ᶜgradᵥ_θ_virt)
thermo_params = CAP.thermodynamics_params(cache.params)
ᶜts = cache.precomputed.ᶜts
θ_virt = TD.virtual_pottemp.(thermo_params, ᶜts)
temp = cache.scratch.ᶜtemp_scalar
parent(temp) .= parent(CAP.grav(cache.params) ./ θ_virt .* dθdz)
if isnothing(out)
return copy(temp)
else
out .= temp
end
end,
)

add_diagnostic_variable!(
short_name = "vT",
long_name = "Product of meridional wind and temperature",
standard_name = "vT",
units = "K m/s",
compute! = (out, state, cache, time) -> begin
thermo_params = CAP.thermodynamics_params(cache.params)
T = TD.air_temperature.(thermo_params, cache.precomputed.ᶜts)
v = ClimaCore.Geometry.UVVector.(state.c.uₕ).components.data.:2
if isnothing(out)
return v .* T
else
out .= v .* T
end
end,
)

const ᶜgradᵥ_ = ClimaCore.Operators.GradientF2C()
const ᶠinterp_ = ClimaCore.Operators.InterpolateC2F(
bottom = ClimaCore.Operators.Extrapolate(),
top = ClimaCore.Operators.Extrapolate(),
)

add_diagnostic_variable!(
short_name = "egr",
long_name = "max. Eady growth rate (0.31 f/N du/dz)",
standard_name = "Eady_growth_rate",
units = "s^-1",
compute! = (out, state, cache, time) -> begin
FT = eltype(state)
thermo_params = CAP.thermodynamics_params(cache.params)
dθdz = cache.precomputed.ᶜgradᵥ_θ_virt
ᶜts = cache.precomputed.ᶜts
θ_virt = TD.virtual_pottemp.(thermo_params, ᶜts)
N = cache.scratch.ᶜtemp_scalar
Nsq = CAP.grav(cache.params) ./ θ_virt .* ClimaCore.Geometry.WVector.(dθdz)
mask = parent(Nsq) .> 0
parent(N) .= sqrt.((parent(Nsq) .* mask ))

Ω = CAP.Omega(cache.params)
φ = ClimaCore.Fields.coordinate_field(N).lat
f = 2Ω .* sin.(φ)
u = ClimaCore.Geometry.UVVector.(state.c.uₕ).components.data.:1
grad_u = @. ᶜgradᵥ_.(ᶠinterp_(u))
du_dz = ClimaCore.Geometry.WVector.(grad_u)
temp = cache.scratch.ᶜtemp_scalar
parent(temp) .= parent(FT(0.31) .* f ./ N .* du_dz)
if isnothing(out)
return copy(temp)
else
out .= temp
end
end,
)

# climate diagnostics: ta, ua, (hus), *mass_streamfunction, *stab, mse

# storm track diagnostics: [vT], [v][T], egr = f/N dTdy

# vars = [mse, lr, ediff, mass_streamfunction, stab, vT, egr]
25 changes: 25 additions & 0 deletions experiments/AMIP/driver_utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# useful functions to abstract the driver code

function setup_output_dirs(; output_dir = nothing, regrid_dir = nothing, artifacts_dir = nothing, comms_ctx = nothing)
if output_dir === nothing
output_dir = "."
end
if regrid_dir === nothing
regrid_dir = joinpath(output_dir, "regrid_tmp/")
end
if artifacts_dir === nothing
artifacts_dir = output_dir * "_artifacts"
end

if !isnothing(comms_ctx) && ClimaComms.iamroot(comms_ctx)
@info(output_dir)
mkpath(output_dir)
mkpath(regrid_dir)
mkpath(artifacts_dir)
end

!isnothing(comms_ctx) ? ClimaComms.barrier(comms_ctx) : nothing

return (; output = output_dir, artifacts = artifacts_dir, regrid = regrid_dir)

end
Loading

0 comments on commit faacbf2

Please sign in to comment.