Determining type of particles using Bitflags for nodes

From: Aldo Alberto Batta Marquez <abatta_at_astro.unam.mx>
Date: Tue, 14 Sep 2010 12:22:26 -0500

Dear all,

I'm trying to modify the force_treeevaluate () function in order to change
the gravitational potential for a Black Hole (BH) treated as a Type 5
particle.

As seen on *forcetree.c* the function force_update_node_recursive ()
determines the multipole moments for each node and also assigns them
bitflags that store information about the softening of particles contained
in the node.

I'm trying to use these bitflags to check whether the node contains or not
particles with different softening (gas particles or Type 5 particles (BH))
and what's the particle type who has the greatest softening on the node.

If I'm right, the particle type who has the greatest softening on the node
can be obtained with the following operation:

*(**nop**->u.d.**bitflags** >> 2) & 7* which returns the particle type whit
the greatest softening

and you can check whether there are particles with different softening by
doing :

*(**nop**->u.d.**bitflags** >> 5) & 1* which in case of being 1, means that
there are particles with smaller softening than the one obtained with the
latter operation of bitflags.

I'm trying to use this operations in order to check whether I have a BH on
the node and if that's the case, to instruct the code to open the node until
I end up with a leaf containing the BH.


  *if(((nop->u.d.bitflags >> 5) & 1)) ** **/*! bit-5 signals that there are
particles of different softening in the node */*
* ** {*
* *
* ** no = nop->u.d.nextnode; /*! Continue to next node*/*
* continue;*
* ** }*

If this works I should end up with nodes containing only gas particles and
with a node containing only the BH. Am I right?

Assuming this works then I check if the node I'm using to calculate the
force (and potential) contains the BH or not. I do so by using:

*if(((nop->u.d.bitflags >> 2) & 7) == 5) /* If the particle type with the
greatest softening is a BH, then use this force and potential */*
*{*
* fac = modified force (Paczynski-Witta);*
* pot = modified potential;*
*}*
*else*
*{*

*Calculate the force in the usual way (checking if r < h or not);*
*
*
*}*

Unfortunately this doesn't seem to work, I keep getting the softened
potential instead of a pot = 1/( r - rg)

I guess the problem is that the nodes aren't being opened everytime they
contain a BH. Or maybe my way of selecting the node with the BH isn't
correct.

I'd like to try and fix this before I go with a more radical solution like
computing the force due to the BH outside of the tree. Which would imply
some modifications to the tree construction code. If anyone have any ideas
of how this works I would appreciate any help.

Thanks in advance.

Aldo Batta.

-- 
Aldo Alberto Batta Márquez
Instituto de Astronomia
Universidad Nacional Autonoma de Mexico (UNAM)
http://www.astroscu.unam.mx
Received on 2010-09-14 19:45:42

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:31 CET