8 #include "sll_assert.h"
9 #include "sll_memory.h"
10 #include "sll_working_precision.h"
29 sll_real64,
allocatable :: particle_array(:,:)
30 sll_real64 :: common_weight = 1.0_f64
63 deallocate(self%particle_array)
77 sll_int32 ,
intent( in ) :: n_particles
78 sll_int32 ,
intent( in ) :: n_total_particles
79 sll_real64 ,
intent( in ) :: charge
80 sll_real64 ,
intent( in ) :: mass
81 sll_int32 ,
intent( in ) :: n_weights
85 self%n_particles = n_particles
86 self%n_total_particles = n_total_particles
88 sll_allocate(self%particle_array(5+n_weights, self%n_particles), ierr)
90 allocate(self%species, stat=ierr)
91 sll_assert( ierr == 0)
92 call self%species%init( charge, mass)
94 self%n_weights = n_weights
109 sll_int32 ,
intent( in ) :: n_particles
110 sll_int32 ,
intent( in ) :: n_total_particles
111 sll_real64 ,
intent( in ) :: charge
112 sll_real64 ,
intent( in ) :: mass
113 sll_int32 ,
intent(in) :: n_weights
119 select type( particle_group )
121 call particle_group%init(n_particles, n_total_particles, charge, mass, n_weights)
137 sll_int32 ,
intent( in ) :: n_particles
138 sll_int32 ,
intent( in ) :: n_total_particles
139 sll_real64 ,
intent( in ) :: charge
140 sll_real64 ,
intent( in ) :: mass
141 sll_int32 ,
intent(in) :: n_weights
147 select type( particle_group )
149 call particle_group%init(n_particles, n_total_particles, charge, mass, n_weights)
158 sll_int32 ,
intent( in ) :: i
161 r(1:2) = self%particle_array(1:2, i)
169 sll_int32 ,
intent( in ) :: i
172 r = self%particle_array(3:5, i)
181 sll_int32 ,
intent( in ) :: i
182 sll_int32,
optional ,
intent( in ) :: i_weight
188 if(
present(i_weight)) i_wi = i_weight
189 r = self%species%q * self%particle_array(5+i_wi, i) * self%common_weight
198 sll_int32 ,
intent( in ) :: i
199 sll_int32,
optional ,
intent( in ) :: i_weight
205 if(
present(i_weight)) i_wi = i_weight
206 r = self%species%m * self%particle_array(5+i_wi, i) * self%common_weight
215 sll_int32 ,
intent( in ) :: i
216 sll_real64 :: r(self%n_weights)
218 r = self%particle_array(6:5+self%n_weights, i)
228 r = self%common_weight
236 sll_int32 ,
intent( in ) :: i
237 sll_real64 ,
intent( in) :: x(3)
239 self%particle_array(1:2, i) = x(1:2)
247 sll_int32 ,
intent( in ) :: i
248 sll_real64 ,
intent( in) :: x(3)
250 self%particle_array(3:5, i) = x
258 sll_int32 ,
intent( in ) :: i
259 sll_real64 ,
intent( in) :: x(self%n_weights)
261 self%particle_array(6:5+self%n_weights, i) = x
269 sll_real64 ,
intent( in) :: x
271 self%common_weight = x
279 character(len=*),
intent(in) :: filename
282 open(newunit=file_id,file=filename)
283 write(file_id,*) self%particle_array
Simple particle group group for 2d3v.
subroutine initialize_particle_group_2d3v(self, n_particles, n_total_particles, charge, mass, n_weights)
Initialize particle group.
pure real(kind=f64) function, dimension(3) get_v_2d3v(self, i)
Get velocities of particle i.
subroutine delete_particle_group_2d3v(self)
Prints particle array (Note: Not parallelized)
subroutine, public sll_s_new_particle_group_2d3v(particle_group, n_particles, n_total_particles, charge, mass, n_weights)
Constructor for abstract type.
subroutine, public sll_s_new_particle_group_2d3v_ptr(particle_group, n_particles, n_total_particles, charge, mass, n_weights)
Constructor for abstract type.
subroutine set_x_2d3v(self, i, x)
Set positions of particle i.
subroutine set_common_weight_2d3v(self, x)
Set the common weight.
pure real(kind=f64) function, dimension(3) get_x_2d3v(self, i)
Get positions of particle i.
subroutine set_v_2d3v(self, i, x)
Set velocities of particle i.
pure real(kind=f64) function get_mass_2d3v(self, i, i_weight)
Get mass of particle i ( m * particle_weight)
subroutine set_weights_2d3v(self, i, x)
Set weights of particle i.
pure real(kind=f64) function get_charge_2d3v(self, i, i_weight)
Get charge of particle i ( q * particle_weight)
pure real(kind=f64) function, dimension(self%n_weights) get_weights_2d3v(self, i)
Get weights of particle i.
pure real(kind=f64) function get_common_weight_2d3v(self)
Set the common weight.
subroutine print_particle_group_2d3v(self, filename)
Print particle array.
Simple version of a PIC particle group in 2d3v.