Appearance
adam_prism_pic_object
ADAM, PRISM Particle-in-Cell class definition, CPU backend.
Source: src/app/prism/common/adam_prism_pic_object.F90
Dependencies
Contents
- prism_pic_object
- particle_weighting_interface
- current_weighting_interface
- field_weighting_interface
- totorica_kernels
- check_esirkepov_q_order
- matched_kernels
- set_coherent_gather
- initialize
- set_particle_number
- resize_neighbour_list
- set_plasma_region
- load_from_file
- particle_cartesian_grid_index
- distribute_particles
- exchange_particles
- migrate_particles
- set_gaussian_support_cells
- NGP_charge_weighting
- CIC_charge_weighting
- TSC_charge_weighting
- cubic_charge_weighting
- quartic_charge_weighting
- quintic_charge_weighting
- sextic_charge_weighting
- bspline_charge_weighting
- bspline_closed_weights
- Gaussian_charge_weighting
- NGP_current_weighting
- CIC_current_weighting
- TSC_current_weighting
- cubic_current_weighting
- quartic_current_weighting
- quintic_current_weighting
- sextic_current_weighting
- bspline_current_weighting
- Gaussian_current_weighting
- zeroD_field_weighting
- oneD_field_weighting
- twoD_field_weighting
- threeD_field_weighting
- fourD_field_weighting
- fiveD_field_weighting
- sixD_field_weighting
- Gaussian_field_weighting
- bspline_field_weighting
- shape_field_weighting
- coherent_field_weighting
- transposed_filter_axis
- set_bspline_stencil
- compaction_moves
- conserving_solver_name
- matched_current
- coherent_gather
- matched_gather
- description
- halo_margin_cells
- stencil_radius_cells
- effective_bspline_weight
- gaussian_weight
- effective_gaussian_weight
- bspline_weight
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
INI_SECTION_NAME | character(len=3) | parameter | INI file section name for PIC configuration. |
PLASMA_TYPE_PROBLEM | character(len=6) | parameter | Analyzing physical problem involving the presence of |
COHERENT_INITIALIZATION | character(len=8) | parameter | Field initialization through elliptic solver with |
ELLIPTIC_CLOSURE_GROUNDED | character(len=8) | parameter | t0 solves: the mean fields of the PEC |
ELLIPTIC_CLOSURE_ISOLATED | character(len=8) | parameter | t0 solves: the mean fields of the PEC |
SINGLE_PARTICLE_TYPE_PROBLEM | character(len=15) | parameter | Analyzing physical problem involving the |
NGP_WEIGHTING_MODEL | character(len=3) | parameter | NGP weighting model. |
CIC_WEIGHTING_MODEL | character(len=3) | parameter | CIC weighting model. |
TSC_WEIGHTING_MODEL | character(len=3) | parameter | TSC weighting model. |
CUBIC_WEIGHTING_MODEL | character(len=5) | parameter | cubic order weighting model. |
QUARTIC_WEIGHTING_MODEL | character(len=7) | parameter | quartic order weighting model. |
QUINTIC_WEIGHTING_MODEL | character(len=7) | parameter | quintic order weighting model. |
SEXTIC_WEIGHTING_MODEL | character(len=6) | parameter | Sextic B-spline weighting. |
GAUSSIAN_WEIGHTING_MODEL | character(len=8) | parameter | Gaussian weighting model. |
ZEROD_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 0D field weighting. |
ONED_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 1D field weighting. |
TWOD_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 2D field weighting. |
THREED_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 3D field weighting. |
FOURD_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 4D field weighting. |
FIVED_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | 5D field weighting. |
SIXD_FIELDS_WEIGHTING_MODEL | character(len=2) | parameter | Sextic field weighting. |
NUM_SCHEME_TIME_PIC_LEAPFROG | character(len=8) | parameter | Leapfrog numerical scheme for time operator. |
NUM_SCHEME_TIME_PIC_RUNGE_KUTTA | character(len=11) | parameter | Runge-Kutta numerical scheme for time operator. |
UNIFORM_DOMAIN | character(len=14) | parameter | |
UNIFORM_CILINDER | character(len=16) | parameter | |
UNIFORM_CELL | character(len=12) | parameter | |
UNIFORM_SLAB | character(len=12) | parameter | Slab spanning the transverse domain. |
UNIFORM_BOX | character(len=11) | parameter | Box inside the domain. |
CONSERVING_CURRENT_WEIGHTING_MODEL | character(len=10) | parameter | Charge-conserving current model. |
LONDRILLO_CURRENT_CONSERVING_SOLVER | character(len=9) | parameter | Esirkepov face flux + inverse |
TOTORICA_CURRENT_CONSERVING_SOLVER | character(len=8) | parameter | Matched local current with L = m, |
ESIRKEPOV_MODIFIED_CURRENT_CONSERVING_SOLVER | character(len=11) | parameter | Matched local current family |
Derived Types
prism_pic_object
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
plasma_density | real(kind=R8P) | Plasma density | |
neutral_fraction | real(kind=R8P) | Neutral fraction | |
particle_weight | real(kind=R8P) | Real particles per macroparticle. | |
cilinder_length | real(kind=R8P) | ||
cilinder_radius | real(kind=R8P) | ||
cilinder_center | real(kind=R8P) | ||
cilinder_axis | character(len=1) | ||
slab_normal | character(len=1) | Slab normal direction (x, y, z). | |
slab_thickness | real(kind=R8P) | Slab thickness along the normal. | |
slab_center | real(kind=R8P) | Slab centre coordinate along the normal. | |
box_length | real(kind=R8P) | Box side lengths along x, y, z. | |
box_center | real(kind=R8P) | Box centre. | |
plasma_region_min | real(kind=R8P) | Slab/box region at t0, minimum corner. | |
plasma_region_max | real(kind=R8P) | Slab/box region at t0, maximum corner. | |
sigma | real(kind=R8P) | Standard deviation for a gaussian weighting | |
cutoff_sigma | real(kind=R8P) | Gaussian cutoff. | |
gaussian_support_cells | integer(kind=I4P) | Gaussian support radius; negative selects automatic. | |
particle_number | integer(kind=I4P) | Number of particles owned by this rank. | |
particle_number_global | integer(kind=I4P) | Total number of particles (all ranks). | |
particle_capacity | integer(kind=I4P) | Particle arrays capacity of every rank (issue #112). | |
particle_capacity_factor | real(kind=R8P) | Capacity in units of global/ranks; 0: global. | |
omega_dt_max | real(kind=R8P) | Accuracy threshold on omega_max dt (plasma frequencies). | |
charge_conservation_save | integer(kind=I4P) | Charge-conservation history every N steps; 0: none. | |
n_ions | integer(kind=I4P) | Total ions number | |
n_electrons | integer(kind=I4P) | Total electrons number | |
n_neutrals | integer(kind=I4P) | Total neutrals number | |
neighbour_list | integer(kind=I4P) | allocatable | Particle grid positions array. |
bc | type(prism_pic_bc_object) | Particle closures at the domain faces. | |
problem_type | character(len=99) | Type of problem analyzed | |
plasma_domain | character(len=99) | Domain of plasma at t0 | |
initialization | character(len=99) | Field initialization solver. | |
electric_field_elliptic_initialization | logical | Solve for phi (div D = rho) at t0. | |
magnetic_field_elliptic_initialization | logical | Solve for A (curl B = mu J) at t0. | |
elliptic_initialization_closure | character(len=99) | Mean fields of the t0 solves. | |
filter_deposition | logical | Binomial filter for deposition and gather weights. | |
particle_weighting_model | character(len=99) | Particle weighting model. | |
current_weighting_model | character(len=99) | Current weighting model. | |
field_weighting_model | character(len=99) | Field weighting model. | |
esirkepov_tail_cleanup | logical | Remove small current leakage outside each particle's support. | |
current_conserving_solver | character(len=99) | Conserving current solver. | |
esirkepov_q | integer(kind=I4P) | Q filter coefficients of esirkepov_Q (5,6,8,10), 0 otherwise. | |
gather_q | integer(kind=I4P) | Coherent gather esirkepov_Q: N (5,6,8,10), 0 otherwise. | |
gather_p | real(kind=R8P) | Coherent matched gather: P kernel of the charge deposit. | |
gather_radius | integer(kind=I4P) | Coherent matched gather: taps of P. | |
gather_dual | logical | Coherent gather of an odd esirkepov_Q: base shape on the | |
scheme_time | character(len=99) | Numerical scheme for time operator [runge_kutta, leapfrog,...]. | |
particle_weighting | procedure(particle_weighting_interface) | pass(self), pointer | Particle weighting. |
current_weighting | procedure(current_weighting_interface) | pass(self), pointer | Current weighting. |
field_weighting | procedure(field_weighting_interface) | pass(self), pointer | field weighting. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
description | pass(self) | Return pretty-printed object description. |
conserving_solver_name | pass(self) | Input name of the conserving current solver. |
matched_current | pass(self) | True for the local matched currents (totorica, esirkepov_Q). |
check_esirkepov_q_order | pass(self) | Check the esirkepov_Q filter against the FD order. |
coherent_gather | pass(self) | True for the gathers named after a conserving solver. |
matched_gather | pass(self) | True for the coherent gathers of totorica and esirkepov_Q. |
set_coherent_gather | pass(self) | Set the coherent gather kernels, warn on a deposit mismatch. |
initialize | pass(self) | Initialize IC. |
load_from_file | pass(self) | Load config from file. |
set_particle_number | pass(self) | Scale the plasma inputs, set the particle number at t0. |
resize_neighbour_list | pass(self) | Reallocate the neighbour list, keeping its first columns. |
set_plasma_region | pass(self) | Set and check the slab/box region of the plasma at t0. |
particle_cartesian_grid_index | pass(self) | Compute the grid index corresponding to a particle position. |
halo_margin_cells | pass(self) | Cells a particle may lie outside its block interior. |
distribute_particles | pass(self) | Keep the injected particles owned by this rank. |
exchange_particles | pass(self) | Hand departing particles to their owner ranks. |
migrate_particles | pass(self) | Migrate particles between ranks (host arrays). |
set_gaussian_support_cells | pass(self) | Automatic Gaussian support radius on the final grid. |
stencil_radius_cells | pass(self) | Max cells reached by deposit/gather stencils beyond the particle cell. |
CIC_charge_weighting | pass(self) | Cloud-in-Cell weighting of particle quantities to the grid. |
NGP_charge_weighting | pass(self) | Nearest Grid Point weighting of particle quantities to the grid. |
TSC_charge_weighting | pass(self) | Triangular Shaped Cloud weighting of particle quantities to the grid. |
cubic_charge_weighting | pass(self) | 3rd order weighting of particle quantities to the grid. |
quartic_charge_weighting | pass(self) | 4th order weighting of particle quantities to the grid. |
sextic_charge_weighting | pass(self) | |
sextic_current_weighting | pass(self) | |
quintic_charge_weighting | pass(self) | 5th order weighting of particle quantities to the grid. |
Gaussian_charge_weighting | pass(self) | Gaussian Shaped Cloud weighting of particle quantities to the grid. |
CIC_current_weighting | pass(self) | Cloud-in-Cell weighting of particle quantities to the grid. |
NGP_current_weighting | pass(self) | Nearest Grid Point weighting of particle quantities to the grid. |
TSC_current_weighting | pass(self) | Triangular Shaped Cloud weighting of particle quantities to the grid. |
Gaussian_current_weighting | pass(self) | Gaussian Shaped Cloud weighting of particle quantities to the grid. |
zeroD_field_weighting | pass(self) | |
oneD_field_weighting | pass(self) | |
twoD_field_weighting | pass(self) | |
threeD_field_weighting | pass(self) | |
fourD_field_weighting | pass(self) | |
sixD_field_weighting | pass(self) | |
fiveD_field_weighting | pass(self) | |
Gaussian_field_weighting | pass(self) | |
bspline_field_weighting | pass(self) | |
shape_field_weighting | pass(self) | Gather with the particle shape (charge deposit of the model). |
coherent_field_weighting | pass(self) | Gather with the transpose of the conserving charge operator. |
Interfaces
particle_weighting_interface
current_weighting_interface
field_weighting_interface
Subroutines
totorica_kernels
Totorica's matched current (Totorica 2025, eq. 53-54, S^JO = I) for the centered FD of half stencil hs. The derivative factors as D = delta A, A the face reconstruction FV1_CC(:,hs) (A = m C, m = [1,1]/2); then L = Q = m and P = A m: center i <- faces i-1/2, i+1/2 (weight 1/2 each) <- centers i+1-m, i+m and i-m, i-1+m (weight a_m). FD2 gives P = [1,2,1]/4, the former esirkepov_Q2; from FD4 on P has negative lobes (those of C).
Attributes: pure
fortran
subroutine totorica_kernels(hs, p, qw, radius, qfirst, nq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
hs | integer(kind=I4P) | in | FD half stencil. | |
p | real(kind=R8P) | out | P kernel on cell centers. | |
qw | real(kind=R8P) | out | Q kernel from the faces to the centers. | |
radius | integer(kind=I4P) | out | Taps of P. | |
qfirst | integer(kind=I4P) | out | Offset of the first Q face (flux index = center + qfirst). | |
nq | integer(kind=I4P) | out | Taps of Q. |
Call graph
check_esirkepov_q_order
The esirkepov_Q<N> filters are built on D = delta A with P = A Q for FD6 (A6 = [1,-8,37,37,-8,1]/60): Q5, Q6, Q8 and Q10 require fdv_order = 6. No-op for the other solvers (totorica adapts to any centered FD order).
fortran
subroutine check_esirkepov_q_order(self, fdv_order)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. | |
fdv_order | integer(kind=I4P) | in | FD order. |
Call graph
matched_kernels
P = A Q maps the base-shape nodes to centers, Q maps the face prefix sums to centers (A2 = [1,1]/2 for FD2, A6 = [1,-8,37,37,-8,1]/60 for FD6, so that D J = P H). Even Q: base on centers, P odd and centered, Q from faces. Odd Q: base on the dual nodes (node m at x_m+dx/2), P even with taps m=i-N/2-2..i+N/2+2, Q centered on the prefix sums at centers (flux index f = center-1). radius bounds the taps of P (plus one if odd). totorica: totorica_kernels.
fortran
subroutine matched_kernels(solver, q, hs, p, qw, radius, qfirst, nq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
solver | character(len=*) | in | Matched solver (totorica or esirkepov_Q). | |
q | integer(kind=I4P) | in | esirkepov_Q filter N. | |
hs | integer(kind=I4P) | in | FD half stencil (totorica). | |
p | real(kind=R8P) | out | P kernel on cell centers. | |
qw | real(kind=R8P) | out | Q kernel from the faces to the centers. | |
radius | integer(kind=I4P) | out | Taps of P. | |
qfirst | integer(kind=I4P) | out | Offset of the first Q face (flux index = center + qfirst). | |
nq | integer(kind=I4P) | out | Taps of Q. |
Call graph
set_coherent_gather
Set the P kernel of the coherent matched gathers (totorica needs the FD half stencil) and warn when the gather is not the coherent one of the deposit in use: it is then not the adjoint of the charge deposit and self-forces are not cancelled. A conserving solver is coherent with the gather of its name (londrillo also with the gather of the particle shape, S^rho = S); a non-conserving deposit with the gather of its particle shape.
fortran
subroutine set_coherent_gather(self, hs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
hs | integer(kind=I4P) | in | FD half stencil. |
Call graph
initialize
Initialize PIC.
fortran
subroutine initialize(self, field, grid, file_parameters, physics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | Pic object. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
physics | type(prism_physics_object) | in |
Call graph
set_particle_number
Scale the plasma inputs of a non-dimensional model and set the particle number from the plasma volume at t0.
Needs only the input (load_from_file) and the domain corners, so it also serves the memory estimate made before the grid exists (issue #112). Every rank holds the whole set until distribute_particles keeps its own ones.
fortran
subroutine set_particle_number(self, emin, emax, physics)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
emin | real(kind=R8P) | in | Domain minimum corner. | |
emax | real(kind=R8P) | in | Domain maximum corner. | |
physics | type(prism_physics_object) | in | Physics. |
Call graph
resize_neighbour_list
Reallocate the neighbour list to n particles, keeping its first min(n, old) columns (issue #112): the injection and the distribution index the whole injected set, the run the capacity of the rank.
fortran
subroutine resize_neighbour_list(self, n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
n | integer(kind=I4P) | in | New number of particles. |
Call graph
set_plasma_region
Set the slab/box region of the plasma at t0, stop if it leaves the domain.
The slab spans the whole domain across its normal; a face of the region may touch a domain face.
fortran
subroutine set_plasma_region(self, emin, emax)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
emin | real(kind=R8P) | in | Domain minimum corner. | |
emax | real(kind=R8P) | in | Domain maximum corner. |
Call graph
load_from_file
Load PIC configuration from file. The removed key, if present.
fortran
subroutine load_from_file(self, file_parameters, go_on_fail)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
file_parameters | type(file_ini) | in | File handler. | |
go_on_fail | logical | in | optional | Go on if load fails. |
Call graph
particle_cartesian_grid_index
Compute the grid index corresponding to a particle position. Good for cartesian grids only.
A particle is first searched in the interior cells of the local blocks (ownership). With several ranks a particle may leave the blocks of its rank within a time step (RK stages, end-of-step deposit before the migration): it is then located in the ghost cells of a local block, at most halo_margin_cells() cells outside the interior, so that its stencil stays within the ghosts (deposits are folded back by reduce_ghost_local/mpi, gathers read exchanged ghosts). With owned_only the halo search is skipped and a non-owned particle gets a zero row, without errors (injection, migration). A particle beyond a periodic face is located the same way, in the ghost halo of the block on that face (the periodic ghosts are images of the opposite interior), until its position is wrapped at the end of the step. A particle outside the domain across a face without particle closure, or beyond the halo of every local block, stops the run.
fortran
subroutine particle_cartesian_grid_index(self, field, grid, q_pic, owned_only)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in) | |
q_pic | real(kind=R8P) | in | PIC variables. | |
owned_only | logical | in | optional | Locate owned particles only, no halo search. |
Call graph
distribute_particles
Keep only the particles owned by the local blocks: the injection fills the whole set on every rank (same sequence), each rank keeps its own ones, in injection order, and the local count becomes particle_number. Every particle must be owned by exactly one rank (checked globally). With one rank nothing moves.
fortran
subroutine distribute_particles(self, field, grid, q_pic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in) | |
q_pic | real(kind=R8P) | inout | PIC variables. |
Call graph
exchange_particles
Hand the departing particles (no longer owned by this rank) to the ranks that own them: every rank receives all the departing particles (MPI_Allgatherv) and keeps the ones owned by its local blocks, in rank order. Every departing particle must be claimed by exactly one rank (checked globally; particles do not leave the domain yet).
fortran
subroutine exchange_particles(self, field, grid, departing, arrived, n_arrived)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in) | |
departing | real(kind=R8P) | in | Departing particles [variable, particle]. | |
arrived | real(kind=R8P) | inout | allocatable | Arrived particles owned by this rank [variable, particle]. |
n_arrived | integer(kind=I4P) | out | Number of arrived particles. |
Call graph
migrate_particles
Hand the particles that left the local blocks to the owner ranks (end of a time step, host arrays). The departed slots are filled by the last particles (stable for the particles that stay before the first hole), the arrived ones are appended, then the particles are located again. Collective; with one rank it is a no-op.
fortran
subroutine migrate_particles(self, field, grid, q_pic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | in | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in) | |
q_pic | real(kind=R8P) | inout | PIC variables. |
Call graph
set_gaussian_support_cells
Automatic Gaussian support radius (gaussian_support_cells < 0 in input): ceiling(cutoff_sigma*sigma/dx_min) + 1 over all blocks of all ranks. To be called once the grid is final (after the uniform refinement): on the root blocks the support would be underestimated by 2**iu_ref_levels.
fortran
subroutine set_gaussian_support_cells(self, field)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). |
Call graph
NGP_charge_weighting
fortran
subroutine NGP_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
CIC_charge_weighting
Cloud-in-Cell weighting of particle quantities to the grid.
fortran
subroutine CIC_charge_weighting(self, field, grid, q, q_PIC, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_PIC | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
TSC_charge_weighting
fortran
subroutine TSC_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
cubic_charge_weighting
fortran
subroutine cubic_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Charge variable index. |
Call graph
quartic_charge_weighting
fortran
subroutine quartic_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Charge variable index. |
Call graph
quintic_charge_weighting
fortran
subroutine quintic_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Charge variable index. |
Call graph
sextic_charge_weighting
fortran
subroutine sextic_charge_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Charge variable index. |
Call graph
bspline_charge_weighting
Deposit particle charge density with the fixed (order+1)^3 B-spline support.
fortran
subroutine bspline_charge_weighting(self, field, grid, q, q_pic, nv, order)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
q | real(kind=R8P) | inout | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in | ||
order | integer(kind=I4P) | in |
Call graph
bspline_closed_weights
Close the unfiltered B-spline weights of one stencil to sum to 1 by changing only the largest one. The raw sum misses 1 by the roundoff of the cell-center spacing (x_cell is not exactly equispaced in floating point). That residual depends on the stencil: for a C0 shape (CIC) it jumps when the stencil changes, so the Esirkepov line sums no longer vanish and a spurious current runs to the domain boundary. Closing every stencil removes it.
Attributes: pure
fortran
subroutine bspline_closed_weights(order, x_p, x_cell, dx, w, pu_error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
order | integer(kind=I4P) | in | B-spline order (0=NGP ... 6=sextic). | |
x_p | real(kind=R8P) | in | Particle coordinate. | |
x_cell | real(kind=R8P) | in | Cell centers of the stencil. | |
dx | real(kind=R8P) | in | Cell size. | |
w | real(kind=R8P) | out | Closed weights of the stencil. | |
pu_error | real(kind=R8P) | out | optional | |raw sum - 1| before the closure. |
Call graph
Gaussian_charge_weighting
Gaussian weighting of particle charge density to the grid.
fortran
subroutine Gaussian_charge_weighting(self, field, grid, q, q_PIC, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid object. | |
q | real(kind=R8P) | inout | Field variables. | |
q_PIC | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Charge-density variable index. |
Call graph
NGP_current_weighting
fortran
subroutine NGP_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
CIC_current_weighting
Cloud-in-Cell weighting of particle quantities to the grid.
fortran
subroutine CIC_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
TSC_current_weighting
Triangular-Shaped-Cloud weighting of particle current density to the grid.
fortran
subroutine TSC_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
cubic_current_weighting
Cubic B-spline weighting of particle current density to the grid.
fortran
subroutine cubic_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
quartic_current_weighting
Quartic B-spline weighting of particle current density to the grid.
fortran
subroutine quartic_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
quintic_current_weighting
Quintic B-spline weighting of particle current density to the grid.
fortran
subroutine quintic_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
sextic_current_weighting
Sextic B-spline weighting of particle current density to the grid.
fortran
subroutine sextic_current_weighting(self, field, grid, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | External fields. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
q | real(kind=R8P) | inout | Field variables. | |
q_pic | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
bspline_current_weighting
Deposit particle current density with B-spline support and optional binomial filtering.
fortran
subroutine bspline_current_weighting(self, field, grid, q, q_pic, nv, order)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
q | real(kind=R8P) | inout | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in | ||
order | integer(kind=I4P) | in |
Call graph
Gaussian_current_weighting
Gaussian weighting of particle current density to the grid.
fortran
subroutine Gaussian_current_weighting(self, field, grid, q, q_PIC, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid object. | |
q | real(kind=R8P) | inout | Field variables. | |
q_PIC | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Index following Jx, Jy, Jz. |
Call graph
zeroD_field_weighting
Zeroth-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine zeroD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
oneD_field_weighting
First-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine oneD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
twoD_field_weighting
Second-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine twoD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
threeD_field_weighting
Third-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine threeD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
fourD_field_weighting
Fourth-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine fourD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
fiveD_field_weighting
Fifth-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine fiveD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
sixD_field_weighting
Sixth-order spatial interpolation of cell-centered fields to particle locations.
fortran
subroutine sixD_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
Gaussian_field_weighting
Gaussian interpolation of cell-centered fields to particle locations.
fortran
subroutine Gaussian_field_weighting(self, field, grid, pic_fields, q, q_PIC, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | PIC object. | |
field | type(field_object) | inout | The field. | |
grid | type(grid_object) | in | Grid object. | |
pic_fields | real(kind=R8P) | inout | Fields at particle locations. | |
q | real(kind=R8P) | in | Field variables. | |
q_PIC | real(kind=R8P) | in | PIC variables. | |
nv | integer(kind=I4P) | in | Number of variables. |
Call graph
bspline_field_weighting
B-spline interpolation of cell-centered fields to particle locations.
fortran
subroutine bspline_field_weighting(self, field, grid, pic_fields, q, q_pic, nv, order)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in | ||
order | integer(kind=I4P) | in |
Call graph
shape_field_weighting
Gather with the particle shape of particle_weighting_model (the transpose of its charge deposit), with or without the binomial filter.
fortran
subroutine shape_field_weighting(self, field, grid, pic_fields, q, q_pic, nv, filter)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in | ||
filter | logical | in | Binomial filter of the shape. |
Call graph
coherent_field_weighting
Gather E and B with the transpose of the charge operator S^rho of the conserving solver the gather is named after, the adjoint of its charge deposit (cancels the electrostatic and magnetostatic self-forces, as the polynomial gathers do for their deposits): londrillo : rho = S rho^P (binomial filter included), gather with the particle shape S; totorica, esirkepov_Q<N>: rho = P S rho^P (no binomial filter), gather P^T on the fields, then the unfiltered base shape, on the dual nodes x_c+dx/2 for the odd esirkepov_Q<N> (the particle seen at x-dx/2). P^T is applied block by block with the zero extension of deposit_pic_modified_charge, circular along a periodic axis (whose filtered ghosts are then the periodic images): single block, single rank (the multi-block conserving path is FNL only).
fortran
subroutine coherent_field_weighting(self, field, grid, pic_fields, q, q_pic, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | inout | ||
field | type(field_object) | inout | ||
grid | type(grid_object) | in | ||
pic_fields | real(kind=R8P) | inout | ||
q | real(kind=R8P) | in | ||
q_pic | real(kind=R8P) | in | ||
nv | integer(kind=I4P) | in |
Call graph
transposed_filter_axis
Transpose of the P filter along one axis of a block interior, zero extension (circular along a periodic axis, single block): output_m = sum_s p(s) input_{m-s} (P^T, equal to P for the symmetric kernels).
Attributes: pure
fortran
subroutine transposed_filter_axis(input, output, axis, p, radius, periodic)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
input | real(kind=R8P) | in | Fields (6, ni, nj, nk). | |
output | real(kind=R8P) | out | Filtered fields. | |
axis | integer(kind=I4P) | in | Filter axis. | |
p | real(kind=R8P) | in | P kernel. | |
radius | integer(kind=I4P) | in | Taps of P. | |
periodic | logical | in | Periodic axis. |
Call graph
set_bspline_stencil
Compute the one-dimensional B-spline stencil.
Attributes: pure
fortran
subroutine set_bspline_stencil(order, x_p, x_c, i_p, i_min, i_max)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
order | integer(kind=I4P) | in | ||
x_p | real(kind=R8P) | in | ||
x_c | real(kind=R8P) | in | ||
i_p | integer(kind=I4P) | in | ||
i_min | integer(kind=I4P) | out | ||
i_max | integer(kind=I4P) | out |
Call graph
compaction_moves
Moves that compact the particle arrays after the departure of the particles listed (ascending) in departed: the holes within the first particle_number-size(departed) slots are filled, in order, by the particles that stay among the last size(departed) slots. Deterministic, and the particles before the first hole do not move.
Attributes: pure
fortran
subroutine compaction_moves(particle_number, departed, moves, n_moves)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
particle_number | integer(kind=I4P) | in | Particles before the departure. | |
departed | integer(kind=I4P) | in | Departing particles, ascending. | |
moves | integer(kind=I4P) | out | allocatable | Moves [from/to, move]. |
n_moves | integer(kind=I4P) | out | Number of moves. |
Call graph
Functions
conserving_solver_name
Input name of the conserving current solver: esirkepov_Q<N> for the matched-current family, the stored tag otherwise.
Returns: character(len=:)
fortran
function conserving_solver_name(self) result(name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. |
Call graph
matched_current
True for the local matched currents J_d = L_d P_transverse F_d^E with rho = P rho^P (totorica, esirkepov_Q<N>): they share the deposit of the filtered charge, the P/Q kernels and the per-particle cleanup.
Attributes: pure
Returns: logical
fortran
function matched_current(self) result(matched)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. |
Call graph
coherent_gather
True for the gathers named after a conserving solver (londrillo, totorica, esirkepov_Q<N>): E and B are gathered with the transpose of that solver's charge operator S^rho, the adjoint of its charge deposit.
Attributes: pure
Returns: logical
fortran
function coherent_gather(self) result(coherent)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. |
Call graph
matched_gather
True for the coherent gathers of the matched currents (totorica, esirkepov_Q<N>): P^T on the fields, then the base shape (on the dual nodes for the odd esirkepov_Q<N>).
Attributes: pure
Returns: logical
fortran
function matched_gather(self) result(matched)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. |
Call graph
description
Return a pretty-formatted object description.
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | External fields. |
Call graph
halo_margin_cells
Cells a particle may lie outside the interior of a local block while its deposit/gather stencil stays within the ghosts.
Returns: integer(kind=I4P)
fortran
function halo_margin_cells(self, ngc) result(m)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. | |
ngc | integer(kind=I4P) | in | Ghost cells number. |
Call graph
stencil_radius_cells
Max number of cells, beyond the particle cell, reached by the configured charge, current and field stencils. B-spline of order o (NGP=0 ... sextic=6, field nD = order n): (o+1)/2 cells; Gaussian: gaussian_support_cells; binomial filter: one more cell. A conserving current deposits with the particle shape.
Returns: integer(kind=I4P)
fortran
function stencil_radius_cells(self) result(radius)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(prism_pic_object) | in | PIC object. |
Call graph
effective_bspline_weight
Return the optionally binomial-filtered one-dimensional B-spline weight.
Attributes: pure
Returns: real(kind=R8P)
fortran
function effective_bspline_weight(order, r, filter) result(weight)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
order | integer(kind=I4P) | in | ||
r | real(kind=R8P) | in | ||
filter | logical | in |
Call graph
gaussian_weight
Return an unnormalized one-dimensional Gaussian weight with compact cutoff.
Attributes: pure
Returns: real(kind=R8P)
fortran
function gaussian_weight(r, cutoff_limit) result(weight)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
r | real(kind=R8P) | in | ||
cutoff_limit | real(kind=R8P) | in |
Call graph
effective_gaussian_weight
Return the optionally binomial-filtered one-dimensional Gaussian weight.
Attributes: pure
Returns: real(kind=R8P)
fortran
function effective_gaussian_weight(r, shift, cutoff_limit, filter) result(weight)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
r | real(kind=R8P) | in | ||
shift | real(kind=R8P) | in | ||
cutoff_limit | real(kind=R8P) | in | ||
filter | logical | in |
Call graph
bspline_weight
Return the centered cardinal B-spline weight.
Attributes: pure
Returns: real(kind=R8P)
fortran
function bspline_weight(order, r) result(weight)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
order | integer(kind=I4P) | in | ||
r | real(kind=R8P) | in |
Call graph