Numerically Calculate Boundary Integrals

27 Views Asked by At

I am currently studying the boundary integral formulation for various equations. By using divergence theorem I get an integral of the form $$ \int_S \big(an_x+bn_y\big) dS, $$ where $S=\partial\Omega$ is the boundary of $\Omega$ and $n=(n_x,n_y)$ is the unit outward normal. Let $$ \Omega = \{(x,y)\in[0,1]\times[0,1]\}. $$

Now, I want to calculate this integral for given functions $a,b\colon S\to\mathbb{R}$.

Let us use an equidistant grid with grid spacing $h$. I start at $(0,0)$ and move anti-clockwise on the boundary. This yields $$ x = [0,\ h,\ \dots,\ 1-h,\ 1,\ 1,\ \dots,\ 1,\ 1,\ 1-h,\ \dots,\ h,\ 0,\ 0,\ \dots,\ 0,\ 0], $$ $$ y =[0,\ 0,\ \dots,\ 0,\ 0,\ h,\ \dots,\ 1-h,\ 1,\ 1,\ \dots,\ 1,\ 1,\ 1-h,\ \dots,\ h,\ 0]. $$ To get the value of my integral, I calculated the integrand on every grid point. That is a vector of the same length as $x$ and $y$. Then, I summed up the elements and multiplied the sum by $h$. If I am not mistaken, this is the trapezoidal rule and should be the result I am looking for.

Three questions arise:

  1. What do I do at the corners? I need the outward normal but my boundary is not smooth.
  2. If I integrate analytically, the normal at the corners does not matter because it is a single point which does not vary the value of the integral. Here, the problem is: If I split the integral into four parts, one coordinate is constant and the other is within $[0,1]$. But how do I know if zero or one is the lower limit? It will change the sign if I switch limits of integration.
  3. Is my technique correct? Unfortunately, I have nothing to verify my result.