format of .storeprec file

General information etc.
Post Reply
daniel.wojtaszek
Posts: 25
Joined: Mon Nov 28, 2016 6:59 pm
Security question 1: No
Security question 2: 64

format of .storeprec file

Post by daniel.wojtaszek » Thu May 09, 2019 5:54 pm

What is the format of the data that is stored in the .storeprec files that are created during coupled mode execution?

Cheers.

Dan

Ville Valtavirta
Posts: 418
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: format of .storeprec file

Post by Ville Valtavirta » Fri May 10, 2019 8:42 am

Edited on 14.5.2019 to add the comment of the LIST_DATA_SIZE and fix some related values.

Hi Dan,

you can check the precursorstostore.c file to see exactly how it is written, but the the storeprecA/B files are binary files that contain the point-wise precursor particles from each batch that have reached the end of the time-interval. The batches are stored in the file sequentially in the following format:

Code: Select all

 1*double =   8 bytes | number of particles stored for batch 1
46*double = 368 bytes | all of the information from the particle structure in memory
46*double = 368 bytes | all of the information from the particle structure in memory
...
 1*double =   8 bytes | number of particles stored for batch 2
46*double = 368 bytes | all of the information from the particle structure in memory
46*double = 368 bytes | all of the information from the particle structure in memory
...
the 46 doubles are written for each particle that is stored in the batch. Information of the 46 doubles that are stored can be found from the definition of the PARTICLE data structure, which can be found in locations.h, starting from line 3606 (2.1.30). The first 4 doubles (LIST_DATA_SIZE) are used to store basic data of the doubly linked list that the particle is a part of.

The PARTICLE data structure definition says that, for example the first double after the LIST_DATA (the fifth double written in the file) stored for the particle is its history index and the (x,y,z) coordinates of the particle are the eight, ninth and tenth doubles that are stored:

Code: Select all

/*****************************************************************************/

/***** Particle (neutron / photon) *******************************************/

/* Data block */

#define PARTICLE_BLOCK_SIZE       (LIST_DATA_SIZE + 42)

#define PARTICLE_HISTORY_IDX      (LIST_DATA_SIZE +  0)
#define PARTICLE_RNG_IDX          (LIST_DATA_SIZE +  1)
#define PARTICLE_TYPE             (LIST_DATA_SIZE +  2)
#define PARTICLE_X                (LIST_DATA_SIZE +  3)
#define PARTICLE_Y                (LIST_DATA_SIZE +  4)
#define PARTICLE_Z                (LIST_DATA_SIZE +  5)
-Ville

daniel.wojtaszek
Posts: 25
Joined: Mon Nov 28, 2016 6:59 pm
Security question 1: No
Security question 2: 64

Re: format of .storeprec file

Post by daniel.wojtaszek » Mon May 13, 2019 8:52 pm

Thanks Ville. Am I correct in assuming that, except for the first iteration, the data from these .storeprec files are read by serpent at the beginning of each coupled iteration in order to continue the calculation? In other words, modifying the position of each dnp in these files after an iteration of a coupled transient calculation would affect the calculation of subsequent iterations?

Cheers.

Dan

Ville Valtavirta
Posts: 418
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: format of .storeprec file

Post by Ville Valtavirta » Tue May 14, 2019 10:57 am

Hi Dan,

that's correct. Modifying the positions of the precursors in the files would move them at time-interval boundaries and/or between iterations.

One thing to note is that there are two sets of the store-files (storeprecA and storeprecB) and one is always used to hold the beginning-of-interval (BOI) particles for the currently simulated time-interval, whereas the other stores the end-of-interval (EOI) particles, so that the next iteration can either be a repeat of the current interval (starting from the BOI store) or the first iteration of the next interval (starting from the EOI store).

Since the EOI particles from interval N are the BOI particles for interval N+1, the EOI files get reused as BOI files at the next interval and vice versa. This means that you have to be careful in figuring out, which particles (BOI/EOI) are in which store (A/B). Since on the first time interval, the storeA is used for BOI particles and storeB for EOI particles, it should go like this:

Code: Select all

Interval: | BOI  EOI 
          |---------
1         | A    B
2         | B    A
3         | A    B
4         | B    A
...
-Ville

daniel.wojtaszek
Posts: 25
Joined: Mon Nov 28, 2016 6:59 pm
Security question 1: No
Security question 2: 64

Re: format of .storeprec file

Post by daniel.wojtaszek » Tue May 14, 2019 2:41 pm

Thanks for your very helpful response.

Cheers!

Dan

Ville Valtavirta
Posts: 418
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: format of .storeprec file

Post by Ville Valtavirta » Tue May 14, 2019 3:22 pm

Actually,

there is one last thing (and a problem in my earlier answer).

I wrote that 42 doubles (336 bytes) are written for each particle, which was incorrect. As the locations.h file shows, the PARTICLE_BLOCK_SIZE is actually LIST_DATA_SIZE + 42

Code: Select all

#define PARTICLE_BLOCK_SIZE       (LIST_DATA_SIZE + 42)
and LIST_DATA_SIZE is defined as 4 in a different part of the same file.

This means that each particle consists of 46 doubles (368 bytes) and the indices for the coordinates etc. need to be incremented with 4 also.

I'll edit my earlier message.

-Ville

daniel.wojtaszek
Posts: 25
Joined: Mon Nov 28, 2016 6:59 pm
Security question 1: No
Security question 2: 64

Re: format of .storeprec file

Post by daniel.wojtaszek » Wed May 15, 2019 6:23 pm

Line 206 in precursorstostore.c (serpent 2.1.29) indicates that the number of double sized values written to the file for each particle is PARTICLE_BLOCK_SIZE - LIST_DATA_SIZE, which is 41 - 4 = 37 double values written to the file per particle.

daniel.wojtaszek
Posts: 25
Joined: Mon Nov 28, 2016 6:59 pm
Security question 1: No
Security question 2: 64

Re: format of .storeprec file

Post by daniel.wojtaszek » Wed May 15, 2019 6:46 pm

I've been looking at particlesfromstore.c and noticed that data from the .storepmeshA/B and .storeprecA/B files may both be read during the same PrecursorsToStore() function call. In this case which data is used in the calculation?

Cheers.

Dan

Ville Valtavirta
Posts: 418
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: format of .storeprec file

Post by Ville Valtavirta » Thu May 16, 2019 11:47 am

Hi Dan,

in transients using point-wise precursor tracking Serpent also keeps track of the mesh based concentrations and stores that data to the .storepmeshA/B files. The delayed neutrons are still sampled from the point-wise precursor data and the mesh based concentrations are only needed if the precursor distributions in the end of the simulation are to be stored (set savesrc) and used to start another transient simulation later.

-Ville

Post Reply