@@ -257,67 +257,61 @@ function jacobian_cache(alg::ApproxJacobian, Y, atmos)
257
257
sgs_massflux_blocks... ,
258
258
)
259
259
260
- names₁_group₁ = (@name (c. ρ), sfc_if_available... )
261
- names₁_group₂ = (available_tracer_names ... , ρatke_if_available ... )
262
- names₁_group₃ = ( @name (c . ρe_tot),)
263
- names₁ = (
264
- names₁_group₁ ... ,
265
- names₁_group₂ ... ,
266
- names₁_group₃ ... ,
260
+ mass_and_surface_names = (@name (c. ρ), sfc_if_available... )
261
+ available_scalar_names = (
262
+ mass_and_surface_names ... ,
263
+ ρq_tot_if_available ... ,
264
+ @name (c . ρe_tot) ,
265
+ available_condensate_names ... ,
266
+ ρatke_if_available ... ,
267
267
available_sgs_scalar_names... ,
268
268
)
269
269
270
- alg₂ = MatrixFields. BlockLowerTriangularSolve (
270
+ velocity_alg = MatrixFields. BlockLowerTriangularSolve (
271
271
@name (c. uₕ),
272
272
sgs_u³_if_available... ,
273
273
)
274
- solver_alg =
274
+ full_alg =
275
275
if use_derivative (diffusion_flag) ||
276
276
use_derivative (sgs_advection_flag) ||
277
277
! (atmos. moisture_model isa DryModel)
278
- alg₁_subalg₂ =
278
+ gs_scalar_subalg = if ! (atmos. moisture_model isa DryModel)
279
+ MatrixFields. BlockLowerTriangularSolve (@name (c. ρq_tot))
280
+ else
281
+ MatrixFields. BlockDiagonalSolve ()
282
+ end
283
+ scalar_subalg =
279
284
if atmos. turbconv_model isa PrognosticEDMFX &&
280
285
use_derivative (sgs_advection_flag)
281
- diff_subalg =
282
- use_derivative (diffusion_flag) ?
283
- (;
284
- alg₂ = MatrixFields. BlockLowerTriangularSolve (
285
- names₁_group₂... ,
286
- )
287
- ) : (;)
288
- (;
286
+ MatrixFields. BlockLowerTriangularSolve (
287
+ available_sgs_tracer_names... ;
289
288
alg₂ = MatrixFields. BlockLowerTriangularSolve (
290
- available_sgs_tracer_names ... ;
289
+ @name (c . sgsʲs.:( 1 ) . mse) ;
291
290
alg₂ = MatrixFields. BlockLowerTriangularSolve (
292
- @name (c. sgsʲs.:(1 ). mse);
293
- alg₂ = MatrixFields. BlockLowerTriangularSolve (
294
- @name (c. sgsʲs.:(1 ). ρa);
295
- diff_subalg... ,
296
- ),
291
+ @name (c. sgsʲs.:(1 ). ρa);
292
+ alg₂ = gs_scalar_subalg,
297
293
),
298
- )
294
+ ),
299
295
)
300
296
else
301
- is_in_Y (@name (c. ρq_tot)) ?
302
- (;
303
- alg₂ = MatrixFields. BlockLowerTriangularSolve (
304
- names₁_group₂... ,
305
- )
306
- ) : (;)
297
+ gs_scalar_subalg
307
298
end
308
- alg₁ = MatrixFields. BlockLowerTriangularSolve (
309
- names₁_group₁ ... ;
310
- alg₁_subalg₂ ... ,
299
+ scalar_alg = MatrixFields. BlockLowerTriangularSolve (
300
+ mass_and_surface_names ... ;
301
+ alg₂ = scalar_subalg ,
311
302
)
312
303
MatrixFields. ApproximateBlockArrowheadIterativeSolve (
313
- names₁ ... ;
314
- alg₁,
315
- alg₂,
304
+ available_scalar_names ... ;
305
+ alg₁ = scalar_alg ,
306
+ alg₂ = velocity_alg ,
316
307
P_alg₁ = MatrixFields. MainDiagonalPreconditioner (),
317
308
n_iters = alg. approximate_solve_iters,
318
309
)
319
310
else
320
- MatrixFields. BlockArrowheadSolve (names₁... ; alg₂)
311
+ MatrixFields. BlockArrowheadSolve (
312
+ available_scalar_names... ;
313
+ alg₂ = velocity_alg,
314
+ )
321
315
end
322
316
323
317
temp_matrix = (matrix .+ identity_matrix (matrix, Y)) ./ FT (1 )
0 commit comments