Skip to content

Commit d993c03

Browse files
committed
Change order of calculation in two places of update_jacobian
Hoping to address small floating point differences
1 parent 22d3bab commit d993c03

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/prognostic_equations/implicit/manual_sparse_jacobian.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,18 +644,17 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
644644
@. ᶜK_h = eddy_diffusivity(ᶜK_u, ᶜprandtl_nvec)
645645
end
646646

647-
∂ᶠρχ_dif_flux_∂ᶜχ = ᶠp_grad_matrix
648-
@. ∂ᶠρχ_dif_flux_∂ᶜχ =
649-
DiagonalMatrixRow(ᶠinterp(ᶜρ) * ᶠinterp(ᶜK_h)) ᶠgradᵥ_matrix()
650-
@. ᶜdiffusion_h_matrix = ᶜadvdivᵥ_matrix() ∂ᶠρχ_dif_flux_∂ᶜχ
647+
@. ᶜadvection_matrix =
648+
ᶜadvdivᵥ_matrix() DiagonalMatrixRow(ᶠinterp(ᶜρ) * ᶠinterp(ᶜK_h))
649+
@. ᶜdiffusion_h_matrix = ᶜadvection_matrix ᶠgradᵥ_matrix()
651650
if (
652651
MatrixFields.has_field(Y, @name(c.sgs⁰.ρatke)) ||
653652
!isnothing(p.atmos.turbconv_model) ||
654653
!disable_momentum_vertical_diffusion(p.atmos.vertical_diffusion)
655654
)
656-
@. ∂ᶠρχ_dif_flux_∂ᶜχ =
657-
DiagonalMatrixRow(ᶠinterp(ᶜρ) * ᶠinterp(ᶜK_u)) ᶠgradᵥ_matrix()
658-
@. ᶜdiffusion_u_matrix = ᶜadvdivᵥ_matrix() ∂ᶠρχ_dif_flux_∂ᶜχ
655+
@. ᶜadvection_matrix =
656+
ᶜadvdivᵥ_matrix() DiagonalMatrixRow(ᶠinterp(ᶜρ) * ᶠinterp(ᶜK_u))
657+
@. ᶜdiffusion_u_matrix = ᶜadvection_matrix ᶠgradᵥ_matrix()
659658
end
660659

661660
∂ᶜρe_tot_err_∂ᶜρ = matrix[@name(c.ρe_tot), @name(c.ρ)]

0 commit comments

Comments
 (0)