Change in temperature of a moving gas container which is suddenly stopped Although this question has been asked many times here, I haven't found a satisfactory detailed quantitative answer.
The question is:

If an ideal gas container that is moving with a velocity $v$ is suddenly stopped, will the temperature of the gas change?

I've thought about this for many days but couldn't figure out how to proceed.
I'll be thankful for even hints and would really like a quantitative answer.
Edit: To make it simpler let's assume the walls of the container are adiabatic.
Thank you.
 A: Look at the container before and after it stops. When it stops, the kinetic energy of the centre of mass of the gas molecules is converted to internal energy in the gas.
Thus, the energy supplied to the gas equals the loss in the kinetic energy of the molecules $$\Delta U=\frac{1}{2}mv_{\mathrm{container}}^2.$$The change in temperature depends on the degrees of freedom of the gas according to the equation $$\Delta U=\frac{f}{2}nR\Delta T.$$
I'm reading the conversations associated with all the answers on this page. They are really interesting and thought provoking. I will incorporate my responses into my answer soon.
A: A key condition is "suddenly." In the frame of the initially moving box, the leading wall immediately moves inward at the initial speed of the box, creating a compression shock wave. The trailing wall immediately and correspondingly moves outward; however, due to thermodynamic restrictions associated with the Second Law, no rarefaction shock can exist in an ideal gas, among other materials.
(The impossibility of rarefaction shock in perfect fluids is discussed, for example, in Zel'dovich and Raizer, Physics of Shock Waves and High-Temperature Hydrodynamic Phenomena, §17 "Impossibility of rarefaction shock waves in a fluid with normal
thermodynamic properties." Effectively, any rarefactive discontinuity would propagate at subsonic speed and be immediately outrun by the normal pressure behind it. In contrast, compression discontinuities travel at supersonic speeds and outrun the normal pressure "information" behind them. The so-called Zemplen's theorem shows how rarefactive shocks in perfect fluids decrease global entropy and are therefore forbidden by the Second Law.)
An objection on this page to this interpretation is that the compression and rarefaction are symmetric and that any work done on the gas by the leading edge is exactly canceled by work done by the gas on the trailing edge. This is a good model for gradual deceleration but is unsuitable for an abrupt stop, as the compression-shock solution is physical and the rarefaction-shock solution is not.
(The idea of the speed of a retreating wall fundamentally affecting the nature of even a "simple" ideal-gas problem is of course familiar to us from the comparison of expansion work and free expansion. If an ideal gas is slowly expanded, its temperature decreases because the molecules yield a momentum "kick" to the retreating wall. If the wall is shifted outward instantaneously, no such work occurs, and the gas temperature remains unchanged.)
Dissipative heating (the viscous sloshing in @mikestone's answer) from this compression wave, at such point that the gas can be considered to have returned to an equilibrium state, causes a temperature increase as calculated in @Protein's answer.
Another objection on this page is that the First Law (formulated as $\Delta U=Q+W$) predicts no temperature increase, as no work is done and no heating performed. However, this formulation cannot generally be applied in cases where the bulk linear and angular momenta of the system are changing. Callen, in Thermodynamics and an Introduction to Thermostatistics, notes

There are seven "first integrals of the motion" (as the conserved quantities are known in mechanics). These seven conserved quantities are the energy, the three components of linear momentum, and the three components of the angular momentum; and they follow in parallel fashion from the translation in "space-time" and from rotation.
Why, then, does energy appear to play a unique role in thermostatistics? Should not momentum and angular momentum play parallel roles with the energy? In fact, the energy is not unique in thermostatistics. The linear momentum and angular momentum play precisely parallel roles. The asymmetry in our account of thermostatistics is a purely conventional one that obscures the true nature of the subject.
We have followed the standard convention of restricting attention to systems that are macroscopically stationary, in which case the momentum and angular momentum arbitrarily are required to be zero and do not appear in the analysis. [emph. added] But astrophysicists, who apply thermostatistics to rotating galaxies, are quite familiar with a more complete form of thermostatistics. In that formulation the energy, linear momentum, and angular momentum play fully analogous roles.

The conservation-of-energy approach applied in @Protein's answer is not subject to this constraint and therefore seems more credible than the First Law as formulated for static systems.
Supporting this point, Clarke and Carswell write in "Principles of Astrophysical Fluid Dynamics":

We shall start with the the first law of thermodynamics, which is
an expression of energy conservation:
đQ = dE +p dV (4.3). Here đQ is the quantity of heat absorbed by unit mass of fluid
from its surroundings, p dV is the work done by unit mass of fluid if
its volume changes by dV and dE is the change in the internal energy
content of unit mass of the fluid. We note that this law is only valid if
one can neglect processes (termed viscous or dissipative processes) that
can convert the kinetic energy of the fluid into heat. In the more general
case, where viscosity cannot be neglected, we have đQ < dE + p dV
because extra heat can be fed into the fluid through dissipation of its
kinetic energy. [emph. added]

In The Physics of Astrophysics, Shu derives the following more general volumetric First-Law-like expression:
$$\rho\frac{\partial \mathscr{E}}{\partial t}=\dot{\mathscr{Q}}-P\boldsymbol{\nabla\cdot u}+\pi_{ik}\frac{\partial u_i}{\partial x_k},$$
where $\rho$ is the density, $\mathscr{E}$ is the specific energy, $\dot{\mathscr{Q}}$ is the rate of specific heating, $\boldsymbol{u}$ is the bulk velocity and $\pi_{ik}$ is the viscous stress tensor. The last term in the equation represents "the viscous conversion of ordered energy in differential fluid motions to disordered energy in random particle motions."—undoubtedly central to the present question!
A: 
If an ideal gas container that is moving with a velocity  is
suddenly stopped, will the temperature of the gas change?

As I said in my previous answer, it's debatable. But I believe it is important to understand what is meant by "temperature" when applying the ideal gas equation.  The following equations were used by others in their answers:
$$\Delta U=\frac{f}{2}nR\Delta T.$$
$$ \Delta pV= nR\Delta T $$
These equations are based on or derived from the ideal gas equation. It is important to realize that the change in temperature in the ideal gas equation applies to an ideal gas that is internally in equilibrium in the initial and final state. In other words:
$$\Delta T=T_{final}-T_{initial}$$
Where $T_{final}$ and $T_{initial}$ are the bulk temperatures of the gas in initial and final equilibrium states.
We can assume that the gas in the container was in equilibrium when it was moving at constant velocity prior to deceleration. But the gas was not in equilibrium during the deceleration since both temperature and pressure gradients exist. I believe to properly use the ideal gas equation, $T_{final}$ has to be the temperature of the gas after stopping and after internal equilibrium is reestablished, i.e., when there are no longer temperature and pressure gradients.
As I stated in my previous answer, if the container of the gas is both rigid and perfectly thermally insulated (adiabatic), then there is no boundary work $W$ and no heat transfer, $Q$, with the surroundings. Then according to the first law, $\Delta U=Q-W$ and therefore $\Delta U=0$. And, since for an ideal gas, $\Delta U=C_{v}\Delta T$, that would mean that $\Delta T=0$. In this case the final temperature is the equilibrium temperature, not the localized temperature of the compressed portion of the gas during deceleration.
I believe @Agnius Vasiliauskas stated it best by describing any increase in temperature as “temporary”.  I would add "localized" since the temperature is not the bulk temperature (temperature throughout the gas). In the chat room with Agnius we agreed that after equilibrium is reestablished, the equilibrium temperature of the gas should be the same as before the deceleration, for $\Delta T=0$. That makes it consistent with the first law for an isolated system of an ideal gas.
Hope this helps.
A: On deceleration gas will compress, and thus due to compression, temperature will increase temporarily. Ideal law states that :
$$ \Delta pV= nR\Delta T $$
Pressure change is :
$$ \Delta p=\frac FA = \frac{ma}{A} $$
Where $a$ is container deceleration and $A$ is container cross-section area where gas molecules are pushing to due to deceleration. Substituting it in ideal gas law, expressing amount of substance as $n=m/M$, and solving resulting formula for temperature change $\Delta T$ gives :
$$ \Delta T = \frac{MVa}{AR} $$
Where $M$ molar mass of gas, $V$ gas volume, $a$ - container deceleration.
A: The gas will start to slosh back and forth just as any liquid would. The centre of mass kinetic energy is thus  converted into acoustic energy i.e sound waves. Viscous friction will eventually damp these waves and convert the energy into internal energy.
A: I think it’s debatable, particularly if the container is both rigid and adiabatic (thermally insulated) so no heat transfer occurs and no boundary work is done.
I recall it being pointed out in a related post that during deceleration the temperature of the  part of the gas that pushes up against the leading wall of the container and compresses rises, but at the same time the temperature of the part of the gas that moves away from the trailing wall and expands drops, so that the two tend to cancel one another.
If you think about it, it makes sense. If the container is rigid and insulated any compression of part of the gas must be accompanied by an expansion of another part of the gas for conservation of mass.
Finally, if the container is both rigid and insulated then $W=0$ and $Q=0$, then from the first law $\Delta U=0$. That means for an ideal gas $\Delta T=0$.
Hope this helps.
