Stack overflow and finite difference method

I am facing stack overflow error when I am trying to solve numerically the fractional nonlinear Schrödinger equation using finite difference method in python.

This nonlinear partial differential equation (PDE) models how the envelope and phase of light pulse changes when propagating through a single mode optical fiber, when taking power attenuation ($alpha$), group velocity dispersion ($beta_2$)and waveguide nonlinearity ($gamma$) causing self-phase modulation (SPM) into account.

The complete error code can be found here:

c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:82: RuntimeWarning: overflow encountered in multiply
  return - 1j * fiber.gamma * getPower(pulseVector) * pulseVector
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:108: RuntimeWarning: invalid value encountered in multiply
  K2 = (fiber.dz)**alpha * RightHandSide(fiber,sim, pulseVector + a11 * K1)
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:73: RuntimeWarning: overflow encountered in divide
  return ddy / (sim.time_step ** 2)
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:79: RuntimeWarning: invalid value encountered in multiply
  return 1j * fiber.beta2 / 2 * SecondTimeDerivative(sim,pulseVector)
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:24: RuntimeWarning: overflow encountered in square
  return np.abs(amplitude) ** 2
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:82: RuntimeWarning: invalid value encountered in multiply
  return - 1j * fiber.gamma * getPower(pulseVector) * pulseVector
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:109: RuntimeWarning: invalid value encountered in multiply
  K3 = (fiber.dz)**alpha * RightHandSide(fiber,sim, pulseVector + a22 * K2 + a21 * K1)
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:107: RuntimeWarning: invalid value encountered in multiply
  K1 = (fiber.dz)**alpha * RightHandSide(fiber,sim, pulseVector)
c:UsersBalazsDesktopkutatásfractional nonlinear Schrödinger equationsimulation_v1.7functions.py:111: RuntimeWarning: invalid value encountered in multiply
  return pulseVector + w1 * K1 + w2 * K2 + w3 * K3

My full code can be found here.

The another problem is that, I cannot set the plotting functions, since I am unable getting the solution.

Before using the finite difference method, I have successfully solved numerically this PDE using Split-Step Fourier method. I used SI units. The time step was 0.01 femtosecond, the spatial step was around 50 micron. Unfortunately I can not set the fractional integrator (or any other kind of integrator), when I am using this approach. The next step was to find another solution for my problem. Namely the finite difference method.

My naive (and first) approach was to solve numerically in the easiest way. I faced stack overflow error for the first time. I used the Euler and the fourth order Runge-Kutta integrators. I used SI units. The time step was 0.01 femtosecond, the spatial step was around 1 nm. I did not use adaptive time step. I saved the solution matrix to csv to inspect the raw data. I noticed that the numbers were growing monotonically very fast till I got inf an NAN values. This means that the solution was exploded in finite time. This happened probably because the time and/or the spatial step was too small.

My second approach was to scale the quantities into atomic units using finite difference method. I could change the units between SI and atomic. I did not use adaptive time step. Well, I got the solution in some cases, but generally it did not solve the situation.

My third approach was to solve the PDE using pseudo spectral Fourier method. I could change the units between SI and atomic. I did not use adaptive time step. Well, I got the solution in some cases, but generally it did not solve the situation.

My fourth approach was to return using the finite difference method. I realized that I can reshape the whole PDE into dimensionless form. I could change the units between SI and dimensionless. I did not use adaptive time step. I also implemented the 3-stage fractional order Runge-Kutta integrator. With the other two integrators, now the PDE can be solved without stack overflow error. However the fractional-order ingegrator I still get stack overflow error no matter how I refine the time and/or the space grid. And also the results looks strange to me, compared to the expected results.

The expected results can be found here.

I’m completely out of ideas right now. Any new approaches are welcomed.

New contributor

prior123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật