   SYLLABUS  Previous: 4.3 Aliasing, filters and  Up: 4 FOURIER TRANSFORM  Next: 4.5 Computer quiz

## 4.4 Non-linear equations.

Slide : [ Scheme - Code - Run || VIDEO login]

Combining the linear terms from advection (1.3.1#eq.1), diffusion (1.3.2#eq.1), dispersion (1.3.3#eq.1) and the non-linear wave-breaking term (1.3.4#eq.1) into a single non-linear equation, yields (1)

where the last term has been written so as to explicitly show the quadratic non-linearity. After transformation to Fourier space, all the spatial operators become algebraic and an ordinary evolution equation is obtained for each individual Fourier component (2)

It would here of course be formally possible to write the non-linear term as a convolution in K-space, but it is much easier to write and more efficient to compute the multiplication in X-space. Following the same lines as in sect.4.2, the linear terms are integrated analytically and yield a phase shift proportional to the time-step . The convolution is calculated numerically by transforming back and forth from Fourier to configuration space. A simple Euler integration (1.2.1#eq.2) in time yields the formal solution (3)

This has been implemented in JBONE using the variable keepFFT to store the current values of spectrum and the variable toolFFT for the transformation to X-space required by the convolution and the plotting. As mentioned earlier in sect.4.2, the sign of time in (4.4#eq.3) has been changed to stick to the definition of the phase factor used in Numerical Recipes .

      int N         = mesh_.size();                      //A power of 2
double boxLen = mesh_.size()*mesh_.interval(0);    //Periodicity
double   k    = 2*Math.PI/boxLen;                  //Notation
Complex ik1   = new Complex(  0.,  k  );
Complex ik2   = new Complex(-k*k,  0.  );
Complex ik3   = new Complex(  0.,-k*k*k);

Complex advection = new Complex(ik1.scale(velocity));  //Variables
Complex diffusion = new Complex(ik2.scale(diffusCo));
Complex dispersion= new Complex(ik3.scale(disperCo));

//----- Non-linear term: convolution
s  = keepFFT.getFromKSpace(FFT.bothParts,boxLen);  //Current Spectrum
toolFFT = new FFT(s,s,FFT.inKSpace);               //  for convolution

if (scheme.equals(jbone.ALIASED))                  //With-/out aliasing,
sp = toolFFT.aliasedConvolution(boxLen);         //  use an FFT to
else //scheme.equals(jbone.EXPAND)                 //  calculate product,
sp = toolFFT.expandedConvolution(boxLen);        //  FFT back to KSpace

//----- Linear terms: complex terms in spectrum s
s = keepFFT.getFromKSpace(FFT.bothParts,boxLen);   //Current Spectrum
linear= s;
sp=linear;
for (int m=1;  m<=N/2;  m++) {
exp=(total.scale(timeStep)).exp();
linear    = s[m].mul(exp);
nonlin    = sp[m].mul(ik1.scale(0.5*timeStep*(double)(m)));
sp[m  ]   = linear.add(nonlin);
if (m<N/2) sp[N-m] = sp[m].conj();               //For a real spectrum
}

keepFFT = new FFT(sp,FFT.inKSpace);                //Spectrum is complete
toolFFT = new FFT(sp,FFT.inKSpace);                //inv FFT for plotting
f=toolFFT.getFromXSpacePart(FFT.firstPart,boxLen);

Depending on the scheme selector, the convolution is either calculated without precaution (subject to aliasing) or by temporarily expanding the spectrum by padding the upper part with zeros (cures the problem).

The example below shows the evolution obtained for the Korteweg-DeVries equation, when two solitons propagate and collide through the delicate balance between the non-linear wave-breaking and dispersion.

 Numerical experiments: non-linear equations with FFT Change the switch to Aliased Convolution and observe how aliasing pollutes the spectrum with short wavelengths that evolve into a non-linear instability. Go back to the KdV equation by setting Dispersion=0.5 and try to cure the aliased scheme with a small amount of non-physical diffusion. Separate the short wavelengths (unphysical aliases) from the longer wavelengths (physical) by reducing the ICAmplitude. Is such a solution attractive?

Replace the dispersion with a small amount of diffusion by setting Dispersion=0.0 and Diffusion=0.1; evolve a Gaussian into a shock front and verify how much less aliasing seems to be an issue for the Burger equation (1.3.4#eq.2), when a diffusive process physically damps the short wavelengths... Remember however that the cascade of energy from one wavelength to another is now affected by the aliasing and is much more delicate to diagnose.

SYLLABUS  Previous: 4.3 Aliasing, filters and  Up: 4 FOURIER TRANSFORM  Next: 4.5 Computer quiz