Using pdepe with different material properties
古いコメントを表示
I want to solve a system of 7 PDE (second order mass balances) and 1 ODE (second order electric potential balance) within different materials .I'm writing a vector of ones for c with one value equals to zero (ODE), if statements for f and s and creating mesh points at interfaces, but I have a few questions on how to specify subdomains conditions:
1. How do I specify equal flux and a jump in concentrations at internal interfaces? (eg. D1*(du(1)/dx)=D2(du(1)/dx) & u(1)=K*u(1) where K is constant).
2. How should I specify that the potential balance (ODE) applies only at 1 subdomain? (eg. u(8)=0 everywhere except in subdomain 3 with boundary conditions du(8)/dx=0 and (u(8)+E(u(2),u(5))) -B du(8)/dx =0 with B constant).
Equations
c*du(i)/dt = d/dx(f(x)*du(i)/dx) + s(x,u) ; i=1,2..8
c=[1;1;1;1;1;0;0;0]
r1=k1*u(1)*(1/(1+exp(-F*u(8)/R/T)))/(Ks1+u(1))
r2=k2*u(1)/(Ks2+u(1))
r3=k3*u(5)*exp(beta*F*na/R/T)/(Ko+u(5))
On subdomain 1 and 4 c(6)=1; f=[Ds1;Dh1;Dco1;Dch1;Do1;0;0;0] s=[-u(6)*r2;0;u(6)*r2;u(6)*r2;0;Y2*u(6)*r2 - Kinam*u(6);u(7);u(8)] u0=[Ss0;Hs0;COs0;CHs0;Os0;Xm0;0;0]
On subdomain 2
f=[Ds2;Dh2;Dco2;Dch2;Do2;0?;0?;0?]
s=[0;0;0;0;0;u(6);u(7);u(8)]
u0=[Se0;He0;COe0;CHe0;Oe0;0?;0?;0?]
On subdomain 6
f=[Ds2;Dh2;Dco2;Dch2;Do2;0;0;0]
s=[0;-4*r3;0;0;-r3;u(6);u(7);u(8)]
u0=[Se0;He0;COe0;CHe0;Oe0;0?;0?;0?]
On subdomain 3 c(7)=1; f=[Ds3;Dh3;Dco3;Dch3;Do3;0?;0?;kbio] s=[-u(7)*r1;8*u(7)*r1;u(7)*r1;0;0;u(6);Y1*u(7)*r1-Kinae*u(7);-F*gamma*fe*r1] u0=[Sb0;Hb0;COb0;CHb0;Ob0;0;Xe0;0]
On subdomain 5 and 7
f=[Ds4;Dh4;Dco4;Dch4;Do4;0?;0?;0?]
s=[0;0;0;0;0;u(6);u(7);u(8)]
u0=[Sw0;Hw0;COw0;CHw0;Ow0;0;0;0]
The boundary conditions between subdomains are:
for i=1:5
Continuous flux on internal interfaces
u(i)_subdomain1,2,3,4,5,6 = K(x)*u(i)_subdomain2,3,4,5,6,7
for i=6,7,8
du(6)/dx = 0 on interfaces between subdomains 1-2 , 3-4, 4-5
du(7)/dx = 0 on interfaces between subdomains 2-3 , 3-4
du(8)/dx = 0 on interface between subdomains 3-4
(u(8)+E{u(2),u(5)}) - B*kbio*du(8)/dx = 0 on interface between subdomains 2-3
So variable u(6) only takes values at subdomains 1 and 4 and is equal to 0 elsewhere. Variable u(7) and u(8) only take values at subdomain 3 and are equal to 0 elsewhere.
The missing boundary conditions are external (left and right ones), for left side every flux is zero and for right size every flux is zero, excepting u(3)=0, u(4)=0, u(5)-G=0.
Equation 8 is only function of x and applies on all points of subdomain 3. Because u(6), u(7) and u(8) are non-zero on specific subdomains, i'm not sure how to write c,f,s,u0 on the subdomains they are zero.
9 件のコメント
Bill Greene
2018 年 8 月 10 日
Handling different materials with pdepe is straightforward. The documentation discusses this specifically: "Discontinuities in c and/or s due to material interfaces are permitted provided that a mesh point is placed at each interface." You simply check the value of x in your pdefun and return the appropriate coefficients for that x.
However, if you really have an ODE, i.e. an equation that applies only at a single point in the domain, there is no straightforward way to handle that with pdepe. I suggest you modify your post to include the equations.
Juan Diego Carvajalino Olave
2018 年 8 月 10 日
Bill Greene
2018 年 8 月 11 日
When I suggested adding the equations to your post, I really meant in mathematical form rather than trying to write pdepe code. It is hard to understand this system in the form you have written it.
Apparently, you misunderstood my comment about discontinuous material properties. pdepe generally makes the flux continuous between domains but does not permit any "internal" boundary conditions.
You did not specify equation 8 but did say u(8) is a function of x so must be satisfied everywhere in the domain. It is probably possible for pdepe to handle this.
Because your PDE system is 1D, pde toolbox offers no advantages over pdepe.
Do you have a document that describes this system of equations in more detail?
Juan Diego Carvajalino Olave
2018 年 8 月 12 日
Bill Greene
2018 年 8 月 16 日
I don't know how to handle a jump condition like u(1)=K*u(1) in pdepe. For this problem, what does it mean to have a sharp discontinuity of the solution?
Juan Diego Carvajalino Olave
2018 年 8 月 21 日
編集済み: Juan Diego Carvajalino Olave
2018 年 8 月 21 日
Juan Diego Carvajalino Olave
2018 年 8 月 22 日
編集済み: Juan Diego Carvajalino Olave
2018 年 8 月 22 日
Bill Greene
2018 年 8 月 23 日
I don't really understand the difference in the two options you propose for those subdomains. It will probably be useful to specify a small amount of diffusion in those subdomains to smooth out the numerical effects of the sharp change in coefficients.
I suggest doing some numerical experiments on a simpler problem, particularly if this is your first experience with pdepe.
Juan Diego Carvajalino Olave
2018 年 8 月 29 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Electromagnetics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!