Skip to content

Commit 36e29c1

Browse files
authored
Merge pull request #3919 from CliMA/zs/hotfix
fix conservation check for 1M
2 parents 012ce46 + 1aa1c9d commit 36e29c1

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

.buildkite/pipeline.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ steps:
312312
artifact_paths: "baroclinic_wave_equil_conservation_source/output_active/*"
313313
agents:
314314
slurm_mem: 16GB
315+
316+
- label: ":computer: baroclinic wave nonequil moist check conservation with sources"
317+
command: >
318+
julia --color=yes --project=.buildkite .buildkite/ci_driver.jl --config_file $CONFIG_PATH/baroclinic_wave_nonequil_conservation_source.yml
319+
--job_id baroclinic_wave_nonequil_conservation_source
320+
artifact_paths: "baroclinic_wave_nonequil_conservation_source/output_active/*"
321+
agents:
322+
slurm_mem: 16GB
315323

316324
- group: "Sphere Examples (Dycore)"
317325
steps:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FLOAT_TYPE: "Float32"
2+
initial_condition: "MoistBaroclinicWave"
3+
t_end: "5days"
4+
moist: "nonequil"
5+
surface_setup: DefaultMoninObukhov
6+
prognostic_surface: "SlabOceanSST"
7+
rad: "clearsky"
8+
precip_model: "1M"
9+
vert_diff: true
10+
dt_save_state_to_disk: "5days"
11+
check_conservation: true
12+
diagnostics:
13+
- short_name: [massa, energya, watera, energyo, watero]
14+
period: 1days
15+
writer: dict

src/cache/precipitation_precomputed_quantities.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ function set_precipitation_surface_fluxes!(
458458
microphysics_model::Union{Microphysics1Moment, Microphysics2Moment},
459459
)
460460
(; surface_rain_flux, surface_snow_flux) = p.precomputed
461-
(; col_integrated_precip_energy_tendency,) = p.conservation_check
462-
(; ᶜwᵣ, ᶜwₛ, ᶜwₗ, ᶜwᵢ) = p.precomputed
461+
(; col_integrated_precip_energy_tendency) = p.conservation_check
462+
(; ᶜwᵣ, ᶜwₛ, ᶜwₗ, ᶜwᵢ, ᶜwₕhₜ) = p.precomputed
463463
ᶜJ = Fields.local_geometry_field(Y.c).J
464464
ᶠJ = Fields.local_geometry_field(Y.f).J
465465
sfc_J = Fields.level(ᶠJ, Fields.half)
@@ -495,8 +495,14 @@ function set_precipitation_surface_fluxes!(
495495
sfc_wₛ = Fields.Field(Fields.field_values(Fields.level(ᶜwₛ, 1)), sfc_space)
496496
sfc_wₗ = Fields.Field(Fields.field_values(Fields.level(ᶜwₗ, 1)), sfc_space)
497497
sfc_wᵢ = Fields.Field(Fields.field_values(Fields.level(ᶜwᵢ, 1)), sfc_space)
498+
sfc_wₕhₜ = Fields.Field(
499+
Fields.field_values(Fields.level(ᶜwₕhₜ.components.data.:1, 1)),
500+
sfc_space,
501+
)
498502

499503
@. surface_rain_flux = sfc_ρ * (sfc_qᵣ * (-sfc_wᵣ) + sfc_qₗ * (-sfc_wₗ))
500504
@. surface_snow_flux = sfc_ρ * (sfc_qₛ * (-sfc_wₛ) + sfc_qᵢ * (-sfc_wᵢ))
505+
@. col_integrated_precip_energy_tendency = sfc_ρ * (-sfc_wₕhₜ)
506+
501507
return nothing
502508
end

src/prognostic_equations/surface_temp.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ function surface_temp_tendency!(Yₜ, Y, p, t, slab::SlabOceanSST)
7878
end
7979

8080
# 2. Turbulent surface energy fluxes (sensible + latent heat) from surface to atmosphere
81-
if !isnothing(p.atmos.vertical_diffusion) ||
82-
!isnothing(p.atmos.turbconv_model)
81+
if !(p.atmos.disable_surface_flux_tendency)
8382
turb_e_flux_sfc_to_atm =
8483
Geometry.WVector.(
8584
p.precomputed.sfc_conditions.ρ_flux_h_tot
@@ -119,8 +118,7 @@ function surface_temp_tendency!(Yₜ, Y, p, t, slab::SlabOceanSST)
119118
# --- WATER BALANCE (if moisture is active) ---
120119
if !(p.atmos.moisture_model isa DryModel)
121120
# 1. Turbulent surface water fluxes (evaporation/condensation)
122-
if !isnothing(p.atmos.vertical_diffusion) ||
123-
!isnothing(p.atmos.turbconv_model)
121+
if !(p.atmos.disable_surface_flux_tendency)
124122
sfc_turb_w_flux =
125123
Geometry.WVector.(
126124
p.precomputed.sfc_conditions.ρ_flux_q_tot

0 commit comments

Comments
 (0)