The coaxial wire method is a common and appreciated choice to assess the beam coupling impedance of an accelerator element from scattering parameters. Nevertheless, the results obtained from wire measurements could be inaccurate due to the presence of the stretched conductive wire that artificially creates the conditions for the propagation of a Transverse ElectroMagnetic (TEM) mode. The aim of this work is to establish a solid technique to obtain the beam coupling impedance from electromagnetic simulations, without modifications of the device under test. In this framework, we identified a new relation to get the resistive wall beam coupling impedance of a circular chamber directly from the scattering parameters and demonstrated that it reduces to the exact theoretical expression. Furthermore, a possible generalization of the method to arbitrary cross section geometries has been studied and validated with numerical simulations