Skip to content

Commit

Permalink
Merge pull request #2532 from CliMA/dy/dry_diffusion_bugfix
Browse files Browse the repository at this point in the history
Fix bug in implicit diffusion without moisture
  • Loading branch information
szy21 authored Jan 17, 2024
2 parents f1f7420 + 22100ce commit be0d6e7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/prognostic_equations/implicit/implicit_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,13 @@ function ImplicitEquationJacobian(
name -> (name, name) => similar(Y.c, TridiagonalRow),
(@name(c.ρe_tot), available_tracer_names...),
)...,
(@name(c.ρe_tot), @name(c.ρq_tot)) =>
similar(Y.c, TridiagonalRow),
(
is_in_Y(@name(c.ρq_tot)) ?
(
(@name(c.ρe_tot), @name(c.ρq_tot)) =>
similar(Y.c, TridiagonalRow),
) : ()
)...,
(@name(c.uₕ), @name(c.uₕ)) =>
!isnothing(atmos.turbconv_model) ||
diffuse_momentum(atmos.vert_diff) ?
Expand Down Expand Up @@ -224,10 +229,12 @@ function ImplicitEquationJacobian(
alg = if use_derivative(diffusion_flag)
alg₁ = MatrixFields.BlockLowerTriangularSolve(
@name(c.ρ);
alg₂ = MatrixFields.BlockLowerTriangularSolve(
tracer_and_other_names...,
),
) # Solve for ᶜρ, then for tracers and others, and then for ᶜρe_tot.
alg₂ = if is_in_Y(@name(c.ρq_tot))
MatrixFields.BlockLowerTriangularSolve(tracer_and_other_names...)
else
MatrixFields.BlockDiagonalSolve()
end,
)
MatrixFields.ApproximateBlockArrowheadIterativeSolve(
non_velocity_names...;
alg₁,
Expand Down

0 comments on commit be0d6e7

Please sign in to comment.