Skip to content

Commit 4ee7f7f

Browse files
authored
Merge pull request #3759 from CliMA/zs/jac_massflux
add mass flux derivative with respect to grid-mean u_3
2 parents 4445eab + c3b4a71 commit 4ee7f7f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

reproducibility_tests/ref_counter.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
230
1+
231
22

33
# **README**
44
#
@@ -20,12 +20,14 @@
2020

2121

2222
#=
23+
231
24+
- Add mass flux derivatives with respect to grid-mean u_3
2325
2426
230
2527
- Add u_{3,m} (updraft) Jacobians to updraft MSE, rho*a, and q_tot prognostic equations. Move sgs ∂ᶠu₃ʲ derivatives to BlockLowerTriangularSolve.
2628
2729
229
28-
remove derivatives with respect to grid mean rho in edmf implicit solver
30+
- Remove derivatives with respect to grid mean rho in edmf implicit solver
2931
3032
228
3133
- Only treat the drag term in edmf pressure closure implicitly

src/prognostic_equations/implicit/implicit_solver.jl

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,10 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
11711171
-(dtγ * ᶜadvdivᵥ_matrix() ∂ᶜupdraft_mass_flux_∂ᶜscalar)
11721172

11731173
## grid-mean ρq_tot
1174-
∂ᶜρq_tot_err_∂ᶜρ = matrix[@name(c.ρq_tot), @name(c.ρ)]
11751174
@. ∂ᶜρq_tot_err_∂ᶜρ +=
11761175
dtγ * ᶜadvdivᵥ_matrix() ∂ᶜupdraft_mass_flux_∂ᶜscalar
11771176
DiagonalMatrixRow(-(ᶜspecific.q_tot) / ᶜρ)
11781177

1179-
∂ᶜρq_tot_err_∂ᶜρq_tot = matrix[@name(c.ρq_tot), @name(c.ρq_tot)]
11801178
@. ∂ᶜρq_tot_err_∂ᶜρq_tot +=
11811179
dtγ * ᶜadvdivᵥ_matrix() ∂ᶜupdraft_mass_flux_∂ᶜscalar
11821180
DiagonalMatrixRow(1 / ᶜρ)
@@ -1187,6 +1185,17 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
11871185
-(dtγ * ᶜadvdivᵥ_matrix() ∂ᶜupdraft_mass_flux_∂ᶜscalar)
11881186

11891187
# grid-mean ∂/∂(u₃ʲ)
1188+
∂ᶜρe_tot_err_∂ᶠu₃ = matrix[@name(c.ρe_tot), @name(f.u₃)]
1189+
@. ∂ᶜρe_tot_err_∂ᶠu₃ +=
1190+
dtγ * ᶜadvdivᵥ_matrix() DiagonalMatrixRow(
1191+
ᶠinterp(
1192+
(Y.c.sgsʲs.:(1).mse + ᶜKʲs.:(1) - ᶜh_tot) *
1193+
ᶜρʲs.:(1) *
1194+
ᶜJ *
1195+
draft_area(Y.c.sgsʲs.:(1).ρa, ᶜρʲs.:(1)),
1196+
) / ᶠJ * (g³³(ᶠgⁱʲ)),
1197+
)
1198+
11901199
∂ᶜρe_tot_err_∂ᶠu₃ʲ =
11911200
matrix[@name(c.ρe_tot), @name(f.sgsʲs.:(1).u₃)]
11921201
@. ∂ᶜρe_tot_err_∂ᶠu₃ʲ =
@@ -1199,6 +1208,16 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
11991208
) / ᶠJ * (g³³(ᶠgⁱʲ)),
12001209
)
12011210

1211+
∂ᶜρq_tot_err_∂ᶠu₃ = matrix[@name(c.ρq_tot), @name(f.u₃)]
1212+
@. ∂ᶜρq_tot_err_∂ᶠu₃ +=
1213+
dtγ * ᶜadvdivᵥ_matrix() DiagonalMatrixRow(
1214+
ᶠinterp(
1215+
(Y.c.sgsʲs.:(1).q_tot - ᶜspecific.q_tot) *
1216+
ᶜρʲs.:(1) *
1217+
ᶜJ *
1218+
draft_area(Y.c.sgsʲs.:(1).ρa, ᶜρʲs.:(1)),
1219+
) / ᶠJ * (g³³(ᶠgⁱʲ)),
1220+
)
12021221

12031222
∂ᶜρq_tot_err_∂ᶠu₃ʲ =
12041223
matrix[@name(c.ρq_tot), @name(f.sgsʲs.:(1).u₃)]

0 commit comments

Comments
 (0)