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
I am trying to model a chromatography column using ModelingToolkit and MethodOfLines, and I can't get past this error message.
From my testing the problematic term is - (1 - Ξ΅_column)*(3/rp)*Deff*dz(cβ(t, z, rp)) - commenting it out discretizes and solves the model. To be clear this should be the the partial derivative evaluated at rp, I'm not sure if this is how it should be coded.
I don't understand how to fix it - previous reports of the same error were due to mixed derivatives, but I don't think I have them do I?
To be clear: the numbers in the Any[...] vector belong to the z domain I think, changing zL changes them too.
I'd be very grateful for some help!
Minimal Reproducible Example π
@parameters t, z, r
@variablesc(..), cβ(..)
zL =0.1# [m] - length of the column
dp =85e-6# [m] diameter of resin particle
rp = dp/2# [m] radius of resin particle
Ξ΅_column =0.36# [-] void fraction of column
Ξ΅_particle =0.88# [-] void fraction of resin particle
kfit =0.083# [-] fitting parameter taking resin particle pore diameter, antibody molecule diameter and pore tortuosity into account
qmax =5.47# [mol m-3] maximum binding capacity of affinity resin
kd =7.7e-4# [mol m-3] equilibrium desorption constant
Dm =5.2154833353911946e-11# [m2 s-1] Molecular diffusivity
Dc =0.008# [m] Internal diameter of the column
Lc =0.1# [m] Length of the column
Ac =pi* (Dc/2)^2# [m2] Cross sectional area of the column
M =145000# [g mol-1] Molecular weight of mAb
cin =2.27586207e-02# [mol m-3]
Qin =1.05000000e-08# [m3 s-1] inlet volumetric flowrate RT: 8 0.63 mL/min
u = Qin/(Ac*Ξ΅_column) # [m s-1] Liquid interstitial velocity
Re =997*dp*u/0.001002# [-] Reynold's number of the flow (using water dynamic viscosity and density)
Dax = dp*u*Ξ΅_column/(0.339+0.033*Re^0.48) # [m2 s-1] Axial dispersion coefficient
Deff = kfit*Ξ΅_particle*Dm # [m2 s-1] Effective pore diffusion coefficient
k_film =3/(rp) # [m-1] film mass transfer coefficient
dt =Differential(t)
dz =Differential(z)
dr =Differential(r)
dz_sq =Differential(z)^2
dr_sq =Differential(r)^2
eqs = [
Ξ΅_column*dt(c(t, z)) ~-u*Ξ΅_column*dz(c(t, z)) + Ξ΅_column*Dax*dz_sq(c(t, z)) - (1- Ξ΅_column)*(3/rp)*Deff*dz(cβ(t, z, rp)), #### this last term is the problem
Ξ΅_particle*dt(cβ(t, z, r)) ~ Deff*(dr_sq(cβ(t, z, r)) +2/(r)*dr(cβ(t, z, r)))- (1- Ξ΅_particle)*kd*qmax*c(t, z)/(kd +c(t, z))^2,
]
bcs = [
# boundary conditionsc(t,0) ~ cin + (Dax/u) *dz(c(t,0)),
dz(c(t,zL)) ~0,
cβ(t, z, rp) ~c(t, z),
dr(cβ(t,z, 0)) ~0,
# Initial conditionsc(0, z) ~0,
cβ(0, z, r) ~0,
]
domain = [z β (0.0, zL), r β (0.0, rp), t β (0.0, 400)]
@named HPLC =PDESystem(eqs, bcs, domain, [t, z, r], [c(t, z), cβ(t, z, r)])
# prob = discretize(HPLC, MOLFiniteDifference([z=>40, r=>40], t), advection_scheme = WENOScheme())
prob =discretize(HPLC, MOLFiniteDifference([z=>40, r=>40], t), advection_scheme =UpwindScheme())
sol =solve(prob, Tsit5(), saveat =1)
Describe the bug π
I am trying to model a chromatography column using ModelingToolkit and MethodOfLines, and I can't get past this error message.
From my testing the problematic term is
- (1 - Ξ΅_column)*(3/rp)*Deff*dz(cβ(t, z, rp))
- commenting it out discretizes and solves the model. To be clear this should be the the partial derivative evaluated at rp, I'm not sure if this is how it should be coded.I don't understand how to fix it - previous reports of the same error were due to mixed derivatives, but I don't think I have them do I?
To be clear: the numbers in the Any[...] vector belong to the z domain I think, changing zL changes them too.
I'd be very grateful for some help!
Minimal Reproducible Example π
Error & Stacktraceβ οΈ
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: