QuazarTech / DG_Maxwell

Solution of Maxwell equations using Discontinuous Galerkin method.
GNU General Public License v3.0
9 stars 5 forks source link

Error in calculation of volume intgral flux #27

Open Balavarun5 opened 7 years ago

Balavarun5 commented 7 years ago

commit hash : ba250f5aebea532c0394941752f76dd37e4d1794

Issue : Error in calculation of the volume integral flux using Integrate() function.

Calculation of the volume integral flux in the code is done using an Integrate() function.

This function evaluates the integral using quadrature method by taking in the coefficients of the integrand and number of quadrature points.

The term F(u) in integrand represents the flux, when the integral is carried out using the quadrature method, F(u^n), the flux at the quadrature points needs to be calculated.

To do this, first the wave equation for an element is to be calculated and then the value of this function at the quadrature points mapped in the element needs to be calculated.

This is done by taking the amplitude at the LGL points in each element (known) and obtaining the amplitude as a function of xi by representing it as a linear combination of the Lagrange basis polynomials.

U(x) = a_i L_i(xi)

Where the coefficients a_i are the value of the function at the LGL points.

Error

The error in calculating the volume integral using this method is not trivial. https://github.com/QuazarTech/DG_Maxwell/blob/ba250f5aebea532c0394941752f76dd37e4d1794/code/unit_test/test_waveEqn.py#L209

The error of calculating the volume integral flux for an initial wave amplitude e ** (- x ** 2 / 0.4 ** 2) and Lagrange basis polynomials calculated using 8 LGL points is plotted against the number of quadrature points below.

image

Possible error

The amplitude equation e ** (- x ** 2 / 0.4 ** 2) is calculated using the Lagrange basis polynomials (polynomials of order 7).

mchandra commented 7 years ago

How are you computing the reference solution with which you are computing the error?

amanabt commented 7 years ago

I wrote a test code for finding the error between the integral image, calculated using the volume_integral_flux function and analytical integral. I used scipy.integrate.quad to calculate the analytical integral. You may find the test python notebook at this address volume_integral_error_analysis.ipynb

I experimented with varying image and image and some relationships between image and image. Below are the plots for various conditions.

image image image image image

Clearly, for the case of image the error goes below image. So, we may try to use this condition to minimise our error.