Skip to content

Commit

Permalink
Add DYAMONDSummer low resolution simulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharshakandala committed Dec 12, 2024
1 parent 057ae38 commit fbfedb7
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ git-tree-sha1 = "10742e0a2e343d13bb04df379e300a83402d4106"
[[era5_cloud.download]]
sha256 = "bb51e2f2d315b487e05a8d38944d4ad937ee4a40c43b68541220c5d54425e24a"
url = "https://caltech.box.com/shared/static/b6ur4ap4vo04j09vdulem96z9fxqlgyn.gz"

[DYAMOND_SUMMER_ICS_p98deg]
git-tree-sha1 = "46aa28a9177dd7e4cbb813eeba3e02597c3ba071"
lazy = true

[[DYAMOND_SUMMER_ICS_p98deg.download]]
sha256 = "9a5efd20d68d9b954af2fd7803bccdda3fc7ef4ff60421ed13d18f768312d2e3"
url = "https://caltech.box.com/shared/static/whn01xr83v0s4p8tc59ds3nvfsfe6ebs.gz"
2 changes: 1 addition & 1 deletion config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ surface_temperature:
help: "Prescribed surface temperature functional form ['ZonallySymmetric' (default), 'ZonallyAsymmetric', 'RCEMIPII']"
value: "ZonallySymmetric"
initial_condition:
help: "Initial condition [`DryBaroclinicWave`, `MoistBaroclinicWave`, `DecayingProfile`, `IsothermalProfile`, `Bomex`, `DryDensityCurrentProfile`, `AgnesiHProfile`, `ScharProfile`, `RisingThermalBubbleProfile`, `ISDAC`]"
help: "Initial condition [`DryBaroclinicWave`, `MoistBaroclinicWave`, `DecayingProfile`, `IsothermalProfile`, `Bomex`, `DryDensityCurrentProfile`, `AgnesiHProfile`, `ScharProfile`, `RisingThermalBubbleProfile`, `ISDAC`, `DYAMONDSummer`]"
value: "DecayingProfile"
perturb_initstate:
help: "Add a perturbation to the initial condition [`false`, `true` (default)]"
Expand Down
30 changes: 30 additions & 0 deletions config/gpu_configs/gpu_aquaplanet_dyamond_summer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dt_save_state_to_disk: "Inf"
dt_save_to_sol: "Inf"
output_default_diagnostics: false
h_elem: 16
z_max: 60000.0
z_elem: 63
dz_bottom: 30.0
rayleigh_sponge: true
viscous_sponge: true
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
surface_setup: "DefaultMoninObukhov"
dt: "30secs"
t_end: "120secs"
toml: [toml/longrun_aquaplanet.toml]
prescribe_ozone: true
aerosol_radiation: true
prescribed_aerosols: ["CB1", "CB2", "DST01", "OC1", "OC2", "SO4", "SSLT01"]
initial_condition: "DYAMONDSummer"
topography: "Earth"
diagnostics:
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl, pr]
period: "30secs"
5 changes: 5 additions & 0 deletions src/initial_conditions/InitialConditions.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module InitialConditions

import ..AtmosArtifacts as AA
import ..AtmosModel
import ..DryModel
import ..EquilMoistModel
Expand All @@ -9,8 +10,11 @@ import ..Microphysics0Moment
import ..Microphysics1Moment
import ..PrescribedSurfaceTemperature
import ..PrognosticSurfaceTemperature
import ..ᶜinterp
import ..ᶠinterp
import ..C3
import ..C12
import ..compute_kinetic!
import ..PrognosticEDMFX
import ..DiagnosticEDMFX
import ..n_mass_flux_subdomains
Expand All @@ -30,6 +34,7 @@ import SciMLBase
import Interpolations as Intp
import NCDatasets as NC
import Statistics: mean
import ClimaUtilities.SpaceVaryingInputs

include("local_state.jl")
include("atmos_state.jl")
Expand Down
82 changes: 82 additions & 0 deletions src/initial_conditions/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,31 @@ function (initial_condition::DecayingProfile)(params)
return local_state
end

"""
DYAMONDSummer(; perturb = true)
An `InitialCondition` with a decaying temperature profile, and with an optional
perturbation to the temperature.
"""
struct DYAMONDSummer <: InitialCondition end

function (initial_condition::DYAMONDSummer)(params)
function local_state(local_geometry)
FT = eltype(params)
grav = CAP.grav(params)
thermo_params = CAP.thermodynamics_params(params)

T, p = FT(300), FT(100000) # placeholder values

return LocalState(;
params,
geometry = local_geometry,
thermo_state = TD.PhaseDry_pT(thermo_params, p, T),
)
end
return local_state
end

