pirs.hli.mcnp subpackage

This package provides a high-level interface to the MCNP5 code.

Docstrings

class pirs.hli.mcnp.interface.McnpInterface(gm=None, **kwargs)[source]

McnpInterface is an MCNP model with ability to take an instance of one of the solids classes as input data.

Simple box and cylinder >>> print McnpInterface(Box()) MESSAGE:

datapath=C:Python27libsite-packagesmcnp

<BLANKLINE> c title 1 0 -1 imp:n=1 $ model 2 0 1 imp:n=0 $ The other world <BLANKLINE> c surfaces 1 rpp -0.5 0.5 -0.5 0.5 -0.5 0.5 <BLANKLINE> c data cards c materials <BLANKLINE> >>> print McnpInterface(Cylinder()) MESSAGE:

datapath=C:Python27libsite-packagesmcnp

<BLANKLINE> c title 1 0 -1 imp:n=1 $ model 2 0 1 imp:n=0 $ The other world <BLANKLINE> c surfaces 1 rcc 0.0 0.0 -0.5 0.0 0.0 1.0 1.0 <BLANKLINE> c data cards c materials <BLANKLINE>

Box and cylinder with axially distributed density. Note that not only mesh itself must be set, but also the values, so the density is not constant:

>>> s1 = Box()
>>> s1.dens.set_grid([1]*4)
>>> s1.dens.set_values([1.1, 1.2, 1.3, 1.4])
>>> s1.material = 'fuel'
>>> print McnpInterface(s1)
MESSAGE:
     datapath=C:\Python27\lib\site-packages\mcnp

c title
1 0  -1 imp:n=1 fill=1  $ model
2 1 -1.1 2 -3 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
3 1 -1.2 3 -4 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
4 1 -1.3 4 -5 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
5 1 -1.4 5 -6 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
6 0  1 imp:n=0  $ The other world

c surfaces
1 rpp  -0.5  0.5  -0.5  0.5  -0.5  0.5
2 pz  -1000.5
3 pz  -0.25
4 pz  0.0
5 pz  0.25
6 pz  1000.5

c data cards
c materials
m1 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0
>>> s1 = Cylinder()
>>> s1.dens.set_grid([1]*4)
>>> s1.dens.set_values([1.1, 1.2, 1.3, 1.4])
>>> s1.material = 'fuel'
>>> print McnpInterface(s1)
MESSAGE:
     datapath=C:\Python27\lib\site-packages\mcnp

c title
1 0  -1 imp:n=1 fill=1  $ model
2 1 -1.1 2 -3 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
3 1 -1.2 3 -4 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
4 1 -1.3 4 -5 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
5 1 -1.4 5 -6 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
6 0  1 imp:n=0  $ The other world

c surfaces
1 rcc  0.0  0.0  -0.5  0.0  0.0  1.0  1.0
2 pz  -1000.5
3 pz  -0.25
4 pz  0.0
5 pz  0.25
6 pz  1000.5

c data cards
c materials
m1 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0

The temperature mesh:

>>> b = Box()
>>> b.material = 'fuel'
>>> b.temp.set_grid([1]*5)
>>> b.temp.set_values([300, 320, 340, 400, 420])
>>> print McnpInterface(b)
MESSAGE:
     datapath=C:\Python27\lib\site-packages\mcnp

c title
1 0  -1 imp:n=1 fill=1  $ model
2 1 -1.0 2 -3 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
3 2 -1.0 3 -4 imp:n=1 tmp=2.75754976e-08 u=1  $ comment
4 3 -1.0 4 -5 imp:n=1 tmp=2.92989662e-08 u=1  $ comment
5 4 -1.0 5 -6 imp:n=1 tmp=3.4469372e-08 u=1  $ comment
6 5 -1.0 6 -7 imp:n=1 tmp=3.61928406e-08 u=1  $ comment
7 0  1 imp:n=0  $ The other world

