mcdc.Cell#

class mcdc.Cell(region: Region | None = None, fill: MaterialBase | Universe | Lattice | None = None, name: str = '', translation: Sequence[float] = [0.0, 0.0, 0.0], rotation: Sequence[float] = [0.0, 0.0, 0.0])#

Material- or universe-filled regions of the simulation geometry.

Parameters:
  • region (Region, optional) – Boolean region expression. If omitted, the cell covers all space.

  • fill (MaterialBase, Universe, Lattice, or None, optional) – Material or nested geometry placed in the cell. None creates a void cell.

  • name (str, optional) – User-facing name. An automatic name is assigned during compilation when omitted.

  • translation (sequence of 3 float, optional) – Translation, in cm, applied when entering a universe or lattice fill.

  • rotation (sequence of 3 float, optional) – Rotation angles about the x, y, and z axes, in degrees, applied when entering a universe or lattice fill.

Notes

A cell region is commonly written as +left & -right. Surface signs select half-spaces; intersections, unions, and complements may be combined freely.

Examples

Fill a slab between two z planes with a one-group material:

>>> import numpy as np
>>> import mcdc
>>> material = mcdc.MaterialMG(capture=np.array([1.0]))
>>> lower = mcdc.Surface.PlaneZ(z=0.0)
>>> upper = mcdc.Surface.PlaneZ(z=2.0)
>>> cell = mcdc.Cell(region=+lower & -upper, fill=material)

Create a void cell outside the slab:

>>> void = mcdc.Cell(name="Upper void", region=+upper)

Combine regions with a union:

>>> left_sphere = mcdc.Surface.Sphere(center=[-1.0, 0.0, 0.0], radius=0.5)
>>> right_sphere = mcdc.Surface.Sphere(center=[1.0, 0.0, 0.0], radius=0.5)
>>> two_spheres = mcdc.Cell(
...     region=-left_sphere | -right_sphere,
...     fill=material,
... )

Fill the complement of that union:

>>> outside_spheres = mcdc.Cell(
...     region=~(-left_sphere | -right_sphere),
...     fill=material,
... )

Place a reusable universe with a translation and rotation:

>>> assembly = mcdc.Universe(name="Assembly", cells=[cell])
>>> placed_assembly = mcdc.Cell(
...     fill=assembly,
...     translation=[5.0, 0.0, 0.0],
...     rotation=[0.0, 0.0, 90.0],
... )