Example #1
0
class RingTestHarness(TestHarness):
    """Tests cell radial discretization."""

    def __init__(self):
        super(RingTestHarness, self).__init__()
        self.input_set = PinCellInput()

    def _create_geometry(self):
        """Discretize fuel and moderator into rings."""

        self.input_set.create_materials()
        self.input_set.create_geometry()

        # Create different rings for each Cell
        cells = self.input_set.geometry.getAllMaterialCells()
        for i, cell_id in enumerate(cells):
            cells[cell_id].setNumRings(i*2 + 3)

    def _get_results(self, num_iters=False, keff=False, fluxes=False,
                     num_fsrs=True, num_segments=True, num_tracks=True,
                     hash_output=False):
        """Digest info from geometry and return as a string."""

        return super(RingTestHarness, self)._get_results(
                num_iters=num_iters, keff=keff, fluxes=fluxes,
                num_fsrs=num_fsrs, num_segments=num_segments,
                num_tracks=num_tracks, hash_output=hash_output)
Example #2
0
class SectorTestHarness(TestHarness):
    """Tests cell angular discretization."""

    def __init__(self):
        super(SectorTestHarness, self).__init__()
        self.input_set = PinCellInput()

    def _create_geometry(self):
        """Discretize fuel and moderator into sectors."""

        self.input_set.create_materials()
        self.input_set.create_geometry()

        # Create different sectors for each Cell
        cells = self.input_set.geometry.getAllMaterialCells()
        for i, cell_id in enumerate(cells):
            cells[cell_id].setNumSectors(i*2 + 3)

        self._create_trackgenerator()
        self._generate_tracks()

    def _get_results(self, num_iters=False, keff=False, fluxes=False,
                     num_fsrs=True, num_segments=True, num_tracks=True,
                     hash_output=False):
        """Digest info from geometry and return as a string."""

        return super(SectorTestHarness, self)._get_results(
                num_iters=num_iters, keff=keff, fluxes=fluxes,
                num_fsrs=num_fsrs, num_segments=num_segments,
                num_tracks=num_tracks, hash_output=hash_output)
Example #3
0
 def __init__(self):
     super(CorrectFSRVolumeTestHarness, self).__init__()
     self.input_set = PinCellInput()
     self._result = ''
 def __init__(self):
     super(PinCellTestHarness, self).__init__()
     self.input_set = PinCellInput()
class PinCellTestHarness(TestHarness):
    """An eigenmodes calculation in a pin cell with 7-group C5G7 data."""
    def __init__(self):
        super(PinCellTestHarness, self).__init__()
        self.input_set = PinCellInput()

    def _create_geometry(self):
        """Instantiate materials and a pin cell Geometry."""

        self.input_set.create_materials()

        zcylinder = openmoc.ZCylinder(x=0.0, y=0.0, radius=1.0, name='pin')
        xmin = openmoc.XPlane(x=-2.0, name='xmin')
        xmax = openmoc.XPlane(x=+2.0, name='xmax')
        ymin = openmoc.YPlane(y=-2.0, name='ymin')
        ymax = openmoc.YPlane(y=+2.0, name='ymax')

        xmin.setBoundaryType(openmoc.VACUUM)
        xmax.setBoundaryType(openmoc.VACUUM)
        ymin.setBoundaryType(openmoc.VACUUM)
        ymax.setBoundaryType(openmoc.VACUUM)

        fuel = openmoc.Cell(name='fuel')
        fuel.setFill(self.input_set.materials['UO2'])
        fuel.addSurface(halfspace=-1, surface=zcylinder)

        moderator = openmoc.Cell(name='moderator')
        moderator.setFill(self.input_set.materials['Water'])
        moderator.addSurface(halfspace=+1, surface=zcylinder)
        moderator.addSurface(halfspace=+1, surface=xmin)
        moderator.addSurface(halfspace=-1, surface=xmax)
        moderator.addSurface(halfspace=+1, surface=ymin)
        moderator.addSurface(halfspace=-1, surface=ymax)

        root_universe = openmoc.Universe(name='root universe')
        root_universe.addCell(fuel)
        root_universe.addCell(moderator)

        self.input_set.geometry = openmoc.Geometry()
        self.input_set.geometry.setRootUniverse(root_universe)

    def _create_solver(self):
        """Instantiate a IRAMSolver."""
        self.solver = openmoc.CPUSolver(self.track_generator)
        self.solver.setNumThreads(self.num_threads)
        self.solver.setConvergenceThreshold(self.tolerance)

        # Initialize IRAMSolver to perform forward eigenmode calculation
        self.solver = openmoc.krylov.IRAMSolver(self.solver)

    def _run_openmoc(self):
        """Run an OpenMOC forward kyrlov calculation."""
        self.solver.computeEigenmodes(num_modes=2, solver_mode=openmoc.FORWARD)

    def _get_results(self,
                     num_iters=True,
                     keff=True,
                     fluxes=True,
                     num_fsrs=False,
                     num_tracks=False,
                     num_segments=False,
                     hash_output=False):
        """Digest info in the solver and return as a string."""

        # Round to 10th decimal to avoid floating point issues
        outstr = str([round(k, 10) for k in self.solver._eigenvalues])

        return outstr
 def __init__(self):
     super(MultiSimNumAzimTestHarness, self).__init__()
     self.input_set = PinCellInput()
     self.num_simulations = 1
     self.num_tracks = []
     self.num_segments = []
 def __init__(self):
     super(TrackingPinCellCMFDTestHarness, self).__init__()
     self.input_set = PinCellInput()
 def __init__(self):
     super(SplitSegmentsTestHarness, self).__init__()
     self.input_set = PinCellInput()
 def __init__(self):
     super(PlotEnergyFluxesTestHarness, self).__init__()
     self.input_set = PinCellInput()
Example #10
0
 def __init__(self):
     super(SectorTestHarness, self).__init__()
     self.input_set = PinCellInput()
 def __init__(self):
     super(MultiSimSimpleTestHarness, self).__init__()
     self.input_set = PinCellInput()
Example #12
0
 def __init__(self):
     super(PlotQuadratureTestHarness, self).__init__()
     self.input_set = PinCellInput()