Gather auxiliary output from bvp4c
1 次查看(过去 30 天)
显示 更早的评论
Is there a way to gather auxiliary output from the bvp4c solver, e.g. something akin to the output function for ode solvers? I would like to use bvp4c to solve a steady-state diffusion-reaction system embedded within a method of lines solution procedure (using ode15s) for unsaturated fluid flow and solute transport in soils. The bvp4c solution function generates reaction rates that I would like to store, but I can't figure out how to "bring them back" to the calling routine. To help make this more clear, I have pasted in below the solver function for the diffusion-reaction problem; it's the values of RO2 and RNO3 that I would like to save for each spatial node at the end of the solution procedure. PS - Torsten I'm thinking you might be able to help me out with this, given that you recently showed me how to implement bvp4c for the diffusion-reaction problem.
function dCdr = bvpfcn(r,C,nu1,nu2,D,K1,K2,IC1)
RO2 = nu1/D*C(1)/(K1+C(1));
RNO3 = IC1/(IC1+C(1))*nu2/D*C(3)/(K2+C(3));
dCdr = [C(2); -2/r*C(2) + RO2; C(4); -2/r*C(4) + RNO3];
end
0 个评论
采纳的回答
Torsten
2022-11-15
You mean
sol = bvp4c(odefun,bcfun,solinit,options);
C1 = sol.y(1,:);
C2 = sol.y(3,:);
RO2 = nu1/D*C1./(K1+C1);
RNO3 = IC1./(IC1+C1)*nu2/D.*C2./(K2+C2);
?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Boundary Value Problems 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!