Skip to content

Commit 40f6e25

Browse files
committed
editing jacobian for updated noneq param
1 parent b6c228a commit 40f6e25

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

src/prognostic_equations/implicit/manual_sparse_jacobian.jl

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,13 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
605605
function limit(q, dt, n::Int)
606606
return q / float(dt) / n
607607
end
608+
function clipped(q)
609+
if q > 0
610+
return true
611+
else
612+
return false
613+
end
614+
end
608615

609616
function ∂ρqₗ_err_∂ρqₗ(tps, ts, cmc, dt, S, pos_lim, neg_lim,
610617
source_deriv, pos_lim_deriv, neg_lim_deriv)
@@ -620,7 +627,17 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
620627
neg_lim_deriv = 0
621628

622629
if q.tot + q.liq < FT(0)
623-
S = CMNe.conv_q_vap_to_q_liq_ice_MM2015(cmc.liquid, tps, q, ρ, Tₐ(tps, ts))
630+
S = CMNe.conv_q_vap_to_q_liq_ice_MM2015(
631+
cm_params,
632+
thp,
633+
qₜ,
634+
qₗ,
635+
qᵢ,
636+
qᵣ,
637+
qₛ,
638+
ρ,
639+
Tₐ,
640+
)
624641
else
625642
S = 0
626643
source_deriv = 0
@@ -653,7 +670,17 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
653670
q = TD.PhasePartition(tps, ts)
654671
ρ = TD.air_density(tps, ts)
655672

656-
S = CMNe.conv_q_vap_to_q_liq_ice_MM2015(cmc.ice, tps, q, ρ, Tₐ(tps, ts))
673+
S = CMNe.conv_q_vap_to_q_liq_ice_MM2015(
674+
cmc,
675+
thp,
676+
qₜ,
677+
qₗ,
678+
qᵢ,
679+
qᵣ,
680+
qₛ,
681+
ρ,
682+
Tₐ,
683+
)
657684

658685
if S > FT_inner(0)
659686
if S <= limit(TD.vapor_specific_humidity(q), dt, 2)
@@ -684,6 +711,11 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
684711
∂ᶜρqₗ_err_∂ᶜρqₜ = matrix[@name(c.ρq_liq), @name(c.ρq_tot)]
685712
∂ᶜρqᵢ_err_∂ᶜρqₜ = matrix[@name(c.ρq_ice), @name(c.ρq_tot)]
686713

714+
715+
# plan -- check if things have been clipped or not. if so then don't calc.
716+
717+
718+
687719
#if isdefined(Main, :Infiltrator)
688720
# Main.@infiltrate
689721
#end

0 commit comments

Comments
 (0)