Skip to content

Commit 38153c3

Browse files
committed
merge set explicit and implicit precomputed quantities; they don't have to be split after the new update of updraft BCs
1 parent 866c94a commit 38153c3

File tree

1 file changed

+14
-53
lines changed

1 file changed

+14
-53
lines changed

src/cache/precomputed_quantities.jl

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -443,31 +443,20 @@ end
443443

444444
"""
445445
set_implicit_precomputed_quantities!(Y, p, t)
446-
set_implicit_precomputed_quantities_part1!(Y, p, t)
447-
set_implicit_precomputed_quantities_part2!(Y, p, t)
448446
449-
Update the precomputed quantities that are handled implicitly based on the
450-
current state `Y`. These are called before each evaluation of either
451-
`implicit_tendency!` or `remaining_tendency!`, and they include quantities used
447+
Updates the precomputed quantities that are handled implicitly based on the
448+
current state `Y`. This is called before each evaluation of either
449+
`implicit_tendency!` or `remaining_tendency!`, and it includes quantities used
452450
in both tedencies.
453451
454-
These functions also apply a "filter" to `Y` in order to ensure that `ᶠu³` is 0
452+
This function also applies a "filter" to `Y` in order to ensure that `ᶠu³` is 0
455453
at the surface (i.e., to enforce the impenetrable boundary condition). If the
456454
`turbconv_model` is EDMFX, the filter also ensures that `ᶠu³⁰` and `ᶠu³ʲs` are 0
457455
at the surface. In the future, we will probably want to move this filtering
458456
elsewhere, but doing it here ensures that it occurs whenever the precomputed
459457
quantities are updated.
460-
461-
These functions are split into two parts so that the first stage of the implicit
462-
and explicit calculations can be executed in sequence before completing the
463-
remaining steps. This ordering is required to correctly compute variables at
464-
the environment boundary after applying the boundary conditions.
465458
"""
466459
NVTX.@annotate function set_implicit_precomputed_quantities!(Y, p, t)
467-
set_implicit_precomputed_quantities_part1!(Y, p, t)
468-
set_implicit_precomputed_quantities_part2!(Y, p, t)
469-
end
470-
NVTX.@annotate function set_implicit_precomputed_quantities_part1!(Y, p, t)
471460
(; turbconv_model, moisture_model, microphysics_model) = p.atmos
472461
(; ᶜΦ) = p.core
473462
(; ᶜu, ᶠu³, ᶠu, ᶜK, ᶜts, ᶜp) = p.precomputed
@@ -506,16 +495,6 @@ NVTX.@annotate function set_implicit_precomputed_quantities_part1!(Y, p, t)
506495

507496
if turbconv_model isa PrognosticEDMFX
508497
set_prognostic_edmf_precomputed_quantities_draft!(Y, p, ᶠuₕ³, t)
509-
elseif !(isnothing(turbconv_model))
510-
# Do nothing for other turbconv models for now
511-
end
512-
end
513-
NVTX.@annotate function set_implicit_precomputed_quantities_part2!(Y, p, t)
514-
(; turbconv_model) = p.atmos
515-
ᶠuₕ³ = p.scratch.ᶠtemp_CT3
516-
@. ᶠuₕ³ = $compute_ᶠuₕ³(Y.c.uₕ, Y.c.ρ)
517-
518-
if turbconv_model isa PrognosticEDMFX
519498
set_prognostic_edmf_precomputed_quantities_environment!(Y, p, ᶠuₕ³, t)
520499
set_prognostic_edmf_precomputed_quantities_implicit_closures!(Y, p, t)
521500
elseif !(isnothing(turbconv_model))
@@ -524,21 +503,16 @@ NVTX.@annotate function set_implicit_precomputed_quantities_part2!(Y, p, t)
524503
end
525504

526505
"""
527-
set_explicit_precomputed_quantities_part1!(Y, p, t)
528-
set_explicit_precomputed_quantities_part2!(Y, p, t)
506+
set_explicit_precomputed_quantities!(Y, p, t)
529507
530-
Update the precomputed quantities that are handled explicitly based on the
531-
current state `Y`. These are only called before each evaluation of
532-
`remaining_tendency!`, though they include quantities used in both
508+
Updates the precomputed quantities that are handled explicitly based on the
509+
current state `Y`. This is only called before each evaluation of
510+
`remaining_tendency!`, though it includes quantities used in both
533511
`implicit_tendency!` and `remaining_tendency!`.
534-
535-
These functions are split into two parts so that the first stage of the implicit
536-
and explicit calculations can be executed in sequence before completing the
537-
remaining steps. This ordering is required to correctly compute variables at
538-
the environment boundary after applying the boundary conditions.
539512
"""
540-
NVTX.@annotate function set_explicit_precomputed_quantities_part1!(Y, p, t)
541-
(; turbconv_model) = p.atmos
513+
NVTX.@annotate function set_explicit_precomputed_quantities!(Y, p, t)
514+
(; turbconv_model, moisture_model, cloud_model) = p.atmos
515+
(; call_cloud_diagnostics_per_stage) = p.atmos
542516
(; ᶜts) = p.precomputed
543517
thermo_params = CAP.thermodynamics_params(p.params)
544518
FT = eltype(p.params)
@@ -556,18 +530,6 @@ NVTX.@annotate function set_explicit_precomputed_quantities_part1!(Y, p, t)
556530
ᶜgradᵥ(ᶠinterp(TD.liquid_ice_pottemp(thermo_params, ᶜts)))
557531
end
558532

559-
if turbconv_model isa DiagnosticEDMFX
560-
set_diagnostic_edmf_precomputed_quantities_bottom_bc!(Y, p, t)
561-
elseif !(isnothing(turbconv_model))
562-
# Do nothing for other turbconv models for now
563-
end
564-
565-
return nothing
566-
end
567-
NVTX.@annotate function set_explicit_precomputed_quantities_part2!(Y, p, t)
568-
(; turbconv_model, moisture_model, cloud_model) = p.atmos
569-
(; call_cloud_diagnostics_per_stage) = p.atmos
570-
571533
if turbconv_model isa PrognosticEDMFX
572534
set_prognostic_edmf_precomputed_quantities_explicit_closures!(Y, p, t)
573535
set_prognostic_edmf_precomputed_quantities_precipitation!(
@@ -577,6 +539,7 @@ NVTX.@annotate function set_explicit_precomputed_quantities_part2!(Y, p, t)
577539
)
578540
end
579541
if turbconv_model isa DiagnosticEDMFX
542+
set_diagnostic_edmf_precomputed_quantities_bottom_bc!(Y, p, t)
580543
set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
581544
set_diagnostic_edmf_precomputed_quantities_top_bc!(Y, p, t)
582545
set_diagnostic_edmf_precomputed_quantities_env_closures!(Y, p, t)
@@ -628,8 +591,6 @@ end
628591
Updates all precomputed quantities based on the current state `Y`.
629592
"""
630593
function set_precomputed_quantities!(Y, p, t)
631-
set_implicit_precomputed_quantities_part1!(Y, p, t)
632-
set_explicit_precomputed_quantities_part1!(Y, p, t)
633-
set_implicit_precomputed_quantities_part2!(Y, p, t)
634-
set_explicit_precomputed_quantities_part2!(Y, p, t)
594+
set_implicit_precomputed_quantities!(Y, p, t)
595+
set_explicit_precomputed_quantities!(Y, p, t)
635596
end

0 commit comments

Comments
 (0)