예제 #1
0
class Sphere(ShapedComponent):
    """A spherical component."""

    is3D = True

    THERMAL_EXPANSION_DIMS = {}

    # Just usurp the Circle parameters. This may lead to issues at some point in things like the DB
    # interface, but for now, they are the same params, so why not?
    pDefs = componentParameters.getCircleParameterDefinitions()

    def __init__(
        self,
        name,
        material,
        Tinput,
        Thot,
        od=None,
        id=None,
        mult=None,
        modArea=None,
        isotopics=None,
        mergeWith=None,
        components=None,
    ):
        ShapedComponent.__init__(
            self,
            name,
            material,
            Tinput,
            Thot,
            isotopics=isotopics,
            mergeWith=mergeWith,
            components=components,
        )
        self._linkAndStoreDimensions(components,
                                     od=od,
                                     id=id,
                                     mult=mult,
                                     modArea=modArea)

    def getBoundingCircleOuterDiameter(self, Tc=None, cold=False):
        """Abstract bounding circle method that should be overwritten by each shape subclass."""
        return self.getDimension("od")

    def getComponentArea(self, cold=False):
        """Compute an average area over the height"""
        from armi.reactor.blocks import Block  # avoid circular import

        block = self.getAncestor(lambda c: isinstance(c, Block))
        return self.getComponentVolume(cold) / block.getHeight()
        # raise NotImplementedError("Cannot compute area of a sphere component.")

    def getComponentVolume(self, cold=False):
        """Computes the volume of the sphere in cm^3."""
        od = self.getDimension("od", cold=cold)
        iD = self.getDimension("id", cold=cold)
        mult = self.getDimension("mult")
        vol = mult * 4.0 / 3.0 * math.pi * ((od / 2.0)**3 - (iD / 2.0)**3)
        return vol
예제 #2
0
class Circle(ShapedComponent):
    """A Circle."""

    is3D = False

    THERMAL_EXPANSION_DIMS = {"od", "id"}

    pDefs = componentParameters.getCircleParameterDefinitions()

    def __init__(
        self,
        name,
        material,
        Tinput,
        Thot,
        od,
        id=0.0,
        mult=1.0,
        modArea=None,
        isotopics=None,
        mergeWith=None,
        components=None,
    ):
        ShapedComponent.__init__(
            self,
            name,
            material,
            Tinput,
            Thot,
            isotopics=isotopics,
            mergeWith=mergeWith,
            components=components,
        )
        self._linkAndStoreDimensions(components,
                                     od=od,
                                     id=id,
                                     mult=mult,
                                     modArea=modArea)

    def getBoundingCircleOuterDiameter(self, Tc=None, cold=False):
        return max(self.getDimension("id", Tc, cold),
                   self.getDimension("od", Tc, cold))

    def getComponentArea(self, cold=False):
        """Computes the area for the circle component in cm^2."""
        idiam = self.getDimension("id", cold=cold)
        od = self.getDimension("od", cold=cold)
        mult = self.getDimension("mult", cold=cold)
        area = math.pi * (od**2 - idiam**2) / 4.0
        area *= mult
        return area

    def isEncapsulatedBy(self, other):
        """Return True if this ring lies completely inside the argument component"""
        otherID, otherOD = other.getDimension("id"), other.getDimension("od")
        myID, myOD = self.getDimension("id"), self.getDimension("od")
        return otherID <= myID < otherOD and otherID < myOD <= otherOD
예제 #3
0
class Sphere(ShapedComponent):
    """A spherical component."""

    is3D = True

    THERMAL_EXPANSION_DIMS = {}

    # Just usurp the Circle parameters. This may lead to issues at some point in things like the DB
    # interface, but for now, they are the same params, so why not?
    pDefs = componentParameters.getCircleParameterDefinitions()

    def __init__(
        self,
        name,
        material,
        Tinput,
        Thot,
        od=None,
        id=None,
        mult=None,
        modArea=None,
        isotopics=None,
        mergeWith=None,
        components=None,
    ):
        ShapedComponent.__init__(
            self,
            name,
            material,
            Tinput,
            Thot,
            isotopics=isotopics,
            mergeWith=mergeWith,
            components=components,
        )
        self._linkAndStoreDimensions(components,
                                     od=od,
                                     id=id,
                                     mult=mult,
                                     modArea=modArea)
        self.setVolume(self.getVolume())

    def getComponentArea(self, cold=False):
        raise NotImplementedError("Cannot compute area of a sphere component.")

    def getComponentVolume(self):
        """Computes the volume of the sphere in cm^3."""
        od = self.getDimension("od")
        iD = self.getDimension("id")
        mult = self.getDimension("mult")
        vol = mult * 4.0 / 3.0 * math.pi * ((od / 2.0)**3 - (iD / 2.0)**3)
        return vol