Skip to content

Commit

Permalink
Merge pull request #3095 from CliMA/aj/fix_longruns
Browse files Browse the repository at this point in the history
Try fixing longruns
  • Loading branch information
trontrytel authored Jun 17, 2024
2 parents 70dcaae + 357fddd commit 1a7543e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/parameterized_tendencies/microphysics/precipitation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ function compute_precipitation_surface_fluxes!(
)
(; surface_rain_flux, surface_snow_flux) = p.precipitation
(; col_integrated_precip_energy_tendency,) = p.conservation_check
(; ᶜqᵣ, ᶜqₛ, ᶜwᵣ, ᶜwₛ) = p.precomputed
(; ᶜwᵣ, ᶜwₛ, ᶜspecific) = p.precomputed

(; ᶠtemp_scalar) = p.scratch
slg = Fields.level(Fields.local_geometry_field(ᶠtemp_scalar), Fields.half)
Expand All @@ -311,8 +311,14 @@ function compute_precipitation_surface_fluxes!(
ˢρ = Fields.Field(Fields.field_values(Fields.level(Y.c.ρ, 1)), axes(slg))
# For density this is equivalent with ᶠwinterp(ᶜJ, Y.c.ρ) and therefore
# consistent with the way we do vertical advection
ˢqᵣ = Fields.Field(Fields.field_values(Fields.level(ᶜqᵣ, 1)), axes(slg))
ˢqₛ = Fields.Field(Fields.field_values(Fields.level(ᶜqₛ, 1)), axes(slg))
ˢqᵣ = Fields.Field(
Fields.field_values(Fields.level(ᶜspecific.q_rai, 1)),
axes(slg),
)
ˢqₛ = Fields.Field(
Fields.field_values(Fields.level(ᶜspecific.q_sno, 1)),
axes(slg),
)
ˢwᵣ = Fields.Field(Fields.field_values(Fields.level(ᶜwᵣ, 1)), axes(slg))
ˢwₛ = Fields.Field(Fields.field_values(Fields.level(ᶜwₛ, 1)), axes(slg))

Expand Down
8 changes: 5 additions & 3 deletions src/prognostic_equations/implicit/implicit_tendency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@ function implicit_vertical_advection_tendency!(Yₜ, Y, p, t)
# is done with other passive tracers in the explicit tendency.
# Here we add the advection with precipitation terminal velocity
# using downward biasing and free outflow bottom boundary condition
(; ᶜqᵣ, ᶜqₛ, ᶜwᵣ, ᶜwₛ) = p.precomputed
(; ᶜwᵣ, ᶜwₛ) = p.precomputed
@. Yₜ.c.ρq_rai -= ᶜprecipdivᵥ(
ᶠwinterp(ᶜJ, Y.c.ρ) * ᶠright_bias(Geometry.WVector(-(ᶜwᵣ)) * ᶜqᵣ),
ᶠwinterp(ᶜJ, Y.c.ρ) *
ᶠright_bias(Geometry.WVector(-(ᶜwᵣ)) * ᶜspecific.q_rai),
)
@. Yₜ.c.ρq_sno -= ᶜprecipdivᵥ(
ᶠwinterp(ᶜJ, Y.c.ρ) * ᶠright_bias(Geometry.WVector(-(ᶜwₛ)) * ᶜqₛ),
ᶠwinterp(ᶜJ, Y.c.ρ) *
ᶠright_bias(Geometry.WVector(-(ᶜwₛ)) * ᶜspecific.q_sno),
)
end

Expand Down

0 comments on commit 1a7543e

Please sign in to comment.