I'm trying to solve the 1D Schrödinger equation subjected to an absorbing condition using NDSolve but cannot seem to set up the absorbing condition...

My problem is defined on the positive $z$-axis for the function $f(z)$. At $z=0$, I put $f(0,t)=0$. At $z=z_{\text{Max}}$, the absorbing condition reads $f'(z_{\text{Max}},t)=-i f(z_{\text{Max}},t)$. At $t=0$, my function is a Gaussian centered at $z=z_{\text{Max}}/2$ (for instance...). So $f(z,0)=\exp[-(z-z_{\text{Max}}/2)^2]$.

My code is

NDSolveValue[{I*D[f[z,t],{t}] + D[f[z,t],{z,2}] == NeumanValue[-I*f[z,t],z==zMax], f[z,0]==gz[z], f[0,t]==0}, f, {z,0,zMax}, {t,0,tMax}, , Method -> {"PDEDiscretization" -> {"MethodOfLines", 
"SpatialDiscretization" -> {"TensorProductGrid", 
  "MinPoints" -> 100, "MaxPoints" -> 1000, 
  "DifferenceOrder" -> 4}}}]

for which I receive an error

NDSolveValue::ndnum: Encountered non-numerical value for a derivative at t == 0.`.

I'm quite sure that I do not use NeumannValue[] correctly but cannot figure it out...

Thanks in advance for any help.

  • 1
    $\begingroup$ NeumanValue should be NeumannValue. Also, please specify a value for zMax and the function gz[z] so that we can attempt to run your code. $\endgroup$
    – march
    Feb 13, 2020 at 16:43
  • $\begingroup$ NeumannValue does not work with the TensorProductGrid method. Either specify the NeumannVaue as a derivative (like shown here) or use the FiniteElement Method. $\endgroup$
    – user21
    Feb 14, 2020 at 6:59
  • $\begingroup$ Thank you for your comments. Indeed, I was able to make my code run using a boundary condition Derivative[1,0][f][zMax,t]==-I*f[zMax,t] instead of using NeumannValue[]. $\endgroup$
    – coussin
    Feb 14, 2020 at 9:34
  • $\begingroup$ Can you please post the final working code? Thanks. $\endgroup$ Apr 30, 2023 at 0:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.