1

I tried to NDSolve the PDE system $$\partial_t w =x\cdot w\quad\quad\partial_z x=w$$ for $$(t,z)\in[0,1]\times[0,\pi]$$ with boundary conditions $$x(t,0)=w(t,0)=w(t,\pi)=0$$ and initial conditions $$w(0,z)=\sin z\quad\quad x(0,z)=1-\cos z$$ Here's my code:

s = NDSolve[{D[w[t, z], t] == w[t, z]*x[t, z], 
   D[x[t, z], z] == w[t, z], w[0, z] == Sin[z], x[0, z] == 1 - Cos[z],
    w[t, 0] == 0, w[t, π] == 0, x[t, 0] == 0}, {w , x}, {t, 0, 
   1}, {z, 0, π}]

Mathematica displays the following warning:

"NDSolve::mconly: For the method NDSolve`IDA, only machine real code is available. Unable to continue with complex values or beyond floating-point exceptions."

I would appreciate any help on how to overcome this error or solve numerically this kind of PDE system anyway.

1 Answers1

2

This is a quasilinear hyperbolic system of equations. Not all initial data is valid, w=0 should be excluded from the initial data. An example of solving the problem

s = NDSolve[{D[w[t, z], t] == w[t, z]*x[t, z], 
   D[x[t, z], z] == w[t, z], w[0, z] == 1, x[0, z] == 1 - Cos[z], 
   w[t, 0] == 1, w[t, \[Pi]] == 1, x[t, 0] == 0}, {w, x}, {t, 0, 
   1}, {z, 0, \[Pi]}, 
  Method -> {"MethodOfLines", 
    "SpatialDiscretization" -> {"TensorProductGrid", 
      "MinPoints" -> 80, "MaxPoints" -> 100, 
      "DifferenceOrder" -> "Pseudospectral"}}];
{ContourPlot[Evaluate[w[t, z] /. s], {t, 0, 1}, {z, 0, \[Pi]}, 
  Contours -> 20, ColorFunction -> Hue, PlotLabel -> "w", 
  FrameLabel -> {"t", "z"}, PlotLegends -> Automatic], 
 ContourPlot[Evaluate[x[t, z] /. s], {t, 0, 1}, {z, 0, \[Pi]}, 
  Contours -> 20, ColorFunction -> Hue, PlotLabel -> "x", 
  FrameLabel -> {"t", "z"}, PlotLegends -> Automatic]}

fig1

Alex Trounev
  • 44,369
  • 3
  • 48
  • 106
  • Thanks for great help! Also: how can I see that boundary condition $w(t,0)=0$ is invalid? –  Nov 27 '18 at 15:05
  • @user61386 It is necessary to bring the system to a second order equation using $x=w_t/w$ and then $x_z=w=(w_t/w)_z$ – Alex Trounev Nov 27 '18 at 15:22
  • My only problem is that with the initial conditions used above, i.e. $w(0,z)=1$ and $x(0,z)=1-\cos z$, the PDE system equation $\partial_t x =w$ seems to fail for $t=0$. –  Nov 27 '18 at 20:59
  • Sorry, where does this equation come from? – Alex Trounev Nov 27 '18 at 21:12
  • In fact it is an equation I constructed as an example problem. Costructing simple test problems is very helpfull in mathematica. Therefore the ability to costruct valid initial boundary conbitions is of vital importance. –  Nov 28 '18 at 07:06
  • So, I thought that any initial condition for $x$ should obey the condition $\partial_z x= w$. –  Nov 28 '18 at 09:10
  • 1
    Initial and boundary conditions must be consistent. – Alex Trounev Nov 28 '18 at 10:28
  • Probably I am missing something but I cannot find any inconsistency between the boundary and initial conditions I proposed. I need some help with this. –  Nov 28 '18 at 11:03
  • There is another problem. In a quasilinear hyperbolic system, discontinuous solutions are formed similar to shock waves in a compressible medium. These solutions depend on the initial conditions. – Alex Trounev Nov 28 '18 at 11:20
  • OK, thanks for valuable help and time. –  Nov 28 '18 at 12:09
  • Actually NDSolve doesn't analyse the equation system properly, the boundary condition for x isn't used at all. Try the following sample, notice I've introduced an empty function bcx: Clear[bcx]; s = NDSolve[{D[w[t, z], t] == w[t, z]*x[t, z], D[x[t, z], z] == w[t, z], w[0, z] == 1, x[0, z] == 1 - Cos[z], w[t, 0] == 1, w[t, \[Pi]] == 1, x[t, 0] == bcx[t]}, {w, x}, {t, 0, 1}, {z, 0, \[Pi]}, Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MinPoints" -> 80, "MaxPoints" -> 100, "DifferenceOrder" -> "Pseudospectral"}}]; – xzczd Jan 09 '19 at 12:30