You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem below fails with a domain error because u[2] becomes negative. Since u[2] is determined by a linear subproblem I don't think it's expected. It's not just a bit negative but ~-155 for Vern7 and -1e37 for Rodas5. The solvers Tsit5, DP8, VCABM, and Rosenbrock23 all work fine.
using OrdinaryDiffEq
functionhcv!(du, u, p, t)
du[1] =-exp(p.logKa) +180*isinfusion(t)
du[2] =exp(p.logKa)*u[1] -exp(p.logKe)*u[2]
du[3] = p.s - u[3]*(p.e*u[5] + p.d)
du[4] = p.e*u[5]*u[3] -exp(p.logδ)*u[4]
du[5] = p.p/((u[2]/exp(p.logVd)/exp(p.logEC50) +1e-100)^exp(p.logn) +1)*u[4] -exp(p.logc)*u[5]
end
rfx = (
ηKa =2.5507831516698394,
ηKe =0.42510262896450046,
ηVd =0.6897380500448431,
ηn =-1.063040053371937,
ηδ =-0.19115630736819755,
ηc =-1.3073359078470523,
ηEC50 =-0.7018572581731202
)
param = (
p =100.0,
d =0.001,
e =1e-7,
s =20000.0,
logKa =log(0.80) + rfx.ηKa,
logKe =log(0.15) + rfx.ηKe,
logVd =log(100.0) + rfx.ηVd,
logn =log(2.0) + rfx.ηn,
logδ =log(0.20) + rfx.ηδ,
logc =log(7.0) + rfx.ηc,
logEC50 =log(0.12) + rfx.ηEC50,
)
u0 = [
0.0,
0.0,
exp(param.logc + param.logδ)/(param.p*param.e),
(param.s*param.e*param.p - param.d*exp(param.logc + param.logδ))/(param.p*exp(param.logδ)*param.e),
(param.s*param.e*param.p - param.d*exp(param.logc + param.logδ))/(exp(param.logc + param.logδ)*param.e)
]
tspan = (0.0, 40.0)
dosetimes = [8*i for i in0:3]
functionisinfusion(t)
any(dosetime -> dosetime <= t <= dosetime +1, dosetimes)
end
prob =ODEProblem(hcv!, u0, tspan, param)
_tstops =sort([dosetimes; dosetimes .+1])
sol =solve(prob, Vern7(), tstops=_tstops) # fails
sol =solve(prob, Rodas5(), tstops=_tstops) # fails
sol =solve(prob, Tsit5(), tstops=_tstops) # works
sol =solve(prob, DP8(), tstops=_tstops) # works
sol =solve(prob, VCABM(), tstops=_tstops) # works
The text was updated successfully, but these errors were encountered:
The problem below fails with a domain error because
u[2]
becomes negative. Sinceu[2]
is determined by a linear subproblem I don't think it's expected. It's not just a bit negative but ~-155 forVern7
and-1e37
forRodas5
. The solversTsit5
,DP8
,VCABM
, andRosenbrock23
all work fine.The text was updated successfully, but these errors were encountered: