How to set this time derivative boundary condition using MOL?
Afficher commentaires plus anciens
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 commentaires
Torsten
le 17 Juil 2023
Use "pdepe" for your system if you are not experienced in programming numerical methods to solve PDEs.
Torsten
le 17 Juil 2023
Again a delta(Chi) appears in the denominator. This cannot be correct for a continuous form of the boundary condition.
Hashim
le 17 Juil 2023
Your solution variables within ode15s are C_s(1), C_s(2),...,C_s(N),C_m_ox(1), C_m_ox(2),...,C_m_ox(N) where N is the number of discretization points in space.
So what is the problem of implementing the ODE for C_m_ox in Chi=0 as
dC_m_ox/d(tau_M) = k1/k2 * (C_m_ox(2)-C_m_ox(1))/dChi * (C_m_ox(1)*(C_m_ox(1)-1))
?
Hashim
le 17 Juil 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.
Réponses (0)
Catégories
En savoir plus sur Eigenvalue Problems dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
