def test_faraday_rotation(self): L, zsrc, zout = 12.0, -4.5, 4.0 freq, tmax = 0.8, 100.0 resolution = 24 ## Test gyrotropic Lorentzian medium epsn, f0, gamma, sn, b0 = 1.5, 1.0, 1e-3, 0.1, 0.15 susc = [mp.GyrotropicLorentzianSusceptibility(frequency=f0, gamma=gamma, sigma=sn, bias=mp.Vector3(0, 0, b0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_lorentzian(freq, epsn, f0, gamma, sn, b0) print('=' * 24) print("Testing Faraday rotation for gyrotropic Lorentzian model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k) ## Test gyrotropic Drude medium susc = [mp.GyrotropicDrudeSusceptibility(frequency=f0, gamma=gamma, sigma=sn, bias=mp.Vector3(0, 0, b0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_drude(freq, epsn, f0, gamma, sn, b0) print('=' * 24) print("Testing Faraday rotation for gyrotropic Drude model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k) ## Test Landau-Lifshitz-Gilbert medium alpha = 1e-5 susc = [mp.GyrotropicSaturatedSusceptibility(frequency=f0, gamma=gamma, sigma=sn, alpha=alpha, bias=mp.Vector3(0, 0, 1.0))] mat = mp.Medium(epsilon=epsn, mu=1, E_susceptibilities=susc) k = kgyro_llg(freq, epsn, f0, gamma, sn, alpha) print('=' * 24) print("Testing Faraday rotation for Landau-Lifshitz-Gilbert model...") self.check_rotation(mat, L, freq, zsrc, resolution, tmax, zout, k)
def gyrotropic_conversion(material, bias): if bias.norm() != 0: material_suc = [] for susceptibility in material.E_susceptibilities: if type(susceptibility).__name__ == 'DrudeSusceptibility': material_suc.append( mp.GyrotropicDrudeSusceptibility(frequency=susceptibility.frequency, gamma=susceptibility.gamma, sigma=susceptibility.sigma_diag.x, bias=bias)) elif type(susceptibility).__name__ == 'LorentzianSusceptibility': material_suc.append( mp.GyrotropicLorentzianSusceptibility(frequency=susceptibility.frequency, gamma=susceptibility.gamma, sigma=susceptibility.sigma_diag.x, bias=bias)) return mp.Medium(epsilon=material.epsilon_diag.x, E_susceptibilities=material_suc, valid_freq_range=material.valid_freq_range) return material