1
$\begingroup$

Currently, I am studying a 2D nonlinear Schroedinger equation and searching for the fastest method. $$ \begin{equation} i \frac{\partial \psi}{\partial t} = [-\frac{1}{2} \nabla^2 + V_0(r) - i\gamma + g|\psi|^2]\psi + \Phi(r,t), \end{equation} $$ Studying the amplitude of the solution to this time-dependent equation I decided to split the $\psi$ function into two independent functions of time and coordinate: $$ \begin{equation} \psi = u(r)e^{-i\varepsilon t}, \Phi(r,t) = A(r)e^{-i\varepsilon t} \end{equation} $$ This simplification speeds up the solution program because I no longer need to simulate the evolution of the system and just observe the final result at the stationary regime. Then I obtain such equation: $$ \begin{equation} [-\frac{1}{2} \nabla^2 + V_0(r) - i\gamma - \varepsilon + g|\psi|^2]\psi + A(r) = 0 \end{equation} $$

I use Newton's method to find the solution (note that $r$ stands for $(x,y)$). Because of the 2D problem, I discretize the domain in 1024x1024 vertices. This leads to a problem of inversing (10241024)x(10241024) matrix. This task doesn't allow me to use GPU because I have low memory resources and I can't parallelise it with CPU.

At this moment a MATLAB code I have created takes way too much time (up to $2500$ seconds to converge to accuracy $10^{-9}$). So I wonder if there is a faster method I could implement to achieve the same accuracy within a smaller time.

$\endgroup$
7
  • $\begingroup$ I split my u(x,y) function on real and complex parts and using multivariate Newton's method $\endgroup$
    – Andrew
    Apr 10 at 15:55
  • 1
    $\begingroup$ Are you storing a dense or a sparse matrix? $\endgroup$ Apr 10 at 21:10
  • 2
    $\begingroup$ Newton-GMRES with a proper matrix-free implementation would likely perform the best on a problem of this size $\endgroup$
    – whpowell96
    Apr 10 at 21:26
  • $\begingroup$ How does the error develop as you do more Newton iterations? How do you compute the initial guess? Can you solve the problem on a coarser grid, extrapolate the solution to the fine grid and then polish it off with a single Newton step? Why is a parallel linear solve not possible in this context? $\endgroup$ Apr 11 at 8:28
  • $\begingroup$ @DanielShapero I store sparse matrix $\endgroup$
    – Andrew
    Apr 11 at 15:01

1 Answer 1

0
$\begingroup$

Rather than looking for a better method it's probably worth trying a faster programming language. If you do this in Julia (or C++/Fortran) you would likely see a significant speedup. Julia would be especially nice since there is a lot of libraries for doing matrix free solves.

$\endgroup$
1
  • 1
    $\begingroup$ Speed up depends on if OP is using a MATLAB function that is really just a wrapper to a lower level language library or if OP is running pure MATLAB code with for loops. $\endgroup$
    – user7257
    Apr 20 at 20:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.