banner

The site's hierarchy



Home page :: Private area :: Site Map :: Credits
Science / Détection des structures / AdaptaHOP

Navigation

Mar 2009
MTWTFSS
2324252627281
2345678
9101112131415
16171819202122
23242526272829
303112345
News
  • Les premiers zoom de galaxies sont accessibles
  • Le halo FOF 6133 de la boite Horizon L et le halo FOF 544 de Horizon S ont été resimulés avec plusieurs techniques de zoom. Il est important que chaque "zoomer" valide sa méthode, avant de lancer une campagne de zoom sur un plus grand cataloque.
  • Les données de la simulation Mare Nostrum sont disponibles
  • 34 snapshots jusqu’à z=4 sont accessibles sur horizon3 et sur le serveur de fichiers de l’IDRIS à la collaboration Horizon.
  • Méso Machine HPC1 opérationnelle
  • Depuis le 23 Octobre 2005, la Méso machine du site horizon est operationnelle. Elle correspond à 3 quadriprocesseurs avec chacun 64 Giga de RAM reliés par infiniband, ainsi qu’un access conséquent (sur une base de projet dédié) au reste de la ferme). Son acces est ouvert a toute personne de la collaboration ayant acces à la minigrille et qui en fait la demande a admin-minigrille
  • http://
  • Workshop Horizon le 14 et 15 novembre 2005
  • Il aura lieu à Paris les 14 et 15 novembre 2005 (prévoir une nuit sur place). L’enregistrement est ouvert dans la rubrique "meeting!"
  • http://

AdaptaHOP


by Colombi Stéphane (Wednesday 18 October 2006)

Ce module

GZ - 33.5 kb
adaptahop

contient compute_neiKDtree, connu aussi sous le nom de adaptaHOP: un detecteur de structures et sous-structures. Toutes les informations sont contenues au debut du ficher compute_neiKDtree.f90, regarder aussi le parameter file, compute_neiKDtree.config. Le makefile marche pour le compilateur intel sur triguedina.


