# Plotting PDE Solution With Changing Parameter

I have a Fokker-Plank equation I'm trying to solve the Fokker-Planck equation

$$\frac{\partial p}{\partial L}(L, \eta)= \frac{1}{L_{loc}}\frac{\partial}{\partial \eta}\left[\left(\eta^{2}-1\right) \frac{\partial p}{\partial \eta}(L, \eta)\right], \quad \eta>1$$

with initial condition

$$p(L=0, \eta)=\delta(\eta-1).$$ which I'm integrating via

n = 2000;
FPE = D[P[LL, eta], LL] - (1/LLoc)*
D[(eta^2 - 1) D[P[LL, eta], eta], eta]
s = Quiet@
NDSolve[{FPE == 0, P[0, eta] == D[Tanh[n (eta - 1)], eta]},
P, {LL, 0, 30}, {eta, 1, 30}][[1]]
(*Plot hypersurface*)
Plot3D[
Evaluate[P[LL, eta] /. s], {LL, 0, 2}, {eta, 1.01, 1.2},
PlotPoints -> 100, PlotRange -> All, ImageSize -> 500,
AxesLabel -> {L, \[Eta], P}, AxesStyle -> 40, Boxed -> True,
TicksStyle -> 20, PlotTheme -> "Classic"]


which outputs

However, I now want to integrate the PDE when I have the equation $$\frac{\partial p}{\partial L}(L, \eta)= \kappa^2\frac{\partial}{\partial \eta}\left[\left(\eta^{2}-1\right) \frac{\partial p}{\partial \eta}(L, \eta)\right], \quad \eta>1$$

with initial condition

$$p(L=0, \eta)=\delta(\eta-1).$$

I want to plot how the solution changes for a fixed $$\eta,L$$ whilst changing $$\kappa.$$ I tried the following

n = 2000;
FPE = D[P[LL, eta], LL] - (kappa^2)*
D[(eta^2 - 1) D[P[LL, eta], eta], eta]
s = ParametricNDSolveValue[{FPE == 0,
P[0, eta] == D[Tanh[n (eta - 1)], eta]},
P, {LL, 0, 30}, {eta, 1, 30}, {kappa}]


which outputs

s[2][2, 2]
0.00425929


so I know that it runs. I try to plot via

Plot[s[kappa][2, 2], {kappa, 1, 1.1}]


but the code just takes an eternity to compute on my laptop. Could anyone help me in this seemingly easy task? P.S don't worry about the error messages. The solution behaves as expected. Thanks.

• You could build a table of values at the granularity you need (e.g. data = Table[{k, s[k][2, 2]}, {k, 4, 5, 1/10}];) and then use ListPlot or ListLogPlot to build a plot from those points (ListLogPlot[data, PlotRange -> All, Joined -> True]). However, given the repeated warnings from NDSolve, and the extreme range of values returned, I wonder if the solution is any good. – MarcoB Jan 7 at 16:49
• If you introduce a new variale u=L kappa^2 and p[L,eta]==P[u,eta] the new pde doesn't depend on kappa anymore and you have to execute NDSolve only once! – Ulrich Neumann Jan 8 at 11:03