Gather auxiliary output from bvp4c

1 vue (au cours des 30 derniers jours)
Eric Roden
Eric Roden le 15 Nov 2022
Commenté : Eric Roden le 15 Nov 2022
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

Réponse acceptée

Torsten
Torsten le 15 Nov 2022
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 commentaire
Eric Roden
Eric Roden le 15 Nov 2022
Well OK, duh, just call for rates back in the calling routine...thanks Torsten!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Configure Simulation Conditions dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by