I am trying to solve numerically the diffusion equation $\partial_t P(x,t)=\partial_x^2 P(x,t)+ \partial_x V'(x)P(x,t)$. I have a potential that diverges at zero: $V(x)=4((1/x^4)-(1/x^2))$, therefore, I want to set a reflecting wall at, say xc=0.5, and solve only for x>xc.
- In the code below, you will see my unsuccessful attempt in placing thes boundary conditions.
- Since I found that I cannot use DiracDelta and HeavisideTheta functions to set my initial condition, I use instead $Pinit(x)=\exp(-(x-8)^2)/\sqrt{\pi}$, which has a negligible contribution from x<=0.
- It seems that even though, mathematically I believe I am setting a reflecting wall condition, which should not allow any flow to the region below x<xc, it seems that numerically this still happens. And eventually it make the end solution u[x,T] not normalized correctly.
How do I achieve my goal above, to solve this equation only on the positive half-plane? The following code shows a negative part for $u(x,T)$, which should not have existed, and I belive it is responcible for $\int_0^\infty u(x,T)dx\neq1$.
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"]
V[x] = ((1/x)^4 - (1/x)^2) 4;
F[x] = -4 (-(4/x^5) + 2/x^3)
x0 = 8;
Pinit[x] = Exp[-(x - x0)^2]/(Sqrt[Pi]);
T = 1000;
BoundaryCondition = 50;
mol[n_Integer, o_: "Pseudospectral"] := {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid", "MaxPoints" -> n,
"MinPoints" -> n, "DifferenceOrder" -> o}}
uval = NDSolveValue[{D[u[x, t], t] + D[F[x]*u[x, t], x] -
D[u[x, t], x, x] == 0,
u[x, 0] == Pinit[x], (D[u[x, t], x] /. x -> 0.5) == 0,
u[0.5, t] == 0}, u, {x, 0.5, BoundaryCondition}, {t, 0, T},
Method -> mol[2000, 4]];
Plot[{uval[x, T]}, {x, -5, 5}, PlotRange -> All,
PlotStyle -> {Automatic, {Thick, Dashed}}]