Continuum limit of Euler-Lagrange equation for Lagrangian density of 1D harmonic lattice I'm trying to follow a derivation of the Euler-Lagrange equation at the continuum limit, and find some details hard to understand. The 1D lattice has a mono-atomic basis with atomic spacing $\mathfrak{a}$ and atom mass being $m$. The relative displacement of the nth atom is $\delta \eta_{n}$. The Lagrangian at the discrete limit is written as
$$\begin{aligned}
\mathfrak{L} &=\sum_{n=1}^{N} \mathfrak{a} \frac{1}{2}\left[\frac{m}{\mathfrak{a}}\left(\delta \dot{\eta}_{n}\right)^{2}-\kappa \mathfrak{a}\left(\frac{\delta \eta_{n+1}-\delta \eta_{n}}{\mathfrak{a}}\right)^{2}-\frac{m}{\mathfrak{a}} \Omega^{2}\left(\delta \eta_{n}\right)^{2}\right] \\
&=: \sum_{n=1}^{N} \mathfrak{a} L_{n}
\end{aligned}$$
where $\kappa$ and $\Omega^2$ are the strength of the atomic bonding and the external field, respectively. At the limit of $N\rightarrow\infty$, the time derivative of the relative displacement $\delta \eta_{n}$ at time $t$ has been replaced by the value of the time derivative $\left(\partial_{t} \varphi\right)$ at the space-time coordinate $(x, t)$. And we have periodic boundary condition of
$$\varphi(x+L, t)=\varphi(x, t), \quad x \in] 0, L], \quad \forall t \in \mathbb{R}.$$
If we let
$$\mu:=\frac{m}{\mathfrak{a}}, \quad Y:=\kappa \mathfrak{a}$$
and replace the discrete sum $\sum_{n}$ by the integral $\int \mathrm{d} x /\mathfrak{a}$ over the semi-open interval $] 0, L]$, then we write the Lagrangian as
$$\begin{aligned}
\mathfrak{L}=& \int_{0}^{L} \mathrm{d} x \frac{1}{2}\left[\mu\left(\frac{\partial \varphi}{\partial t}\right)^{2}-Y\left(\frac{\partial \varphi}{\partial x}\right)^{2}-\mu \Omega^{2} \varphi^{2}\right] \\
=&: \int_{0}^{L} \mathrm{d} x \mathcal{L}
\end{aligned}.$$
where $\mathcal{L}$ is the "Lagrangian density". From Christopher Mudry's book one obtains the continuum limit of Euler-Lagrange equations as
$$\partial_{t} \frac{\delta \mathcal{L}(x, t)}{\delta\left(\partial_{t} \varphi\right)(y, t)}+\partial_{x} \frac{\delta \mathcal{L}(x, t)}{\delta\left(\partial_{x} \varphi\right)(y, t)}=\frac{\delta \mathcal{L}(x, t)}{\delta \varphi(y, t)}\tag{1}.$$
To get (1) I first expand $\mathcal{L}$ in terms of $\varphi,\left(\partial_{x} \varphi\right),$ and $\left(\partial_{t} \varphi\right)$ to give
$$\begin{aligned}
\delta \mathcal{L} &=\mathcal{L}\left[\varphi+\delta \varphi,\left(\partial_{x} \varphi\right)+\delta\left(\partial_{x} \varphi\right),\left(\partial_{t} \varphi\right)+\delta\left(\partial_{t} \varphi\right)\right]-\mathcal{L}\left[\varphi,\left(\partial_{x} \varphi\right),\left(\partial_{t} \varphi\right)\right] \\
&=\frac{\partial \mathcal{L}}{\partial \varphi} \delta \varphi+\frac{\partial \mathcal{L}}{\partial\left(\partial_{x} \varphi\right)} \delta\left(\partial_{x} \varphi\right)+\frac{\partial \mathcal{L}}{\partial\left(\partial_{t} \varphi\right)} \delta\left(\partial_{t} \varphi\right)+\cdots
\end{aligned}\tag{2}.$$
Ignore the higher-order terms in (2) and notice that $\delta\partial_x\varphi=\partial_x\delta\varphi$, we can integrate (2) by parts to give
$$
\begin{aligned}
\delta\mathfrak{L}&=\int^L_0dx\delta\mathcal{L}\\
&=\int^L_0dx\{\frac{\partial\mathcal{L}}{\partial\varphi}\delta\varphi+\partial_x\left(\frac{\partial\mathcal{L}}{\partial(\partial_x\varphi)}\delta\varphi\right)+\partial_t\left(\frac{\partial\mathcal{L}}{\partial(\partial_t\varphi)}\delta\varphi\right)-\delta\varphi\partial_x(\frac{\partial\mathcal{L}}{\partial(\partial_x\varphi)})-\delta\varphi\partial_t(\frac{\partial\mathcal{L}}{\partial(\partial_t\varphi)})\}
\end{aligned}\tag{3}.
$$
In order to get (1) from (3), the following integral must be satisfied:
$$\int^L_0dx\partial_x\left(\frac{\partial \mathcal{L}}{\partial\left(\partial_{x} \varphi\right)} \delta \varphi\right)=\left[\frac{\partial \mathcal{L}}{\partial\left(\partial_{x} \varphi\right)} \delta \varphi\right]^L_0=0\tag{5},$$
$$\int^L_0dx\partial_t\left(\frac{\partial \mathcal{L}}{\partial\left(\partial_{t} \varphi\right)} \delta \varphi\right)=\frac{d}{dt}\int^L_0dx\left(\frac{\partial \mathcal{L}}{\partial\left(\partial_{t} \varphi\right)} \delta \varphi\right)=0\tag{6}.$$
While I have no problem with (5) as we don't change the endpoints, I don't know why Eqn. (6) is valid. Is it just because we treat time $t$ as a fixed parameter in (6)?
 A: OP is right. In general, to make the action principle work, we only need to impose boundary conditions (BCs) at the boundary of spacetime. Hence we shouldn't impose eq. (6) in the interior of spacetime.
