Example #1
0
    def electric_field(self, xyz):
        """
        Electric field from an electric dipole

        .. math::

            \mathbf{E} = \\frac{1}{\hat{\sigma}} \\nabla \\nabla \cdot \mathbf{A}
            - i \omega \mu \mathbf{A}

        """
        dxyz = self.vector_distance(xyz)
        r = self.distance(xyz)
        r = repeat_scalar(r)
        thetar = self.theta * r
        root_pi = np.sqrt(np.pi)

        front = ((self.current * self.length) /
                 (4 * np.pi * self.sigma * r**3))

        symmetric_term = (
            (-(4 / root_pi * thetar**3 + 6 / root_pi * thetar) *
             np.exp(-thetar**2) + 3 * erf(thetar)) *
            (repeat_scalar(self.dot_orientation(dxyz)) * dxyz / r**2))

        oriented_term = ((4. / root_pi * thetar**3 + 2. / root_pi * thetar) *
                         np.exp(-thetar**2) - erf(thetar)) * np.kron(
                             self.orientation, np.ones((dxyz.shape[0], 1)))

        return front * (symmetric_term + oriented_term)
Example #2
0
    def magnetic_field(self, xyz):
        """
        Magnetic field due to a magnetic dipole in a wholespace
        """
        dxyz = self.vector_distance(xyz)
        r = repeat_scalar(self.distance(xyz))
        kr = self.wavenumber * r
        ikr = 1j * kr

        front_term = self.moment / (4. * np.pi * r**3) * np.exp(-ikr)
        symmetric_term = (repeat_scalar(self.dot_orientation(dxyz)) * dxyz *
                          (-kr**2 + 3 * ikr + 3) / r**2)
        oriented_term = ((kr**2 - ikr - 1) *
                         np.kron(self.orientation, np.ones(
                             (dxyz.shape[0], 1))))

        return front_term * (symmetric_term + oriented_term)
Example #3
0
    def electric_field(self, xyz):
        """
        Electric field from a magnetic dipole in a wholespace
        """
        dxyz = self.vector_distance(xyz)
        r = repeat_scalar(self.distance(xyz))
        kr = self.wavenumber * r
        ikr = 1j * kr

        front_term = ((1j * self.omega * self.mu * self.moment) /
                      (4. * np.pi * r**2) * (ikr + 1) * np.exp(-ikr))
        return front_term * self.cross_orientation(dxyz) / r
Example #4
0
    def magnetic_field_time_deriv(self, xyz):
        """
        Time derivative of the magnetic field,
        :math:`\\frac{\partial \mathbf{h}}{\partial t}`
        """

        dxyz = self.vector_distance(xyz)
        r = self.distance(dxyz)
        r = repeat_scalar(r)

        front = (self.current * self.length * self.theta**3 * r /
                 (2 * np.sqrt(np.pi)**3 * self.time))

        return -front * self.cross_orientation(xyz) / r
Example #5
0
    def magnetic_field(self, xyz):
        """
        Magnetic field from an electric dipole
        """
        dxyz = self.vector_distance(xyz)
        r = self.distance(dxyz)
        r = repeat_scalar(r)
        thetar = self.theta * r

        front = (
            self.current * self.length / (4 * np.pi * r**2) *
            (2 / np.sqrt(np.pi) * thetar * np.exp(-thetar**2) + erf(thetar)))

        return -front * self.cross_orientation(xyz) / r
Example #6
0
    def electric_field(self, xyz):
        """
        Electric field from an electric dipole

        .. math::

            \\mathbf{E} = \\frac{1}{\\hat{\\sigma}} \\nabla \\nabla \\cdot
             \\mathbf{A}
            - i \\omega \\mu \\mathbf{A}

        """
        dxyz = self.vector_distance(xyz)
        r = repeat_scalar(self.distance(xyz))
        kr = self.wavenumber * r
        ikr = 1j * kr

        front_term = ((self.current * self.length) /
                      (4 * np.pi * self.sigma * r**3) * np.exp(-ikr))
        symmetric_term = (repeat_scalar(self.dot_orientation(dxyz)) * dxyz *
                          (-kr**2 + 3 * ikr + 3) / r**2)
        oriented_term = ((kr**2 - ikr - 1) *
                         np.kron(self.orientation, np.ones(
                             (dxyz.shape[0], 1))))
        return front_term * (symmetric_term + oriented_term)
Example #7
0
    def magnetic_field(self, xyz):
        """
        Magnetic field from an electric dipole

        .. math::

            \\mathbf{H} = \\nabla \\times \\mathbf{A}

        """
        dxyz = self.vector_distance(xyz)
        r = repeat_scalar(self.distance(xyz))
        kr = self.wavenumber * r
        ikr = 1j * kr

        front_term = (self.current * self.length / (4 * np.pi * r**2) *
                      (ikr + 1) * np.exp(-ikr))
        return -front_term * self.cross_orientation(dxyz) / r