def set_mag( self, b_vec ) : # Normalize the magnetic-field vector. norm_b = calc_arr_norm( b_vec ) # Store the components of the normalized magnetic-field vector. self._norm_b_x = norm_b[0] self._norm_b_y = norm_b[1] self._norm_b_z = norm_b[2] # Compute perpendicular and parallel velocities. self._u_par_mag = self['vel_cen'] * calc_arr_dot( self['norm_b'], self['dir'] ) self._u_par_x = self['u_par_mag'] * self['norm_b_x'] self._u_par_y = self['u_par_mag'] * self['norm_b_y'] self._u_par_z = self['u_par_mag'] * self['norm_b_z'] self._u_per_x = self['vel_cen']*self['dir_x']-self['u_par_x'] self._u_per_y = self['vel_cen']*self['dir_y']-self['u_par_y'] self._u_per_z = self['vel_cen']*self['dir_z']-self['u_par_z'] self._u_per_mag = sqrt( self['u_per_x']**2+self['u_per_y']**2 +self['u_per_z']**2 )
def set_mag(self, b_vec): # Normalize the magnetic-field vector. norm_b = calc_arr_norm(b_vec) # Store the components of the normalized magnetic-field vector. self._norm_b_x = norm_b[0] self._norm_b_y = norm_b[1] self._norm_b_z = norm_b[2] self._maglook = calc_arr_dot(self['norm_b'], self['dir'])
def calc_eff_area(self, v): # Note. #nvn is a vector similar to inflow particle bulk # velocity and ndir is the look direction. # Normalize the particle velocity. vn = calc_arr_norm(v) nvn = tuple([-c for c in vn]) # Calculate the particle inflow angle (in degrees) relative to # the cup normal (i.e., the cup pointing direction). psi = acos(calc_arr_dot(self['dir'], nvn)) * pi / 180. if (psi > 90.): return 0. # Return the effective collecting area corresponding to "psi". return interp(psi, self._spec._eff_deg, self._spec._eff_area)