pymcnp.meshtal Subpackage

pymcnp.meshtal contains the MESHTAL parser. PyMCNP implements an object-oriented recursive descent parser, approximating MESHTAL as the following context-free-grammar described in modified Backus-Naur form:

...

AST Classes

PyMCNP represents MESHTAL non-terminals with AST classes and stores them in nested subpackages. These AST class have methods for translating between PyMCNP and MESHTAL:

  • from_mcnp. Parses MESHTAL source, checking for syntax and semantic errors.

  • to_mcnp. Generates MESHTAL source from PyMCNP objects, reformatting.

Header Class

class pymcnp.meshtal.Header(code: String, version: String, ld: String, probid: String, title: String, histories: Integer, number: Integer, particle: String, columns: String, bins_x: String = None, bins_y: String = None, bins_z: String = None, bins_energy: String = None, bins_time: String = None)

Represents MESHTAL header blocks.

code

Simulation name.

version

Simulation version.

ld

Simulation load date.

probid

Simulation problem identification description.

title

Simulation title.

histories

Number of histories used.

number

Mesh tally number.

particle

Mesh tally particle type.

bins_x

Mesh tally x-direction bins.

bins_y

Mesh tally y-direction bins.

bins_z

Mesh tally z-direction bins.

bins_energy

Mesh tally energy bins.

bins_time

Mesh tally time bins.

columns

Tallies heading.

static from_mcnp(source: str)

Generates Header from MESHTAL.

Parameters:

source – MESHTAL for Header.

Returns:

Header.

Raises:

PtracError – SYNTAX_BLOCK.

to_mcnp()

Generates MESTHAL from Header.

Returns:

INP for Header.

Tally Class

class pymcnp.meshtal.Tally(result: String, error: String, x: String = None, y: String = None, z: String = None, energy: String = None, time: String = None)

Represents MESHTAL tally line.

x

Tally x direction.

y

Tally y direction.

z

Tally z direction.

energy

Tally energy.

time

Tally time.

result

Tally result.

error

Tally relative error.

static from_mcnp(source: str)

Generates Tally from MESHTAL.

Parameters:
  • source – MESHTAL for Tally.

  • header – MESHTAL header.

to_mcnp()

Generates MESTHAL from Tally.

Returns:

INP for Tally.