pdepe function maximum value

조회 수: 10 (최근 30일)
FM
FM 2018년 3월 7일
댓글: Torsten 2018년 3월 9일
Hello,
I want to solve Fick's second law of diffusion using the pdepe function, where w is the concentration of a species in a solid and D is the diffusion coefficient
  • ∂w/∂t=∂/∂x(D ∂w/∂x)
I defined the following parameters
  • c=1 m=0 s=0 and f=D ∂w(x,t)/∂x
I made a function to define D
My boundary conditions are (at x=0 and x=L)
  • -D ∂w(0,t)/∂x=beta
  • -D ∂w(L,t)/∂x=0
Since boundaries are defined as p+qf=0 I've set
  • pl=beta
  • ql=1
  • pr=0
  • qr=1
My code seems to work just fine. The concentration w at point x=0 grows with time and numerically, the way I’ve written the code, it has no limit but physically it cannot surpass a saturation concentration Cp. Is there a way to set a maximum to the function? I do not know how to translate this to the code or even where I can add this condition.I would like a code that sets w(0,t)=Cp whenever, w(0,t) ≥Cp
Thanks
  댓글 수: 12
FM
FM 2018년 3월 9일
Sorry to bother you again Torsten but I have a problem when I try to launch pdepe twice in a same matlab file. I launch it once with the first boundary conditions and then when the concentration reaches Cp I launch it again but with the new boundary conditions. However it stops at the first launch. If I run my code directly on the command window it works fine, (it runs pdepe twice) so I don't think there is a problem with my code. Do you know why this happens?
Thank you in advance
Torsten
Torsten 2018년 3월 9일
Please show your code.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by