Startpage >> Main >> NonlinearSchrodingerEquation

Nonlinear Schrodinger Equation

Non linear Schrodinger equation, thanks to G. Sadaka

$$ \begin{array}{rcll} i\,\partial_t u+\alpha\, i\, -\Delta u +\lambda\,\nu(u)\cdot u& =&f & \mbox{on } \Omega=B(0,R)\subset \mathbb{C}^2\\ u(x,y,0)&=& u_0 &\mbox{on } \partial \Omega\\ u(x,y,t)&=&0 &\mbox{on } \partial \Omega\quad t>0 \end{array} $$

download example: Sadaka_Nonlinear_Schrodinger.edp or return to 2D examples

verbosity=0;
real Dx=.2, R=10.;
border C(t=0.,2.*pi){x=R*cos(t);y=R*sin(t);label=1;};
mesh Th=buildmesh(C(floor(2.*pi*R/Dx)));
fespace Vh(Th,P2);
real dt=0.01,Tf=10., lambda=-1., p=3.,alpha=0.;
Vh<complex> uh, vh, uh0=exp(-x^2-y^2-5.*1i*x), uhk=uh0, TNL, B;
varf a(u,v) = int2d(Th)(u*v*1i/dt + u*v*1i*alpha/2. + (dx(u)*dx(v) + dy(u)*dy(v))/2.) + on(1,u=0);
matrix<complex> A = a(Vh,Vh);
varf b(u,v) = int2d(Th)(uh0*v*1i/dt - uh0*v*1i*alpha/2. - (dx(uh0)*dx(v) + dy(uh0)*dy(v))/2.
 - lambda*TNL*(uhk+uh0)*v/2.) + on(1,u=0);
Vh ABSU;
int kk=0;
real[int] NORML2(floor(Tf/dt)+1);
for (real t=0.;t<=Tf;t+=dt){
    TNL=abs(uh0)^(p-1);
     for (int i=0;i<2;i++){
        B[] = b(0,Vh);
        set(A,solver=sparsesolver);
        uhk[] = A^-1*B[];
    }
    uh0[]=uhk[];
    ABSU=abs(uh0);
    NORML2[kk]=sqrt(int2d(Th)(abs(uh0)^2));        
    if ( !(kk % 10)){
        plot(ABSU,cmm="t="+t+"  ;||u||_L^2="+NORML2[kk], fill=true,value=true,dim=2);
    {
        ofstream gnufile("||u||_L2.gnu");
         for (int i=0;i<=kk;i++)
            gnufile<<i*dt<<" "<<NORML2(i)<<endl;
    }
exec("echo 'plot \"||u||_L2.gnu\" w lp \
pause 5 \
quit' | gnuplot");
    }
    kk++;
}

return to 2D examples

Page last modified on March 28, 2014, at 06:33 PM