========
Examples
========

The main problems solvable by the ORIGEN family of codes are enumerated
below (with relevant components in parentheses).

  1. Decay (ORIGEN)

  2. Activation (ORIGEN)

  3. Fuel irradiation (ARP+ORIGEN or ORIGAMI)

  4. Emission spectra from decay (ORIGEN)

  5. Processing, including batch/continuous chemical removal, isotopic
     feed, and stream blending (ORIGEN)

  6. Unit conversions (OPUS)

Examples of the six variations above are contained in the following
sections, except for fuel irradiation problems with ORIGAMI, as
described in its own chapter.

Decay of :sup:`238`\ U
======================

.. code-block:: scale
   :caption: Decay of :sup:`238`\ U
   :name: fig-origen-u238-decay

   =origen
   case{
       % use ENDF/VII-based decay library
       lib{ file="end7dec" }

       % create a material with 1 gram U-238
       mat{
           units=GRAMS
           iso=[u238=1.0]
       }
       time=[20L 1.0 1e9] %default units are days

       % save all information to f71
       save=yes
   }
   end


:numref:`fig-origen-u238-decay` illustrates using the "end7dec" binary decay
library and decaying one gram of :sup:`238`\ U for 10\ :sup:`9` days using
the logarithmic array shortcut to put 20 logarithmically spaced values between
1.0 and 1e9 days.

:sup:`252`\ Cf neutron Emission Spectrum
========================================

.. code-block:: scale
   :caption: :sup:`252`\ Cf neutron emission spectrum.
   :name: fig-origen-cf252-decay

   =origen

   bounds{
       neutron=[ 2.000000e+07 6.376300e+06 3.011900e+06 1.826800e+06
               1.422700e+06 9.071800e+05 4.076200e+05 1.110900e+05 1.503400e+04
               3.035400e+03 5.829500e+02 1.013000e+02 2.902300e+01 1.067700e+01
               3.059000e+00 1.855400e+00 1.300000e+00 1.125300e+00 1.000000e+00
               8.000000e-01 4.139900e-01 3.250000e-01 2.250000e-01 1.000000e-01
               5.000000e-02 3.000000e-02 1.000000e-02 1.000000e-05 ]
   }

   case{
       title="Cf-252 decay"

       lib{ file="end7dec" pos=1 }

       time{
          units=YEARS
          t=[ 0.01 0.03 0.1 0.3 1 3 10 ]
       }

       mat{
          units=CURIES
          iso=[cf252=1.0]
       }

       %perform neutron calculation with defaults
       neutron=yes

       print{
          neutron{
              summary=yes
              spectra=yes
              detailed=yes
          }
       }
   }
   end


:numref:`fig-origen-cf252-decay` illustrates decay of 1 Ci of :sup:`252`\ Cf for ten years
with calculation of the time- and energy-dependent neutron source. The
case uses the binary decay library "end7dec." The neutron energy group
structure is defined in the bounds block with array "neutron."

Simple Fuel Irradiation Plus Decay
===================================

:numref:`fig-origen-simple` illustrates the input for irradiation of a fuel
assembly for 200 days at 15 MW in case "irrad," followed by decay for 5 years
in the next case, "decay." The ORIGEN library (f33) was prepared by ARP to
have a single position with a burnup of 1500 MWd/MTU. The input material
has been specified to have 1 MTU total with an enrichment of 4.0% in
:sup:`235`\ U. Note that there are consistency requirements between ARP
and ORIGEN that cannot be checked by either module. Namely, the
enrichment specified in ARP should be equivalent to the effective
enrichment specified in the ORIGEN input, and the burnup-dependent cross
section data on the ORIGEN library should be for the *midpoint burnup of
the case*, which requires consistency between the operating history
(power and time) and the initial isotopics heavy metal loading. In
typical fuel depletion calculations, it is most convenient to specify a
metric ton (10\ :sup:`6` grams) of initial heavy metal, such that the
power in MW may be interpreted as MW/MTIHM. In the above example, the
power history does not need to be constant but when combined with the
time values should produce an average burnup of 1500 MWd/MTU in order
that the cross sections interpolated by ARP in position 1 are valid.


