Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analytic expressions for scattered power (flux) #12

Open
johnaparker opened this issue Mar 23, 2021 · 0 comments
Open

Analytic expressions for scattered power (flux) #12

johnaparker opened this issue Mar 23, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@johnaparker
Copy link
Owner

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.

@johnaparker johnaparker added the enhancement New feature or request label Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant