Example #1
0
    def recompute_spchg_efield(self, MP_e, t_curr=None):
        
        flag_recompute=True              
        if self.flag_decimate:
            flag_recompute = (t_curr - self.t_last_recom)>=self.Dt_sc
        
        if flag_recompute:
            self.t_last_recom = t_curr
            
            #print t_curr
            
            if (MP_e.N_mp>0):
            
                qe=1.602176565e-19;
                eps0=8.8541878176e-12;
                
                rho=rhocom.compute_sc_rho(MP_e.x_mp[0:MP_e.N_mp],MP_e.y_mp[0:MP_e.N_mp],MP_e.nel_mp[0:MP_e.N_mp],
                                          self.bias_x,self.bias_y,self.Dh, self.Nxg, self.Nyg)

                rho=-qe*rho/(self.Dh*self.Dh);
                
                self.compute_spchg_efield_from_rho(rho, flag_verbose = False)
                
                
        self.flag_recomputed_sc=flag_recompute
    def recompute_spchg_efield(self, MP_e, t_curr=None):
        
        flag_recompute=True              
        if self.flag_decimate:
            flag_recompute = (t_curr - self.t_last_recom)>=self.Dt_sc
        
        if flag_recompute:
            self.t_last_recom = t_curr
            
            #print t_curr
            
            if (MP_e.N_mp>0):
            
                qe=1.602176565e-19;
                eps0=8.8541878176e-12;
                
                rho=rhocom.compute_sc_rho(MP_e.x_mp[0:MP_e.N_mp],MP_e.y_mp[0:MP_e.N_mp],MP_e.nel_mp[0:MP_e.N_mp],
                                          self.bias_x,self.bias_y,self.Dh, self.Nxg, self.Nyg)

                rho=-qe*rho/(self.Dh*self.Dh);
                
                self.compute_spchg_efield_from_rho(rho, flag_verbose = False)
                
                
        self.flag_recomputed_sc=flag_recompute
Example #3
0
 def particles_to_mesh(self, *mp_coords, **kwargs):
     x, y = mp_coords  #only 2 dimensions are supported
     charge = kwargs.get("charge", e)
     nel_mp = charge * np.ones(x.shape)
     rho = rhocom.compute_sc_rho(x, y, nel_mp, self.mesh.x0, self.mesh.y0,
                                 self.mesh.dx, self.mesh.nx, self.mesh.ny)
     return rho.reshape(self.mesh.nx, self.mesh.ny).T
Example #4
0
 def particles_to_mesh(self, *mp_coords, **kwargs):
     x, y = mp_coords #only 2 dimensions are supported
     charge = kwargs.get("charge", e)
     nel_mp = charge * np.ones(x.shape)
     rho = rhocom.compute_sc_rho(x, y, nel_mp, self.mesh.x0, self.mesh.y0,
                                 self.mesh.dx, self.mesh.nx, self.mesh.ny)
     return rho.reshape(self.mesh.nx, self.mesh.ny).T
Example #5
0
	def scatter(self, x_mp, y_mp, nel_mp, charge = -qe):
		
		if not (len(x_mp)==len(y_mp)==len(nel_mp)):
			raise ValueError('x_mp, y_mp, nel_mp should have the same length!!!')
		
		if len(x_mp)>0:
			rho=rhocom.compute_sc_rho(x_mp,y_mp,nel_mp,
									  self.bias_x,self.bias_y,self.Dh, self.Nxg, self.Nyg)

			self.rho=charge*rho/(self.Dh*self.Dh);
		else:
			self.rho=self.rho*0.
Example #6
0
    def scatter(self, x_mp, y_mp, nel_mp, charge = -qe, flag_add=False):
        
        if not (len(x_mp)==len(y_mp)==len(nel_mp)):
            raise ValueError('x_mp, y_mp, nel_mp should have the same length!!!')
        
        if len(x_mp)>0:
            rho=rhocom.compute_sc_rho(x_mp,y_mp,nel_mp,self.bias_x,self.bias_y,self.dx,self.dy,self.Nxg,self.Nyg)
        else:
            rho=self.rho*0.

        if flag_add:
            self.rho+=charge*rho/(self.dx*self.dy);
        else:
            self.rho=charge*rho/(self.dx*self.dy);