Create custom output file

From: Jesus <>
Date: Fri, 24 Feb 2017 18:48:48 -0800

Hello all,
I have created a function in Gadget2 that calculates a velocity increment (dv), and I add this increment on the file timestep.c every 100 timesteps.
However, I'd like to know if my function is actually doing what I want, so I want to output a file that writes "dv1, dv2, dv3".
What I did was to add this immediately after I calculate dv on timestep.c, on the advance_and_find_timesteps function:

if (ThisTask ==0)
   fprintf( t_out, "%e, %e, %e, %e, %e, %e\n", P[i].Pos[0], P[i].Pos[1], P[i].Pos[2], dv1, dv2, dv3 ) ;

The file is created and the values are written, but it only writes 1400 values (out of 20,000 particles). I am not sure how to fix this so that all the 20,000 values are written. If I remove the if statement, the code crashes, saying "Segmentation fault: 11. Signal code: Address not mapped"

If anyone has any suggestions, please let me know.
Thank you very much.

Received on 2017-02-25 03:48:32

This archive was generated by hypermail 2.3.0 : 2022-09-01 14:03:43 CEST