$\int_\Omega |\nabla u |^2-2u^2\sin{x} \, dx$ - first variation, natural boundary conditions and solution for I am taking calculus of variations course and I am stuck with the following problem:
I need to find first varation, Euler equation, natural boundary conditions and solution for $I[u]=\int_\Omega (|\nabla u |^2-2u^2\sin{x} )\, dx$.
First of all I am comfortable with problems like this one but for "ordinary", more straightforward functionals. E.g. I can solve the same problem if 
$I[u]=\int_0^1(y'')^2+2x\, dx + x^2(0)$ without any issues.
But I never met integrals like this - it looks like it is "ordinary" integral but it is defined on a domain $\Omega$. Moreover, we do not have any information not only about boundaries of $\Omega$, but also even about dimension of $\Omega$! I guess it is either does not depend on the dimension or if it depends on it please suppose that the dimension is 2. But still, there is no information about the boundary of $\Omega$.
I understand the general idea about first steps. We calculate the first variation by definition and use it to obtain Euler Equation and natural boundary conditions.
$$\begin{align}
0 =\frac{d}{dt}\Bigg[ I[u+th]\Bigg ]_{t=0} = \frac{d}{dt}\Bigg [\int_\Omega (|\nabla (u+th) |^2-2(u+th)^2\sin{x} )\, dx\Bigg ]_{t=0} =\\
= \frac{d}{dt}\Bigg [\int_\Omega (\sum_i{(u'_i+th'_i)^2}-2(u^2+2thu+t^2h^2)\sin{x} )\, dx\Bigg ]_{t=0} =\\
=2\cdot\int_\Omega \sum_i{u'_ih'_i}-2hu\sin{x} \, dx= -4\cdot\int_\Omega \ hu\sin{x}\, dx + 2\cdot\int_\Omega \ \sum_i{u'_ih'_i}\, dx
\end{align}$$
What one is trying do do next with an "ordinary" functional is the following:
We should represent first variation with an integral having the form $\int Eh \, dx$ (where E is Euler equation) and another terms, which have the form $h(x_j)B_j$ (where $B_j$ will give us natural boundary conditions).
In "ordinary" case at this moment we use integration by parts in order to remove terms with $h'$ and obtain everything else.
But I do see how to do it here. I guess that I have to modify the last summand $$\int_\Omega \ \sum_i{u'_ih'_i}\, dx$$ with some kind of multidimensional integration by parts, but I do not see how to do it. Moreover, I do not see how to solve the problem because I do not see the form of Euler equation and natural boundary conditions. I do not even feel sure the solution (by "solution" I mean explicit form of $u$) can be found.
Please help me to understand this.
Thanks a lot for your time and help!
Update:
Gio67 advised to use Divergence theorem
I can move forward a bit:
$$\begin{align}
= -2\cdot\int_\Omega \ h(2u\sin{x} + \Delta u)\, dx + 2\cdot\int_{\partial\Omega} \ h\sum_i{u'_i\nu_i}\, ds
\end{align}$$
Can you please advice what to do with the last summand and how to get Euler equation and natural boundary conditions?
 A: In higher dimensions you generally need to apply the divergence theorem, which gives you integration by parts
$$\int_\Omega g\frac{\partial h}{\partial x_i} dx=-\int_\Omega  \frac{\partial g}{\partial x_i}h\, dx+\int_{\partial\Omega}hg\nu_i\,dS,$$
where $\nu_i$ is the $i$-th component of the outward normal.
In your case $g=\frac{\partial u}{\partial x_i}$ so you get
$$\int_\Omega \sum_i\frac{\partial u}{\partial x_i}\frac{\partial h}{\partial x_i}dx=-\int_\Omega \sum_i\frac{\partial^2 u}{\partial x_i^2} h\, dx+\int_{\partial\Omega}h \sum_i \frac{\partial u}{\partial x_i}\nu_i\,dS.$$
Note that $\sum_i\frac{\partial^2 u}{\partial x_i^2}$ is the Laplacian $\Delta u$ of $u$ and $\sum_i \frac{\partial u}{\partial x_i}\nu_i=\frac{\partial u}{\partial \nu}$ which is the normal derivative.
Edit In your case though you are in one dimension since otherwise $\sin x$ would not make sense, so you get, assuming $\Omega=(a,b)$
$$0=\int_\Omega h(-2u^{\prime\prime}-4u\sin x)dx+ h(b)u^{\prime}(b)-h(a)u^{\prime}(a)$$
for every regular $h$. The first part will give you the Euler equation $-2u^{\prime\prime}-4u\sin x=0$ in $\Omega$, the second will give you the natural boundary condition $u^{\prime}(a)=u^{\prime}(b)=0$. 
