particles_map_blocks
Module
Description
$Id$
This module contains subroutines useful for mapping particles on the mesh.
This version is for block domain decomposition of particles.
In block domain decomposition the main mesh is divided among the processors in the usual way. The local mesh is then divided into so-called “bricks”, small volumes of grid points. Particles are counted in each of those bricks, and then the bricks are distributed among the processors so that each processor has approximately the same number of particles. A brick fostered by a processor is called a “block”.
In each time-step the relevant dynamical variables must be transferred from bricks at the parent processors to blocks at the foster processors. This can be e.g. gas velocity field (for drag force) or gravitational potential (for self-gravity).
A processor can open up new bricks in its own domain, if a particle moves into an empty brick. Full load balancing is performed at regular intervals. Here each processor count particles in their blocks and sends the information to the parent processors. The parent processors then decide on a new division of particle blocks.
** 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 = .true.
Quick access
- Types:
- 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
cdata: $Id$general(keep_compiler_quiet()): $Id$mpicomm: $Id$messages: $Id$particles_cdata: $Id$particles_mpicomm: $Id$
Variables
- particles_map/interp_field_pencil [private]
- particles_map/interp_field_pencil_0 [private]
- particles_map/interp_field_pencil_1 [private]
- particles_map/particle_block_index [private]
- particles_map/random_particle_blocks [private]
- particles_map/tsc_index_range [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.
Check the particle-mesh interpolation method.
- subroutine particles_map/map_nearest_grid(fp, ineargrid[, k1_opt[, k2_opt]])
Find processor, brick, and grid point index of all or some of the particles.
01-nov-09/anders: coded
- Parameters:
fp (mpar_loc,mparray) [real,in]
ineargrid (mpar_loc,3) [integer,out]
k1_opt [integer]
k2_opt [integer]
- Called from:
register_particles(),initialize_particles(),init_particles(),insert_lost_particles(),insert_particles(),particles_dragforce_stiff(),pencil_criteria_particles(),pencil_interdep_particles(),calc_pencils_particles(),dxxp_dt(),dvvp_dt(),dxxp_dt_pencil(),dvvp_dt_pencil(),dxxp_dt_blocks(),dvvp_dt_blocks(),remove_particles_sink_simple(),create_particles_sink_simple(),read_particles_init_pars(),write_particles_init_pars(),read_particles_run_pars(),write_particles_run_pars(),powersnap_particles(),calc_diagnostics_particles(),particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles(),register_particles_sink(),initialize_particles_sink(),init_particles_sink(),calc_selfpot_sinkparticles(),create_particles_sink(),remove_particles_sink()- Call to:
get_brick_index(),fatal_error_local(),weigh_particle(),fill_bricks_with_blocks(),fold_f(),fill_blocks_with_bricks(),fatal_error(),mpiwait(),not_implemented()
- subroutine particles_map/map_xxp_grid(f, fp, ineargrid[, lmapsink_opt])
Map the particles as a continuous density field on the grid.
01-nov-09/anders: coded
- Parameters:
- Use :
ghostfold(fold_f()),particles_sub(get_rhopswarm(),weigh_particle())- Called from:
register_particles(),initialize_particles(),init_particles(),insert_lost_particles(),insert_particles(),particles_dragforce_stiff(),pencil_criteria_particles(),pencil_interdep_particles(),calc_pencils_particles(),dxxp_dt(),dvvp_dt(),dxxp_dt_pencil(),dvvp_dt_pencil(),dxxp_dt_blocks(),dvvp_dt_blocks(),remove_particles_sink_simple(),create_particles_sink_simple(),read_particles_init_pars(),write_particles_init_pars(),read_particles_run_pars(),write_particles_run_pars(),powersnap_particles(),calc_diagnostics_particles(),particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles(),register_particles_sink(),initialize_particles_sink(),init_particles_sink(),calc_selfpot_sinkparticles()- Call to:
weigh_particle(),fill_bricks_with_blocks(),fold_f(),fill_blocks_with_bricks(),fatal_error(),mpiwait(),not_implemented()
- subroutine particles_map/map_vvp_grid(f, fp, ineargrid)
Map the particle velocities as vector field on the grid.
16-nov-09/anders: dummy 17-may-23/ccyang: under construction
- Parameters:
- Use :
- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to:
fatal_error(),weigh_particle(),fill_bricks_with_blocks(),fold_f(),fill_blocks_with_bricks(),mpiwait(),not_implemented()
- 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.
12-oct-09/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,]
- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to:
- subroutine particles_map/fill_blocks_with_bricks(a, ab, marray, ivar)
Fill adopted blocks with bricks from the f-array.
04-nov-09/anders: coded
- Parameters:
- Use :
mpicomm(mpirecv_nonblock_real(),mpisend_nonblock_real(),mpiwait())- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),particles_pencil_criteria(),particles_pencil_interdep(),particles_calc_pencils(),particles_calc_selfpotential(),particles_before_boundary(),particles_special_bfre_bdary(),particles_special_after_dtsub(),particles_pde(),particles_pde_pencil(),particles_calc_pencil_diags(),particles_pde_blocks(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles(),initialize_particles_map(),map_nearest_grid(),map_xxp_grid(),map_vvp_grid()- Call to:
- subroutine particles_map/fill_bricks_with_blocks(a, ab, marray, ivar[, nosum_opt])
Fill bricks (i.e. the f-array) with blocks adopted by other processors.
04-nov-09/anders: coded
- Parameters:
- Use :
mpicomm(mpirecv_nonblock_real(),mpisend_nonblock_real(),mpiwait())- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),particles_pencil_criteria(),particles_pencil_interdep(),particles_calc_pencils(),particles_calc_selfpotential(),particles_before_boundary(),particles_special_bfre_bdary(),particles_special_after_dtsub(),particles_pde(),particles_pde_pencil(),particles_calc_pencil_diags(),particles_pde_blocks(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles(),initialize_particles_map(),map_nearest_grid(),map_xxp_grid(),map_vvp_grid()- Call to:
- subroutine particles_map/interpolate_linear(f, ivar1, ivar2, xxp, gp, inear, iblock, ipar)
Interpolate the value of g to arbitrary (xp, yp, zp) coordinate using the linear interpolation formula
g(x,y,z) = A*x*y*z + B*x*y + C*x*z + D*y*z + E*x + F*y + G*z + H .
The coefficients are determined by the 8 grid points surrounding the interpolation point.
30-dec-04/anders: coded
- Parameters:
- Use :
- Called from:
register_particles(),initialize_particles(),init_particles(),particles_dragforce_stiff(),pencil_criteria_particles(),pencil_interdep_particles(),calc_pencils_particles(),dxxp_dt(),dvvp_dt(),dxxp_dt_pencil(),periodic_boundcond_on_aux(),register_particles_nbody(),initialize_particles_nbody(),pencil_criteria_par_nbody(),pencil_interdep_par_nbody(),calc_pencils_par_nbody(),init_particles_nbody(),dvvp_dt_nbody_pencil(),fp_nearest_grid(),initialize_particles_adaptation(),particles_adaptation_pencils(),read_particles_adapt_run_pars(),write_particles_adapt_run_pars(),rprint_particles_adaptation(),register_particles_breakup(),initialize_particles_breakup(),read_particles_breakup_init_pars(),write_particles_breakup_init_pars(),read_particles_breakup_run_pars(),write_particles_breakup_run_pars(),rprint_particles_breakup(),dbreakup_dt(),particles_breakup_pencils(),register_particles_caustics(),initialize_particles_caustics(),init_particles_caustics(),dcaustics_dt(),dcaustics_dt_pencil(),register_particles_grad(),initialize_particles_grad(),pencil_criteria_par_grad(),set_particle_grad(),dsigmap_dt_pencil(),register_particles_lyapunov(),initialize_particles_lyapunov(),init_particles_lyapunov(),dlyapunov_dt(),dlyapunov_dt_pencil(),register_particles_selfgrav(),initialize_particles_selfgrav(),calc_selfpotential_particles(),pencil_criteria_par_selfgrav(),pencil_interdep_par_selfgrav(),calc_pencils_par_selfgrav(),dvvp_dt_selfgrav_pencil(),calc_diagnostics_particles_selg(),dvvp_dt_selfgrav(),register_particles_sink(),initialize_particles_sink(),init_particles_sink(),calc_selfpot_sinkparticles(),create_particles_sink(),remove_particles_sink(),initialize_particles_stalker(),finalize_particles_stalker(),particles_stalker_sub(),register_particles_tetrad(),initialize_particles_tetrad(),init_particles_tetrad(),dtetrad_dt(),dtetrad_dt_pencil()- Call to:
- 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:
- Called from:
register_particles_sink(),initialize_particles_sink(),init_particles_sink(),calc_selfpot_sinkparticles(),create_particles_sink()- Call to:
- 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:
- Called from:
register_particles(),initialize_particles(),init_particles(),particles_dragforce_stiff(),pencil_criteria_particles(),pencil_interdep_particles(),calc_pencils_particles(),dxxp_dt(),dvvp_dt(),dxxp_dt_pencil(),register_particles_nbody(),initialize_particles_nbody(),pencil_criteria_par_nbody(),pencil_interdep_par_nbody(),calc_pencils_par_nbody(),init_particles_nbody(),dvvp_dt_nbody_pencil(),freeze_solid_cells(),pencil_criteria_solid_cells(),solid_cells_clean_up(),in_solid_cell(),register_particles_selfgrav(),initialize_particles_selfgrav(),calc_selfpotential_particles(),pencil_criteria_par_selfgrav(),pencil_interdep_par_selfgrav(),calc_pencils_par_selfgrav(),dvvp_dt_selfgrav_pencil(),calc_diagnostics_particles_selg(),dvvp_dt_selfgrav(),register_particles_sink(),initialize_particles_sink(),init_particles_sink(),calc_selfpot_sinkparticles(),create_particles_sink(),initialize_particles_stalker(),finalize_particles_stalker(),particles_stalker_sub()- Call to:
- 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.
16-nov-09/anders: dummy
- Parameters:
- Called from:
register_particles(),initialize_particles(),init_particles(),insert_lost_particles(),insert_particles(),particles_dragforce_stiff(),pencil_criteria_particles(),pencil_interdep_particles(),calc_pencils_particles(),dxxp_dt(),dvvp_dt(),dxxp_dt_pencil(),dvvp_dt_pencil(),dxxp_dt_blocks(),dvvp_dt_blocks(),remove_particles_sink_simple(),create_particles_sink_simple(),read_particles_init_pars(),write_particles_init_pars(),read_particles_run_pars(),write_particles_run_pars(),powersnap_particles(),calc_diagnostics_particles(),particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to:
- subroutine particles_map/boundcond_neighbour_list()
Copy the number of neighbours to the boundary points of the neighbour list
Dummy so far.
12-qpr-15/MR: added
- Call to:
- subroutine particles_map/shepherd_neighbour_pencil(fp, ineargrid, kshepherd, kneighbour)
Create a shepherd/neighbour list of particles in the pencil.
16-nov-09/anders: dummy
- Parameters:
- Called from:
initialize_particles_coag(),particles_coagulation_timestep(),particles_coagulation_pencils(),initialize_particles_collisions(),particles_collisions_timestep(),particles_collisions_pencils(),particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),particles_pencil_criteria(),particles_pencil_interdep(),particles_calc_pencils(),particles_calc_selfpotential(),particles_before_boundary(),particles_special_bfre_bdary(),particles_special_after_dtsub(),particles_pde(),particles_pde_pencil(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to:
- subroutine particles_map/shepherd_neighbour_block(fp, ineargrid, kshepherd, kneighbour, iblock)
Create a shepherd/neighbour list of particles in the block.
17-nov-09/anders: coded
- Parameters:
- Called from:
initialize_particles_collisions(),particles_collisions_timestep(),particles_collisions_pencils(),particles_collisions_blocks()- Call to:
- subroutine particles_map/shepherd_neighbour_pencil3d(fp, ineargrid, kshepherd, kneighbour)
17-dec-2011: ought to be coded by 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 (mpar_loc,3) [integer]
kshepherd (,,*) [integer]
kneighbour (mpar_loc) [integer]
- Called from:
initialize_particles_diagnos_dv(),read_pars_diagnos_dv_run_pars(),write_pars_diagnos_dv_run_pars(),rprint_particles_diagnos_dv(),collisions()- Call to:
- subroutine particles_map/interpolation_consistency_check()
Check that all interpolation requirements are satisfied:
16-nov-09/anders: dummy
- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules()- Call to:
- subroutine particles_map/interpolate_quantities(f, fp, p, ineargrid)
Interpolate the needed sub-grid quantities according to preselected interpolation policies.
16-nov-09/anders: dummy
- Parameters:
- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),particles_pencil_criteria(),particles_pencil_interdep(),particles_calc_pencils(),particles_calc_selfpotential(),particles_before_boundary(),particles_special_bfre_bdary(),particles_special_after_dtsub(),particles_pde(),particles_pde_pencil(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to:
- subroutine particles_map/cleanup_interpolated_quantities()
Deallocate memory from particle pencil interpolation variables
16-nov-09/anders: dummy
- Called from:
particles_register_modules(),particles_rprint_list(),particles_initialize_modules(),particles_init(),particles_finalize(),particles_read_snapshot(),particles_write_snapshot(),particles_write_dsnapshot(),particles_write_pdim(),particles_write_block(),particles_write_rmv(),particles_timestep_first(),particles_timestep_second(),split_update_particles(),particles_load_balance(),particles_boundconds(),particles_pencil_criteria(),particles_pencil_interdep(),particles_calc_pencils(),particles_calc_selfpotential(),particles_before_boundary(),particles_special_bfre_bdary(),particles_special_after_dtsub(),particles_pde(),particles_pde_pencil(),read_all_particles_init_pars(),read_all_particles_run_pars(),write_dim_particles(),write_snapshot_particles(),read_snapshot_particles()- Call to: