Example #1
0
    def createMesh(self):
        '''Create BoundedMesh objects.
        '''
        from ExchangerLib import createGlobalBoundedBox, exchangeBoundedBox, createBoundary, createEmptyInterior
        inv = self.inventory

        # the bounding box of the mesh on this solver
        self.globalBBox = createGlobalBoundedBox(self.all_variables)

        # the bounding box of the mesh on the other solver
        mycomm = self.communicator
        self.remoteBBox = exchangeBoundedBox(self.globalBBox, mycomm.handle(),
                                             self.sinkComm.handle(), 0)

        # the nodes on the boundary, top and bottom boundaries are special
        self.boundary, self.myBBox = createBoundary(self.all_variables,
                                                    inv.exclude_top,
                                                    inv.exclude_bottom)

        # an empty interior object, which will be filled by a remote interior obj.
        if inv.two_way_communication:
            self.remoteIntrList = range(self.remoteSize)
            for i in range(self.remoteSize):
                self.remoteIntrList[i] = createEmptyInterior()

        return
Example #2
0
    def createMesh(self):
        '''Create BoundedMesh objects.
        '''
        from ExchangerLib import createGlobalBoundedBox, exchangeBoundedBox, createBoundary, createEmptyInterior
        inv = self.inventory

        # the bounding box of the mesh on this solver
        self.globalBBox = createGlobalBoundedBox(self.all_variables)

        # the bounding box of the mesh on the other solver
        mycomm = self.communicator
        self.remoteBBox = exchangeBoundedBox(self.globalBBox,
                                             mycomm.handle(),
                                             self.sinkComm.handle(),
                                             0)

        # the nodes on the boundary, top and bottom boundaries are special
        self.boundary, self.myBBox = createBoundary(self.all_variables,
                                                    inv.exclude_top,
                                                    inv.exclude_bottom)

        # an empty interior object, which will be filled by a remote interior obj.
        if inv.two_way_communication:
            self.remoteIntrList = range(self.remoteSize)
            for i in range(self.remoteSize):
                self.remoteIntrList[i] = createEmptyInterior()

        return
Example #3
0
    def exchangeTemperature(self):
        if not self.inventory.exchange_initial_temperature:
            return

        from ExchangerLib import createEmptyInterior, CitcomSource_create
        interior = range(self.remoteSize)
        source = range(self.remoteSize)

        for i in range(len(interior)):
            interior[i] = createEmptyInterior()

        for i, comm, b in zip(range(self.remoteSize), self.srcCommList,
                              interior):
            # sink is always in the last rank of a communicator
            sinkRank = comm.size - 1
            source[i] = CitcomSource_create(comm.handle(), sinkRank, b,
                                            self.myBBox, self.all_variables)

        import Outlet
        for i, src in zip(range(self.remoteSize), source):
            outlet = Outlet.TOutlet(src, self.all_variables)
            outlet.send()

        # Any modification of read-in temperature is done here
        # Note: modifyT is called after sending unmodified T to EmbeddedCoupler.
        # If T is modified before sending, EmbeddedCoupler's T will lose sharp
        # feature.
        # EmbeddedCoupler has to call modifyT too to ensure consistent T field.
        #self.modifyT(self.remoteBBox)

        return