25 #include "sll_assert.h"
26 #include "sll_errors.h"
27 #include "sll_memory.h"
28 #include "sll_working_precision.h"
57 sll_real64 :: total_charge
67 sll_real64,
intent( in ) :: target_total_charge
68 self%total_charge = target_total_charge
76 distribution_params, &
80 conservative_sampling_params, &
87 sll_int32,
intent( in ),
optional :: nb_weights
90 sll_real64,
intent( in ),
optional :: xmin(:)
91 sll_real64,
intent( in ),
optional :: lx(:)
93 sll_real64 :: target_total_charge
94 logical :: enforce_total_charge
96 select type ( particle_group )
101 if(
present(conservative_sampling_params) )
then
102 enforce_total_charge = .true.
103 target_total_charge = conservative_sampling_params%total_charge
105 enforce_total_charge = .false.
106 target_total_charge = 0._f64
108 call particle_group%sample( target_total_charge, enforce_total_charge, distribution_params )
113 sll_assert(
present( random_sampler ) )
114 sll_assert(
present( xmin ) )
115 sll_assert(
present( lx ) )
116 call random_sampler%sample( particle_group, distribution_params, xmin, lx )
119 if (nb_weights == 1 )
then
120 call random_sampler%sample ( particle_group, distribution_params, xmin, lx )
121 elseif ( nb_weights == 3 )
then
123 call random_sampler%sample_cv ( particle_group, distribution_params, xmin, lx,
control_variate )
125 sll_error(
"sll_s_sample_particle_group",
"random sampling interface not implemented for this nb of weights")
137 conservative_sampling_params ) !< whether charge must be conserved
141 sll_real64 :: target_total_charge
142 logical :: enforce_total_charge
144 select type ( particle_group )
147 if(
present(conservative_sampling_params) )
then
148 enforce_total_charge = .true.
149 target_total_charge = conservative_sampling_params%total_charge
151 enforce_total_charge = .false.
152 target_total_charge = 0._f64
154 call particle_group%resample( target_total_charge, enforce_total_charge )
157 sll_error(
"sll_s_resample_particle_group",
"resampling interface not implemented for this type of particle group")
Parameters to define common initial distributions.
Module for a particle group with linearized-backward-flow (lbf) resamplings.
Interface routines for sampling and resampling particle groups.
subroutine, public sll_s_sample_particle_group(particle_group, distribution_params, random_sampler, nb_weights, control_variate, conservative_sampling_params, xmin, Lx)
sampling interface
subroutine, public sll_s_resample_particle_group(particle_group, conservative_sampling_params)
resampling interface
subroutine set_total_charge(self, target_total_charge)
Particle initializer class with various functions to initialize a particle.
real(kind=f64) function, dimension(size(particle, 2)) control_variate(particle)
Abstract data type for parameters of initial distribution.
Group of sll_t_particle_group_2d2v_lbf.
Data type for particle sampling.
type used to enforce some conservation properties in the sampling – (there may be more than just one ...