Exemple #1
0
 def _child_cells(self):
     """get all the child cells within the current cell,
      defined by the miniribs
     """
     cells = []
     for leftrib, rightrib in\
             itertools.izip(self.rib_profiles_3d[:-1], self.rib_profiles_3d[1:]):
         cells.append(BasicCell(leftrib, rightrib))
     if not self._miniribs:
         return cells
     ballooning = [self.rib1.ballooning[x] + self.rib2.ballooning[x] for x in self.x_values]
     #for i in range(len(first.data)):
     for index, (bl, left_point, right_point) in enumerate(itertools.izip(
         ballooning, self._ribs[0].profile_3d.data, self._ribs[1].profile_3d.data
     )):
         l = norm(right_point - left_point)  # L
         lnew = sum([norm(c.prof1.data[index] - c.prof2.data[index]) for c in cells])  # L-NEW
         for c in self._child_cells:
             newval = lnew / l / bl
             if newval < 1.:
                 c.ballooning_phi.append(arsinc(newval))  # B/L NEW 1 / (bl * l / lnew)
             else:
                 c.ballooning_phi.append(arsinc(1.))
                 #raise ValueError("mull")
     return cells
Exemple #2
0
    def recalc(self):
        if not self.rib2.profile_2d.numpoints == self.rib1.profile_2d.numpoints:
            raise ValueError("Unequal length of Cell-Profiles")
        xvalues = self.rib1.profile_2d.x_values
        BasicCell.recalc(self)
        self.prof1 = self.rib1.profile_3d
        self.prof2 = self.rib2.profile_3d
        #Map Ballooning

        if not self.miniribs:  # In case there is no midrib, The Cell represents itself!
            self._cells = [self]  # The cell itself is its cell, clear?
            self._yvalues = [0, 1]
        else:
            self._cells = []
            self._yvalues = [0] + [rib.y_value for rib in self.miniribs] + [1]
            ballooning = [self.rib1.ballooning[x] + self.rib2.ballooning[x] for x in xvalues]
            miniribs = sorted(self.miniribs, key=lambda rib: rib.y_value)  # sort for cell-wide (y) argument.

            first = self.rib1.profile_3d
            for minirib in miniribs:
                big = self.midrib_basic_cell(minirib.y_value, True).data
                small = self.midrib_basic_cell(minirib.y_value, False).data
                points = []

                for i in range(len(big)):  # Calculate Rib
                    fakt = minirib.function(xvalues[i])  # factor ballooned/unb. (0-1)
                    point = small[i] + fakt * (big[i] - small[i])
                    points.append(point)

                minirib.data = points
                second = minirib
                self._cells.append(BasicCell(first, second, []))  # leave ballooning empty
                first = second
            #Last Sub-Cell
            self._cells.append(BasicCell(first, self.rib2.profile_3d, []))

            # Calculate ballooning for each x-value
            # Hamilton Principle:
            #       http://en.wikipedia.org/wiki/Hamilton%27s_principle
            #       http://en.wikipedia.org/wiki/Hamilton%E2%80%93Jacobi_equation
            # b' = b
            # f' = f*(l/l') [f=b/l]
            for i in range(len(first.data)):
                bl = ballooning[i] + 1  # b/l -> *l/lnew
                l = norm(self.rib2.profile_3d.data[i] - self.rib1.profile_3d.data[i])  # L
                lnew = sum([norm(c.prof1.data[i] - c.prof2.data[i]) for c in self._cells])  # L-NEW
                for c in self._cells:
                    newval = lnew / l / bl
                    if newval < 1.:
                        c.ballooning_phi.append(arsinc(newval))  # B/L NEW 1 / (bl * l / lnew)
                    else:
                        c.ballooning_phi.append(arsinc(1.))
                        #raise ValueError("mull")
            for cell in self._cells:
                cell.recalc()
Exemple #3
0
 def ballooning_phi(self):
     x_values = self.rib1.profile_2d.x_values
     balloon = [self.rib1.ballooning[i] + self.rib2.ballooning[i] for i in x_values]
     return HashedList([arsinc(1. / (1+bal)) for bal in balloon])
Exemple #4
0
 def ballooning_phi(self):
     x_values = self.rib1.profile_2d.x_values
     balloon = [self.rib1.ballooning[i] + self.rib2.ballooning[i] for i in x_values]
     return HashedList([arsinc(1. / (1+bal)) for bal in balloon])