Re: Compute Local density for No Gas particles

From: Arman Khalatyan <arm2arm_at_gmail.com>
Date: Mon, 15 Oct 2012 13:00:22 +0200

Hi Magda, there is no simple way to calculate density with Gadget2, but you
can make it work with a few changes.

please check the attachment . I have my modified version of read_io.c
In Makefile you need to define which particles to move to SPH slot:
for example add this lines to calculate density of DM particles.
OPT +=-DDM_ONLY # calculate density only for DM or STARS
OPT += -DALL_RHO

In main.c:
comment out run(); routine then:

ngb_treebuild();
savepositions(1);

Probably you need to change io.c to save results into some another block
instead of RHO, let say:
#ifdef DM_ONLY
   strcpy(RHONAME, "RHO1");
   strcpy(HSMLNAME,"H1 ");
#endif


Then in function fill_Tab_IO_Labels() in switch statement:
case IO_RHO:
      strncpy(Tab_IO_Labels[IO_RHO], RHONAME, 4);
     break;
      case IO_HSML:
    strncpy(Tab_IO_Labels[IO_HSML]
, HSMLNAME, 4);
    break;


Thats it.

Arman.


On Mon, Oct 15, 2012 at 8:59 AM, Yves Revaz <yves.revaz_at_epfl.ch> wrote:

> **
> Dear Magda,
>
> This is not trivial to do in Gagdget2, as to compute the density
> (and hydro) you need to use the SphP structure. But this structure
> exists by default only for type 0 (gas) particles.
>
> If you don't use the hydro part, one very easy way to implement what
> you need is to move your type 2 particles into time 0, and disable the
> hydro forces.
>
> If this is not sufficient for your purpose, you need to extend the SphP
> structure to
> other particles. This is of course possible, but much more tricky.
>
> yves
>
>
>
> On 10/15/2012 08:42 AM, Magda Guglielmo wrote:
>
> Dear gadget list,
>
> I need Gadget2 to compute the local density and the number of neighbours
> in the current smoothing radius for particles of type 2 (disk particles).
> My understanding is that Gadget normally does only for gas particles (SPH),
> so I need to modify the density.c routine. I am not running any SPH Hydro
> simulation, so I don't use this routine, but I would like to keep the
> Gadget structure unchanged so that it will keep working.
> I saw that a similar topic has been posted the web archive, but I did not
> find any answer or suggestions.
> Does anyone has any suggestion on how I can do this in the simplest way
> possible?
>
>
> Thank you in advance
> Best Regards
>
>
>
> --
> (o o)
> --------------------------------------------oOO--(_)--OOo-------
> Dr. Yves Revaz
> Laboratory of Astrophysics
> Ecole Polytechnique Fédérale de Lausanne (EPFL)
> Observatoire de Sauverny Tel : ++ 41 22 379 24 28
> 51. Ch. des Maillettes Fax : ++ 41 22 379 22 05
> 1290 Sauverny e-mail : Yves.Revaz_at_epfl.ch
> SWITZERLAND Web : http://www.lunix.ch/revaz/
> ----------------------------------------------------------------
>
>
>
> -----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send mail to
> minimalist_at_MPA-Garching.MPG.de with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here:
> http://www.mpa-garching.mpg.de/gadget/gadget-list
>
>



Received on 2012-10-15 13:00:24

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