# Galerkin method + FEM - clarification for Poisson equation with mixed boundary conditions

I will be refering to this link, but I am interested in slightly easier equation:

$$-\Delta c = f, \quad (x, y) \in \Omega$$

with the following (mixed) boundary condition: \begin{aligned} 1. & \; c = g_1, \quad (x, y) \in \Gamma_1 \\ 2. & \; \frac{\partial c}{\partial n} = g_2, \quad (x, y) \in \Gamma_2 \\ 3. & \; \sigma c + \frac{\partial c}{\partial n} = g_3, \quad (x, y) \in \Gamma_3 \end{aligned} \quad \quad \Gamma = \Gamma_1 \, \cup \; \Gamma_2 \, \cup \; \Gamma_3

To my understanding the derivation goes like this: First, we multiply both sides of the equation by some test function $v$ and integrate over $\Omega$ $$\int \limits_\Omega \left( -\Delta c \right) v \, \mathrm{d} \Omega = \int \limits_\Omega f v \, \mathrm{d} \Omega$$ Then we use per partes + Gauss thm to obtain $$\int \limits_\Omega \left( \vec{\nabla} c \right) \cdot \left( \vec{\nabla} v \right) \, \mathrm{d} \Omega - \int \limits_\Gamma \frac{\partial c}{\partial n} v \: \mathrm{d} \Gamma = \int \limits_\Omega f v \, \mathrm{d} \Omega$$ Now we divide integral over $\Gamma$ to three parts $$\int \limits_\Omega \left( \vec{\nabla} c \right) \cdot \left( \vec{\nabla} v \right) \, \mathrm{d} \Omega - \int \limits_{\Gamma_1} \frac{\partial c}{\partial n} v \: \mathrm{d} \Gamma - \int \limits_{\Gamma_2} \frac{\partial c}{\partial n} v \: \mathrm{d} \Gamma - \int \limits_{\Gamma_3} \frac{\partial c}{\partial n} v \: \mathrm{d} \Gamma = \int \limits_\Omega f v \, \mathrm{d} \Omega$$

The first integral over $\Gamma_1$ obtains $c$ with essential BC, so we require $v = 0$ on $\Gamma_1$ and this integral will drop out. In the second one, Neumann BC can be directly substituted from (2.) and in the third one, Robin BC can be substituted from (3.): $$\int \limits_\Omega \left( \vec{\nabla} c \right) \cdot \left( \vec{\nabla} v \right) \, \mathrm{d} \Omega - \int \limits_{\Gamma_2} g_2 v \: \mathrm{d} \Gamma - \int \limits_{\Gamma_3} ( g_3 - \sigma c ) \, v \: \mathrm{d} \Gamma = \int \limits_\Omega f v \, \mathrm{d} \Omega$$ This is just cosmetic; we separate terms with $c$ and without $c$ $$\int \limits_\Omega \left( \vec{\nabla} c \right) \cdot \left( \vec{\nabla} v \right) \, \mathrm{d} \Omega + \int \limits_{\Gamma_3} \sigma c \, v \: \mathrm{d} \Gamma = \int \limits_\Omega f v \, \mathrm{d} \Omega + \int \limits_{\Gamma_2} g_2 v \: \mathrm{d} \Gamma + \int \limits_{\Gamma_3} g_3 v \: \mathrm{d} \Gamma$$

Now we expand the solution $c$ to piecewise (linear, quadratic, ...) basis functions: $$c(x,y) = \sum_i c_i \lambda_i (x, y) + c_0 (x, y)$$

$c_0$ is there to satisfy the essential (Dirichlet) BC: \begin{aligned} 1. & \; c0 = g_1, \quad (x, y) \in \Gamma_1 \\ 2. & \; \lambda_i = 0, \quad (x, y) \in \Gamma_1 \end{aligned}

To work out coefficients $c_i$ we take $v = \lambda_i$ (test functions are basis functions themselves): $$\int \limits_\Omega \left( \vec{\nabla} \left( \sum_j c_j \lambda_j + c_0\right) \right) \cdot \left( \vec{\nabla} \lambda_i \right) \, \mathrm{d} \Omega + \int \limits_{\Gamma_3} \sigma \left( \sum_j c_j \lambda_j + c_0 \right) \, \lambda_i \: \mathrm{d} \Gamma =\\= \int \limits_\Omega f \lambda_i \, \mathrm{d} \Omega + \int \limits_{\Gamma_2} g_2 \lambda_i \: \mathrm{d} \Gamma + \int \limits_{\Gamma_3} g_3 \lambda_i \: \mathrm{d} \Gamma$$ $$\sum_j c_j \left[ \int \limits_\Omega \left( \vec{\nabla} \lambda_j \right) \cdot \left( \vec{\nabla} \lambda_i \right) \, \mathrm{d} \Omega + \int \limits_{\Gamma_3} \sigma \lambda_j \, \lambda_i \: \mathrm{d} \Gamma \right] = \int \limits_\Omega f \, \lambda_i \, \mathrm{d} \Omega + \int \limits_{\Gamma_2} g_2 \, \lambda_i \: \mathrm{d} \Gamma + \int \limits_{\Gamma_3} g_3 \lambda_i \, \mathrm{d} \Gamma - \\- \int \limits_\Omega \left( \vec{\nabla} c_0 \right) \cdot \left( \vec{\nabla} \lambda_i \right) \, \mathrm{d} \Omega - \int \limits_{\Gamma_3} \sigma \, c_0 \, \lambda_i \: \mathrm{d} \Gamma$$

1. I know the data $g_1$ on $\Gamma_1$, however, this approach requires me to somehow "extend" this data to the whole domain along with its gradient (see the term $\int \limits_\Omega \left( \vec{\nabla} c_0 \right) \cdot \left( \vec{\nabla} \lambda_i \right) \, \mathrm{d} \Omega$ containing $c_0$). How am I supposed to know $c_0$ on whole $\Omega$?
2. In the pdf from the beginning (page 12, formula no. 22) there is the term analogous to $\int \limits_\Omega \left( \vec{\nabla} c_0 \right) \cdot \left( \vec{\nabla} \lambda_i \right) \, \mathrm{d} \Omega$, however there is no term with $c_0$ integrated over $\Gamma_3$. Is this just a typo in the pdf, or am I missing something?
3. Everyone claims that $\sigma$ in Robin BC is a positive constant. Why can't be $\sigma$ a positive function instead? I see no problem with it being a function, not just a constant - all we have to do is to treat it like every other function ($g_2$, $g_3$) that pops out under these integrals - expand it with basis functions, or if possible, obtain those definite integrals analytically. What am I missing here?