# Solve numerically a diffusion equation with fully reflecting wall?

Posted 5 months ago
301 Views
|
0 Replies
|
0 Total Likes
|
 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 {"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}}] `