How to set this time derivative boundary condition using MOL?
4 views (last 30 days)
Show older comments
LHS = Left hand side aka
BC = Boundary condition
Hi,
I have a system of coupled raection diffusion PDEs as such.
For my species I have a LHS at such as
I am trying to solve this using the method of lines by using ODE15s solver for which I have written the function as such. But I do not know how to incorporate the term into the script and how to assign it to be my LHS boundary condition.
k1=0.073317274764052;
k2=1.052512778689219e-04;
tau=0.466500000000000;
tau_2=0.699700000000000;
dchi=0.100000000000000;
N=11;
tspan_2=linspace(tau, tau_2, N);
[t, CmBC] = ode15s(@(t, Cm2) BCodefun(t, Cm2, k1, k2, dchi), tspan_2, 0.9, []);
function dCdt2BC = BCodefun(t, CmBC, k1, k2, dchi)
dCdt2BC = (k1/k2).*(((CmBC).*(CmBC^2-CmBC))/dchi);
end
This gives me a 1*11 matrix (code till above should function). You can see below how I am using a multi point approximation to set a no flux BC at my left hand. I am not sure how to assign my ODE output as my left hand side BC in my MOL implementation.
% What I have been using to set a no flux boundary condition on the LHS
Cm2(1) = (-Cm2(3)+4*Cm2(2))./3;
% WHat I think I should do to set the output from my ODE solution to set my
% LHS BC
Cm2(1) = CmBC;
9 Comments
Torsten
on 17 Jul 2023
Edited: Torsten
on 17 Jul 2023
Reread how the method-of-lines works to solve partial differential equations.
As I wrote you don't solve for a single unknown value of the concentration field as you seem to try with the command
[t, Cm2(1)] = ode15s(@(t, Cm2) BCodefun(t, Cm2, k1, k2, dchi), tspan_2, 1, []);
but for the complete profile of C_m_ox and C_s over the spatial domain.
That's why I wrote you have 2*N solution variables where N is the number of spatial discretization points.
As far as I know, the following PDE solver similar to pdepe supports ODEs as boundary conditions:
Maybe you want to test it for your problem.
Answers (0)
See Also
Categories
Find more on Partial Differential Equation Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!