I thought that we understood from the links I quoted in my previous posts, (Boyle's Law) that in a closed system, the number of molecules or atoms of a gas cannot increase or decrease as none can escape, and none can enter the closed container, therefore volume of the container remains constant, so no matter at what temperature the gas is heated or cooled, its density cannot change, only the pressure can....
Indeed. That is a point I have repeated made to EFLI.
However, as you say, it relates only to a simple 'closed system' (e.g. a sealed container), whereas we are talking about something much more complicated than that. We are talking about a system which has several interconnected components, each of which will have pressure and temperature gradients within then, and of a system in which flow and pressure (and hence, to some extent temperature) will be varying cyclically.
The cooler cannot be considered to be 'closed', since molecules can (and constantly do) move from it into the manifold, and also potentially backwards into the compressor under some circumstances. ... and also, of course, the volume of the entire system changes every time the engine's inlet valves open or close. Furthermore, as EFLI has pointed out, even when one
does have a closed (constant volume) system, whilst the mass of the contents (i.e. number of molecules) cannot change, it is possible for the density to be different in different parts of the system, even though the
average density of the entire contents obviously cannot change. It really is a very complex situation to analyse, particularly when there is a continuous (but not constant) flow of air through the entire system. The concept of a 'closed' system therefore does not really exist - it is more a question of pressures, flows and resistances.
To give a simple illustration of the absence of a 'closed' system, if, with the engine not running, one
heated the air in the intercooler, the pressure rise of air in the cooler would be less than you would expect, and the density of air in the cooler
would decrease, since some molecules of air would move from the cooler into the manifold and some would move backwards into the compressor. Of course, as above, when the compressor is running, there is a constant ('pulsatile') flow of air through the entire system, which further complicates analysis of the system.
However, none of this alters my serious doubts about the suggestion that increasing density is the "main reason" for having an intercooler.
Kind Regards, John