Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
Data Types | Modules | Macros | Functions/Subroutines | Variables
sll_m_particle_group_2d2v_lbf.F90 File Reference
#include "sll_assert.h"
#include "sll_errors.h"
#include "sll_memory.h"
#include "sll_working_precision.h"
Include dependency graph for sll_m_particle_group_2d2v_lbf.F90:

Go to the source code of this file.

Data Types

type  sll_t_int_list_element
 linked lists of integers, used in some of the module routines More...
 
type  sll_t_int_list_element_ptr
 a pointer type is needed for arrays of lists More...
 
type  sll_t_particle_group_2d2v_lbf
 Group of sll_t_particle_group_2d2v_lbf. More...
 

Modules

module  sll_m_particle_group_2d2v_lbf
 Module for a particle group with linearized-backward-flow (lbf) resamplings.
 

Macros

#define UPDATE_CLOSEST_PARTICLE_ARRAYS_USING_NEIGHBOR_CELLS(djx, djy, djvx, djvy)
 

Functions/Subroutines

pure real(kind=f64) function, dimension(3) get_x_2d2v_lbf (self, i)
 Getters ----------------------------------------------------------------------------------------------------------------—. More...
 
pure real(kind=f64) function, dimension(3) get_v_2d2v_lbf (self, i)
 Get the velocity of a particle. More...
 
pure real(kind=f64) function get_charge_2d2v_lbf (self, i, i_weight)
 Get charge of a particle (q * particle_weight) More...
 
pure real(kind=f64) function get_mass_2d2v_lbf (self, i, i_weight)
 Get mass of a particle ( m * particle_weight) More...
 
pure real(kind=f64) function, dimension(self%n_weights) get_weights_2d2v_lbf (self, i)
 Get weights of a particle. More...
 
pure real(kind=f64) function get_common_weight_2d2v_lbf (self)
 Set the common weight. More...
 
subroutine set_x_2d2v_lbf (self, i, x)
 Setters ----------------------------------------------------------------------------------------------------------------—. More...
 
subroutine set_v_2d2v_lbf (self, i, x)
 Set the velocity of a particle. More...
 
subroutine set_weights_2d2v_lbf (self, i, x)
 Set the weights of a particle. More...
 
subroutine set_common_weight_2d2v_lbf (self, x)
 Set the common weight. More...
 
subroutine initialize_particle_group_2d2v_lbf (self, species_charge, species_mass, domain_is_x_periodic, domain_is_y_periodic, remap_degree, remapping_grid_eta_min, remapping_grid_eta_max, remapping_sparse_grid_max_levels, n_particles_x, n_particles_y, n_particles_vx, n_particles_vy, n_weights)
 Initializer ------------------------------------------------------------------------------------------------------------— Initialize particle group. More...
 
subroutine, public sll_s_new_particle_group_2d2v_lbf_ptr (particle_group, species_charge, species_mass, domain_is_x_periodic, domain_is_y_periodic, remap_degree, remapping_grid_eta_min, remapping_grid_eta_max, remapping_sparse_grid_max_levels, n_particles_x, n_particles_y, n_particles_vx, n_particles_vy)
 Constructor for abstract type. More...
 
subroutine delete_particle_group_2d2v_lbf (self)
 Destructor -------------------------------------------------------------------------------------------------------------—. More...
 
subroutine sample (self, target_total_charge, enforce_total_charge, init_f_params, rand_seed, rank, world_size)
 sample (layer for resample procedure) ----------------------------------------------------------------------------------— this routine essentially does 2 things: More...
 
subroutine resample (self, target_total_charge, enforce_total_charge, init_f_params, rand_seed, rank, world_size)
 resample (and sample) --------------------------------------------------------------------------------------------------— this routine essentially does 2 things: More...
 
subroutine write_known_density_on_remapping_grid (self, distribution_params)
 write_known_density_on_remapping_grid ----------------------------------------------------------------------------------— this routine writes a given distribution on the interpolation (sparse grid) nodes to further approximate it More...
 
subroutine reset_particles_positions (self)
 reset_particles_positions ----------------------------------------------------------------------------------------------— reset the particles on the initial (cartesian) grid – we use the (multi-purpose) lbf grid – NOTE: particles will be located at the center of each cell (to avoid a particular treatment of periodic domains) More...
 
integer(kind=i32) function get_neighbor_index (self, k, dim, dir)
 get_neighbor_index -----------------------------------------------------------------------------------------------------— returns the index of the specified particle neighbor (defines the particle connectivity) More...
 
subroutine reset_particles_weights_with_direct_interpolation (self, target_total_charge, enforce_total_charge)
 reset_particles_weights_with_direct_interpolation ----------------------------------------------------------------------— compute (and set) the particle weights using a direct interpolation (here, sparse grid) – does not change the position of the deposition particles More...
 
real(kind=f64) function interpolate_value_of_remapped_f (self, eta)
 interpolate_value_of_remapped_f ----------------------------------------------------------------------------------------— computes the value of the (last) remapped density f using the interpolation tool – for now, assuming only sparse grid interpolation More...
 