.. code-block:: scale
   :caption: Simple fuel irradiation plus decay.
   :name: fig-origen-simple

   =arp
   'library type
   w17x17
   'wt%
   4.0
   'number of cycles
   1
   'number of days per cycle
   200.0
   'cycle-average specific power (MW/MTU)
   15.0
   'number of interpolated cross section sets generated per cycle
   1
   'moderator density (g/cc)
   0.723
   'interpolated output ORIGEN library
   w17x17_100d.f33
   end
   =origen
   case(irrad){
       % use xs data at pos=1 corresponds to midpoint burnup (200 d * 15MW/MTU)/2
       lib {
            file="w17x17_100d.f33" pos=1
       }
       % 1 MT of enriched uranium
       mat {
           units=GRAMS
           iso=[u234=356 u235=40000 u236=184 u238=959460]
       }
       % power history (at least 4 steps for MATREX)
       time=[ 50 100 150 200 ] %default time in days
       power=[ 15 15 15 15 ] %power in MW
   }
   case(decay){
       time{
           units=YEARS
           start=0 %start time at 0 in this case for ease of input for t[]
           t=[0.1 0.3 0.9 1 2 3 4 5] %observe rule of threes
       }
       save{ file="discharge.f71" steps=[0 LAST] } %only save begin and end
   }
   end


It is important to note that with the MATREX solver, used by default,
the recommendation for irradiation and decay of spent fuel is to use no
fewer than four steps for the irradiation and begin the decay period
with a time step on the order of weeks or a month, increasing the
interval for each subsequent step by no more than a factor of three. In
many continuation cases, such as the decay case described here, it is
convenient to specify times starting from zero for the case with
"start=0" in the time block.

Three Cycles of Irradiation Plus Decay
======================================

:numref:`fig-origen-3cycle` is similar to the previous one, except there are
three sets of burnup-dependent transition cross sections (positions) generated
by ARP and used in ORIGEN, and there are three cases, one corresponding to
each cycle. Neutron and gamma sources are generated and saved to the f71
file for the final decay case. The maximum burnup achieved is 60 GWd/MTIHM.


.. code-block:: scale
   :caption: Three cycles of irradiation plus decay
   :name: fig-origen-3cycle

   =arp
   w17x17
   4.0
   3
   500 500 500
   40.0 40.0 40.0
   1 1 1
   0.723
   ft33f001
   end

   =origen
   bounds{ neutron="xn27g19v7.0"
           gamma=[1e+7 8e+6 6.5e+6 5e+6 4e+6 3e+6 2.5e+6 2e+6 1.66e+6 1.33e+6 1e+6
                  8e+5 6e+5 4e+5 3e+5 2e+5 1e+5 5e+4 1e+4]}
   case(c1){
       lib{ file="ft33f001" pos=1 }
       time=[8i 50 500]
       power=[10r40]
       mat{ iso=[u235=4e3 u238=960e3] }
   }
   case(c2){
       lib{ pos=2 }
       time=[8i 550 1000]
       power=[10r40]
   }
   case(c3){
       lib{ pos=3 }
       time=[8i 1050 1500]
       power=[10r40]
   }
   case(cool){
       time{ start=0 t=[20L 0.001 100] units=YEARS }
       save{ file="snf.f71" time_offset=1500 }
    gamma{ sublib=ALL brem_medium=UO2 }
    print{ neutron{ spectra=yes } }
    neutron{ alphan_medium=UO2 }
    }
    end


Load Isotopics from an f71 File
===============================

The "mat" block allows isotopics to be loaded from any position on an
existing f71 file, as seen in :numref:`fig-origen-load-mat`. A table of
contents is printed in the output file every time an f71 is read or written.
Inspection of this table can help identify the appropriate position on the
f71, as shown in :numref:`fig-origen-f71-toc`, extracted
from the output file.


.. code-block:: scale
   :caption: Load isotopics from an f71 file using the "mat" block and perform a follow-on decay.
   :name: fig-origen-load-mat

   'copy existing f71 file from input file directory to working directory
   =shell
   cp ${INPDIR}/discharge.f71 discharge2.f71
   end

   =origen
   case(restart){
       % decay only library
       lib {
           file="end7dec" pos=1
       }
       % must know correct position
       mat {
           load{ file="discharge2.f71" pos=2 }
       }
       % continue timeline from previous case ending at 5 years
       time{
           units=YEARS
           start=5
           t=[10 20 40 80 160]
       }
       % append to file
       save{
           file="discharge2.f71" steps=[1 2 3 4 5]
       }
   }
   end


