For a system of dipoles and nanoparticles, the expansion coefficients of the source and system can be calculated with this:
def get_p_src(cluster, origin=[0,0,0]):
"""get the p_src expansion coefficients; assumes all sources are dipoles
Arguments:
cluster miepy.cluster or miepy.sphere_cluster
origin origin around which to obtain expansion
"""
if isinstance(cluster.source, miepy.sources.combined_source):
p_src = []
positions = []
for dipole in cluster.source.sources:
p_src_d = np.zeros([2,3], dtype=complex)
p_src_d[0] = (dipole.weight[-1], dipole.weight[0], dipole.weight[1])
p_src.append(p_src_d)
positions.append(dipole.position)
p_src = np.asarray(p_src)
positions = np.asarray(positions)
else:
dipole = cluster.source
p_src = np.zeros([2,3], dtype=complex)
p_src[0] = (dipole.weight[-1], dipole.weight[0], dipole.weight[1])
positions = np.array([dipole.position])
p_src = np.array([p_src])
return miepy.cluster_coefficients(positions, p_src,
cluster.material_data.k_b, origin, lmax=cluster.lmax)
def get_p_scat(cluster, origin=[0,0,0]):
"""get the p_scat expansion coefficients of the nanoparticles
Arguments:
cluster miepy.cluster or miepy.sphere_cluster
origin origin around which to obtain expansion
"""
return miepy.cluster_coefficients(cluster.position, cluster.p_scat,
cluster.material_data.k_b, origin=origin, lmax=cluster.lmax)
Then the flux of the source (P0) and system (P) is:
Z0 = miepy.constants.Z0
k = 2*np.pi/wavelength
p_src = get_p_src(cluster)
p_scat = get_p_scat(cluster)
P0 = 0.5/Z0*np.pi/k**2*np.sum(np.abs(p_src)**2) # power source
P = 0.5/Z0*np.pi/k**2*np.sum(np.abs(p_scat + p_src)**2) # power system
enhance = P/P0
These functions should be added to MiePy in some way to make this type of calculation straightforward.
For a system of dipoles and nanoparticles, the expansion coefficients of the source and system can be calculated with this:
Then the flux of the source (P0) and system (P) is:
These functions should be added to MiePy in some way to make this type of calculation straightforward.