@@ -543,6 +543,7 @@ NVTX.@annotate function Wfact!(A, Y, p, dtγ, t)
543
543
p. core. ᶜΦ,
544
544
p. core. ᶠgradᵥ_ᶜΦ,
545
545
p. scratch. ᶜtemp_scalar,
546
+ p. scratch. ᶜtemp_scalar_2,
546
547
p. scratch. ᶜtemp_C3,
547
548
p. scratch. ᶠtemp_CT3,
548
549
p. scratch.∂ᶜK_∂ᶜuₕ,
@@ -623,17 +624,17 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
623
624
ᶠgⁱʲ = Fields. local_geometry_field (Y. f). gⁱʲ
624
625
ᶠlg = Fields. local_geometry_field (Y. f)
625
626
626
- ᶜkappa_m = @. lazy (
627
- TD . gas_constant_air (thermo_params, ᶜts) / TD . cv_m (thermo_params, ᶜts),
628
- )
627
+ ᶜkappa_m = p . ᶜtemp_scalar
628
+ @. ᶜkappa_m =
629
+ TD . gas_constant_air (thermo_params, ᶜts) / TD . cv_m (thermo_params, ᶜts )
629
630
631
+ ᶜ∂kappa_m∂q_tot = p. ᶜtemp_scalar_2
630
632
# Using abs2 because ^2 results in allocation
631
- ᶜ∂kappa_m∂q_tot = @. lazy (
633
+ @. ᶜ∂kappa_m∂q_tot =
632
634
(
633
635
ΔR_v * TD. cv_m (thermo_params, ᶜts) -
634
636
Δcv_v * TD. gas_constant_air (thermo_params, ᶜts)
635
- ) / abs2 (TD. cv_m (thermo_params, ᶜts)),
636
- )
637
+ ) / abs2 (TD. cv_m (thermo_params, ᶜts))
637
638
638
639
if use_derivative (topography_flag)
639
640
@. ∂ᶜK_∂ᶜuₕ = DiagonalMatrixRow (
@@ -920,19 +921,19 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
920
921
) # Need to wrap ᶠupwind_matrix in this for well-defined boundaries.
921
922
922
923
ᶠu³ʲ_data = ᶠu³ʲs.:(1 ). components. data.:1
923
- ᶜkappa_mʲ = @. lazy (
924
+ ᶜkappa_mʲ = p. ᶜtemp_scalar
925
+ @. ᶜkappa_mʲ =
924
926
TD. gas_constant_air (thermo_params, ᶜtsʲs.:(1 )) /
925
- TD. cv_m (thermo_params, ᶜtsʲs.:(1 )),
926
- )
927
+ TD. cv_m (thermo_params, ᶜtsʲs.:(1 ))
927
928
928
929
# Note this is the derivative of R_m / cp_m with respect to q_tot
929
930
# but we call it ∂kappa_m∂q_totʲ
930
- ᶜ∂kappa_m∂q_totʲ = @. lazy (
931
+ ᶜ∂kappa_m∂q_totʲ = p. ᶜtemp_scalar_2
932
+ @. ᶜ∂kappa_m∂q_totʲ =
931
933
(
932
934
ΔR_v * TD. cp_m (thermo_params, ᶜtsʲs.:(1 )) -
933
935
Δcp_v * TD. gas_constant_air (thermo_params, ᶜtsʲs.:(1 ))
934
- ) / abs2 (TD. cp_m (thermo_params, ᶜtsʲs.:(1 ))),
935
- )
936
+ ) / abs2 (TD. cp_m (thermo_params, ᶜtsʲs.:(1 )))
936
937
937
938
∂ᶜq_totʲ_err_∂ᶜq_totʲ =
938
939
matrix[@name (c. sgsʲs.:(1 ). q_tot), @name (c. sgsʲs.:(1 ). q_tot)]
@@ -1190,6 +1191,18 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
1190
1191
1191
1192
# Derivative of total energy tendency with respect to updraft MSE
1192
1193
# # grid-mean ρe_tot
1194
+ ᶜkappa_m = p. ᶜtemp_scalar
1195
+ @. ᶜkappa_m =
1196
+ TD. gas_constant_air (thermo_params, ᶜts) /
1197
+ TD. cv_m (thermo_params, ᶜts)
1198
+
1199
+ ᶜ∂kappa_m∂q_tot = p. ᶜtemp_scalar_2
1200
+ @. ᶜ∂kappa_m∂q_tot =
1201
+ (
1202
+ ΔR_v * TD. cv_m (thermo_params, ᶜts) -
1203
+ Δcv_v * TD. gas_constant_air (thermo_params, ᶜts)
1204
+ ) / abs2 (TD. cv_m (thermo_params, ᶜts))
1205
+
1193
1206
@. ∂ᶜρe_tot_err_∂ᶜρ +=
1194
1207
dtγ * ᶜadvdivᵥ_matrix () ⋅ ∂ᶜupdraft_mass_flux_∂ᶜscalar ⋅
1195
1208
DiagonalMatrixRow (
0 commit comments