.. code-block:: scale
   :caption: Table of contents printed when accessing the f71 file.
   :name: fig-origen-f71-toc

   ==================================================================================
   = Restart F71 File for case 'restart' (#1/1) =
   ----------------------------------------------------------------------------------
   Data taken from position: 2
   index time power flux fluence burnup libpos case step DCGNAB
       1 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 3.00000e+03 1 2 0 DC----
       2 1.57800e+08 0.00000e+00 0.00000e+00 0.00000e+00 3.00000e+03 1 2 8 DC----
   D - state definition present
   C - concentrations present
   G - gamma emission spectra present
   N - neutron emission spectra present
   A - alpha emission spectra present
   B - beta emission spectra present


The simple input in :numref:`fig-origen-load-rename` can be used to print
contents of an existing f71 file. The file is renamed so that it does
not have extension ".f71." This prevents the automatic copy back from the
working directory to the input file directory. Note that the same is true
with any ORIGEN libraries that have the extension ".f33." There is a rule
in place that *any* file in the working directory with extension ".f71" or
".f33" is copied back to the input file's directory. To prevent this from
occurring, the ".f71" or ".f33" extensions must not be used in the filename,
or unneeded files with a shell command at the end must be explicitly deleted.

.. code-block:: scale
   :caption: Isotopics from an f71 or f33 file.
   :name: fig-origen-load-rename

   'avoid .f71 extension to prevent automatic copy back
   =shell
   cp /path/to/unknown.f71 f71
   end

   =origen
   case(test){
       lib{ file="end7dec" pos=1 }
       mat{ load{ file="f71" pos=1 } }
       time=[1]
   }
   end

   'remove any *.f71 or *.f33 in the working directory to prevent automatic copy back
   '(not necessary in this example, but for reference)
   =shell
   rm -f *.f71
   rm -f *.f33
   end


Continuous Feed and Removal
===========================

Both continuous feeding of nuclides into a system and chemical removal
of elements from a system are required to simulate molten fuel systems
such as the molten salt reactor (MSR). Simulation of removal can be used
to represent other physical processes such as purification systems
(i.e., removal of chemical species by filtration or ion-exchange columns) and
ventilated systems in which the removal can be represented using a rate
constant (1/s). :numref:`fig-origen-msr` applies to simulation of a molten
salt reactor system, and it uses both continuous feed of :sup:`232`\ Th and
simultaneous removal of fission products according to their removal process.
To actually simulate this system properly, an ORIGEN reactor library
appropriate for the MSR must be generated.

There are 11 groups of nuclides in this example, each with the same
removal constant. The groups, by element and removal rate in units of
(1/s), are

   -  Group 1: Ca to As (3.37 :math:`\times` 10\ :sup:`-9`);

   -  Group 2: Y, La, Ce, Pr, Nd, Pm, Sm, Gd (2.31 :math:`\times` 10\ :sup:`-7`);

   -  Group 3: Eu (2.31 :math:`\times` 10\ :sup:`-8` );

   -  Group 4: Se, Nb, Mo, Tc, Ru, Rh, Pd, Ag, Sb, Te (5 :math:`\times` 10\ :sup:`-2`);

   -  Group 5: Zr, Cd, In, Sn (5.79 :math:`\times` 10\ :sup:`-8`) ;

   -  Group 6: Kr, Xe (5 :math:`\times` 10\ :sup:`-2`);

   -  Group 7: Br, I (1.93 :math:`\times` 10\ :sup:`-7`);

   -  Group 8: Rb, Sr, Cs, Ba (3.37 :math:`\times` 10\ :sup:`-9`);

   -  Group 9: Th, Li, Be, F (3.37 :math:`\times` 10\ :sup:`-9`);

   -  Group 10: Pa (3.86 :math:`\times` 10\ :sup:`-6`); and

   -  Group 11: Np, Pu, Am, Cm, Bk, Cf (1.98 :math:`\times` 10\ :sup:`-9`).

A :sup:`232`\ Th feed rate of 2.0 :math:`\times` 10\ :sup:`-2` grams/s is used.

.. code-block:: scale
   :caption: Demonstration of continuous feed and removal within an ORIGEN irradiation case.
   :name: fig-origen-msr

   =origen
   case{
       title="Single fluid MSR depletion calculation"

       lib{
          file="msr.f33"
          pos=1
       }
       time{
           units=YEARS
           t=[ 8i 0.05 1.0 ]
       }

       power=[ 10r30 ] %30 MW

       %initial material
       mat{
          %FLiBe with pure Li7 and 1 MTIHM loading
          units=GRAMS
          iso =[f=1e7 li7=5e6 be=1e6 th232=9.5e5 u233=0.5e5]

          %continuous feed of th-232
          feed=[th232=2e-2] %g/s
       }

       %continuous removal by element using atomic numbers
       processing{ removal{rate=3.37e-9 ele=[12i 20 33]}
                   removal{rate=2.31e-7 ele=[39 57 58 59 60 61 62 64]}
                   removal{rate=5.79e-8 ele=[40 48 49 50]}
                   removal{rate=5e-2 ele=[36 54]}
                   removal{rate=1.93e-7 ele=[35 53]}
                   removal{rate=3.37e-9 ele=[37 38 55 56]}
                   removal{rate=3.37e-9 ele=[90 3 4 9]}
                   removal{rate=3.86e-6 ele=[91]}
                   removal{rate=1.98e-9 ele=[93 94 95 96 97 98]}
       }

       print{
            cutoffs=[ GRAMS=0.1 ] %do not show grams < 0.1% of total
            nuc{ units=[GRAMS] total=yes }
            kinf=yes   %print k-infinity summary
            absfrac_sublib=LT %absorption fractions for light nuclides in FLiBe
       }
   } %end case
   end

The absorption rates, fission rates, and k-infinity values are printed
during irradiation, which can be used to evaluate the influence of the
feed rates and removal constants on the time-dependent reactor
performance. For the MSR in particular, the ability to self-sustain can
be assessed from the "k-infinity" summary output, enabled by "kinf=yes"
in print block (as well as the absorption fractions in the light
nuclides in FLiBe), and enabled by "absfrac_sublib=LT" in the print
block (:numref:`fig-origen-msr-history`). This example uses pure Li-7, whereas
if natural Li is used, one will see a much larger fraction of absorptions in
Li-6 and much lower "k-infinity."


.. code-block:: none
   :caption: Continuous feed and removal--history overview.
   :name: fig-origen-msr-history

   =============================================================================================
   = History overview for case '1' (#1/1)
   = Single fluid MSR depletion calculation
   ---------------------------------------------------------------------------------------------
      step          t0          t1          dt           t        flux     fluence       power      energy
       (-)         (y)         (y)         (s)         (s)   (n/cm2-s)     (n/cm2)        (MW)       (MWd)
         1      0.0000      0.0500  1.5780E+06  1.5780E+06  1.9782E+13  3.1217E+19  3.0000E+01  5.4792E+02
         2      0.0500      0.1556  3.3313E+06  4.9093E+06  2.0112E+13  9.8216E+19  3.0000E+01  1.7046E+03
         3      0.1556      0.2611  3.3313E+06  8.2407E+06  2.0575E+13  1.6676E+20  3.0000E+01  2.8613E+03
         4      0.2611      0.3667  3.3313E+06  1.1572E+07  2.1057E+13  2.3691E+20  3.0000E+01  4.0181E+03
         5      0.3667      0.4722  3.3313E+06  1.4903E+07  2.1557E+13  3.0872E+20  3.0000E+01  5.1748E+03
         6      0.4722      0.5778  3.3313E+06  1.8235E+07  2.2075E+13  3.8226E+20  3.0000E+01  6.3315E+03
         7      0.5778      0.6833  3.3313E+06  2.1566E+07  2.2613E+13  4.5759E+20  3.0000E+01  7.4882E+03
         8      0.6833      0.7889  3.3313E+06  2.4897E+07  2.3171E+13  5.3478E+20  3.0000E+01  8.6449E+03
         9      0.7889      0.8944  3.3313E+06  2.8229E+07  2.3750E+13  6.1390E+20  3.0000E+01  9.8016E+03
        10      0.8944      1.0000  3.3313E+06  3.1560E+07  2.4351E+13  6.9502E+20  3.0000E+01  1.0958E+04

                 step - step index within this case
                   t0 - time at beginning-of-step in input units
                   t1 - time at end-of-step in input units
                   dt - length of step in seconds
                    t - end-of-step cumulative time in seconds
                 flux - flux in neutrons/cm^2-sec (CALCULATED)
              fluence - cumulative end-of-step fluence in neutrons/cm^2 (CALCULATED)
                power - power in mega-watts (INPUT)
               energy - cumulative end-of-step energy released in mega-watt-days (INPUT)
   =============================================================================================


   =============================================================================================
   =   Overall neutron balance for case '1' (#1/1)
   =   Single fluid MSR depletion calculation
   ---------------------------------------------------------------------------------------------
                          0.0E+00y    5.0E-02y    1.6E-01y    2.6E-01y    3.7E-01y    4.7E-01y
   n-production           2.9579E+18  2.9272E+18  2.9110E+18  2.9123E+18  2.9138E+18  2.9154E+18
   n-absorption           2.6018E+18  2.6178E+18  2.6858E+18  2.7707E+18  2.8583E+18  2.9489E+18
   k-inf                  1.1369E+00  1.1182E+00  1.0838E+00  1.0511E+00  1.0194E+00  9.8864E-01
   =============================================================================================

   =============================================================================================
   =   Fraction of absorption rate for light elements for case '1' (#1/1)
   =   Single fluid MSR depletion calculation
   ---------------------------------------------------------------------------------------------
               0.0E+00y    5.0E-02y    1.6E-01y    2.6E-01y    3.7E-01y    4.7E-01y
   f-19        9.5276E-02  9.4189E-02  9.2293E-02  9.0506E-02  8.8782E-02  8.7113E-02
   be-9        9.4833E-02  9.3751E-02  9.1862E-02  9.0083E-02  8.8366E-02  8.6704E-02
   li-7        6.3293E-02  6.2572E-02  6.1312E-02  6.0125E-02  5.8980E-02  5.7871E-02
   li-6        0.0000E+00  5.6409E-04  1.7104E-03  2.8000E-03  3.8355E-03  4.8190E-03
   he-3        0.0000E+00  2.9340E-08  7.1009E-07  3.0708E-06  7.9374E-06  1.5939E-05
   o-16        0.0000E+00  4.3552E-08  1.3502E-07  2.2606E-07  3.1678E-07  4.0728E-07

   *{list continues}*


Calculate Fuel :math:`\left(\alpha,n \right)` Emissions in a Glass Matrix
=========================================================================

Batch processing options are provided to separate various components of
the nuclide compositions into different streams and to recombine the
streams to form new compositions. This example applies to the
irradiation of typical commercial fuel and subsequent storage of
separated fission products and actinides from fuel in a glass matrix.
The matrix is important in determining the :math:`\left(alpha,n\right)` component of the
neutron source because the alpha particles interact with the light
element constituents in the matrix, with :math:`\left(alpha,n\right)` yields corresponding to
the medium containing the :math:`\alpha`-emitting nuclides. Therefore, an accurate
calculation of the neutron source in a glass matrix requires combining
the oxide fuel compositions after irradiation with the defined glass
matrix. The calculation could be performed by creating a case by
manually entering the calculated nuclide activities and the matrix
composition. However, this is only practical if the number of source
nuclides is small. This example applies batch processing and blending
options to generate the required compositions.

The blending option is used to combine two streams: one stream from
irradiated fuel, and the other stream defining the glass matrix
composition.

An irradiation case---"irrad"---is performed first to generate spent nuclear
fuel compositions. The next case "spent" decays the results for one
year. At the start of the decay, only selected elements are retained in
the stream by performing processing with the "retained" array. In this
example, all elements are removed except for Se (99.8%); Rb, Sr, Te, Cs,
Ba, Dy (77.8%); and U, Np, Pu, Am, Cm (1%).

The glass matrix compositions are then defined in the third case,
"glass."

The final case---"blend"---blends 10% of each the last step's isotopics from the
"spent" and "glass" cases. To test the dependence on the time when the blend
is performed, the blend can be changed to "blend=[spent(N)=0.1 glass=0.1 ],"
where *N* is the index of the step from which to take isotopics from the
spent case.

.. code-block:: scale
   :caption: Continuous feed and removal--blending option.
   :name: fig-origen-blending

   =arp
   w17x17
   3
   1
   360
   40
   1
   0.723
   fuellib
   end

   =origen
   bounds{
       neutron=[ 1.00E-05 1.00E-02 3.00E-02 5.00E-02 1.00E-01 2.25E-01
                 3.25E-01 4.14E-01 8.00E-01 1.00E+00 1.13E+00 1.30E+00
                 1.86E+00 3.06E+00 1.07E+01 2.90E+01 1.01E+02 5.83E+02
                 3.04E+03 1.50E+04 1.11E+05 4.08E+05 9.07E+05 1.42E+06
                 1.83E+06 3.01E+06 6.38E+06 2.00E+07 ]
   }
   case(irrad){
       title="Fuel Stream 1 Irradiation"
       lib{ file="fuellib" pos=1 }
       time=[ 8I 36 360 ]
       power=[ 10r40 ]
       mat{
           units=GRAMS
           iso=[u234=534 u235=60000 u236=276 u238=939190]
       }
   }
   case(spent){
       title="Fuel Stream 1 Decay"
       time{
           t=[ 0.1 0.3 1 3 10 30 100 300 360 ] start=0 %enter times from 0
       }
       processing {
           retained=[se=0.998 rb=0.778 sr=0.778 te=0.778 cs=0.778 ba=0.778
                     dy=0.998 u=0.010 np=0.010 pu=0.010 am=0.010 cm=0.010]
       }
   }
   case(glass){
       title="100 kg glass" time{ t=[ 1 ] start=0 }
       mat{
           units=GRAMS
           iso=[li=2.18e3 b=2.11e3 o=46.4e3 f=0.061e3 na=7.65e3 mg=0.49e3 al=2.18e3
                si=25.4e3 cl=0.049e3 ca=1.08e3 mn=1.83e3 fe=8.61e3 ni=0.70e3
                zr=0.88e3 pb=0.049e3 ]
       }
   }
   case(blend){
       title="final blended case"  time=[ 1.01 3 10 30 100 ] %continue previous
       mat{
           blend=[ spent=0.1 glass=0.1 ] %blend factors of 0.1 for each
       }
    neutron{ alphan_medium=CASE } %use this case's isotopics
    print{ ele{ total=yes units=[GRAMS] }
           neutron{ summary=yes spectra=yes detailed=yes }
    }
   }
   end


Create an ORIGEN Decay Library from a Decay Resource
====================================================

The following ORIGEN input (:numref:`fig-couple-decay-lib`) is all that is
required to produce a binary decay library from the ORIGEN decay resource
file. Note that ORIGEN decay resources can also be raw ENDF formatted data
files.

.. code-block:: scale
   :caption: Creation of an ORIGEN decay library from the decay resource
   :name: fig-couple-decay-lib

    =origen

    build_lib("origen.end7dec") {
      nuclide {
        type=NAMED_SET
        list="complete_v6.2"
      }
      decay {
        type=ENDF_DECAY
        resource="${DATA}/origen_data/origen.rev03.decay.data"
      }
    }

    end

Create an ORIGEN Reaction Library
=================================

:numref:`fig-couple-rxn-lib` creates an ORIGEN reaction library from an
AMPX library created using the SCALE ``t-depl-1d`` sequence. This particular
sequence is used to create the ORIGEN library which contains all possible
reactions and decays between the standard set of nuclides used for all
Polaris and TRITON calculations. For this reason, ``allow_zero=yes`` is
important because it makes sure no reactions are eliminated. The spectrum
in this case is not important because Polaris and TRITON will overwrite the
values for each depletable zone at each time step.


.. code-block:: scale
   :caption: Creation of an ORIGEN reaction library.
   :name: fig-couple-rxn-lib

    =t-depl-1d parm=(addnux=4,bonami)
    PWR pincell calculation to get transition definition skeleton
    v7-56

    read comp
    'Fuel
    uo2  1 den=10.412  1  900 92234 0.04 92235 4.11  92238 95.85   end
    wtptzirc 25 6.44 4 40000 97.91 26000 0.5 50116 0.86 50120 0.73 1.0 600  end
    h2o  26 den=0.6798  1  593 end
    wtptbor 26 0.6798 1 5000 100 500e-6 593 end
    end comp

    read celldata
      latticecell squarepitch hpitch=.83116 26 fuelr=0.47815 1 cladr=0.5588 25 end
    end celldata

    read depletion
      1
    end depletion

    read burndata
      power=40  burn=0 end
    end burndata

    read keep
      microlibfile
    end keep

    read model
    Infinite lattice PWR pin cell
    read parm
     prtflux=no collapse=yes prtmxsec=no
     sn=4 inners=5 outers=100 epsouter=1e-6
     epsglobal=1e-6
    end parm
    read materials
     mix=1 pn=0 com='4.11% enriched fuel' end
     mix=25 pn=0 com='cladding' end
     mix=26 pn=0 com='water' end
    end materials
    read geom
      geom=cylinder leftBC=refl rightBC=white
      zoneIDs 1 25 26 end zoneIDs
      zoneDimensions .47815 .55880 .83116 end zoneDimensions
      zoneIntervals 3r8 end zoneIntervals
    end geom
    end model
    end

    =origen

    build_lib("origen.transition.def") {

      nuclide {
        type=NAMED_SET
        list="complete_v6.2"
      }

      decay {
        type=ENDF_DECAY
        resource="${DATA}/origen_data/origen.rev03.decay.data"
      }

      neutron(1) {
        type=ENDF_ENERGY_DEPENDENT
        reaction_resource="${DATA}/origen.rev01.jeff56g"
        fp_yield_resource="${DATA}/origen_data/origen.rev05.yield.data"

        %%%%%%%%%%%%%%
        allow_zero=yes
        %%%%%%%%%%%%%%

        spectrum {
          type=MULTIGROUP
          flux=[56R 1.0]
        }

        xs_update {
          type=AMPX_LIBRARY
          file="sysin.microWorkLib_0.f44"
          mixture=1
        }

      }
    }

    end

    =shell
    cp origen.transition.def ${OUTDIR}/pwr.rev04.orglib
    end


Create an ORIGEN Activation Library
===================================

Activation calculations typically do not require self-shielding, so an
ORIGEN "activation" library is a means to refer to a library that is
using infinitely dilute cross sections from the reaction resource. An
ORIGEN activation library can be created very easily as long as the flux
spectrum is available in one of the reaction resource group structures.

In the example below, we create a fast spectrum library based on the 200-group
reaction resource and irradiate one gram of iron for 10 days at 1e15 flux.


.. code-block:: scale
   :caption: Creation of an ORIGEN activation library.
   :name: fig-couple-act-lib

    =origen
    build_lib("ff.f33") {
        neutron(1) {
            type=ENDF_ENERGY_DEPENDENT
            reaction_resource="n200.reaction.data"
            spectrum {
              type=MULTIGROUP
              flux=[20r 1.0 180r 0.0]
            }
        }
    }
    case {
      lib {file="ff.f33"}
      mat { iso=[fe=1.0] units=GRAMS }
      time=[10]
      flux=[1e15]
    }
    end


Create an ORIGEN Library with User-Supplied Cross Sections
==========================================================

It is possible to change specific cross sections on ORIGEN libraries. The
following input uses all default values for all data (the flux spectrum
from the reaction resource will be used) but changes the U-238 fission (18)
and n,gamma (102) reactions to 20 and 10 barns, respectively.

.. code-block:: scale
   :caption: Creation of an ORIGEN library with user-supplied cross sections.
   :name: fig-couple-user-rxn-lib

    =origen

    build_lib("my.f33") {
      neutron(1) {
        type=ENDF_ENERGY_DEPENDENT
        reaction_resource="n252.reaction.data"
        coeff_update [
            u238 18  20
            u238 102 10
        ]
      }
    }

    end


Printing library cross-section values
=====================================

Print the Cross Section Values on an ORIGEN Library with OBIWAN
---------------------------------------------------------------

The ``obiwan`` utility was introduced in SCALE 6.3 to help users interrogate
the data contained in ORIGEN binary files. From the command line, one
can view all coefficients on the library with the following. See
:numref:`sec-obiwan` for details.

::

    obiwan view my.f33



Print the Cross Section Values on an ORIGEN Library in ORIGEN
-------------------------------------------------------------

Cross sections can also be printed when the library is used in ORIGEN by
setting "print_xs=yes" in the options block, shown as
:numref:`fig-origen-print-lib`.

.. code-block:: scale
   :caption: Printing cross section values on an ORIGEN library using ORIGEN.
   :name: fig-origen-print-lib

   =shell
   cp ${INPDIR}/my_rx.f33 ft33f001
   end

   =origen
   options{ print_xs=yes }
   case{
       lib{ file="ft33f001" pos=1 }
       time=[1] %dummy time
       mat{ iso=[u235=1] } %dummy iso
   }
   end


Ranking Contribution to Toxicity
================================

The OPUS input in :numref:`fig-opus-rank-radtox` creates a plot of the
volume of various nuclides with the maximum permissible concentration (MPC)
in water using the "snf.f71" produced by the "Three cycle plus decay" example
(:numref:`fig-origen-3cycle`). Only positions 6--16 are plotted using
"minposition" and "maxposition." Three nuclides (:sup:`242`\ Cm,
:sup:`137m`\ Ba, and :sup:`99`\ Tc ) are forced to be included via the "symnuc"
list, with 17 more nuclides (for total "nrank=20") included according to their
average rank in terms of the MPC in water. The total number of nuclides
requested is 20. The x-axis label is set to "TIME (YEARS)," and the title is
"SPENT FUEL AT 60 GWD/MTHM."

.. code-block:: scale
   :caption: Using OPUS to produce a ranked contribution to radiotoxicity
   :name: fig-opus-rank-radtox

   =shell
     cp ${INPDIR}/snf.f71 f71
   end

   =opus
   data="f71"
   typarams=nucl
   units=h2om**3
   time=year
   libtype=fisact
   minposition=6  maxposition=16   nrank=20
   title="SPENT FUEL AT 60 GWD/MTIHM "
   xlabel="TIME (YEARS)"
   symnuc=cm-242 ba-137m tc-99 end
   end

Spectrum plots with OPUS
========================

Photon Spectrum Plot
--------------------

The OPUS input shown in :numref:`fig-opus-photon-spec` creates a plot of the
photon spectrum for all times between 1 and 5 years, using "tmin=1" and
"tmax=5" with "time=years."


.. code-block:: scale
   :caption: Plotting the photon spectrum using OPUS.
   :name: fig-opus-photon-spec

   =shell
   cp ${INPDIR}/snf.f71 f71
   end

   =opus
   data="f71"
   typarams=gspectrum
   units=intensity
   tmin=1 tmax=5 time=years
   end


:numref:`fig-opus-gamma-output` shows the output of the time-dependent
gamma spectrum extracted from the f71 file by OPUS.

.. code-block:: scale
   :caption: Photon spectrum plot from OPUS-- output of the time-dependent gamma spectrum.
   :name: fig-opus-gamma-output

	       1/(s.MeV) |        1.25y       2.15y       3.73y
   ----------------------+-------------------------------------
    1.00e+01 -- 8.00e+00 |   2.7961e+11  3.0661e+03  3.0661e+03
    8.00e+00 -- 6.50e+00 |   7.1201e+13  1.9436e+04  1.9436e+04
    6.50e+00 -- 5.00e+00 |   8.9725e+15  2.5300e+10  5.3041e+09
    5.00e+00 -- 4.00e+00 |   3.7075e+16  9.1643e+12  1.9001e+12
    4.00e+00 -- 3.00e+00 |   1.1734e+17  1.3562e+14  2.8824e+13
    3.00e+00 -- 2.50e+00 |   3.4321e+17  5.5945e+15  4.8216e+15
    2.50e+00 -- 2.00e+00 |   5.2847e+17  1.1338e+16  5.9433e+15
    2.00e+00 -- 1.66e+00 |   8.3528e+17  3.3015e+16  1.8382e+16
    1.66e+00 -- 1.33e+00 |   1.8060e+18  2.7233e+17  2.4658e+17
    1.33e+00 -- 1.00e+00 |   2.4156e+18  1.4238e+17  9.2264e+16
    1.00e+00 -- 8.00e-01 |   5.0662e+18  3.2193e+17  2.6845e+17
    8.00e-01 -- 6.00e-01 |   6.4083e+18  2.1010e+18  1.8903e+18
    6.00e-01 -- 4.00e-01 |   7.1803e+18  1.1822e+18  1.0301e+18
    4.00e-01 -- 3.00e-01 |   8.7297e+18  1.7856e+18  1.6414e+18
    3.00e-01 -- 2.00e-01 |   1.9481e+19  1.0658e+19  9.7018e+18
    2.00e-01 -- 1.00e-01 |   2.9105e+19  1.5198e+19  1.3996e+19
    1.00e-01 -- 5.00e-02 |   6.2160e+19  9.1756e+18  8.3611e+18
    5.00e-02 -- 1.00e-02 |   1.1219e+20  3.4628e+19  3.1458e+19


Neutron Spectrum Plot
---------------------

The OPUS input in :numref:`fig-opus-total-neut-spec` creates a plot of the
total neutron spectrum at all times.

.. code-block:: scale
   :caption: Neutron spectrum plot using OPUS
   :name: fig-opus-total-neut-spec

   =opus
   data="f71"
   typarams=nspe
   units=intensity
   end


Isotopic Weight Percentages for Uranium and Plutonium During Decay
==================================================================

The isotopic distributions in uranium and plutonium, in weight percent,
may be plotted with the OPUS input in :numref:`fig-opus-iso-wt-pct`.


.. code-block:: scale
   :caption: Isotopic weight percentages for uranium and plutonium during decay.
   :name: fig-opus-iso-wt-pct

   =opus
   data="f71"
   units=wpel
   libtype=act
   symnuc=u pu end
   end


User-Specified Response Function in OPUS
========================================

In :numref:`fig-opus-user-response`, response conversion factor data are
entered in the RESPONSE= array as nuclide-response factor pairs, with the
nuclide id being the legacy nuclide ID (ZZAAAI), with ZZ two digits of
atomic number, AAA three digits of mass number, and I one digit of isomeric
state. For example, :sup:`235m`\ U would be given as 922351 and H-1 as 10010.
In this example, it is assumed that the response factors are activity based
(response/Bq of nuclide), so the units of Becquerels are requested using the
UNITS keyword. The user-supplied response conversion factors are applied to
the Becquerel units for all nuclides in the RESPONSE= array, and the results
for any nuclide for which no response factors are provided are zeroed.


.. code-block:: scale
   :caption: Example of a user-specified response function in OPUS.
   :name: fig-opus-user-response

   =opus
   data="f71"
   units=becq
   time=year
   typarams=nucl
   response=
    270600 1.92027E+00  962460 2.27711E-01  481151 1.64222E-01
    822100 5.19246E-12  962470 1.75728E-09  501230 3.81237E-02
    832101 9.43341E-09  962480 1.05672E+00  511240 1.53438E+02
    882260 1.51600E-05  962500 1.60583E+02  511250 1.81023E-04
    892270 1.67080E-05  982490 2.21420E-04  511260 5.13360E+00
    902280 2.06832E-02  982500 2.87199E+02  end
   end