c surfaces
1 rpp  -0.5  0.5  -0.5  0.5  -0.5  0.5
2 pz  -1000.5
3 pz  -0.3
4 pz  -0.1
5 pz  0.1
6 pz  0.3
7 pz  1000.5

c data cards
c materials
m1 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0
m2 $ mixture  H-001 at 320.0 K 
     1001.31c 0.788017730687     1001.32c 0.211982269313 $ 0.788017730687 parts of 299.999663469K and 0.211982269313 parts of 400.007287629K
m3 $ mixture  H-001 at 340.0 K 
     1001.31c 0.5825662186     1001.32c 0.4174337814 $ 0.5825662186 parts of 299.999663469K and 0.4174337814 parts of 400.007287629K
m4 $ mixture  H-001 at 400.0 K 
     1001.32c 1.0
m5 $ mixture  H-001 at 420.0 K 
     1001.32c 0.790847540923     1001.33c 0.209152459077 $ 0.790847540923 parts of 400.007287629K and 0.209152459077 parts of 500.003307284K

model consisting of several solids, each with its own material:

>>> b = Box()
>>> b.X = 10
>>> b.Y = 10 
>>> b.Z = 100
>>> c = b.insert(1, Cylinder())
>>> c.R = 1
>>> c.Z = b.Z
>>> b.material = 'water'
>>> c.material = 'pin'
>>> print McnpInterface(b)
MESSAGE:
     datapath=C:\Python27\lib\site-packages\mcnp

c title
1 0  -1 imp:n=1 fill=1  $ model
2 1 -1.0 2 -3 (4:1.5:1.6) imp:n=1 tmp=2.5852029e-08 u=1  $ comment
3 2 -1.0 -4 -1.5 -1.6 imp:n=1 u=1 tmp=2.5852029e-08  $ 1
4 0  1 imp:n=0  $ The other world

c surfaces
1 rpp  -5.0  5.0  -5.0  5.0  -50.0  50.0
2 pz  -1005.0
3 pz  1005.0
4 cz  1.0

c data cards
c materials
m1 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0
m2 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0

A more complex model consisting of several solids and with density and temperature distributions.

>>> b = Box()
>>> b.set_radius(10.)
>>> b.material = 'm1'
>>> c1 = b.insert(1, Cylinder())
>>> c2 = b.insert(2, Cylinder())
>>> c3 = b.insert(3, Cylinder())
>>> c1.pos.z = -5
>>> c2.pos.z =  0
>>> c3.pos.z =  5
>>> b.dens.set_grid([1,1,1])
>>> b.dens.set_values( [1, 2, 3] )
>>> b.temp.set_grid([1,1,1, 1, 1, 1])
>>> b.temp.set_values( [300, 320, 340, 360, 420, 400.] )
>>> m = McnpInterface(b)
>>> print m
MESSAGE:
     datapath=C:\Python27\lib\site-packages\mcnp

c title
1 0  -1 imp:n=1 fill=1  $ model
2 1 -1 2 -3 imp:n=1 tmp=2.5852029e-08 u=1  $ comment
3 2 -1 3 -4 5 imp:n=1 tmp=2.75754976e-08 u=1  $ comment
4 3 -2 4 -6 (5.1:7:-8) imp:n=1 tmp=2.92989662e-08 u=1  $ comment
5 4 -2 6 -9 (5.1:7:-8) imp:n=1 tmp=3.10224348e-08 u=1  $ comment
6 5 -3 9 -10 (5.1:11:-12) imp:n=1 tmp=3.61928406e-08 u=1  $ comment
7 6 -3 10 -13 imp:n=1 tmp=3.4469372e-08 u=1  $ comment
8 0  -5 imp:n=1 u=1  $ 1
9 0  -5.1 -7 8 imp:n=1 u=1  $ 2
10 0  -5.1 -11 12 imp:n=1 u=1  $ 3
11 0  1 imp:n=0  $ The other world

