1
$\begingroup$

Consider this initial-boundary-value problem: $$\frac{\partial u}{\partial t}=\frac{\partial^2u}{\partial x^2}+\frac{\partial^2u}{\partial y^2},\quad \Omega=(0,1)\times(0,1),\quad t>0.$$ $$u(x,0,t)=1,u(x,1,t)=0,u_x(0,y,t)=u_x(1,y,t)=0,\quad t>0$$ $$u(x,y,0)=0,\quad (x,y)\in\Omega.$$ For this code

f[t_] := Piecewise[{{0, t <= 0}, {1, t > 0}}]
NDSolveValue[{D[u[x, y, t], t] == 
   D[u[x, y, t], x, x] + D[u[x, y, t], y, y], u[x, 0, t] == f[t], 
  u[x, 1, t] == 0, Derivative[1, 0, 0][u][0, y, t] == 0, 
  Derivative[1, 0, 0][u][1, y, t] == 0, u[x, y, 0] == 0}, u, {x, 0, 
  1}, {y, 0, 1}, {t, 0, 10}]

I got error message

Encountered non-numerical value for a derivative at t == 0

Piecewise function works well on my other code. I don't know how to fix this one.

$\endgroup$
  • $\begingroup$ Since you are only solving for t >= 0 anyways, why do you need the discontinuity in the time derivative? $\endgroup$ – Marius Ladegård Meyer Mar 5 '16 at 23:04
  • $\begingroup$ To avoid conflict with initial condition $u(x,y,0)=0$ $\endgroup$ – Sukan Mar 5 '16 at 23:12
  • $\begingroup$ I mean, does it make sense that $u$ jumps from 0 to 1 along $y=0$ as $t$ passes $t=0$...? Should it not be a derivative that makes this jump for instance? $\endgroup$ – Marius Ladegård Meyer Mar 5 '16 at 23:22
  • $\begingroup$ My best answer is: I cannot change the problem $\endgroup$ – Sukan Mar 5 '16 at 23:24
  • $\begingroup$ Ok. Is the second condition on $u$ supposed to be $u(x,1,t)=0$ instead of $u(0,1,t)$? $\endgroup$ – Marius Ladegård Meyer Mar 5 '16 at 23:28
4
$\begingroup$

The problem is actually 1-dimensional. Hence let us drop the dependence of u on x.

Also we choose a slightly more smooth function instead of the jump

f[t_, a_] := (a t)/(a t + 1)

The parameter "a" gives the slope at t=0 which can be chosen arbitrarily steep.

The problem is then numerically solved by

With[{a = 10}, 
 soly = NDSolveValue[{Derivative[0, 1][u][y, t] == 
     Derivative[2, 0][u][y, t], u[0, t] == f[t, a], u[1, t] == 0, 
    u[y, 0] == 0}, u, 
       {y, 0, 1}, {t, 0, 10}]];

Plotting it

Plot3D[soly[y, t], {y, 0, 1}, {t, 0, 5}, AxesLabel -> {"y", "t"}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.