nbia-astro / skeletor

Parallel PIC code written in Python and based on the skeleton codes provided by PICKSC
GNU General Public License v3.0
1 stars 0 forks source link

Ly should be part of cython grid class #157

Closed tberlok closed 7 years ago

tberlok commented 7 years ago

We have a yellow line in 37 below.

+26: def shear_periodic_y(particle_t[:] particles, grid_t grid, real_t S, real_t t):
 27:     """Shearing periodic boundaries along y.
 28: 
 29:        This function modifies x and vx and subsequently applies periodic
 30:        boundaries on x.
 31: 
 32:        The periodic boundaries on y are handled by ppic2 *after* we have
 33:        used the values of y to update x and vx.
 34:     """
+35:     cdef int Np = particles.shape[0]
+36:     cdef real_t ny = <real_t> grid.ny
+37:     cdef real_t vx_boost = S*grid.Ly
+38:     cdef real_t x_boost = vx_boost*t/grid.dx
 39:     cdef int ip
 40: 
+41:     for ip in prange(Np, nogil=True, schedule='static'):
 42:         # Left
+43:         if particles[ip].y < 0.0:
+44:             particles[ip].x = particles[ip].x - x_boost
+45:             particles[ip].vx = particles[ip].vx - vx_boost
 46:         # Right
+47:         if particles[ip].y >= ny:
+48:             particles[ip].x = particles[ip].x + x_boost
+49:             particles[ip].vx = particles[ip].vx + vx_boost
tberlok commented 7 years ago

This is also an issue for finite_difference.html because we have only defined cdef public int lbx, lby but not ubx and uby, apparently.