c surfaces
1 rpp  -10.0  10.0  -10.0  10.0  -10.0  10.0
2 pz  -1010.0
3 pz  -6.666666667
4 pz  -3.333333333
5 rcc  0.0  0.0  -5.5  0.0  0.0  1.0  1.0
6 pz  0.0
7 pz  0.5
8 pz  -0.5
9 pz  3.333333333
10 pz  6.666666667
11 pz  5.5
12 pz  4.5
13 pz  1010.0

c data cards
c materials
m1 $ mixture  H-001 at 300.0 K 
     1001.31c 1.0
m2 $ mixture  H-001 at 320.0 K 
     1001.31c 0.788017730687     1001.32c 0.211982269313 $ 0.788017730687 parts of 299.999663469K and 0.211982269313 parts of 400.007287629K
m3 $ mixture  H-001 at 340.0 K 
     1001.31c 0.5825662186     1001.32c 0.4174337814 $ 0.5825662186 parts of 299.999663469K and 0.4174337814 parts of 400.007287629K
m4 $ mixture  H-001 at 360.0 K 
     1001.31c 0.383073636439     1001.32c 0.616926363561 $ 0.383073636439 parts of 299.999663469K and 0.616926363561 parts of 400.007287629K
m5 $ mixture  H-001 at 420.0 K 
     1001.32c 0.790847540923     1001.33c 0.209152459077 $ 0.790847540923 parts of 400.007287629K and 0.209152459077 parts of 500.003307284K
m6 $ mixture  H-001 at 400.0 K 
     1001.32c 1.0
bc[source]

Dictionary specifying boundary conditions on the axial and radial boundaries of the model.

Two keys are meaningful: ‘axial’ and ‘radial’. Values can be one of ‘’ , ‘*’ and ‘+’ meaning no reflection, mirror and white reflection, respectively.

>>> b = Cylinder()
>>> m = McnpInterface(b)
>>> m.bc['axial'] = '*'
>>> print m     
...
1 0  -3 -2 1 imp:n=1  $ model
2 0  3:2:-1 imp:n=0  $ The other world

c surfaces
*1 pz  -0.5
*2 pz  0.5
3 cz  1.0
...
>>> m.bc['radial'] = '*'
>>> print m        
...
1 0  -1 imp:n=1  $ model
2 0  1 imp:n=0  $ The other world

c surfaces
*1 rcc  0.0  0.0  -0.5  0.0  0.0  1.0  1.0
...
>>> m.bc['radial'] = '+'
>>> print m        
...
1 0  -3 -2 1 imp:n=1  $ model
2 0  3:2:-1 imp:n=0  $ The other world

c surfaces
*1 pz  -0.5
*2 pz  0.5
+3 cz  1.0
...
gm[source]

Link to the general model. This is the input data for the MCNP input file generated by the McnpInterface.

materials[source]

Dictionary to define the actual meaning of the material names used in the general model. Keys are strings with material names from the general model, values are instances of mcnp.Material class.

Note that instances of mcnp.Material class have their own property T (temperature). This property is not used. The temperature is defined in the temp property of each element of the general model.

Note also that each instance of the mcnp.Material class has its own xsdir property. This will be replaced with the xsdir property set to the model.

plot_commands(element=None, XYopt={}, XZopt={}, YZopt={})[source]

A multi-line string representing plot commands, which can be feed to MCNP to produce plots of the model.

By dafault, commands for three plots are written: section by XY, XZ and YZ planes.

element – optional argument. If of one of solids type, its dimensions will be used to set extent of the plot.

XYopt – optional dictionary to provide user-defined options to the XY plot. For example, XYopt={‘ext’:‘3.0 6.0’}

read_meshtal(meshtal='meshtal')[source]

Reads meshtall to the correspondent meshtallies and returns the copy of the general model containing read values.

Table Of Contents

Previous topic

pirs.scf2 subpackage

Next topic

pirs.hli.scf2 subpackage

This Page