# PETSc integration of the non linear schrodinger equation

**URL:** <https://community.freefem.org/t/petsc-integration-of-the-non-linear-schrodinger-equation/3693>\
**Category:** General Discussion\
**Created:** [January 14, 2025, 11:27am UTC](https://community.freefem.org/t/petsc-integration-of-the-non-linear-schrodinger-equation/3693 "2025-01-14T11:27:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexei](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@Alexei](https://community.freefem.org/u/Alexei)\
**Post date:** [January 14, 2025, 11:27am UTC](https://community.freefem.org/t/petsc-integration-of-the-non-linear-schrodinger-equation/3693/1 "2025-01-14T11:27:52Z")

</div>

Hoping that it can be helpful, I attach a code for parallel integration of the non-linear Schrodinger equation in a circular domain using PETSc/SLEPc.

[fiber-circle-time-SLEPc.edp](https://community.freefem.org/uploads/short-url/ilWn3NSoj1SIn5gaV7w2hTaZYsq.edp) (9.0 KB)

The code uses an implicit midpoint integrator and initializes the wavefunction to an eigenvector of the linear Schrodinger equation (or their linear combination).

Best wishes,  
Alexei

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 14, 2025, 12:22pm UTC](https://community.freefem.org/t/petsc-integration-of-the-non-linear-schrodinger-equation/3693/2 "2025-01-14T12:22:14Z")

</div>

Nice example. Just FYI, you should consider ditching the `build` macro and use `DmeshCreate()`/`MatCreate()` instead.
