@@ -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
),
@@ -889,6 +896,8 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
889
896
top = Operators. SetValue (zero (UpwindMatrixRowType{CT3{FT}})),
890
897
bottom = Operators. SetValue (zero (UpwindMatrixRowType{CT3{FT}})),
891
898
) # Need to wrap ᶠupwind_matrix in this for well-defined boundaries.
899
+
900
+ ᶠu³ʲ_data = ᶠu³ʲs.:(1 ). components. data.:1
892
901
ᶜkappa_mʲ = p. ᶜtemp_scalar
893
902
@. ᶜkappa_mʲ =
894
903
TD. gas_constant_air (thermo_params, ᶜtsʲs.:(1 )) /
@@ -903,6 +912,20 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
903
912
ᶠset_upwind_matrix_bcs (ᶠupwind_matrix (ᶠu³ʲs.:(1 )))
904
913
) - (I,)
905
914
915
+ ∂ᶜq_totʲ_err_∂ᶠu₃ʲ =
916
+ matrix[@name (c. sgsʲs.:(1 ). q_tot), @name (f. sgsʲs.:(1 ). u₃)]
917
+
918
+ @. ∂ᶜq_totʲ_err_∂ᶠu₃ʲ =
919
+ dtγ * (
920
+ - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
921
+ ᶠset_upwind_bcs (
922
+ ᶠupwind (CT3 (sign (ᶠu³ʲ_data)), Y. c. sgsʲs.:(1 ). q_tot),
923
+ ) * adjoint (C3 (sign (ᶠu³ʲ_data))),
924
+ ) +
925
+ DiagonalMatrixRow (Y. c. sgsʲs.:(1 ). q_tot) ⋅ ᶜadvdivᵥ_matrix ()
926
+ ) ⋅ DiagonalMatrixRow (g³³ (ᶠgⁱʲ))
927
+
928
+
906
929
∂ᶜmseʲ_err_∂ᶜq_totʲ =
907
930
matrix[@name (c. sgsʲs.:(1 ). mse), @name (c. sgsʲs.:(1 ). q_tot)]
908
931
@. ∂ᶜmseʲ_err_∂ᶜq_totʲ =
@@ -915,6 +938,18 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
915
938
)
916
939
)
917
940
941
+ ∂ᶜmseʲ_err_∂ᶠu₃ʲ =
942
+ matrix[@name (c. sgsʲs.:(1 ). mse), @name (f. sgsʲs.:(1 ). u₃)]
943
+ @. ∂ᶜmseʲ_err_∂ᶠu₃ʲ =
944
+ dtγ * (
945
+ - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
946
+ ᶠset_upwind_bcs (
947
+ ᶠupwind (CT3 (sign (ᶠu³ʲ_data)), Y. c. sgsʲs.:(1 ). mse),
948
+ ) * adjoint (C3 (sign (ᶠu³ʲ_data))),
949
+ ) +
950
+ DiagonalMatrixRow (Y. c. sgsʲs.:(1 ). mse) ⋅ ᶜadvdivᵥ_matrix ()
951
+ ) ⋅ DiagonalMatrixRow (g³³ (ᶠgⁱʲ))
952
+
918
953
∂ᶜmseʲ_err_∂ᶜmseʲ =
919
954
matrix[@name (c. sgsʲs.:(1 ). mse), @name (c. sgsʲs.:(1 ). mse)]
920
955
@. ∂ᶜmseʲ_err_∂ᶜmseʲ =
@@ -987,6 +1022,22 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
987
1022
ᶠset_upwind_matrix_bcs (ᶠupwind_matrix (ᶠu³ʲs.:(1 ))) ⋅
988
1023
DiagonalMatrixRow (1 / ᶜρʲs.:(1 )) - (I,)
989
1024
1025
+
1026
+ ∂ᶜρaʲ_err_∂ᶠu₃ʲ =
1027
+ matrix[@name (c. sgsʲs.:(1 ). ρa), @name (f. sgsʲs.:(1 ). u₃)]
1028
+ @. ∂ᶜρaʲ_err_∂ᶠu₃ʲ =
1029
+ dtγ * - (ᶜadvdivᵥ_matrix ()) ⋅ DiagonalMatrixRow (
1030
+ ᶠinterp (ᶜρʲs.:(1 ) * ᶜJ) / ᶠJ *
1031
+ ᶠset_upwind_bcs (
1032
+ ᶠupwind (
1033
+ CT3 (sign (ᶠu³ʲ_data)),
1034
+ draft_area (Y. c. sgsʲs.:(1 ). ρa, ᶜρʲs.:(1 )),
1035
+ ),
1036
+ ) *
1037
+ adjoint (C3 (sign (ᶠu³ʲ_data))) *
1038
+ g³³ (ᶠgⁱʲ),
1039
+ )
1040
+
990
1041
∂ᶠu₃ʲ_err_∂ᶜq_totʲ =
991
1042
matrix[@name (f. sgsʲs.:(1 ). u₃), @name (c. sgsʲs.:(1 ). q_tot)]
992
1043
@. ∂ᶠu₃ʲ_err_∂ᶜq_totʲ =
0 commit comments