metrumresearchgroup / Torsten

library of C++ functions that support applications of Stan in Pharmacometrics
BSD 3-Clause "New" or "Revised" License
52 stars 11 forks source link

[BUG] KA=0 is not allowed in one/two cpt models. #24

Closed yizhang-yiz closed 4 years ago

yizhang-yiz commented 4 years ago

Description

ka=0 leads to exception instead of eliminating absorption in one/two cut models.

Example

  y0(0) = 745;
  y0(1) = 100;
  rate[0] = 1200;
  rate[1] = 200;
  ka = 0.0;
  using model_t = PMXOneCptModel<double, double, double, double>;
  model_t model(t0, y0, rate, CL, V2, ka);
  auto y = model.solve(ts[0]);

The above model throws exception when check_positive_finite is applied to ka, removing this check will give NaN in output y because ka is used in denominators in the solver.

Expected Output

Solution with no absorption

Current Version:

v0.87.1