The effect of diffusion and pressure on porosity in composites