Re: Potential energy of gas particles in the adiabatic collapse example

From: O.A. Vaquero <vaquero_at_astro.rug.nl>
Date: Fri, 27 Feb 2009 16:44:57 +0100

Sander Valcke wrote:
>
> Hi Oscar,
>
> did you add a piece of code reading the potential data in
> read_snapshot.c?
>
> you can check if the data is written to the snapshot correctly by
> examining what happens in io.c around line 305.
>
> kind regards,
>
> Sander
>
> O.A. Vaquero wrote:
>>
>> Hi everybody,
>>
>> Well, I am just starting to play with Gadget 2.0.3, and it seems
>> that after activating the options to compute the potential energy in the
>> Makefile and creating the binary, the potential energy of the
>> particles is not stored in the field P[i].Potential, being the value
>> that is stored
>>
>> 0.0 for all the particles, as read with read_snapshot.c. I just try
>> to do a fprintf(stdout, "%f\n", P[i].Potential) in a loop, and it
>> returns me for
>> all the particles 0.00000.
>>
>> Can anyone help me? Thank you very much in advance.
>>
>> Cheers,
>>
>> Oscar
>>
>>
>>
>>
>> -----------------------------------------------------------
>> 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
>
>
>
>
> -----------------------------------------------------------
> 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
Thank you for the answer. I add the field "Potential " and then just
write it to a file as with the
Mass, or Kinetic Energy fields. Like that:
struct particle_data
{
  float Pos[3];
  float Vel[3];
  float Mass;
  *float Potential;*
  int Type;

  float Rho, U, Temp, Ne;
} *P;

And then...

for(k=0;k<header1.npart[0];k++){

    m=m+P[k].Mass;
    
ke=ke+0.5*(P[k].Mass)*(pow(P[k].Vel[0],2)+pow(P[k].Vel[1],2)+pow(P[k].Vel[2],2));
    p=p+P[k].Potential;
    u=u+P[k].U;
    fprintf(stdout,"%f\n",p);
   
  }

Thank you again

Cheers,

Oscar
Received on 2009-02-27 16:44:58

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