The numerical speed of the pulse can be calculated in the Matlab Command Window using logical functions = distance travelled in the time interval dx dt >> (x(u(:,end) == max(u(:,end))) - x(u(:,1) == max(u(:,1))))/8 ans = 9.9874 The free space wave speed is = 10 a.u. and is its value agrees with the v numerical wave speed = (9.99 0.02) a.u. vn Boundary Conditions We can use the Gaussian pulse to investigate the behaviour of the pulse for different boundary conditions. The same boundary conditions apply at each time step for = 1 to = nt nt Nt -1 Dirichlet boundary conditions = 0 u(boundary) u(1, nt+1) = 0; % Fixed end u(Nx, nt+1) = 0; % Fixed end boundary conditions Neumann u(Nx,nt+1) = u(Nx-1,nt+1); % Free end u(1,nt+1) = u(2,nt+1); % Free end Absorbing boundary conditions ABC Using the magic time step, it takes one time step for the wave to propagate from one grid position to the next. Hence, to apply absorbing boundary conditions at the ends of the simulation space, the values of the wavefunction at the boundaries are set to the adjacent wavefunction values one time step earlier. u(Nx,nt+1) = u(Nx-1,nt); % ABC u(1,nt+1) = u(2,nt); % ABC Figures 5 and 6 show the graphical output for a number of simulations of a pulse being reflected from the boundaries of the simulation region. Fig. 5. A Gaussian reflected a fixed end termination
The numerical speed of the pulse can be calculated in the Matlab Command Window using logical functions dx = distance travelled in the time interval dt >> (x(u(:,end) == max(u(:,end))) - x(u(:,1) == max(u(:,1))))/8 ans = 9.9874 The free space wave speed is v = 10 a.u. and is its value agrees with the numerical wave speed vn = (9.99 0.02) a.u. Boundary Conditions We can use the Gaussian pulse to investigate the behaviour of the pulse for different boundary conditions. The same boundary conditions apply at each time step for nt = 1 to nt = Nt -1 Dirichlet boundary conditions u(boundary) = 0 u(1, nt+1) = 0; % Fixed end u(Nx, nt+1) = 0; % Fixed end Neumann boundary conditions u(Nx,nt+1) = u(Nx-1,nt+1); % Free end u(1,nt+1) = u(2,nt+1); % Free end Absorbing boundary conditions ABC Using the magic time step, it takes one time step for the wave to propagate from one grid position to the next. Hence, to apply absorbing boundary conditions at the ends of the simulation space, the values of the wavefunction at the boundaries are set to the adjacent wavefunction values one time step earlier. u(Nx,nt+1) = u(Nx-1,nt); % ABC u(1,nt+1) = u(2,nt); % ABC Figures 5 and 6 show the graphical output for a number of simulations of a pulse being reflected from the boundaries of the simulation region. Fig. 5. A Gaussian reflected a fixed end termination
em_swe.docx