1
$\begingroup$

Hello I have the following PDE, $$Pe\left(\frac{\partial z}{\partial x}+\frac{\partial z}{\partial y}\right)=\frac{\partial^2 z}{\partial x^2}+\frac{\partial^2 z}{\partial y^2}$$ and I am trying to solve it in Mathematica. In my case $Pe=2$.

Here is a snippet of the notepad I am using.

pde = 2 D[z[x, y], x] + 2 D[z[x, y], y] ==  D[D[z[x, y], x], x] + D[D[z[x, y], y], y]
bc1 = z[0, y] == 0
bc2 = z[1, y] == 1
bc3 = D[z[x, y], y] == 0 /. y -> 0
bc4 = D[z[x, y], y] == 0 /. y -> 1
DSolve[{pde, bc1, bc2, bc3, bc4}, z[x, y], {x, y}]

Mathematica is not giving me a solution so I must be messing something up. I'm only interested in getting a symbolic solution to the PDE if possible. Thanks in advance.

$\endgroup$
  • 4
    $\begingroup$ You are not messing anything up - DSolve does not know the solution. $\endgroup$ – user21 Feb 8 '17 at 7:54
6
$\begingroup$

When all else fails, try FEM

pde = 2 D[z[x, y], x] +2 D[z[x, y], y] -D[D[z[x, y], x], x]+D[D[z[x, y], y], y];
bc1 = DirichletCondition[z[x, y] == 0, x == 0];
bc2 = DirichletCondition[z[x, y] == 1, x == 1];
bc3 = NeumannValue[0, y == 0];
bc4 = NeumannValue[0, y == 1];
sol = NDSolveValue[{pde == bc3 + bc4, bc1, bc2}, z, {x, 0, 1}, {y, 0, 1}, 
   Method -> {"FiniteElement",
             "MeshOptions" -> {"BoundaryMeshGenerator" -> "Continuation"}}];

Plot3D[sol[x, y], {x, 0, 1}, {y, 0, 1}, Mesh -> All, 
  AxesLabel -> {"x", "y", "z[x,y]"}, BaseStyle -> 14, ImageSize -> 400]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thanks! Under Method, is it possible to use other options besides FEM? And is there any way to get an expression from Mathematica? $\endgroup$ – WnGatRC456 Feb 8 '17 at 11:18
  • 1
    $\begingroup$ @NWernerC456, no FEM is the only option for stationary (elliptic) PDEs. The interpolating function is an expression; though I suspect you are looking for an analytical solution, which NDSolve does not give. As a side note, the NeumannValues are not necessary. Neumann zero is the default. $\endgroup$ – user21 Feb 8 '17 at 13:27
  • $\begingroup$ @user21, Ok well if I can't use anything but FEM that should be fine but can I still get the data points at each node in a NxN mesh to plot in MATLAB? I'm trying to compare my numerical results to this analytic result. $\endgroup$ – WnGatRC456 Feb 8 '17 at 14:18
  • 1
    $\begingroup$ @NWernerC456, NDSolve does not generate a analytic result. Just evaluate the interpolating function at the nodes. $\endgroup$ – user21 Feb 8 '17 at 15:02
  • $\begingroup$ @user21, OK but how do I get the interpolating function? $\endgroup$ – WnGatRC456 Feb 8 '17 at 15:11

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.