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
62 deallocate(self%particle_array)
76 sll_int32 ,
intent( in ) :: n_particles
77 sll_int32 ,
intent( in ) :: n_total_particles
78 sll_real64 ,
intent( in ) :: charge
79 sll_real64 ,
intent( in ) :: mass
80 sll_int32 ,
intent( in ) :: n_weights
84 self%n_particles = n_particles
85 self%n_total_particles = n_total_particles
87 sll_allocate(self%particle_array(4+n_weights, n_particles), ierr)
89 allocate(self%species, stat=ierr)
90 sll_assert( ierr == 0)
91 call self%species%init( charge, mass )
93 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 )
136 sll_int32 ,
intent( in ) :: n_particles
137 sll_int32 ,
intent( in ) :: n_total_particles
138 sll_real64 ,
intent( in ) :: charge
139 sll_real64 ,
intent( in ) :: mass
140 sll_int32 ,
intent( in ) :: n_weights
145 select type (particle_group)
147 call particle_group%init( n_particles, n_total_particles, charge, mass, n_weights )
157 sll_int32 ,
intent( in ) :: i
161 r(1:3) = self%particle_array(1:3, i)
169 sll_int32 ,
intent( in ) :: i
173 r(1) = self%particle_array( 4, 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(4+i_wi, i) * self%common_weight
197 sll_int32 ,
intent( in ) :: i
198 sll_int32,
optional ,
intent( in ) :: i_weight
204 if(
present(i_weight)) i_wi = i_weight
205 r = self%species%m * self%particle_array( 4+i_wi, i) * self%common_weight
213 sll_int32 ,
intent( in ) :: i
214 sll_real64 :: r(self%n_weights)
216 r = self%particle_array(5:4+self%n_weights, i)
226 r = self%common_weight
234 sll_int32 ,
intent( in ) :: i
235 sll_real64 ,
intent( in) :: x(3)
237 self%particle_array(1:3, i) = x(1:3)
245 sll_int32 ,
intent( in ) :: i
246 sll_real64 ,
intent( in) :: x(3)
248 self%particle_array(4, i) = x(1)
256 sll_int32 ,
intent( in ) :: i
257 sll_real64 ,
intent( in) :: x(self%n_weights)
259 self%particle_array(5:4+self%n_weights, i) = x
268 sll_real64 ,
intent( in):: x
270 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 type for 3d1v.
pure real(kind=f64) function, dimension(3) get_v_3d1v(self, i)
Get velocity.
subroutine set_v_3d1v(self, i, x)
Set velocity of particle i.
pure real(kind=f64) function, dimension(self%n_weights) get_weights_3d1v(self, i)
Get particle weights.
subroutine initialize_particle_group_3d1v(self, n_particles, n_total_particles, charge, mass, n_weights)
Initialization of the particle group.
subroutine set_weight_3d1v(self, i, x)
Set weights of particle i.
pure real(kind=f64) function, dimension(3) get_x_3d1v(self, i)
Get position.
pure real(kind=f64) function get_charge_3d1v(self, i, i_weight)
Get charge of particle (q * particle_weight)
pure real(kind=f64) function get_mass_3d1v(self, i, i_weight)
Get mass of particle (m * particle_weight)
subroutine, public sll_s_new_particle_group_3d1v_ptr(particle_group, n_particles, n_total_particles, charge, mass, n_weights)
Constructor for pointer.
pure real(kind=f64) function get_common_weight_3d1v(self)
Set the common weight.
subroutine delete_particle_group_3d1v(self)
print particle array to file
subroutine set_common_weight_3d1v(self, x)
Set the common weight.
subroutine print_particle_group_3d1v(self, filename)
Print particle array to file.
subroutine set_x_3d1v(self, i, x)
Set position of particle i.
subroutine, public sll_s_new_particle_group_3d1v(particle_group, n_particles, n_total_particles, charge, mass, n_weights)
Constructor for allocatable.
Simple version of a PIC particle group in 3d1v.