MortenA (Petroleum)"Normally you would assume that the cold gas rushing in (beeing cooled by the JT effect)"
JT can be applied to STEADY FLOW problems, where upstream and downstream KE and potential energies are negligible.
Since the problem is a transient, even if velocities are neglected (KE effect),and the system well insulated, JT, by itself has no meaning.
Consider
Filling air temp, same as downstream temp
For example, the filling of an evacuated volume that was originally filled with air or other gas.
First evacuate the volume.
Let the inteernal air come to temperature equilibrium with the surrounding environment of air.
Let it now be well insulated. (Some how on the inside)
Put a small opening in the vessel and let outside air flow in.
The vessel air will heat up. Solution is obtained from conservation of energy. (No relation to JT)
Change of internal energy of the air in the volume=
stagnation enthalpy (or static enthalpy of outside air, since there is no KE outside) times mass added to vessel.
For simplication, let initial mass in tank be negligible compared to mass added.
Then m*u =ho*m where m is final mass in vessel , u internal energy of air in vessel, ho stag enthalpy of outside air.
or u=ho
For perfect gas, constant spec heat CvT=CpTo T=kTo
where T is container air temp , To outside air temp and k ratio of specific heats (Cp/Cv). Note temp is absolute.
My above example, based on a lumped mode analysis does not relate to hammer effects.
For hammer effects, such as the original thread problem indicates, I would suggest a method of characteristics solution. This would require pipe lengths, valve opening time and valve characteristics, etc. Combustion or detonation effects could be included, if need be.