Esempio n. 1
0
    def _magnetic_field_strength(field, data):
        xm = "relative_magnetic_field_%s" % axis_names[0]
        ym = "relative_magnetic_field_%s" % axis_names[1]
        zm = "relative_magnetic_field_%s" % axis_names[2]

        B2 = (data[ftype, xm])**2 + (data[ftype, ym])**2 + (data[ftype, zm])**2

        return handle_mks_cgs(np.sqrt(B2), field.units)
Esempio n. 2
0
 def _magnetic_field_poloidal(field, data):
     bm = handle_mks_cgs(
         data.get_field_parameter("bulk_magnetic_field"), field.units)
     r = data["index", "r"]
     z = data["index", "z"]
     d = np.sqrt(r * r + z * z)
     rax = axis_names.find('r')
     zax = axis_names.find('z')
     return ((data[ftype, "magnetic_field_r"] - bm[rax]) * (r / d) +
             (data[ftype, "magnetic_field_z"] - bm[zax]) * (z / d))
Esempio n. 3
0
 def _relative_vector(field, data):
     iax = axis_order.index(ax)
     d = handle_mks_cgs(data[field_components[iax]], field.units)
     bulk = handle_mks_cgs(get_bulk(data, basename, d.unit_quantity),
                           field.units)
     return d - bulk[iax]
Esempio n. 4
0
 def _magnetic_field_toroidal(field, data):
     ax = axis_names.find('phi')
     bm = handle_mks_cgs(
         data.get_field_parameter("bulk_magnetic_field"), field.units)
     return data[ftype, "magnetic_field_phi"] - bm[ax]