This is an example usage of the dg_maxwell library to
find the time_evolution of the wave equation.
The 1D wave equation needs the following parameters to find the time evolution of the wave equation. You may find the parameters in the dg_maxwell/params.py file. Below is the list of the parameters you need to set before you run the program.
| Variable | Description |
|---|---|
| x_nodes | The domain of the wave function. |
| N_LGL | The number of LGL points into which an element is split. |
| N_Elements | Number of elements the domain is to be divided into. |
| scheme | The scheme to be used for integration. Values are either |
| 'gauss_quadrature' or 'lobatto_quadrature' | |
| volume_integral_scheme | The scheme to integrate the volume integral flux |
| N_quad | The number quadrature points to be used for integration. |
| c | Wave speed. |
| total_time | The total time for which the wave is to be evolved by the simulation. |
| c_lax | The c_lax to be used in the Lax-Friedrichs flux. |
You will also have to change the arrayfire backend you want to use in all the files where the function arrayfire.set_backend(< backend >) is being used. You may choose from the following three backends:
Caution: If you change the backend, make sure to change the backend in every file. Failing to do so may result in unexpected errors.
The time evolution of the wave will be stored in the results/1D_Wave_images directory.
To create a video from the images on Ubuntu16.04, follow these steps
sudo apt-get install ffmpeg
cd results/1D_Wave_images
ffmpeg -f image2 -i %04d.png -vcodec mpeg4 -mbd rd -trellis 2 -cmp 2 -g 300 -pass 1 -r 25 -b 18000000 movie.mp4
This will store your video in results/1D_Wave_images/movie.mp4.
In [1]:
import os
import sys
sys.path.insert(0, os.path.abspath('../'))
from dg_maxwell import wave_equation
In [2]:
wave_equation.time_evolution()
In [ ]: