First off if you are attempting to compact the earth just by soaking it, it won’t work. Different soils need different levels of moisture to compact properly, but mechanical compaction is the only thing that will get it to denser levels.
Now the foam occurs because there are broken down oraganic compounds that have seeped through and then get carried by the water. And since they are both less dense than water and at least partially hydrophobic they form bubbles.
Latest Answers