"""
AgnesiHProfile(; perturb = false)
Expand Down Expand Up @@ -351,6 +376,63 @@ function (initial_condition::RisingThermalBubbleProfile)(params)
return local_state
end

overwrite_initial_conditions!(
initial_condition::InitialCondition,
Y,
thermo_params,
) = (return nothing)

function overwrite_initial_conditions!(
initial_condition::DYAMONDSummer,
Y,
thermo_params,
config,
)
file_path = AA.dyamond_summer_artifact_path(; context = config.comms_ctx)
center_space = Fields.axes(Y.c)
face_space = Fields.axes(Y.f)
p_sfc = Fields.level(
SpaceVaryingInputs.SpaceVaryingInput(file_path, "p", face_space),
Fields.half,
)
ᶜT = SpaceVaryingInputs.SpaceVaryingInput(file_path, "t", center_space)
ᶜq_tot = SpaceVaryingInputs.SpaceVaryingInput(file_path, "q", center_space)
ᶜ∂lnp∂z = @. -thermo_params.grav /
(TD.gas_constant_air(thermo_params, TD.PhasePartition(ᶜq_tot)) * ᶜT)
ᶠlnp_over_psfc = zeros(face_space)
Operators.column_integral_indefinite!(ᶠlnp_over_psfc, ᶜ∂lnp∂z)
ᶠp = p_sfc .* exp.(ᶠlnp_over_psfc)
ᶜts = TD.PhaseEquil_pTq.(thermo_params, ᶜinterp.(ᶠp), ᶜT, ᶜq_tot)
Y.c.ρ .= TD.air_density.(thermo_params, ᶜts)
vel =
Geometry.UVWVector.(
SpaceVaryingInputs.SpaceVaryingInput(file_path, "u", center_space),
SpaceVaryingInputs.SpaceVaryingInput(file_path, "v", center_space),
SpaceVaryingInputs.SpaceVaryingInput(file_path, "w", center_space),
)
Y.c.uₕ .= C12.(Geometry.UVVector.(vel))
Y.f.u₃ .= ᶠinterp.(C3.(Geometry.WVector.(vel)))
e_kin = similar(ᶜT)
compute_kinetic!(e_kin, Y.c.uₕ, Y.f.u₃)
e_pot = Fields.coordinate_field(Y.c).z .* thermo_params.grav
Y.c.ρe_tot .= TD.total_energy.(thermo_params, ᶜts, e_kin, e_pot) .* Y.c.ρ
Y.c.ρq_tot .= ᶜq_tot .* Y.c.ρ
if config.parsed_args["precip_model"] == "1M"
Y.c.ρq_sno .=
SpaceVaryingInputs.SpaceVaryingInput(
file_path,
"cswc",
center_space,
) .* Y.c.ρ
Y.c.ρq_rai .=
SpaceVaryingInputs.SpaceVaryingInput(
file_path,
"crwc",
center_space,
) .* Y.c.ρ
end
return nothing
end
##
## Baroclinic Wave
##
Expand Down
11 changes: 9 additions & 2 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ function get_initial_condition(parsed_args)
return getproperty(ICs, Symbol(parsed_args["initial_condition"]))(
parsed_args["perturb_initstate"],
)
elseif parsed_args["initial_condition"] in ["DYAMONDSummer"]
return getproperty(ICs, Symbol(parsed_args["initial_condition"]))()
elseif parsed_args["initial_condition"] in [
"Nieuwstadt",
"GABLS",
Expand Down Expand Up @@ -626,7 +628,6 @@ end
function get_simulation(config::AtmosConfig)
params = create_parameter_set(config)
atmos = get_atmos(config, params)

sim_info = get_sim_info(config)
job_id = sim_info.job_id
output_dir = sim_info.output_dir
Expand Down Expand Up @@ -655,7 +656,6 @@ function get_simulation(config::AtmosConfig)

initial_condition = get_initial_condition(config.parsed_args)
surface_setup = get_surface_setup(config.parsed_args)

if !sim_info.restart
s = @timed_str begin
Y = ICs.atmos_state(
Expand All @@ -671,6 +671,13 @@ function get_simulation(config::AtmosConfig)

tracers = get_tracers(config.parsed_args)

CA.InitialConditions.overwrite_initial_conditions!(
initial_condition,
Y,
params.thermodynamics_params,
config,
)

s = @timed_str begin
p = build_cache(
Y,
Expand Down
8 changes: 8 additions & 0 deletions src/utils/AtmosArtifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@ function earth_orography_file_path(; context = nothing)
)
end

function dyamond_summer_artifact_path(; context = nothing)
filename = "DYAMOND_SUMMER_ICS_p98deg.nc"
return joinpath(
@clima_artifact("DYAMOND_SUMMER_ICS_p98deg", context),
filename,
)
end

end

0 comments on commit fbfedb7

Please sign in to comment.