Simulation of microwave devices with external cavities using MAGY