In other words, OP should preferably redo their above analysis using the action rather than the Lagrangian.
A: My attempt to derive the Euler-Lagrange equation above starts from the action,
$$S=\int_{t_1}^{t_2}\int_0^L\mathcal{L}(\varphi,\partial_x\varphi,\partial_t\varphi)dxdt\tag{1}$$
and I introduce the disturbance to the path, $\delta\varphi(x,t)$ to write
$$S_{\lambda}=\int_{t_1}^{t_2}\int^L_0dxdt\mathcal{L}(\varphi+\lambda\delta\varphi,\partial_x\varphi+\lambda\partial_x\delta\varphi,\partial_t\varphi+\lambda\partial_t\delta\varphi).$$
Then
$$
\begin{aligned}\frac{\partial S_{\lambda}}{\partial\lambda}&=\int^{t_2}_{t_1}\int_0^Ldxdt\left\{\delta\varphi\frac{\partial \mathcal{L}}{\partial(\varphi+\lambda\delta\varphi)}+\partial_x(\delta\varphi)\frac{\partial\mathcal{L}}{\partial(\partial_x\varphi+\lambda\partial_x(\delta\varphi))}\right.\\
&\left.+\partial_t(\delta\varphi)\frac{\partial \mathcal{L}}{\partial(\partial_t\varphi+\lambda\partial_t(\delta\varphi))}\right\}\end{aligned}\tag{2}$$
and
$$\begin{aligned}\frac{\partial S_{\lambda}}{\partial \lambda}|_{\lambda=0}&=\int^{t_2}_{t_1}\int_0^Ldxdt\left\{\delta\varphi\frac{\partial \mathcal{L}}{\partial\varphi}+\partial_x(\delta\varphi)\frac{\partial \mathcal{L}}{\partial(\partial_x\varphi)}+\partial_t(\delta\varphi)\frac{\partial \mathcal{L}}{\partial(\partial_t\varphi)}\right\}\\
&=\int_0^L\left[\delta\varphi\frac{\partial \mathcal{L}}{\partial(\partial_t\varphi)}\right]^{t_2}_{t_1}dx+\int_{t_1}^{t2}\int^L_0dxdt\left\{\delta\varphi\frac{\partial \mathcal{L}}{\partial\varphi}-\delta\varphi\partial_t\left[\frac{\partial \mathcal{L}}{\partial(\partial_t\varphi)}\right]+\partial_x(\delta\varphi)\frac{\partial \mathcal{L}}{\partial(\partial_x\varphi)}\right\}\\
&=\int_{t_1}^{t_2}\int_0^Ldxdt\left\{\delta\varphi\left[\frac{\partial L}{\partial\varphi}-\partial_t\left(\frac{\partial L}{\partial(\partial_t\varphi)}\right)-\partial_x\left(\frac{\partial L}{\partial(\partial_x\varphi)}\right)\right]\right\}+\int_{t1}^{t2}\left[\delta\varphi\frac{\partial \mathcal{L}}{\partial(\partial_x\varphi)}\right]^{L}_{0}dt\\
&=\int_{t_1}^{t_2}\int_0^Ldxdt\left\{\delta\varphi\left[\frac{\partial L}{\partial\varphi}-\partial_t\left(\frac{\partial L}{\partial(\partial_t\varphi)}\right)-\partial_x\left(\frac{\partial L}{\partial(\partial_x\varphi)}\right)\right]\right\}
\end{aligned}\tag{3}.$$
So
$$
\frac{\partial S_{\lambda}}{\partial \lambda}|_{\lambda=0}=\int^{t_2}_{t_1}\int_0^Ldxdt\left\{\delta\varphi\left[\frac{\partial L}{\partial\varphi}-\partial_t\left(\frac{\partial L}{\partial(\partial_t\varphi)}\right)-\partial_x\left(\frac{\partial L}{\partial(\partial_x\varphi)}\right)\right]\right\}=0\tag{4}.
$$
From (4) we have
$$
\frac{\partial\mathcal{L}}{\partial\varphi}=\partial_t\left(\frac{\partial L}{\partial(\partial_t\varphi)}\right)+\partial_x\left(\frac{\partial L}{\partial(\partial_x\varphi)}\right)\tag{5}.
$$
