A study of wave interactions with flanged waveguides and cavities using the on-surface radiation condition method