I am trying to minimize the following integral
$$A(x)=\frac{1}{T}\int_0^T\left(\dfrac{\partial h}{\partial t}+U\dfrac{\partial h}{\partial x}\right)^2dt.$$
The parameter $U$ is constant and $h=h(x,t)$. So I thought that I could introduce $L=\left(\dfrac{\partial h}{\partial t}\right)^2+2U\dfrac{\partial h}{\partial t}\dfrac{\partial h}{\partial x}+U^2\left(\dfrac{\partial h}{\partial x}\right)^2$ as a Lagrangian.
I looked up the Euler-Lagrange equations for this type of problem: $$\dfrac{\partial L}{\partial h}-\dfrac{\partial}{\partial x}\left(\dfrac{\partial L}{\partial h'} \right)-\dfrac{\partial}{\partial t}\left(\dfrac{\partial L}{\partial \dot{h}} \right).$$
I use $h'=\dfrac{\partial h}{\partial x}$ and $\dot{h}=\dfrac{\partial h}{\partial t}$ to simplify notation.
Using this equation and applying it to my Lagrangian $L$ results in the follwing equation:
$$\dfrac{\partial^2 h}{\partial t^2}+2U\dfrac{\partial^2 h}{\partial x\partial t}+U^2\dfrac{\partial^2 h}{\partial x^2}=0.$$
Solving this PDE will give $h(x,t)=g(Ut-x)+xf(Ut-x)$, in which $g$ and $f$ are arbitrary functions.
Is my procedure correct (solution of PDE is not important, but rather the way I set up the PDE)?
It seems relevant to point out that there is a shortcut, see Section 3 below. No need to deal with the second-order PDE from the Euler-Lagrange (EL) equation.
In fact more troublesome: the EL equation relies on boundary conditions (BC), which seem absent here. Without BC, the procedure/approach by OP is flawed/unjustified, cf. OP's main question in yellow (v1).
Instead it is evident from the $A$-functional, that a minimizing solution $h$ should satisfy the first-order PDE $$\frac{\partial h}{\partial t}+U\frac{\partial h}{\partial x}~=~0 ,$$ with complete solution of the form $$ h(x,t)~=~g(Ut-x). $$