I’ve solved the completeness problem -
The additional equation appear to have been added because the new variables (mH2O, mA, mB) were added using the @species macro.
Re-defining using the @variables macro eliminates the issue:
using Catalyst, ModelingToolkit
@independent_variables t
@parameters k1 k2 k3 rho
@variables mH2O(t) mA(t) mB(t) V(t)
@species H2O(t) A(t) B(t)
rxns = [
Reaction(k1, [H2O], [A , B])
Reaction(k2, [A], [B])
Reaction(k3, [B], [H2O])
]
@named rn = ReactionSystem(rxns, combinatoric_ratelaws=false)
equations = [
V ~ mH2O / rho
H2O ~ mH2O / V
A ~ mA / V
B ~ mB / V
]
@named alg = ODESystem(equations, t, [mH2O mA mB V], [rho])
rn2 = extend(alg, rn)
rn2 = complete(rn2; sys=rn2)
Now the system can be defined as fully determined:
u0 = [mA => 0.1, mB => 0, mH2O => 49.5]
ps = [k1 => 100, k2 => 30, k3 => 0.5, rho => 0.99]
oprob = ODEProblem(rn2, u0, (0.0, 5.0), ps, structural_simplify=true)
It happens that the system defined in this example is singular, which appears during the solution step.