1
$\begingroup$

I am trying to solve a simple damped wave equation with transparent boundary conditions with triangular shaped piecewise function as my initial condition. I understand that there are issues with this initial condition because it is not differentiable at the center and at the two vertices of the triangular wave pulse.

Is there anyway to get around this? Also using the same approach, I want to then use a square wave using the same approach.

Here is my code:

interpolatingFunctLinear[initalPulseFunction_, xBoundLow_, xBoundHigh_,           
timeBound_] :=   First[
pdeY = D[Y[x, t], t, t] + .04 D[Y[x, t], t] == D[Y[x, t], x, x];
solnDerivativeY = 
NDSolve[{pdeY, Y[x, 0] == initalPulseFunction, 
  Derivative[0, 1][Y][x, 0] == 0, 
  Derivative[1, 0][Y][xBoundLow, t] == 
  Derivative[0, 1][Y][xBoundLow, t], 
  Derivative[1, 0][Y][xBoundHigh, t] == -Derivative[0, 1][Y][xBoundHigh, t]}, Y, 
  {x, xBoundLow, xBoundHigh}, {t, 0,    timeBound }]]

f[x_] :=  Piecewise[{{1 - 0.118941 Abs[x] , Abs[x] < 8.40749}, 
 {0, Abs[x] >= 8.40749}}]

interpolatingFunctLinear[f[x], -200, 200, 300]

Manipulate[ Show[Plot[
Evaluate[{Y[x, t] /. solnDerivativeY} /. t -> \[Tau]], {x, -200, 
200}, PlotRange -> {{-200, 200}, {0, 1.1}}]], {\[Tau], 0, 300}]

Mathematica evaluates this NDSolve indefinitely, and gets "NDSolve::mxsst: Using maximum number of grid points 10000 allowed by the MaxPoints or MinStepSize options for independent variable x" error.
I want to know if I can resolve this IC issue. Thank You!!

$\endgroup$
  • 1
    $\begingroup$ The docs suggest trying out a smaller grid and seeing if the solution is accurate: Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MaxPoints" -> 101}}. $\endgroup$ – Michael E2 Sep 22 '14 at 16:12
  • $\begingroup$ It is now fixed. Thank You again @Michael E2 ! $\endgroup$ – soccerboyz9341 Sep 22 '14 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.