Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. Clear ["Global`*"]
  2. c = 0.03;
  3. k = 10 π;
  4. w = 10^7;
  5. h0[x_] := Exp[-x^2/0.05];
  6. p[t_, x_] := -D[h[t, x], {x, 2}] - c Exp[2 I k x + 2 I w t]
  7. eq1 = D[h[t, x], t] == 1/3 D[(h[t, x]^3 D[p[t, x], x]), x];
  8. TraditionalForm[eq1];
  9. x0 = -1.5;
  10. x1 = 1.5;
  11. con1 =
  12. Derivative[0, 1][h][t, x0] == D[h0[x], x] /. x -> x0;
  13. con2 =
  14. Derivative[0, 1][h][t, x1] == D[h0[x], x] /. x -> x1;
  15. con3 =
  16. Derivative[0, 3][h][t, x0] == D[h0[x], {x, 3}] /. x -> x0;
  17. con4 =
  18. Derivative[0, 3][h][t, x1] == D[h0[x], {x, 3}] /. x -> x1;
  19.  
  20. sol = NDSolve[{eq1, h[0, x] == h0[x], con1, con2, con3, con4},
  21. h, {t, 0, 2.5}, {x, x0, x1} ,
  22. MaxSteps -> 10^5,
  23. Method -> {"PDEDiscretization" -> {"MethodOfLines",
  24. "SpatialDiscretization" -> {"TensorProductGrid",
  25. "MinPoints" -> 2500}}},
  26. PrecisionGoal -> 2, MaxStepSize -> 0.01];
  27. Plot[Abs[Evaluate[h[1., x] /. sol[[1, 1]]]], {x, x0, x1},
  28. PlotRange -> All]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement