particles_map

Module

Description

$Id$

This module contains subroutines for mapping particles on the mesh. Different domain decompositions have different versions of this module.

** AUTOMATIC CPARAM.INC GENERATION ************************ Declare (for generation of cparam.inc) the number of f array variables and auxiliary variables added by this module

CPARAM logical, parameter :: lparticles_blocks = .false.


Quick access

Types:

particle

Variables:

collect_particles, distribute_particles, interp_field_pencil, interp_field_pencil_0, interp_field_pencil_1, interp_field_pencil_ogrid, interp_field_pencil_wrap, interpolate_fourth, interpolate_linear_range, interpolate_linear_scalar, invert_ineargrid_list, map_particles, map_xxp_grid__loop_ap, particle, particle_block_index, particle_pencil_index, pm_assignment, pm_interpolation, random_particle_blocks, random_particle_pencils, tsc_index_range

Routines:

boundcond_neighbour_list(), cleanup_interpolated_quantities(), fill_blocks_with_bricks(), fill_bricks_with_blocks(), initialize_particles_map(), interpolate_linear(), interpolate_quadratic(), interpolate_quadratic_spline(), interpolate_quantities(), interpolation_consistency_check(), map_nearest_grid(), map_vvp_grid(), map_xxp_grid(), shepherd_neighbour_block(), shepherd_neighbour_pencil(), shepherd_neighbour_pencil3d(), sort_particles_iblock(), sort_particles_imn()

Needed modules

Variables

  • particles_map/interp_field_pencil [private]
  • particles_map/interp_field_pencil_0 [private]
  • particles_map/interp_field_pencil_1 [private]
  • particles_map/interp_field_pencil_ogrid [private]
  • particles_map/interp_field_pencil_wrap [private]
  • particles_map/interpolate_fourth [private]
  • particles_map/interpolate_linear_range [private]
  • particles_map/interpolate_linear_scalar [private]
  • particles_map/invert_ineargrid_list [private]
  • particles_map/map_xxp_grid__loop_ap [private]
  • particles_map/particle_pencil_index [private]
  • particles_map/random_particle_pencils [private]

Subroutines and functions

subroutine  particles_map/initialize_particles_map()

Perform any post-parameter-read initialization.

29-mar-16/ccyang: coded.

Note: Currently, this subroutine is called after modules

Particles_mpicomm and Particles.

Call to:

fatal_error(), close_interpolation(), fatal_error_local(), real_to_index(), fold_f(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/interpolate_quadratic(f, ivar1, ivar2, xxp, gp, inear, iblock, ipar)

Quadratic interpolation of g to arbitrary (xp, yp, zp) coordinate using the biquadratic interpolation function

g(x,y,z) = (1+x+x^2)*(1+y+y^2)*(1+z+z^2)

The coefficients (9, one for each unique term) are determined by the 9 grid points surrounding the interpolation point.

The interpolation matrix M is defined through the relation

M#c = g

Here c are the coefficients and g is the value of the function at the grid points. An equidistant grid has the following value of M:

invmat(:,1)=(/ 0.00, 0.00, 0.00, 0.00, 1.00, 0.00, 0.00, 0.00, 0.00/) invmat(:,2)=(/ 0.00, 0.00, 0.00,-0.50, 0.00, 0.50, 0.00, 0.00, 0.00/) invmat(:,3)=(/ 0.00, 0.00, 0.00, 0.50,-1.00, 0.50, 0.00, 0.00, 0.00/) invmat(:,4)=(/ 0.00,-0.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.50, 0.00/) invmat(:,5)=(/ 0.00, 0.50, 0.00, 0.00,-1.00, 0.00, 0.00, 0.50, 0.00/) invmat(:,6)=(/ 0.25, 0.00,-0.25, 0.00, 0.00, 0.00,-0.25, 0.00, 0.25/) invmat(:,7)=(/-0.25, 0.50,-0.25, 0.00, 0.00, 0.00, 0.25,-0.50, 0.25/) invmat(:,8)=(/-0.25, 0.00, 0.25, 0.50, 0.00,-0.50,-0.25, 0.00, 0.25/) invmat(:,9)=(/ 0.25,-0.50, 0.25,-0.50, 1.00,-0.50, 0.25,-0.50, 0.25/)

invmat(:,1)=invmat(:,1) invmat(:,2)=invmat(:,2)/dx invmat(:,3)=invmat(:,3)/dx**2 invmat(:,4)=invmat(:,4)/dz invmat(:,5)=invmat(:,5)/dz**2 invmat(:,6)=invmat(:,6)/(dx*dz) invmat(:,7)=invmat(:,7)/(dx**2*dz) invmat(:,8)=invmat(:,8)/(dx*dz**2) invmat(:,9)=invmat(:,9)/(dx**2*dz**2)

Space coordinates are defined such that the nearest grid point is at (0,0). The grid points are counted from lower left:

7 8 9 4 5 6 1 2 3

The nearest grid point has index number 5.

09-jun-06/anders: coded

Parameters:
  • f (mx,my,mz,mfarray) [real,in]

  • ivar1 [integer,in]

  • ivar2 [integer]

  • xxp (3) [real,in]

  • gp (1 - ivar1 + ivar2) [real,out]

  • inear (3) [integer,in]

  • iblock [integer]

  • ipar [integer]

Call to:

fatal_error(), fatal_error_local(), real_to_index(), fold_f(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/interpolate_quadratic_spline(f, ivar1, ivar2, xxp, gp, inear, iblock, ipar)

Quadratic spline interpolation of the function g to the point xxp=(xp,yp,zp).

10-jun-06/anders: coded

Parameters:
  • f (mx,my,mz,mfarray) [real,in]

  • ivar1 [integer,in]

  • ivar2 [integer]

  • xxp (3) [real,in]

  • gp (1 - ivar1 + ivar2) [real,out]

  • inear (3) [integer,in]

  • iblock [integer]

  • ipar [integer]

Call to:

fatal_error(), fatal_error_local(), real_to_index(), fold_f(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/map_nearest_grid(fp, ineargrid[, k1_opt[, k2_opt]])

Find index (ix0, iy0, iz0) of nearest grid point of all or some of the particles.

23-jan-05/anders: coded 08-jul-08/kapelrud: support for non-equidistant grids 26-nov-20/ccyang: delegated to Grid

Parameters:
  • fp (mpar_loc,mparray) [real,in]

  • ineargrid (mpar_loc,3) [integer,out]

  • k1_opt [integer,in,]

  • k2_opt [integer,in,]

Use :

grid (real_to_index())

Call to:

fatal_error_local(), real_to_index(), fatal_error(), fold_f(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/sort_particles_imn(fp, ineargrid, ipar[, dfp[, f]])

Sort the particles so that they appear in the same order as the (m,n) loop.

20-apr-06/anders: coded

Parameters:
  • fp (mpar_loc,mparray) [real,inout]

  • ineargrid (mpar_loc,3) [integer,inout]

  • ipar (mpar_loc) [integer,inout]

  • dfp (mpar_loc,mpvar) [real,inout,]

  • f (mx,my,mz,mfarray) [real]

Use :

general (safe_character_assign())

Call to:

fatal_error(), fold_f(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/boundcond_neighbour_list()

Copy the number of neighbours to the boundary points of the neighbour list

nlist(1-neighbourx:0) = nlist() allocate(nlist(1-neighbourx:nx+neighbourx,1-neighboury:nx+neighboury, &

1-neighbourz:nx+neighbourz,Nneighbour+1))

Call to:

fold_f(), fatal_error(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/map_xxp_grid(f, fp, ineargrid[, lmapsink_opt])

Map the particles as a continuous density field on the grid. This is run both in start.90 and in run.f90.

27-nov-05/anders: coded

Parameters:
  • f (mx,my,mz,mfarray) [real,inout]

  • fp (mpar_loc,mparray) [real,in]

  • ineargrid (mpar_loc,3) [integer,in]

  • lmapsink_opt [logical,in,]

Use :

ghostfold (fold_f()), particles_sub (get_rhopswarm())

Call to:

fold_f(), fatal_error(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/map_vvp_grid(f, fp, ineargrid)

Map the particle velocities as vector field on the grid.

07-oct-08/anders: coded

Parameters:
  • f (mx,my,mz,mfarray) [real,inout]

  • fp (mpar_loc,mparray) [real,in]

  • ineargrid (mpar_loc,3) [integer,in]

Use :

ghostfold (fold_f()), particles_sub (get_rhopswarm())

Call to:

fold_f(), fatal_error(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/shepherd_neighbour_pencil(fp, ineargrid, kshepherd, kneighbour)

Create a shepherd/neighbour list of particles in the pencil.

24-oct-05/anders: coded

Parameters:
  • fp (mpar_loc,mparray) [real]

  • ineargrid (mpar_loc,3) [integer]

  • kshepherd (nx) [integer]

  • kneighbour (*) [integer]

Call to:

fatal_error(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/shepherd_neighbour_block(fp, ineargrid, kshepherdb, kneighbour, iblock)

Create a shepherd/neighbour list of particles in the block.

17-nov-09/anders: dummy

Parameters:
  • fp (mpar_loc,mparray) [real,in]

  • ineargrid (mpar_loc,3) [integer,in]

  • kshepherdb (nxb,nyb,nzb) [integer,out]

  • kneighbour (*) [integer,out]

  • iblock [integer,in]

Call to:

fatal_error(), warning(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/interpolation_consistency_check()

Check that all interpolation requirements are satisfied:

Call to:

warning(), fatal_error(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/interpolate_quantities(f, fp, p, ineargrid)

Interpolate the needed sub-grid quantities according to preselected interpolation policies.

28-jul-08/kapelrud: coded

Parameters:
  • f (mx,my,mz,mfarray) [real,in]

  • fp (mpar_loc,mparray) [real,in]

  • p [pencil_case]

  • ineargrid (mpar_loc,3) [integer,in]

Call to:

fatal_error(), interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid()

subroutine  particles_map/cleanup_interpolated_quantities()

Deallocate memory from particle pencil interpolation variables

28-jul-08/kapelrud: coded

Call to:

interpolate_linear(), interpolate_quadratic_spline(), interpolate_quadratic(), map_nearest_grid_ogrid(), interpolate_particles_ogrid(), fatal_error()

subroutine  particles_map/sort_particles_iblock(fp, ineargrid, ipar[, dfp])

Sort the particles so that they appear in order of the global brick index. That is, sorted first by processor number and then by local brick index.

16-nov-09/anders: dummy

Parameters:
  • fp (mpar_loc,mparray) [real]

  • ineargrid (mpar_loc,3) [integer]

  • ipar (mpar_loc) [integer]

  • dfp (mpar_loc,mpvar) [real]

Call to:

fatal_error()

subroutine  particles_map/fill_blocks_with_bricks(a, ab, marray, ivar)

Fill adopted blocks with bricks from the f-array.

04-nov-09/anders: dummy

Parameters:
  • a (mx,my,mz,marray) [real]

  • ab (mxb,myb,mzb,marray,nblockmax) [real]

  • marray [integer]

  • ivar [integer]

subroutine  particles_map/fill_bricks_with_blocks(a, ab, marray, ivar)

Fill adopted blocks with bricks from the f-array.

04-nov-09/anders: dummy

Parameters:
  • a (mx,my,mz,marray) [real]

  • ab (mxb,myb,mzb,marray,nblockmax) [real]

  • marray [integer]

  • ivar [integer]

subroutine  particles_map/shepherd_neighbour_pencil3d(fp, ineargrid_c, kshepherd_c, kneighbour_c)

20-July-2010: coded AlexHubbard

Create a shepherd/neighbour list of particles in the pencil. On collisional grid Adapted from particles_map

Parameters:
  • fp (mpar_loc,mparray) [real]

  • ineargrid_c (mpar_loc,3) [integer]

  • kshepherd_c (,,*) [integer]

  • kneighbour_c (mpar_loc) [integer]