@@ -293,6 +293,12 @@ function ImplicitEquationJacobian(
293
293
similar (Y. c, TridiagonalRow),
294
294
(@name (c. sgsʲs.:(1 ). ρa), @name (c. sgsʲs.:(1 ). mse)) =>
295
295
similar (Y. c, TridiagonalRow),
296
+ (@name (c. sgsʲs.:(1 ). ρa), @name (f. sgsʲs.:(1 ). u₃)) =>
297
+ similar (Y. c, BidiagonalRow_ACT3),
298
+ (@name (c. sgsʲs.:(1 ). mse), @name (f. sgsʲs.:(1 ). u₃)) =>
299
+ similar (Y. c, BidiagonalRow_ACT3),
300
+ (@name (c. sgsʲs.:(1 ). q_tot), @name (f. sgsʲs.:(1 ). u₃)) =>
301
+ similar (Y. c, BidiagonalRow_ACT3),
296
302
(@name (f. sgsʲs.:(1 ). u₃), @name (c. sgsʲs.:(1 ). q_tot)) =>
297
303
similar (Y. f, BidiagonalRow_C3),
298
304
(@name (f. sgsʲs.:(1 ). u₃), @name (c. sgsʲs.:(1 ). mse)) =>
@@ -359,12 +365,14 @@ function ImplicitEquationJacobian(
359
365
names₁ = (
360
366
names₁_group₁... ,
361
367
available_sgs_scalar_names... ,
362
- sgs_u³_names_if_available... ,
363
368
names₁_group₂... ,
364
369
names₁_group₃... ,
365
370
)
366
371
367
- alg₂ = MatrixFields. BlockLowerTriangularSolve (@name (c. uₕ))
372
+ alg₂ = MatrixFields. BlockLowerTriangularSolve (
373
+ @name (c. uₕ),
374
+ sgs_u³_names_if_available... ,
375
+ )
368
376
alg =
369
377
if use_derivative (diffusion_flag) ||
370
378
use_derivative (sgs_advection_flag) ||
@@ -386,8 +394,7 @@ function ImplicitEquationJacobian(
386
394
alg₂ = MatrixFields. BlockLowerTriangularSolve (
387
395
@name (c. sgsʲs.:(1 ). mse);
388
396
alg₂ = MatrixFields. BlockLowerTriangularSolve (
389
- @name (c. sgsʲs.:(1 ). ρa),
390
- @name (f. sgsʲs.:(1 ). u₃);
397
+ @name (c. sgsʲs.:(1 ). ρa);
391
398
diff_subalg... ,
392
399
),
393
400
),
@@ -890,6 +897,8 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
890
897
top = Operators. SetValue (zero (UpwindMatrixRowType{CT3{FT}})),
891
898
bottom = Operators. SetValue (zero (UpwindMatrixRowType{CT3{FT}})),
892
899
) # Need to wrap ᶠupwind_matrix in this for well-defined boundaries.
900
+
901
+ ᶠu³ʲ_data = ᶠu³ʲs.:(1 ). components. data.:1
893
902
ᶜkappa_mʲ = p. ᶜtemp_scalar
894
903
@. ᶜkappa_mʲ =
895
904
TD. gas_constant_air (thermo_params, ᶜtsʲs.:(1 )) /
@@ -904,6 +913,20 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
904
913
ᶠset_upwind_matrix_bcs (ᶠupwind_matrix (ᶠu³ʲs.:(1 )))
905
914
) - (I,)
906
915
916
+ ∂ᶜq_totʲ_err_∂ᶠu₃ʲ =
917
+ matrix[@name (c. sgsʲs.:(1 ). q_tot), @name (f. sgsʲs.:(1 ). u₃)]
918
+
919
+ @. ∂ᶜq_totʲ_err_∂ᶠu₃ʲ =
920
+ dtγ * (
921
+ - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
922
+ ᶠset_upwind_bcs (
923
+ ᶠupwind (CT3 (sign (ᶠu³ʲ_data)), Y. c. sgsʲs.:(1 ). q_tot),
924
+ ) * adjoint (C3 (sign (ᶠu³ʲ_data))),
925
+ ) +
926
+ DiagonalMatrixRow (Y. c. sgsʲs.:(1 ). q_tot) ⋅ ᶜadvdivᵥ_matrix ()
927
+ ) ⋅ DiagonalMatrixRow (g³³ (ᶠgⁱʲ))
928
+
929
+
907
930
∂ᶜmseʲ_err_∂ᶜq_totʲ =
908
931
matrix[@name (c. sgsʲs.:(1 ). mse), @name (c. sgsʲs.:(1 ). q_tot)]
909
932
@. ∂ᶜmseʲ_err_∂ᶜq_totʲ =
@@ -916,6 +939,18 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
916
939
)
917
940
)
918
941
942
+ ∂ᶜmseʲ_err_∂ᶠu₃ʲ =
943
+ matrix[@name (c. sgsʲs.:(1 ). mse), @name (f. sgsʲs.:(1 ). u₃)]
944
+ @. ∂ᶜmseʲ_err_∂ᶠu₃ʲ =
945
+ dtγ * (
946
+ - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
947
+ ᶠset_upwind_bcs (
948
+ ᶠupwind (CT3 (sign (ᶠu³ʲ_data)), Y. c. sgsʲs.:(1 ). mse),
949
+ ) * adjoint (C3 (sign (ᶠu³ʲ_data))),
950
+ ) +
951
+ DiagonalMatrixRow (Y. c. sgsʲs.:(1 ). mse) ⋅ ᶜadvdivᵥ_matrix ()
952
+ ) ⋅ DiagonalMatrixRow (g³³ (ᶠgⁱʲ))
953
+
919
954
∂ᶜmseʲ_err_∂ᶜmseʲ =
920
955
matrix[@name (c. sgsʲs.:(1 ). mse), @name (c. sgsʲs.:(1 ). mse)]
921
956
@. ∂ᶜmseʲ_err_∂ᶜmseʲ =
@@ -988,6 +1023,22 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
988
1023
ᶠset_upwind_matrix_bcs (ᶠupwind_matrix (ᶠu³ʲs.:(1 ))) ⋅
989
1024
DiagonalMatrixRow (1 / ᶜρʲs.:(1 )) - (I,)
990
1025
1026
+
1027
+ ∂ᶜρaʲ_err_∂ᶠu₃ʲ =
1028
+ matrix[@name (c. sgsʲs.:(1 ). ρa), @name (f. sgsʲs.:(1 ). u₃)]
1029
+ @. ∂ᶜρaʲ_err_∂ᶠu₃ʲ =
1030
+ dtγ * - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
1031
+ ᶠinterp (ᶜρʲs.:(1 ) * ᶜJ) / ᶠJ *
1032
+ ᶠset_upwind_bcs (
1033
+ ᶠupwind (
1034
+ CT3 (sign (ᶠu³ʲ_data)),
1035
+ draft_area (Y. c. sgsʲs.:(1 ). ρa, ᶜρʲs.:(1 )),
1036
+ ),
1037
+ ) *
1038
+ adjoint (C3 (sign (ᶠu³ʲ_data))) *
1039
+ g³³ (ᶠgⁱʲ),
1040
+ )
1041
+
991
1042
∂ᶠu₃ʲ_err_∂ᶜq_totʲ =
992
1043
matrix[@name (f. sgsʲs.:(1 ). u₃), @name (c. sgsʲs.:(1 ). q_tot)]
993
1044
@. ∂ᶠu₃ʲ_err_∂ᶜq_totʲ =
0 commit comments