- Mail actions: [ respond to this message ] [ mail a new topic ]
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Guillermo Arreaga Garcia <garreaga_at_cajeme.cifus.uson.mx>

Date: Wed, 26 Aug 2009 11:32:59 -0700

Hi all,

I need to obtain separately the array of hydrodynamical and gravitational

accelerations of a gadget2īs simulation having only gas particles. The

procedure what I have followed is outlined below.

Firstly, I have already activated the option -DOUTPUTACCELERATION in the

Makefile in order to write the 3-array P[i].Acce[k] for every

particle i to the output snapshot file.

Secondly, I have modified the file io.c only in the part where

it will write the particle data to the buffer. My modification consisted in

multiplying by 0.0 the part of the acceleration which I would

like to eliminate from the array of total acceleration.

That is:

a) to get hydrodinamical acceleration

case IO_ACCEL:

#ifdef OUTPUTACCELERATION

for(n = 0; n < pc; pindex++)

if(P[pindex].Type == type)

{

for(k = 0; k < 3; k++)

fp[k] = 0.0*fac1*P[pindex].GravAccel[k];

#ifdef PMGRID

for(k = 0; k < 3; k++)

fp[k] += 0.0*fac1 * P[pindex].GravPM[k];

#endif

if(P[pindex].Type == 0)

for(k = 0; k < 3; k++)

fp[k] += fac2*SphP[pindex].HydroAccel[k];

fp += 3;

n++;

}

#endif

break;

and

b) to get gravitational acceleration

case IO_ACCEL: /* acceleration */

#ifdef OUTPUTACCELERATION

for(n = 0; n < pc; pindex++)

if(P[pindex].Type == type)

{

for(k = 0; k < 3; k++)

fp[k] = fac1 * P[pindex].GravAccel[k];

#ifdef PMGRID

for(k = 0; k < 3; k++)

fp[k] += fac1 * P[pindex].GravPM[k];

#endif

if(P[pindex].Type == 0)

for(k = 0; k < 3; k++)

fp[k] += 0.0*fac2*SphP[pindex].HydroAccel[k];

fp += 3;

n++;

}

#endif

break;

Thirdly, for the two cases a and b, I update the file io.c with the

appropriate changes and then I compile and run the gadget2 separately. I have

written a code for reading the output snapshot file from which I get the Acce

array.

However, I am surprising because what I get in the two cases are

the same data for the Acce array...that is, it seems that there is

no difference between the hydrodynamical and gravitational

accelerations, which is impossible.

Then I wonder what I am missing or doing incorrectly in the

previous procedure.

I would greatly appreciate any comment or assistance.

Sincerely,

Guillermo Arreaga,

Received on 2009-08-26 20:49:39

Date: Wed, 26 Aug 2009 11:32:59 -0700

Hi all,

I need to obtain separately the array of hydrodynamical and gravitational

accelerations of a gadget2īs simulation having only gas particles. The

procedure what I have followed is outlined below.

Firstly, I have already activated the option -DOUTPUTACCELERATION in the

Makefile in order to write the 3-array P[i].Acce[k] for every

particle i to the output snapshot file.

Secondly, I have modified the file io.c only in the part where

it will write the particle data to the buffer. My modification consisted in

multiplying by 0.0 the part of the acceleration which I would

like to eliminate from the array of total acceleration.

That is:

a) to get hydrodinamical acceleration

case IO_ACCEL:

#ifdef OUTPUTACCELERATION

for(n = 0; n < pc; pindex++)

if(P[pindex].Type == type)

{

for(k = 0; k < 3; k++)

fp[k] = 0.0*fac1*P[pindex].GravAccel[k];

#ifdef PMGRID

for(k = 0; k < 3; k++)

fp[k] += 0.0*fac1 * P[pindex].GravPM[k];

#endif

if(P[pindex].Type == 0)

for(k = 0; k < 3; k++)

fp[k] += fac2*SphP[pindex].HydroAccel[k];

fp += 3;

n++;

}

#endif

break;

and

b) to get gravitational acceleration

case IO_ACCEL: /* acceleration */

#ifdef OUTPUTACCELERATION

for(n = 0; n < pc; pindex++)

if(P[pindex].Type == type)

{

for(k = 0; k < 3; k++)

fp[k] = fac1 * P[pindex].GravAccel[k];

#ifdef PMGRID

for(k = 0; k < 3; k++)

fp[k] += fac1 * P[pindex].GravPM[k];

#endif

if(P[pindex].Type == 0)

for(k = 0; k < 3; k++)

fp[k] += 0.0*fac2*SphP[pindex].HydroAccel[k];

fp += 3;

n++;

}

#endif

break;

Thirdly, for the two cases a and b, I update the file io.c with the

appropriate changes and then I compile and run the gadget2 separately. I have

written a code for reading the output snapshot file from which I get the Acce

array.

However, I am surprising because what I get in the two cases are

the same data for the Acce array...that is, it seems that there is

no difference between the hydrodynamical and gravitational

accelerations, which is impossible.

Then I wonder what I am missing or doing incorrectly in the

previous procedure.

I would greatly appreciate any comment or assistance.

Sincerely,

Guillermo Arreaga,

Received on 2009-08-26 20:49:39

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