# CalcG Function

CalcG is the method that accurately computes the surface integral $\int_{\Delta S}{G(\vec{r},\vec{r}^{\,\prime})dS^{\,\prime}}$ where $G(\vec{r},\vec{r}^{\,\prime})=\frac{e^{-i k R}}{4\pi R}$ is Helmholtz kernel regardless of how close is the observation point $\vec{r}$ to the triangle $\Delta S$. Although this integral does not typically arise in BEM, the method is written for test purposes.

## Syntax

dcomplex CalcG(
double k,
const vec3 &ro,
const vec3 &r1,
const vec3 &r2,
const vec3 &r3
)


## Parameters

k

Type: double
The wavenumber. Comes from Helmholtz equation $\nabla^2\phi+k^2\phi=0$.

ro

Type: vector
3D coordinate of the observation point.

r1

Type: vector
The coordinate of the vertex of the triangle.

r2

Type: vector
The coordinate of the vertex of the triangle.

r3

Type: vector
The coordinate of the vertex of the triangle.

## Return Value

Type: complex
The computed value of the integral.

## Remarks

As the observation point $\vec{r}_o$ shown in Fig. [1] is closer to the triangle $\Delta S$, the special care needs to be taken in order to accurately compute the integral $\int_{\Delta S}{G(\vec{r},\vec{r}^{\,\prime})dS^{\,\prime}}$.