Gather auxiliary output from bvp4c

2 次查看(过去 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

采纳的回答

Torsten
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);
?
  1 个评论
Eric Roden
Eric Roden 2022-11-15
Well OK, duh, just call for rates back in the calling routine...thanks Torsten!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Configure Simulation Conditions 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by