SPMODEL: A Series of Hierarchical Spectral Models for GFD << Prev | Index| Next >>

5.1. The KdV equation in a one-dimensional cyclic domain

This is an example of a numerical calculation for two soliton solutions with different amplitudes passing through each other. The governing equation and the module employed have been already shown in Section 4. We present them again below for the reader's convenience. Readers are referred to [6] and [7] for the Korteweg-deVries equation and its analytical solution.

The first equation is the governing equation, i.e., the Korteweg-deVries equation, the second equation is the initial condition, where U1, x1, U2, x2 denote the amplitudes and the positions of the centers of the two soliton solutions, respectively.

The resultant program source code is given as kdv1.f90. In the program source code, the initial condition is written as:

g_Zeta= U1*sech((g_X-X1)/sqrt(12/u1))**2 &
        + U2*sech((g_X-X2)/sqrt(12/u2))**2 

The time integration is performed with the leap-frog scheme:

do it=1,nt
    e_Zeta = e_Zeta0 + 2*dt * & 
            ( -e_g(g_e(e_Zeta1)*g_e(e_Dx_e(e_Zeta1))) &
              - e_Dx_e(e_Dx_e(e_Dx_e(e_Zeta1)))  )
    e_Zeta0=e_Zeta1 ; e_Zeta1=e_Zeta
    ...
enddo

Note that the initial condition is also requires only a single statement when the array operation features of Fortran90 are used.


[animation]

SPMODEL: A Series of Hierarchical Spectral Models for GFD << Prev | Index| Next >>