Message Boards Message Boards

How to solve a PDE for an pool discharge?

Posted 2 years ago

Hello dear community,

I want to solve a partial differential equation that has a negative value only in the center of the area. the initial condition is that all space is equal to 1 at t = 0. The 2 edge conditions are that they are constant and equal to 1 at all times, but the other 2 edge conditions must be that the second derivative is equal to zero.

This is the code I am testing. giving me an error due to the derivative I use for the boundary conditions. How can I correctly include this condition for the edge?

a=2;
Sol = NDSolveValue[
   {D[h[t, x, y], t] == (D[h[t, x, y], x, x] + D[h[t, x, y], y, y]) - If[x == 0 && y == 0, a, 0],
    h[0, x, y] == 1,
    h[t, -1, y] == 1,
    h[t, 1, y] == 1,
    D[h[t, x, y], x, x] == 0 /. y -> -1,
    D[h[t, x, y], x, x] == 0 /. y -> +1
    },
   h, {t, 0, 2000}, {x, -1, 1}, {y, -1, 1}
   ];

Kind regards.

POSTED BY: Gonzalo Quezada
3 Replies

And here is a 2D-example. It runs (at least on my machine) quite long

dd = .1;
cc = 1;
ee = 25.;
f1 = f[x, y, t];
sol = NDSolve[
    {
     D[f1, t] == 
      dd ( D[f1, x, x] + D[f1, y, y]) - cc Exp[-ee (x^2 + y^2)], 
     D[f1, x] == 0 /. x -> -1,
     D[f1, x] == 0 /. x -> 1,
     D[f1, y] == 0 /. y -> -1,
     D[f1, y] == 0 /. y -> 1,
     f[x, y, 0] == 1
     },
    f,
    {x, -1, 1}, {y, -1, 1},
    {t, 0, 15}][[1, 1]];
ff = f /. sol;
Manipulate[
 Plot3D[ff[x, y, t], {x, -1, 1}, {y, -1, 1}, PlotRange -> {0, 1.1}, 
  PlotStyle -> Opacity[.5]], {t, 0, 15}]
POSTED BY: Hans Dolhaine

Yes dear Hans, your 1-dimensional solution has helped me understand the problem. Thanks a lot.

POSTED BY: Gonzalo Quezada

Hello Gonzalo. What do you want to describe? I assume a square basin of water with a sink in the middle?

Here is a one-dimensional attempt as a first step:

dd = .1;
cc = 1;
ee = 25.;
sol = NDSolve[
    {
     D[f[x, t], t] == dd D[f[x, t], x, x] - cc Exp[-ee x^2],
     D[f[x, t], x] == 0 /. x -> -1,
     D[f[x, t], x] == 0 /. x -> 1,
     f[x, 0] == 1
     },
    f,
    {x, -1, 1},
    {t, 0, 15}
    ][[1, 1]];
ff = f /. sol;
Manipulate[
 Plot[
  {1 - cc Exp[-ee x^2], ff[x, t]}, {x, -1, 1}, PlotRange -> {0, 1.1}],
 {t, 0, 15}
 ]
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract