Taking partial derivative out of definite integral that has functions as limits I came across it in derivation of shallow water equations from Navier-Stokes equations
$\int _{-\zeta \left(t,x,y\right)}^{h\left(t,x,y\right)}\frac{\partial }{\partial x}u\left(t,x,y,z\right)dz=\frac{\partial }{\partial x}\int _{-\zeta \:\left(t,x,y\right)}^{h\left(t,x,y\right)}u\left(t,x,y,z\right)dz-u\left(t,x,y,h\right)\frac{\partial \zeta }{\partial x}-u\left(t,x,y,-\zeta \:\right)\frac{\partial h\:}{\partial x}$
How did last two terms come about? If the first term on the right side of the equation had a total derivative then it's simply a Leibniz integral rule, but the derivative is partial:
page 18 http://users.ices.utexas.edu/~arbogast/cam397/dawson_v2.pdf
page 7 https://www.whoi.edu/fileserver.do?id=52134&pt=2&p=59686
 A: There is a general formula for this:
$$\frac {\textrm d} {\textrm d x} \int \limits _{f(x)} ^{g(x)} F(u, x) \textrm d u = F \big( g(x), x \big) g'(x) - F \big( f(x), x \big) f'(x) + \int \limits _{f(x)} ^{g(x)} \frac {\partial F} {\partial x} (u, x) \textrm d u .$$
To memorize it, visualize the integral $\int \limits _{f(x)} ^{g(x)} F(u, x) \textrm d u$ as a formal product between the integration operator (that depends on $x$) and the integrand $F$ (that depends on $x$, too) and derive this formal product according to Leibniz's theorem. Of course, this is not a proof; the proof is done by considering the function
$$G(x, y, z) = \int \limits _y ^z F(u, x) \textrm d u$$
and computing its differential:
$$\textrm d G = F(z, x) \textrm d z - F(y, x) \textrm d y + \left( \int \limits _y ^z \frac {\partial F} {\partial x} (u, x) \textrm d u \right) \textrm d x .$$
Now, if you evaluate this differential for $y = f(x)$ and $z = g(x)$ (in differential geometrical terms: you pull $\textrm d G$ back onto the curve $x \mapsto \big( x, f(x), g(x) \big)$), using the fact that $\textrm d y = f'(x) \textrm d x$ and $\textrm d z = g'(x) \textrm d x$ you will obtain precisely the claimed statement.
To use this in your own problem, replace $u$ by $z$, $F(u, x)$ by $u(t, x, y, z)$ (note that $t$ and $y$ play no role here), $f(x)$ by $-\zeta (t, x, y)$, and $g(x)$ by $h(t,x,y)$.
