Message Boards Message Boards

0
|
2721 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

[?] Use NDSolve to solve three dimensional (t,x,y,) pde?

Posted 6 years ago

Consider the following code:

Clear[x, t, xMin, xMax, TMax, yMin, yMax];
        TMax = 3.73; xMin = -Sqrt[2] Pi; xMax = -xMin; yMin = -Sqrt[
            2] Pi; yMax = -yMin;
        eqn = D[h[t, x, y], 
            t] == -Div[Grad[h[t, x, y], {x, y}]/h[t, x, y], {x, y}] - 
            Div[Grad[Laplacian[h[t, x, y], {x, y}], {x, y}]*h[t, x, y]^3, {x, 
              y}];
        bcs = {h[0, x, y] == 1 - 0.1 Cos[Sqrt[2]/2*Sqrt[x^2 + y^2]], 
           h[t, x, yMin] == h[t, x, yMax], h[t, xMin, y] == h[t, xMax, y]};
        hsol = NDSolveValue[{eqn, bcs}, 
          h[t, x, y], {t, 0, TMax}, {x, xMin, xMax}, {y, yMin, yMax}]

The above code can be run but show no results when I try to plot it using Plot3D,like: Plot3D[hsol[0, x, y], {x, xMin, xMax}, {y, yMin, yMax}, PlotRange -> All]. Does anyone can help me with this? Thanks a lot.

POSTED BY: Yixin Zhang
2 Replies

There is an inconsistency between the structure of hsol and the way you use it. Try it either this way:

hsol = NDSolveValue[{eqn, bcs}, 
  h, {t, 0, TMax}, {x, xMin, xMax}, {y, yMin, yMax}]

or this way:

hsol2[t_, x_, y_] = 
 NDSolveValue[{eqn, bcs}, 
  h[t, x, y], {t, 0, TMax}, {x, xMin, xMax}, {y, yMin, yMax}]
POSTED BY: Gianluca Gorni
Posted 6 years ago

Thanks a lot. It works after your suggestion.

POSTED BY: Yixin Zhang
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