Skip to content

Commit

Permalink
change buoyancy
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Oct 29, 2023
1 parent a01efa2 commit df3139f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
13 changes: 7 additions & 6 deletions src/cache/diagnostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ function set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
∇Φ³_prev_level = Fields.field_values(Fields.level(ᶜ∇Φ³, i - 1))
∇Φ³_data_prev_level = ∇Φ³_prev_level.components.data.:1
ρ_prev_level = Fields.field_values(Fields.level(Y.c.ρ, i - 1))
u³_prev_halflevel = Fields.field_values(Fields.level(ᶠu³, i - 1 - half))
u³⁰_prev_halflevel =
Fields.field_values(Fields.level(ᶠu³⁰, i - 1 - half))
u³⁰_data_prev_halflevel = u³⁰_prev_halflevel.components.data.:1
Expand Down Expand Up @@ -359,13 +360,13 @@ function set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
local_geometry_prev_halflevel,
),
TD.relative_humidity(thermo_params, tsʲ_prev_level),
ᶜphysical_buoyancy(params, ρ_ref_prev_level, ρʲ_prev_level),
ᶜphysical_buoyancy(params, ρ_prev_level, ρʲ_prev_level),
get_physical_w(
_prev_halflevel,
u³_prev_halflevel,
local_geometry_prev_halflevel,
),
TD.relative_humidity(thermo_params, ts_prev_level),
ᶜphysical_buoyancy(params, ρ_ref_prev_level, ρ_prev_level),
FT(0),
dt,
p.atmos.edmfx_entr_model,
)
Expand All @@ -383,13 +384,13 @@ function set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
local_geometry_prev_halflevel,
),
TD.relative_humidity(thermo_params, tsʲ_prev_level),
ᶜphysical_buoyancy(params, ρ_ref_prev_level, ρʲ_prev_level),
ᶜphysical_buoyancy(params, ρ_prev_level, ρʲ_prev_level),
get_physical_w(
_prev_halflevel,
u³_prev_halflevel,
local_geometry_prev_halflevel,
),
TD.relative_humidity(thermo_params, ts_prev_level),
ᶜphysical_buoyancy(params, ρ_ref_prev_level, ρ_prev_level),
FT(0),
dt,
p.atmos.edmfx_detr_model,
)
Expand Down
12 changes: 6 additions & 6 deletions src/cache/prognostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ function set_prognostic_edmf_precomputed_quantities_closures!(Y, p, t)
draft_area(Y.c.sgsʲs.:($$j).ρa, ᶜρʲs.:($$j)),
get_physical_w(ᶜuʲs.:($$j), ᶜlg),
TD.relative_humidity(thermo_params, ᶜtsʲs.:($$j)),
ᶜphysical_buoyancy(params, ᶜρ_ref, ᶜρʲs.:($$j)),
get_physical_w(ᶜu, ᶜlg),
ᶜphysical_buoyancy(params, Y.c.ρ, ᶜρʲs.:($$j)),
get_physical_w(ᶜu, ᶜlg),
TD.relative_humidity(thermo_params, ᶜts⁰),
ᶜphysical_buoyancy(params, ᶜρ_ref, ᶜρ⁰),
FT(0),
dt,
p.atmos.edmfx_entr_model,
)
Expand All @@ -214,10 +214,10 @@ function set_prognostic_edmf_precomputed_quantities_closures!(Y, p, t)
draft_area(Y.c.sgsʲs.:($$j).ρa, ᶜρʲs.:($$j)),
get_physical_w(ᶜuʲs.:($$j), ᶜlg),
TD.relative_humidity(thermo_params, ᶜtsʲs.:($$j)),
ᶜphysical_buoyancy(params, ᶜρ_ref, ᶜρʲs.:($$j)),
get_physical_w(ᶜu, ᶜlg),
ᶜphysical_buoyancy(params, Y.c.ρ, ᶜρʲs.:($$j)),
get_physical_w(ᶜu, ᶜlg),
TD.relative_humidity(thermo_params, ᶜts⁰),
ᶜphysical_buoyancy(params, ᶜρ_ref, ᶜρ⁰),
FT(0),
dt,
p.atmos.edmfx_detr_model,
)
Expand Down
5 changes: 3 additions & 2 deletions src/prognostic_equations/advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
ᶠgradᵥ(ᶜKʲs.:($$j)[colidx])

# TODO: Move this to implicit_vertical_advection_tendency!.
# For the updraft u_3 equation, we assume the grid-mean to be hydrostatic
# and calcuate the buoyancy term relative to the grid-mean density.
@. Yₜ.f.sgsʲs.:($$j).u₃[colidx] -=
(
ᶠgradᵥ(ᶜp[colidx] - ᶜp_ref[colidx]) +
ᶠinterp(ᶜρʲs.:($$j)[colidx] - ᶜρ_ref[colidx]) *
ᶠinterp(ᶜρʲs.:($$j)[colidx] - Y.c.ρ[colidx]) *
ᶠgradᵥ_ᶜΦ[colidx]
) / ᶠinterp(ᶜρʲs.:($$j)[colidx])
end
Expand Down

0 comments on commit df3139f

Please sign in to comment.