Writing source files

This category replaces the missing input manual
User avatar
Jaakko Leppänen
Site Admin
Posts: 2387
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Writing source files

Post by Jaakko Leppänen » Mon Oct 22, 2012 4:11 pm

Source definitions are described in Chapter 9 of Serpent manual. One of the options is to read the distribution from an external file (see Sec. 9.2.4). Serpent 2.1.9 now has an option to write source files in the same format by adding a "df" entry in detector definitions:

Code: Select all

det <name> df "file"
All scores that are recorded for the detector are then also written in the file specified after "df", which can be directly read by the source routine.

Another option is to write source points from a criticality source calculation. By specifying:

Code: Select all

set csw "file"
the code will write all source points from active criticality cycles into a source file specified in the card.
- Jaakko

orca.blu
Posts: 59
Joined: Wed Apr 20, 2011 1:39 pm

Re: Writing source files

Post by orca.blu » Sun Nov 11, 2012 3:36 am

Hi,

I tried the two options on Version 2.1.9 with criticality somulations.

- det <name> df "file"
seems ok.

- set scw "file"
is not working, It produces no files at all.

Maybe I am missing something.
Manuele Aufiero
LPSC/IN2P3/CNRS Grenoble

User avatar
Jaakko Leppänen
Site Admin
Posts: 2387
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: Writing source files

Post by Jaakko Leppänen » Tue Nov 13, 2012 3:13 am

Sorry, the name of the parameter is "csw", not "scw"
- Jaakko

orca.blu
Posts: 59
Joined: Wed Apr 20, 2011 1:39 pm

Re: Writing source files

Post by orca.blu » Tue Nov 13, 2012 10:26 am

ops... sorry

it works
Manuele Aufiero
LPSC/IN2P3/CNRS Grenoble

User avatar
Jaakko Leppänen
Site Admin
Posts: 2387
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: Writing source files

Post by Jaakko Leppänen » Tue Nov 13, 2012 7:00 pm

No, the mistake was mine, I just edited the previous post and corrected it...
- Jaakko

jesse.johns
Posts: 114
Joined: Wed Apr 20, 2011 5:19 am

Re: Writing source files

Post by jesse.johns » Sat Aug 23, 2014 7:15 am

Hello,

I am using Serpent 2.1.21.

I noticed that when I use this option to write a source in the criticality mode, to initialize a source for the dynamic mode, the detector writes during the inactive cycles.

I added:

Code: Select all

if (RDB[DATA_CYCLE_IDX] < RDB[DATA_CRIT_SKIP])
    return;
to line 31 of writesourcefile.c to correct this. I'm not sure if it should be done somewhere before hand - to prevent scoring of the source points and improve runtimes?

There is the criticality source writing option above; however, this only seems to generate 'source' points. I wanted to be able to capture the initial conditions of a system before a transient, not just the source points.

Cheers.

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

Re: Writing source files

Post by Ville Valtavirta » Tue Aug 26, 2014 4:44 pm

Hi Jesse,

do you get output during inactive cycles when you are using the "det" or "set csw" option? In both case that behavior is a bit unexpected and I can't seem to reproduce it with a simple input. For "csw" the check should be already at fission.c

Lines 348-350 of fission.c should be

Code: Select all

if ((RDB[DATA_CYCLE_IDX] > RDB[DATA_CRIT_SKIP]) &&
   ((ptr = (long)RDB[DATA_PTR_CRIT_SRC_DET]) > VALID_PTR))
     WriteSourceFile(ptr, x, y, z, *u, *v, *w, E, 1.0, t0 + td, id);
Is your version of fission.c missing that check?

As for the detector option, collision detectors should not be scored before the beginning of the active cycles.

For the second part of your question, by 'initial conditions' do you mean "momentary neutron positions"? Setting up a detector

Code: Select all

det <name> df <outfile> <frac> 
you can tally a certain fraction (defined by <frac>) of all of the virtual interactions sampled by Serpent~2. This provides a nice distribution of neutrons at random points of their life, i.e., not only at the fission source point. To use that distribution as an initial source for your transient simulation, you'll also have to set the time coordinate (last value) of each source point to zero and the weight of each source point (the second last value) to one. Edit: You can also set the source type to 2 in your source definition for automatic resetting of time and weight.

Cheers,
-Ville

jesse.johns
Posts: 114
Joined: Wed Apr 20, 2011 5:19 am

Re: Writing source files

Post by jesse.johns » Sat Aug 30, 2014 11:10 pm

Hi Ville:

I am using "det df" option only. The fission source isn't a very good initial condition for an external source calculation. When I run with something like this:

Code: Select all

kcode 20000 2 300 1.0
I get an output during the 300 inactive cycles, while using the "det df" option.

Through some test cases and playing around with source options, I was able to figure out the type options.

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

Re: Writing source files

Post by Ville Valtavirta » Mon Sep 01, 2014 5:27 pm

This is strange, do you get output from other detectors as well during the inactive cycles? In any case, the check for the inactive cycles in the beginning of writesourcefile.c should do the trick.

Also, there is a bug in the way the sampling is done to figure out whether to save a reaction point or not. This introduces a bias to the neutrons saved with "det df", meaning that those points are not a representative source for a dynamical mode simulation. This will be fixed in the next update. The fix requires changes to multiple locations in the source code. I'll contact you with the details.

-Ville

jesse.johns
Posts: 114
Joined: Wed Apr 20, 2011 5:19 am

Re: Writing source files

Post by jesse.johns » Mon Sep 01, 2014 10:01 pm

Hi,

I do not get any detector output; it's just from writing the source. That's what prompted me to looking into the matlab-output source and just copy the bit of code that prevents writing during inactive cycles.

There are some problems that I have been having with respect to the energy spectrum when I read the source. It might be related. I am going to post a something about it later tonight, in the event it is not related.

Cheers,

Jesse

Post Reply