Example #1
0
    def _cylindrical_z_component(field, data):
        """The cylindrical z component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        return get_cyl_z_component(vectors, normal)
    def _cylindrical_z_component(field, data):
        """The cylindrical z component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        return get_cyl_z_component(vectors, normal)
Example #3
0
    def _particle_velocity_cylindrical_z(field, data):
        """The cylindrical z component of the particle velocities

        Relative to the coordinate system defined by the *normal* vector,
        *bulk_velocity* vector and *center* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vel = data["relative_particle_velocity"].T
        cylz = get_cyl_z_component(vel, normal)
        return cylz
def test_cylindrical_coordinate_projections():
    normal = [0, 0, 1]
    theta = get_cyl_theta(coords, normal)
    z = get_cyl_z(coords, normal)
    zero = np.tile(0, coords.shape[1])

    # Purely radial field
    vecs = np.array([np.cos(theta), np.sin(theta), zero])
    assert_array_almost_equal(zero, get_cyl_theta_component(vecs, theta, normal))
    assert_array_almost_equal(zero, get_cyl_z_component(vecs, normal))

    # Purely toroidal field
    vecs = np.array([-np.sin(theta), np.cos(theta), zero])
    assert_array_almost_equal(zero, get_cyl_z_component(vecs, normal))
    assert_array_almost_equal(zero, get_cyl_r_component(vecs, theta, normal))

    # Purely z field
    vecs = np.array([zero, zero, z])
    assert_array_almost_equal(zero, get_cyl_theta_component(vecs, theta, normal))
    assert_array_almost_equal(zero, get_cyl_r_component(vecs, theta, normal))
def test_cylindrical_coordinate_projections():
    normal = [0, 0, 1]
    theta = get_cyl_theta(coords, normal)
    z = get_cyl_z(coords, normal)
    zero = np.tile(0, coords.shape[1])

    # Purely radial field
    vecs = np.array([np.cos(theta), np.sin(theta), zero])
    assert_array_almost_equal(zero, get_cyl_theta_component(vecs, theta, normal))
    assert_array_almost_equal(zero, get_cyl_z_component(vecs, normal))

    # Purely toroidal field
    vecs = np.array([-np.sin(theta), np.cos(theta), zero])
    assert_array_almost_equal(zero, get_cyl_z_component(vecs, normal))
    assert_array_almost_equal(zero, get_cyl_r_component(vecs, theta, normal))

    # Purely z field
    vecs = np.array([zero, zero, z])
    assert_array_almost_equal(zero, get_cyl_theta_component(vecs, theta, normal))
    assert_array_almost_equal(zero, get_cyl_r_component(vecs, theta, normal))
Example #6
0
    def _particle_velocity_cylindrical_z(field, data):
        """The cylindrical z component of the particle velocities

        Relative to the coordinate system defined by the *normal* vector,
        *bulk_velocity* vector and *center* field parameters.
        """
        normal = data.get_field_parameter('normal')
        center = data.get_field_parameter('center')
        bv = data.get_field_parameter("bulk_velocity")
        pos = data.ds.arr([data[ptype, spos % ax] for ax in "xyz"])
        vel = data.ds.arr([data[ptype, svel % ax] for ax in "xyz"])
        pos = pos - np.reshape(center, (3, 1))
        vel = vel - np.reshape(bv, (3, 1))
        cylz = get_cyl_z_component(vel, normal)
        return cylz
    def _particle_velocity_cylindrical_z(field, data):
        """The cylindrical z component of the particle velocities

        Relative to the coordinate system defined by the *normal* vector,
        *bulk_velocity* vector and *center* field parameters.
        """
        normal = data.get_field_parameter('normal')
        center = data.get_field_parameter('center')
        bv = data.get_field_parameter("bulk_velocity")
        pos = data.ds.arr([data[ptype, spos % ax] for ax in "xyz"])
        vel = data.ds.arr([data[ptype, svel % ax] for ax in "xyz"])
        pos = pos - np.reshape(center, (3, 1))
        vel = vel - np.reshape(bv, (3, 1))
        cylz = get_cyl_z_component(vel, normal)
        return cylz