# Finite element method with two different Dirichlet boundary conditions

I have the problem like this $$-\triangle u = f \ \ on\ \Omega \\ u = g_1 \ \ on \ \partial \Omega_1 \\ u = g_2 \ \ on \ \partial \Omega_2$$ If we choose

$$V_1 = \{ \nu_1 \in H^1 : \nu_1 = 0 \ on\ \partial \Omega_1 \bigcup \partial \Omega_2 \} \\ V_2 = \{ \nu_2 \in H^1 : \nu_2 = g_1 \ on\ \partial \Omega_1 \ and\ \nu_2 = g_2 \ on\ \partial \Omega_2 \}$$

If $$v\ \in V_1$$ and $$u\ \in \ V_2$$, and decompose $$u$$ into three regions $$u = u_{ \Omega}+ u_ {\partial \Omega_1} + u_{\partial \Omega_2}$$, the week formulation of the problem using this definition would be

$$\int_{\Omega} \triangledown u.\triangledown \nu_1 dx = \int_{\Omega} f \nu_1 dx - \int_{\Omega} \triangledown u_{g_1}.\triangledown \nu_1 dx - \int_{\Omega} \triangledown u_{g_2}.\triangledown \nu_1 dx$$ Would the definition of basis function, particularly on boundaries be correct,i.e. forcing to be zero on two boundaries for $$V_1$$ and equal boundary values for $$V_2$$ on boundary?

Consider a 1D domain, the left and right ends are $$\partial \Omega_1$$ and $$\partial \Omega_2$$ where you specify point values of $$u$$. This is the usual, first problem in finite elements for PDEs. As long as the boundary points/segments (2D)/faces (3D) are disjoint, everything is correct if you force the solution to the desired values there and test functions to unity, generally speaking. You probably shouldn't have overlapping Dirichlet boundary sets because the underlying PDE won't be well posed, but there are problems where things can be made to work (like the stick-slip problem in fluid mechanics). These problems can have a singularity at the intersection of the boundary sets.