Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Mar 29, 2024
1 parent 016f2f0 commit c90bb46
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/prognostic_equations/implicit/implicit_solver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use_derivative(::UseDerivative) = true
use_derivative(::IgnoreDerivative) = false

"""
ImplicitEquationJacobian(Y, atmos; approximate_solve_iters, diffusion_flag, topography_flag, sgs_advection_flag, transform_flag)
ImplicitEquationJacobian(
Y, atmos;
approximate_solve_iters, diffusion_flag, topography_flag, sgs_advection_flag, transform_flag
)
A wrapper for the matrix ``∂E/∂Y``, where ``E(Y)`` is the "error" of the
implicit step with the state ``Y``.
Expand Down Expand Up @@ -76,15 +79,15 @@ is reached.
- `diffusion_flag::DerivativeFlag`: whether the derivative of the
diffusion tendency with respect to the quantities being diffused should be
computed or approximated as 0; must be either `UseDerivative()` or
`Ignoreerivative()` instead of a `Bool` to ensure type-stability
`IgnoreDerivative()` instead of a `Bool` to ensure type-stability
- `topography_flag::DerivativeFlag`: whether the derivative of vertical
contravariant velocity with respect to horizontal covariant velocity should be
computed or approximated as 0; must be either `UseDerivative()` or
`IgnoreDerivative()` instead of a `Bool` to ensure type-stability
- `sgs_advection_flag::DerivativeFlag`: whether the derivative of the
subgrid-scale advection tendency with respect to the updraft quantities should be
computed or approximated as 0; must be either `UseDerivative()` or
`Ignoreerivative()` instead of a `Bool` to ensure type-stability
`IgnoreDerivative()` instead of a `Bool` to ensure type-stability
- `transform_flag::Bool`: whether the error should be transformed from ``E(Y)``
to ``E(Y)/Δt``, which is required for non-Rosenbrock timestepping schemes from
OrdinaryDiffEq.jl
Expand Down Expand Up @@ -300,6 +303,13 @@ function ImplicitEquationJacobian(
alg₁_subalg₂ =
if atmos.turbconv_model isa PrognosticEDMFX &&
use_derivative(sgs_advection_flag)
diff_subalg =
use_derivative(diffusion_flag) ?
(;
alg₂ = MatrixFields.BlockLowerTriangularSolve(
names₁_group₂...,
)
) : (;)
(;
alg₂ = MatrixFields.BlockLowerTriangularSolve(
@name(c.sgsʲs.:(1).q_tot);
Expand All @@ -308,9 +318,7 @@ function ImplicitEquationJacobian(
alg₂ = MatrixFields.BlockLowerTriangularSolve(
@name(c.sgsʲs.:(1).ρa),
@name(f.sgsʲs.:(1).u₃);
alg₂ = MatrixFields.BlockLowerTriangularSolve(
names₁_group₂...,
),
diff_subalg...,
),
),
)
Expand Down

0 comments on commit c90bb46

Please sign in to comment.