Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clear ["Global`*"]
- c = 0.03;
- k = 10 π;
- w = 10^7;
- h0[x_] := Exp[-x^2/0.05];
- p[t_, x_] := -D[h[t, x], {x, 2}] - c Exp[2 I k x + 2 I w t]
- eq1 = D[h[t, x], t] == 1/3 D[(h[t, x]^3 D[p[t, x], x]), x];
- TraditionalForm[eq1];
- x0 = -1.5;
- x1 = 1.5;
- con1 =
- Derivative[0, 1][h][t, x0] == D[h0[x], x] /. x -> x0;
- con2 =
- Derivative[0, 1][h][t, x1] == D[h0[x], x] /. x -> x1;
- con3 =
- Derivative[0, 3][h][t, x0] == D[h0[x], {x, 3}] /. x -> x0;
- con4 =
- Derivative[0, 3][h][t, x1] == D[h0[x], {x, 3}] /. x -> x1;
- sol = NDSolve[{eq1, h[0, x] == h0[x], con1, con2, con3, con4},
- h, {t, 0, 2.5}, {x, x0, x1} ,
- MaxSteps -> 10^5,
- Method -> {"PDEDiscretization" -> {"MethodOfLines",
- "SpatialDiscretization" -> {"TensorProductGrid",
- "MinPoints" -> 2500}}},
- PrecisionGoal -> 2, MaxStepSize -> 0.01];
- Plot[Abs[Evaluate[h[1., x] /. sol[[1, 1]]]], {x, x0, x1},
- PlotRange -> All]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement