I'm studying a PDE which roughly models a rope subjected to driving on one end. The coordinate $v$ is related to physical time $t$ via the relation $v=t-x$. I'd like to solve the initial value problem using the method of lines. The following Mathematica code returns a solution, but the accuracy is rather low. Passing the WorkingPrecision option to NDSolveValue throws the following error:
The initialization of the method NDSolve`StateSpace failed
How can one systematically improve the solution accuracy?
Clear["Global`*"]
vmax = 10;
f[v_] := Sin[v]^2;
method := {
"MethodOfLines",
"TemporalVariable" -> v,
"SpatialDiscretization" -> {
"TensorProductGrid",
"DifferenceOrder" -> "Pseudospectral", MaxPoints -> 100}};
{timing, uinterp} = Timing@NDSolveValue[{
2 Derivative[1, 1][u][x, v] == Derivative[2, 0][u][x, v],
u[x, 0] == 0,
u[0, v] == f[v],
u[1, v] == 0}
, u, {x, 0, 1}, {v, 0, vmax}, Method -> method, MaxStepSize -> 0.1]
Animate[Plot[If[x < t, uinterp[x, t - x], 0], {x, 0, 1}, PlotRange -> {-1, 1.1}, AxesLabel -> {x, u}], {t, 0, vmax}]


[u][x, v]whenvis supposed to be time? Why not use normal notation and usetthere, just like you did when you definedf[t_]? Also in the plot you changed tot. ofcourse the computer does not care what letter you use, but it makes your code confusing to read. – Nasser Dec 02 '23 at 16:26NDSolveValue[{2 Derivative[1,1][u][x,v]==Derivative[2,0][u][x,v],u[x,0]==0,u[0,v]==f[v],u[1,v]==0},u,{x,0,1},{v,0,T}]– Nasser Dec 02 '23 at 16:30