Gather auxiliary output from bvp4c

2 ビュー (過去 30 日間)
Eric Roden
Eric Roden 2022 年 11 月 15 日
コメント済み: Eric Roden 2022 年 11 月 15 日
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 Center および File ExchangeConfigure Simulation Conditions についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by