When a gas is compressed by a piston, where is the heat added to the gas? Suppose an ideal gas is being compressed by a piston inside a cylinder in an adiabatic compression process. 
Does the gas closest to the piston heat up first as the gas molecules collide with the piston moving forward, and then this heat is transferred to the rest of the gas in the cylinder? Or does the gas uniformly heat up with no thermal gradients present?
Any answers would be much appreciated!
Alex
p.s. I would of thought that if a small volume of gas is considered inside the middle of the cylinder- away from the piston, call it dV. This volume does not initially change, and as dW= pdV, no work is done upon it initially so why should it heat up? The only time it changes volume would be when the piston advances to the boundary of dV. The conclusion of this thought process being that a temperature gradient would be present in the cylinder, with the gas closest to the piston being much hotter.
 A: Ideal gases are compressible against ideal liquids which are not. In a hypothetical large enough experiment the molecules in contact with the walls of the vessel would compress before the ones in the middle that only transferred movement. So there IS a gradient in temperature.
A: Macroscopic temperature is a measure of the average kinetic energy of a group of molecules. Those molecules which are colliding with the face of the piston have their velocity increased due to their elastic collision with a moving boundary - the piston face. Therefore, as a group their rebound velocity and their temperature is increased. As a group, these molecules do have a higher temperature than those at the other end of the cylinder and there is a temperature gradient in the cylinder. This gradient is reduced by  heat that is transferred through the working gas.
If you speed up your observations, you will realize that the increase in molecular or atomic velocity immediately after rebound from the piston face is not random. The increase is entirely along the axis of piston face movement. As this is not purely random motion, one can ask if it is really thermal energy at all or if it is not more correctly viewed as flow energy and you can reasonably ask what portion of it is reflected as temperature at any particular moment in time. The answer depends a bit on the speed of the gas molecules in relation to the speed of the piston face and on what time increment and size scale you want to observe the process.
The increased kinetic energy of these molecules can not propagate through the gas and away from the piston face at a speed any faster than the speed at which the molecules possessing it are themselves moving. Generally speaking, it is limited by the speed of sound in the gas. When the speed of the piston face approaches the speed of the gas molecules, very large gradients can build up creating supersonic shock waves.
Furthermore, the initial increase in kinetic energy is all oriented along the direction of the piston face movement. As these faster molecules collide at various and random angles with slower gas molecules, the slower molecules are sped up in random directions and the increase in kinetic energy is randomized. This energy is therefore re-partitioned among the three translational axes until the average energy in each axis is equal and relative uniformity is reached. Likewise, energy is also internally re-partitioned between molecular translation, rotation, and vibration energy storage modes within the molecule. This internal molecular re-partition is extremely fast - nano or pico seconds if I recall correctly. Now the increased molecular energy is clearly all thermal.
Bottom line, temperature and pressure gradients do occur on compression. For subsonic processes they can generally be ignored. These gradients are important in some cases. As one example, they form the basis for thermo-acoustic phenomenon. As another, they can form hot spots on objects traveling at supersonic speeds. 
A: This was homework problem in my undergrad chem engr  
You do an energy balance.  The piston did work on the gas.  Assume reversible compression.  That work had to go somewhere.  And you need to account for the potential energy of compressed gas.  I forget he detail but the work done was not exactly the potential energy and the difference has to be accounted for as temperature.
Not exactly the same throttling a gas as that is irreversible but if you then throttle the gas you get adiabatic cooling.  
If you then just release the piston and lets is oscillate it will do less work as it was irreversible and you will get some heating via random kinetic energy being formed.  You can only take credit for work done against the external pressure.
A: 
I would of thought that if a small volume of gas is considered inside the middle of the cylinder- away from the piston, call it dV. This volume does not initially change

Why wouldn't it change?  If the compression is done slowly (so the entire cylinder is at pressure equilibrium), then any volume that contains some amount of gas $n$ will occupy a smaller volume.  This means some work was done on that volume of gas, even very far from the piston.
Imagine you place a movable disk inside the cylinder, so a fraction of the gas is trapped by it.  As you compress the piston, the disk will move to keep the pressure equal on both sides.  You can do the same work calculation on that disk and see work is being done on the gas.  
A: Approach to reversibility means infinite time for change in state and even infinite equibrium states on macroscopic scale.for a real
System instant equibriums can't be achieved.so while compressing a gas,you have to give it sufficient time for infinitesimal change for reversibility.technically you cant use term heat up but internal energy of gas which increases as
Momentum is transferred to molecules.it is oblivious in real systems that momentum is first transferred to molecules near to 
Piston and then to further molecules.