!=======================================================================
!                           COMPUTE_NEIKDTREE
!=======================================================================
! Author : S. Colombi
!          Institut d'Astrophysique de Paris
!          98 bis bd Arago, F-75014, Paris, France
!          colombiatiap.fr
!
! This program has multiple usage and can do three things
! (1) Read an input particle distribution file and compute the mean
!     square distance between each particle and its nearest neighbourgs
! (2) Read an input particle distribution file and compute the SPH
!     density associated to each particle + the list of its nearest
!     neighbourgs
! (3) Read an input particle distribution and a neighbourgs file which
!     is an output of step 2), and output the tree of the structures in
!     structures.
!
! If steps (1) and (2) are probably correct, step (3) is still under
! test and construction. Step (1) was rather extensively tested, while
! step (2) needs further tests although I am quite confident it should
! be correct.
!
!=======================================================================
!
! USAGE :
! +++++
!    
! compute_neikdtree config_file_name
! or
! compute_neikdtree
! In the last case the default config file name is used, i.e.
! compute_neiKDtree.config
! The config file contains all the informations required for
! running compute_neikdtree
! The FORTRAN namelist technique is used, where the parameters are
! specified by ``name=parameter''
!
!=======================================================================
!
! PARAMETERS IN THE CONFIG FILE
! +++++++++++++++++++++++++++++
!
! A example of config file is given in compute_neiKDtree.config
!
!
! verbose     : normal verbose mode (.true. or .false.)
! megaverbose : full verbose mode (.true. or .false.)
! filein      : name of the input particles/velocities file ('myfilename')
! Ntype       : format of the file (integer number)
!               0 : PM simple precision unformatted
!               1 : GADGET simple precision unformatted, cosmological simulation
!                   of dark matter only with periodic boundaries
!               2 : RAMSES unformatted (particles) simulation
!                   MPI multiple output
!               3 : CONE unformatted
!               4 : Ninin treecode unformatted
! remove_degenerate : if this set to .true., check for particles at the same
!               position and add a random displacement at approximately
!               floating representation accuracy in order to avoid infinite
!               number of KD tree cells creation. This parameter is global since
!               if a random displacement has been applied once for computing
!               SPH density, the same one must be applied again for subsequent
!               calculations in order to be self-consistent.
!               Setting remove_degenerate=.false. will of course speep-up
!               the program at the cost of a risk of crash due to infinite
!               KD tree cell creation. This is however safe in most cases since
!               KD tree creation can now deal with particles at the same position.
!               It is therefore recommended to set remove_degenerate to .false.
!               first before trying .true.
! action      : 'distances' for computing mean square distance between each
!                           particle and its nearest neighbourgs
!               'neighbors' for computing the list of the nearest neighbourgs of
!                           each particle and its SPH density
!               'adaptahop' for computing the tree of structures and substructures
!                           in the simulation
!               'posttreat' for computing the physical properties of dynamically
!                           selected haloes and subhaloes
!
! if (Ntype=1) : GADGET format
! --------------
!
! nmpigadget  : number of CPU used to perform the simulation (in order to read the
!               appropriate number of files). If there is no multiple file
!               extension (only one file), set nmpigadget=-1.
!
! if (Ntype=2) : RAMSES unformatted (dark matter particles)
! --------------
!
! mtot        : total mass in the full simulation box, of the population considered,
!               in internal RAMSES units.
!               mtot=-1 works if full simulation box is analysed.
! Ltot        : size of the full simulation box, in internal RAMSES units.
!               Ltot=-1 gives default value, valid for cosmological simulations
!               only.
!
! if (Ntype=3) : CONE unformatted (dark matter particles)
! ------------------
!
! boxsize     : comoving size of the simulation box in Mpc
!
! if (Ntype=4) : Ninin treecode unformatted
! --------------
!
! boxsize2    : comoving size of the simulation box, in Mpc
! hubble      : value of H0/100 in km/s/Mpc
! omega0      : value of cosmological density parameter
! omegaL      : value of cosmological constant
! aexp_max    : value of expansion factor at present time
!
! if (action='distances') :
! -------------------------
!
! nvoisdis    : number of neighbors considered for each particle
! filedis     : name of the output file for the mean square distances
!               ('mydistancename')
!               (this is a binary unformatted or formatted file which will be
!               described more in detail in the near future)
! formatted   : .true. if the output file is in ASCII, .false. if the output
!               file is in binary unformatted double float.
! ncpu        : number of virtual threads for a parallel calculation with openMP
!               This integer number should be a multiple of the real number of
!               threads used during the run. The larger it will be, the better
!               the load balancing will be.
! velocities  : .true. or .false. : if set to .true., include velocities
!               treatment in the calculation and the output of the results
!
! if (action='neighbors') :
! -------------------------
!
! nvoisnei    : number of neighbors considered for computing the SPH density
!               (integer number). Typically this number should vary between
!               20 and 100 (template value 64).
! nhop        : number of stored nearest neighbourgs in the output file
!              (integer number).
!              nhop must smaller smaller or equal to nvoisnei. Typically nhop
!              should be of order 10-30 (template value 16).
! fileneinei  : name of the output file for the SPH density and the list of
!              nhop nearest neighbors for each particle ('myfileneighbors')
!              (this is a binary unformatted file which will be described more
!              in detail in the near future)
!
! if (action='adaptahop') :
! -------------------------
!
! rho_threshold : density threshold. Particles with SPH density below this
!              density threshold are not selected. This thresholding will
!              define a number of connected regions, each of which corresponding
!              to a structure. For each of these structures, we aim to
!              build a tree of substructures. Typically, one is interested
!              in finding the substructures of highly nonlinear objects. A value
!              often taken for rho_threshold is 80, which corresponds roughly
!              to friend-of-friend algorithm parameter b=2.
! nmembthresh: threshold on the number of particles that a structure or a
!              a substructure (above some density threshold rhot) must contain
!              for being considered as significant.
!              The choice of nmembthresh is related to effects of N-body relaxation
!              (treecode) or over-softening of the forces (AMR or PM codes) or
!              SPH smoothing (SPH smoothing over a number N of particles tends
!              to ``erase'' structures with less than N particles).
!              Basically, due to either of these effects, structures or
!              substructures with a number of particles smaller than nmembthresh
!              are not considered. A typical choice of nmembthresh is 64.
! fudgepsilon: This parameter can be seen as an Eulerian version of the thresholding
!              controlled by nmembthresh. It defines the size of the smallest structures
!              that can exist physically and is related to force softening.
!              Basically, if epsilon is the softening parameter, substructures with
!              typical radius smaller than epsilon are just coincidences and should
!              not be considered. The typical radius of a structure is given by the
!              mean square distance of particles belonging to it with respect to its
!              center of gravity.
!              The criterion for selecting a structure is thus
!              
!              radius_{substructure} > epsilon,
!            
!              where epsilon=fudgepsilon*L/Npart^{1/3}. Fudgepsilon is thus expressed
!              in units of mean interparticle separation.
!              - For a treecode, fudgepsilon is typically of the order of 1/20;
!              - For a PM code, fudgepsilon is typically of the order of N_g/Npart^{1/3}
!              where N_g is the resolution of the grid used for the force calculations,
!              i.e. of the order of 1 or 0.5.
!              - For a quasi-Lagrangian code such as RAMSES, putting constrains from fudgespilon
!              is not really useful. Basically it corresponds to N_g/Npart^{1/3} where N_g
!              would be the equivalent of the PM grid probed by the smallest AMR cells.              
! alpha      : a criterion can be applied to decide weither a substructure
!              is selected or not. Here the choice of alpha dictates by how
!              much the maximum local density in this substructure should be larger
!              than the local average density in this substructure:
!
!              rho_max_{substructure} >= alpha*< rho >_{substructure}.
!
!              Basically, the choice of alpha dictates the ``peakyness'' of a
!              substructure. For instance, a substructure might contain itself
!              5 local maxima. For this substructure to be dynamically significant
!              we want the largest of the local maxima to be at least alpha
!              times the mean local density, i.e. the average density of all the
!              particles within the substructure. Dynamically bounded substructures
!              are expected to be very peaky. A typical choice of alpha would be
!              alpha=0 or a few unites, e.g. alpha=4.
! fudge      : a criterion can be applied to decide wither a substructure is
!              statistically significant in terms of Poisson noise. Indeed,
!              even if Poisson noise is considerably reduced by SPH smoothing
!              it is still present to some extent, and some substructures might
!              be simply due to local Poisson fluctuations.
!              Here the choice of fudge dictates by how many ``sigma's''
!              a structure must be compared to a random Poisson fluctuation.
!              The criterion applied is
!
!              < rho >_{substructure} > rhot*[1+fudge/sqrt(N)]
!
!              where N is the number of particles in the substructure and rhot
!              the density threshold corresponding to this substructure (in
!              other worlds, rhot is the minimum density of particles whithin
!              the substructure).
!              This criterion can be understood as follows : if a given substructure
!              contains N particles, the corresponding random poisson fluctuations are
!              of the order of sqrt(N). So typically the uncertainty on the density
!              estimate of a structure containing N particles is of the order of
!              sqrt(N) (this of course neglects the fact that SPH softening reduces
!              considerably the effects of poisson fluctuations). For the
!              fluctuation associated to the substructure to be significant, we
!              impose that (< rho >_{substructure} - rhot)/rhot > fudge*sigma with
!              sigma=1/sqrt(N)=sqrt(< (M-<M>)^2 >)/<M> where M is a Poisson process
!              of average N.
!              A typical value is fudge=4.
!
!              IMPORTANT NOTE : we should always have fudge > 0. Small values of
!              fudge will slow down the program, while large values of fudge will
!              make the hierarchical decomposition in terms of substructures less
!              accurate.
!              The reason for that is that despite the fact we know all the saddle points
!              connecting all the substructures, it was impossible to figure out a simple
!              way of sorting these saddle points in order to construct automatically
!              the tree of structures and substructures. As a result, we operate
!              iteratively by increasing the local threshold density as follows:
!              [rhot NEXT] = [rhot OLD]*[1+fudge/sqrt(N)] where N is the number of particles
!              in the substructure. Then we see weither saddle points within this
!              substructure are below the new value of rhot: if this happens, it
!              means that at the density level [rhot NEXT], the substructure is composed
!              of disconnected subsubstructures and the threshold value of connection
!              between these subsubstructures is approximated by [rhot NEXT] (the real value
!              should be between [rhot NEXT] and [rhot OLD]).
! filenode   : output file for the tree of structures and substructures. See below
!              for explanation of its format
! simu_unitsnei : .true. or .false : to specifie if the nodes positions and radii in the
!              file filenode are specified in the same units as in the simulation input
!              file or in Mpc
! filepartnodenei : ouput file for particule node number. To each particle, a
!              integer is associated, which is the node number the deepest possible in the tree
!              given in filenode. This way, at any level in the tree, it will be possible to
!              find recursively all the particles belonging to the tree. If the node number
!              is zero, it means the SPH density of particle is below the threshold rho_threshold
!              and is therefore associated to no structure.
! formattedpartnodenei : .true. for having filepartnodenei in ascii format, .false. for
!              having filepartnodenei in binary format. The format is in both
!              case, the number of particles npart in the first line, followed by id(:),
!              where id(:) is an array of npart integers.
! fileneihop : input file with SPH density and list of nearest neighbors of each
!              particle, obtained by running comptu_neiKDtree with action='neighbors'.
!
! if (action='posttreat') :
! -------------------------
! This option is still in development and test phase
!
!=======================================================================
!
! FORMAT OF OUTPUT FILES
! ++++++++++++++++++++++
!
! filenode :
! ----------
! nnodes,rho_threshold,nmembthresh,alpha,fudge,fudgepsilon,if_simu_units
! 1, node(id=1)
! [space]
! 2, node(id=2)
! [space]
! ...
! nnodes, node(id=nnodes)
! [space]
!
! where node(id) is a structure defined as follow (in order) :
!
! level : integer number corresponding to the level in the tree.
!         The root, node(1), corresponds to level=0. The root corresponds
!         to all the selected particles (above the density threshold)
!         in the simulation box: it is not physically relevant.
! mother : the id of the mother of this node, i.e. the id of substructure
!         which contains this substructure (for the root, there is no
!         mother, i.e. mother=0).
! firstchild : the id of the first child of this node, i.e. the first
!         substructure it contains. Other substructures will be found
!         by running over the list their sisters. If we are sitting
!         at the end of a branch, firstchild=0 (i.e. this node correspond
!         to an elementary substructure) .
! nsisters : the number of sisters of this substructure + 1.
! sister : the id of the sister ``at the right'' of this structure. A structure
!         that has not sister at its ``right'' has sister=0.
! rho_saddle : the density of the saddle(s) point(s) connecting this  
!         structure to its sisters. In principle this could be calculated
!         uniquely so that a structure would always have at most one
!         sister, but as explained in the important note above,
!         rho_saddle is computed approximately, as a result, it can
!         correspond to more than a single saddle point.
!         For a given density threshold, rho_th, if rho_th > rho_saddle,
!         the substructure is connected to its sisters, whereas if
!         rho_th < rho_saddle, the substructure is disconnected from its
!         sisters.
! density : average density of the substructure, calculated from the
!         average SPH density of all particles with SPH density larger than
!         rho_saddle and belonging to the substructure.
! densmax : maximum density within the substructure : it correspond
!         to the largest SPH density of all the particles within the
!         substructure.
! radius : size in Mpc or in simulation units of the substructure calculated
!         by computing the mean
!         square distance of each particle belonging to it with respect
!         to its center of mass.
! mass :  number of particles within the substructure.
! truemass : normalized mass within the substructure (same as mass if all
!         the particles have the same mass).
! position(3) : coordinates in Mpc of the center of mass of the
!         substructure.
!
!
! fileneinei (as well as input file fileneihop)
! ----------
! This a fortran binary unformatted file with:
! npart,nvoisins,nhop
! (density(ipar),ipar=1,npart)
! do ipar=1,npart
!    (iparneigh(ihop,ipar),ihop=1,nhop)
! enddo
!
! npart    : number of particles in the data file (int*4)
! nvoisins : number of neighbors used to perform the SPH smoothing (int*4)
! nhop     : number of neighbors actually kept for each particle (int*4)
! density  : SPH density for each particle (assuming that average density
!           of the universe is unity) (real*4)
! iparneigh(1:nhop,ipar) : the list of nhop nearest neighbors for particle ipar
!           (int*4)
!
!
! filepartnodenei
! ---------------
! This is either a fortran binary unformatted file or an ascii file
! according to the choice of the user.
! npart
! (partnode(ipar),ipar=1,npart)
!
! npart : number of particles in the data file (int*4)
! partnode(ipar) : the leaf to which this particle belongs (or the
!         node number the deepest possible in the tree of structures
!         and substructures) (int*4)
!         partnode(ipar)=0 when this particle belongs to nothing.
!
!=======================================================================
!
! TO COMPILE THE PROGRAM
! ++++++++++++++++++++++
!
! on a DEC ALPHA the appropriate command is
! f90 -O -recursive -o compute_neiKDtree compute_neiKDtree_common.f90 \
!                      compute_neiKDtree.f90
!
!=======================================================================
!
! HISTORY
! +++++++
!
! 02/05/02/SC/IAP : first operational clean version with namelist and
!                   three options for the calculations.
!                   + action='distances' tested by comparison with the
!                   results of a different algorithm based on link list
!                   approach instead of KDtree (compute_neighbourgs2.f)
!                   The agreement between the 2 softwares is good within
!                   float calculation accuracy (5.10^{-6} relative
!                   maximum differences). The differences can be
!                   explained by a slightly different approach used
!                   in the 2 programs to do floating calculations.
!                   + action='neighbors' is not fully tested but should be
!                   okay.
!                   + action='adaptahop' has been seen to work fine on
!                   a few data sets, but is not by any mean extensively
!                   tested. (No comments on the parameters of the namelist
!                   to avoid the users using this option)
!                   --> Version 0.0
! 04/05/02/SC/IAP : Full comments on the namelist parameters corresponding
!                   to action='adaptahop'. A few comments are added to
!                   the program. A new input particle file format is
!                   added (RAMSES).
!                   --> Version 0.1
! 04/17/02/SC&RT/IAP : Clean up the RAMSES format. Speed up the SPH
!                   smoothing procedure
!                   --> Version 0.2
! 12/02/02/SC/IAP : Parallelize action='distances' and action='neighbors'
!                   Add RAMSES dark matter format with periodic boundaries
!                   (Ntype=-2), add CONE format (Ntype=3)
!                   --> Version 0.3
! 27/05/03/SC&RT/IAP&STR : Add RAMSES MPI dark matter + stars format with
!                   periodic boundaries (still under work, Ntype=-20) and
!                   a subroutine to remove degeneracy in particle positions
!                   Add GADGET multiple file MPI format.
! 04/06/03/SC/IAP : Dynamical selection of haloes and subhaloes :
!                   + new action='posttreat'
! 26/10/03/SC/IAP : add Ninin treecode format Ntype=4
! 16/10/06/SC/IAP : Change the treecode algorithm to be able to deal with
!                   2 or more particles at the same position. It is not
!                   yet completely safe in terms of the calculation of
!                   the SPH density (if all the particles are at the
!                   same position one gets 0/0).
!                   Add a few comments on file formats.
!                   --> Version 0.8
! 18/10/06/SC&RT/IAP : remove obsolete formats and improve RAMSES MPI
!                   format (now swapped from -20 to 2).
!
!=======================================================================
!
! ERRORS
! ++++++
!
! If one of the following errors occures :
!
! 'ERROR in create_nodes :'
! 'All subgroups are below the threshold.'
!
! You can comment the corresponding STOP and cross your fingers.
! I did not figure out exactly what happens in that case, nothing really
! bad, apparently :0).
!
!=======================================================================