I am designing a PIFA antenna in CST microwave studio. I have found something peculiar that I do not quite understand. My antenna resonates at 1.6 GHz, and when the substrate (FR4) is very thin (0.5 mm), I get an S11 of about -20 dB. The realized gain at this frequency is -12.5 dB. If I make the substrate thicker, the S11 resonance gets worse, and the gain gets better. For example, making it 3 mm (instead of 0.5 mm), the S11 went to -4, and the gain went to -6.
Can anyone explain why this is? I thought realized gain takes into account mismatch loss, meaning S11 should be a factor. If the S11 gets worse, how is the realized gain getting better??