Hi Community! I need your expertise ! I am solving a 1D diffusion equation with a moving boundary. The physical background is the reaction of gas with a solid particle, where the gas diffuses through the product layer but cannot penetrate the dense core so that surface reaction happens. The dense core will be gradually consumed and shrink. In combustion science, this classical model is named shrinking core model.
I tried to explain this model clearly with a diagram and my equations, as shown in the supplementary material. What is tricky here, for me, is the left boundary of the domain – it changes with time. I checked the previous topics in our Julia community, and they do not really help.
My codes are also attached for your perusal, which is problematic (I know~). Feel free to share your ideas!
using MethodOfLines, OrdinaryDiffEq, Plots, DifferentialEquations, Symbolics, Latexify, DomainSets, ModelingToolkit
r0 = 0.01; K = 2e-4; De = 6e-6; mol_rho = 109500
Nx=30
order=2C=20; k=0.08; x_inf=1 #bulk concentration; reaciton rate const; molar fraction of bulk
@parameters r, t
@variables u(…)
@variables r_c(…)Dr = Differential(r)
Drr = Differential(r)^2
Dt = Differential(t)eqs=[Dt(u(r,t)) ~ De*Drr(u(r,t)),
Dt(r_c(t)) ~ (-k)Cu(r_c(t),t)/mol_rho]bcs=[Dr(u(r_c(t),t)) ~ -ku(r_c(t),t)/r_c(t),
DeDr(u(r0,t)) ~ -K*(u(r0,t)-u_inf/r0),
u(r,0) ~ 0.0, r_c(0) ~ r0]domains = [r ∈ Interval(0, r0), t ∈ Interval(0.0, 30.0)]
@named scmsys = PDESystem(eqs,bcs,domains,[r,t], [u(r,t), r_c(t)])
discretization = MOLFiniteDifference([r => Nx], t)
@time prob = discretize(scmsys, discretization)
I think the domain should be [0, r_0] or [r_c, r_0]. The former domain discretizes the whole area, and returns zero values to u(r,t) when r<r_c. The latter is a dynamic discretization which I have no idea how to achieve that. Or could this be an interface problem ([0, r_0] + [r_c, r_0])?
Similar cases were found in a Mathematica community here and there. I am trying to understand but really struggling.
Supplementary figures
(Note: the diffusion equation is altered for simplification, which is inaccurate in fact but does not influence the solution of this topic.)