subroutine reconstruct_f_lbf (self, reconstruction_set_type, given_grid_4d, given_array_4d, reconstruct_f_on_last_node, target_total_charge, enforce_total_charge)
 macro for the lbf approximation of a transported density (reconstruct_f_lbf) below -------------------------------------— More...
 
subroutine reconstruct_f_lbf_on_remapping_grid (self)
 reconstruct_f_lbf_on_remapping_grid ------------------------------------------------------------------------------------— layer for reconstruct_f_lbf, when reconstructing f on the remapping grid More...
 
subroutine reconstruct_f_lbf_on_given_grid (self, given_grid_4d, given_array_4d, reconstruct_f_on_last_node, target_total_charge, enforce_total_charge)
 reconstruct_f_lbf_on_remapping_grid ------------------------------------------------------------------------------------— layer for reconstruct_f_lbf, when reconstructing f on a given grid More...
 
subroutine get_ltp_deformation_matrix (self, k, mesh_period_x, mesh_period_y, h_particles_x, h_particles_y, h_particles_vx, h_particles_vy, x_k, y_k, vx_k, vy_k, d11, d12, d13, d14, d21, d22, d23, d24, d31, d32, d33, d34, d41, d42, d43, d44)
 get_ltp_deformation_matrix ---------------------------------------------------------------------------------------------— Compute the coefficients of the particle 'deformation' matrix which actually approximates the Jacobian matrix of the exact backward flow (defined between the current time and that of the particle initialization – or the last particle remapping) at the current particle position. More...
 
subroutine periodic_correction (p_group, x, y)
 periodic_correction ----------------------------------------------------------------------------------------------------— puts the point (x,y) back into the computational domain if periodic in x or y (or both) otherwise, does nothing More...
 
type(sll_t_int_list_element) function, pointer sll_f_add_element_in_int_list (head, new_element)
 sll_f_add_element_in_int_list ------------------------------------------------------------------------------------------— list management More...
 
subroutine convert_4d_index_to_1d (k, j_x, j_y, j_vx, j_vy, n_parts_x, n_parts_y, n_parts_vx, n_parts_vy)
 convert_4d_index_to_1d -------------------------------------------------------------------------------------------------— given the 4d index of a node on a cartesian grid, returns its 1d index in some assumed order see inverse function convert_1d_index_to_4d More...
 
subroutine convert_1d_index_to_4d (j_x, j_y, j_vx, j_vy, k, n_parts_x, n_parts_y, n_parts_vx, n_parts_vy)
 convert_1d_index_to_4d -------------------------------------------------------------------------------------------------— given the 1d index of a node on a cartesian grid (with some assumed order), returns its 4d index see inverse function convert_4d_index_to_1d More...
 
subroutine get_1d_cell_containing_point (j, x, x_min, h)
 get_1d_cell_containing_point -------------------------------------------------------------------------------------------— elementary function to compute the index j of the 1d cell containing a point x, ie x_min + (j-1)*h <= x < x_min + j*h bounds check should be performed outside this routine More...
 
subroutine update_closest_particle_arrays (k_part, x_aux, y_aux, vx_aux, vy_aux, i, j, l, m, h_cell_x, h_cell_y, h_cell_vx, h_cell_vy, closest_particle, closest_particle_distance)
 update_closest_particle_arrays -----------------------------------------------------------------------------------------— update the arrays closest_particle and closest_particle_distance with the index of the given particle if closer to what had been stored up to now. More...
 

Variables

integer(kind=i32), parameter sll_p_lbf_remapping_grid = 1
 possible values for the parameter reconstruction_set_type in the reconstruction routine More...
 
integer(kind=i32), parameter sll_p_lbf_given_grid = 2
 

Macro Definition Documentation

◆ UPDATE_CLOSEST_PARTICLE_ARRAYS_USING_NEIGHBOR_CELLS

#define UPDATE_CLOSEST_PARTICLE_ARRAYS_USING_NEIGHBOR_CELLS (   djx,
  djy,
  djvx,
  djvy 
)
Value:
1  do; \
2  k_neighbor = closest_particle(j_x+(djx), j_y+(djy), j_vx+(djvx), j_vy+(djvy)); \
3 ; \
4  if(k_neighbor /= 0) then; \
5  do; \
6  coords = self%get_x(k_neighbor) ; \
7  x = coords(1) ; \
8  y = coords(2) ; \
9  coords = self%get_v(k_neighbor) ; \
10  vx = coords(1) ; \
11  vy = coords(2) ; \
12  call periodic_correction(self,x,y) ; \
13  call update_closest_particle_arrays(k_neighbor, \
14  x - self%lbf_grid%eta1_min, y - self%lbf_grid%eta2_min, vx - self%lbf_grid%eta3_min, vy - self%lbf_grid%eta4_min, \
15  j_x, j_y, j_vx, j_vy, \
16  h_flow_grid_x, \
17  h_flow_grid_y, \
18  h_flow_grid_vx, \
19  h_flow_grid_vy, \
20  closest_particle, \
21  closest_particle_distance) ; \
22  exit; \
23  end do; \
24  end if; \
25  exit; \
26  end do
    Report Typos and Errors