2
$\begingroup$

The aim is to plot the solution of a PDE with initial value along with its characteristics and initial value.

$x u_x - y u_y = 0$ on the line $x=y=u=t$, i.e. $u(t,t)=t$ $(t > 0)$.

Then the general solution is given by $u(x,y) = \Phi(xy)$, on the line by $u_p(x,y) = \sqrt{xy}$.

First I define the solution of the PDE by

In[1]:= sol7212a = DSolve[{x*D[u[x, y], x] - y*D[u[x, y], y] == 0}, u, {x, y}]

Out[1]= {{u -> Function[{x, y}, C[1][x y]]}}

and then the plot.

In[2]:= Show[
  Plot3D[

Evaluate[u[x, y] /. sol7212a /. {C[1][t_] -> Sqrt[t]}[[1]]], {x, -4, 
4}, {y, -4, 4}, Mesh -> True, 
ColorFunction -> (ColorData["LakeColors"][#3] &)], 
 ParametricPlot3D[{t, t, t}, {t, -4, 4}, PlotStyle -> Cyan], 
 Evaluate[
Table[ContourPlot3D[{z == Sqrt[x*y], x* y == C}, {x, -4, 4}, {y, -4, 
4}, {z, -4, 4}, Contours -> {0}, ContourStyle -> Opacity[0], Mesh -> None, 
BoundaryStyle -> {1 -> None, 2 -> None, {1, 2} -> {{Green, Tube[.03]}}}, Boxed -> False], {C, 1, 10, 1}] ], LabelStyle -> (FontFamily -> "Museo Sans"), Boxed -> False]

This produces the desired result.

Plot

Thus, the first Evaluate[] draws the solution surface of the PDE and ParametricPlot3D[] the line $(t,t,t)$. The second Evaluate[] calculates the characteristics for constants 1,2,...,10.

But the ContourPlot3D command is very slow. I am not even able to resize or turn the produced image. Is there a better way to implement the characteristics?

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ – bbgodfrey Jul 10 '15 at 15:47
1
$\begingroup$

The problem seems to be the ContourStyle option. After changing

ContourStyle -> Opacity[0]

to

ContourStyle -> None

the plot is generated normally and in a fraction of time. The result can be manipulated and exported normally as well.

Thanks, wueb.

$\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.