Message Boards Message Boards

0
|
3685 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Divergence of numerical solution of discontinuous nonllinear ordinary ODE

Hi, I am facing troubles to solve the following 2nd order ordinary differential equation

{x'[t] == v[t],  v'[t] == 0.4 Sign[v[t]] UnitBox[v[t], x[t]] - 0.1 v[t] - x[t]}

Apparently, this is a nonlinear ODE, moreover, it contains a discontinuity (step) in both variables. I solve it numerically using

sol = NDSolve[{x'[t] == v[t], v'[t] == 0.4 Sign[v[t]] UnitBox[v[t], x[t]] - 0.1 v[t] - x[t], x[0] == 1., v[0] == 1.}, 
{v[t], x[t]}, {t, 0, 30}]

Plotting the solution using

ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 0, 30}]

I get

enter image description here

This suggests that there is a limit cycle. Indeed, this is confirmed by plotting the phase portrait by

f2 = StreamPlot[{v, 0.4` Sign[v] UnitBox[v, x] - 0.1` v - x}, {x, -2, 2}, {v, -2, 2}, StreamStyle -> LightGray];

and plotting it together with the previous solution

Show[f1, f2]

enter image description here

But now, if I set the initial conditions to inside the orbit, the solution fails

sol = NDSolve[{x'[t] == v[t], v'[t] == 0.4 Sign[v[t]] UnitBox[v[t], x[t]] - 0.1 v[t] - x[t], x[0] == 0.1., v[0] == 0.1.}, 
    {v[t], x[t]}, {t, 0, 30}]

f3 = ParametricPlot[Evaluate[{x[t], v[t]} /. sol], {t, 0, 4.1}, PlotStyle -> Red]

Show[f1, f2, f3]`

enter image description here

What can be done about it? I tried changing the solver and it did not help. I tried to insert the WhenEvent together with CrossDiscontinuity option. No way.

POSTED BY: Zdenek Hurak

I think it helps to highlight the unitbox:

Show[StreamPlot[{v, 
   0.4` Sign[v] UnitBox[v, x] - 0.1` v - x}, {x, -0.6, 0.6}, {v, -0.6,
    0.6}, StreamStyle -> LightGray, 
  Prolog -> {LightBlue, Rectangle[{-0.5, -0.5}, {0.5, 0.5}]}], f3]

Blue Box

As you can see, the blue box is the source of the trouble. The curves are smooth until they hit the box. The part where it goes wrong is a very difficult part of the box. If you look at the stream, it is directing the curve back into the edge of the box.

enter image description here

It's getting pushed back into the discontinuity basically over and over. This part probably needs some very special treatment.

POSTED BY: Sean Clarke
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