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
댓글 수: 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!