Ejemplo n.º 1
0
    def compute(self, name):
        if name == 'cp_prim':
            theta1 = {
                'rgt': -1 / 4.0,
                'top': 1 / 4.0,
                'lft': 3 / 4.0,
                'bot': 5 / 4.0,
            }
            theta2 = {
                'rgt': 1 / 4.0,
                'top': 3 / 4.0,
                'lft': 5 / 4.0,
                'bot': 7 / 4.0,
            }

            flt = self.props['flt'].vec_data['prop']
            for fname in self.faces:
                face = self.faces[fname]
                num_u = face._num_cp_total['u']
                num_v = face._num_cp_total['v']
                self._shapes[fname][:,:,:] \
                    = PGMlib.computeshape(num_u, num_v,
                                          theta1[fname], theta2[fname],
                                          numpy.ones((num_v, 3),
                                                     order='F'),
                                          flt, numpy.zeros((num_u, num_v),
                                                           order='F'))

        return super(PGMbody, self).compute(name)
Ejemplo n.º 2
0
    def compute(self, name):
        if name == 'cp_prim':
            theta1 = {'rgt': -1/4.0, 
                      'top': 1/4.0,
                      'lft': 3/4.0,
                      'bot': 5/4.0,
            }
            theta2 = {'rgt': 1/4.0, 
                      'top': 3/4.0,
                      'lft': 5/4.0,
                      'bot': 7/4.0,
            }

            flt = self.props['flt'].vec_data['prop']
            for fname in self.faces:
                face = self.faces[fname]
                num_u = face._num_cp_total['u']
                num_v = face._num_cp_total['v']
                self._shapes[fname][:,:,:] \
                    = PGMlib.computeshape(num_u, num_v, 
                                          theta1[fname], theta2[fname],
                                          numpy.ones((num_v, 3),
                                                     order='F'), 
                                          flt)

        return super(PGMbody, self).compute(name)
Ejemplo n.º 3
0
    def computeQs(self):
        nx = self.Qs[0].shape[1]
        ny = self.Qs[0].shape[0]
        nz = self.Qs[1].shape[0]
        v = self.variables
        b = self.bottom==2

        #v['pos'][0] = 2*v['pos'][1] - v['pos'][2]
        #v['pos'][-1] = 2*v['pos'][-2] - v['pos'][-3]

        shapes = range(4)
        shapes[0] = PGMlib.computeshape(ny, nx,-b/4.0, 1/4.0, v['flt'], v['shR'])
        shapes[1] = PGMlib.computeshape(nz, nx, 1/4.0, 3/4.0, v['flt'], v['shT'])
        shapes[2] = PGMlib.computeshape(ny, nx, 3/4.0, (4+b)/4.0, v['flt'], v['shL'])
        shapes[3] = PGMlib.computeshape(nz, nx, 5/4.0, 7/4.0, v['flt'], v['shB'])

        nQ = nx*(9+6*ny+6*nz) if self.bottom==2 else nx*(9+6*ny+3*nz)
        self.computeSections(nQ, shapes)
Ejemplo n.º 4
0
    def compute(self, name):
        if name == 'cp_prim':
            theta1 = {
                'rt0': -1 / 4.0,
                'tp0': 1 / 4.0,
                'lt0': 3 / 4.0,
                'bt0': 5 / 4.0,
                'rt1': 1 / 4.0,
                'tp1': 3 / 4.0,
                'lt1': 5 / 4.0,
                'bt1': 7 / 4.0,
            }
            theta2 = {
                'rt0': 1 / 4.0,
                'tp0': 3 / 4.0,
                'lt0': 5 / 4.0,
                'bt0': 7 / 4.0,
                'rt1': -1 / 4.0,
                'tp1': 1 / 4.0,
                'lt1': 3 / 4.0,
                'bt1': 5 / 4.0,
            }

            flt = self.props['flt'].vec_data['prop']
            thk = self.props['thk'].vec_data['prop']
            for fname in self.faces:
                face = self.faces[fname]
                num_u = face._num_cp_total['u']
                num_v = face._num_cp_total['v']
                if fname[2] == '0':
                    sgn = 1.0
                elif fname[2] == '1':
                    sgn = -1.0
                self._shapes[fname][:,:,:] \
                    = PGMlib.computeshape(num_u, num_v,
                                          theta1[fname], theta2[fname],
                                          numpy.ones((num_v, 3),
                                                     order='F') + sgn*thk/2.0,
                                          flt, numpy.zeros((num_u, num_v),
                                                           order='F'))
            output = super(PGMshell, self).compute(name)

            for fname in ['rt', 'tp', 'lt', 'bt']:
                for ind in range(2):
                    outer = self.faces[fname +
                                       '0'].vec_data['cp_prim'][:, -ind, :]
                    inner = self.faces[fname +
                                       '1'].vec_data['cp_prim'][::-1, -ind, :]
                    outer[:, :] = 0.5 * (outer + inner)
                    inner[:, :] = outer[:, :]

            return output

        else:
            return super(PGMshell, self).compute(name)
Ejemplo n.º 5
0
    def compute(self, name):
        if name == 'cp_prim':
            theta1 = {'rt0': -1/4.0,
                      'tp0': 1/4.0,
                      'lt0': 3/4.0,
                      'bt0': 5/4.0,
                      'rt1': 1/4.0,
                      'tp1': 3/4.0,
                      'lt1': 5/4.0,
                      'bt1': 7/4.0,
            }
            theta2 = {'rt0': 1/4.0,
                      'tp0': 3/4.0,
                      'lt0': 5/4.0,
                      'bt0': 7/4.0,
                      'rt1': -1/4.0,
                      'tp1': 1/4.0,
                      'lt1': 3/4.0,
                      'bt1': 5/4.0,
            }

            flt = self.props['flt'].vec_data['prop']
            thk = self.props['thk'].vec_data['prop']
            for fname in self.faces:
                face = self.faces[fname]
                num_u = face._num_cp_total['u']
                num_v = face._num_cp_total['v']
                if fname[2] == '0':
                    sgn = 1.0
                elif fname[2] == '1':
                    sgn = -1.0
                self._shapes[fname][:,:,:] \
                    = PGMlib.computeshape(num_u, num_v, 
                                          theta1[fname], theta2[fname],
                                          numpy.ones((num_v, 3),
                                                     order='F') + sgn*thk/2.0, 
                                          flt, numpy.zeros((num_u, num_v),
                                                           order='F'))
            output = super(PGMshell, self).compute(name)

            for fname in ['rt', 'tp', 'lt', 'bt']:
                for ind in range(2):
                    outer = self.faces[fname+'0'].vec_data['cp_prim'][:, -ind, :]
                    inner = self.faces[fname+'1'].vec_data['cp_prim'][::-1, -ind, :]
                    outer[:, :] = 0.5 * (outer + inner)
                    inner[:, :] = outer[:, :]

            return output

        else:
            return super(PGMshell, self).compute(name)
Ejemplo n.º 6
0
    def compute(self, name):
        # print name
        if name == 'cp_prim':

            #x = 0.22 # 0.16 (small) <-> 0.25 (ini)

            x_top = 0.18
            x_bot = 0.22  #0.1 # 0.0 <-> 0.5

            theta1 = {
                'rgt': -x_bot,  #-1/6.0, # -0.5 + x,
                'top': x_top,  #1/6.0, # 1/3.0,
                'lft': 1.0 - x_top,  #5/6.0, # 2/3.0,
                'bot': 1.0 + x_bot,  #7/6.0, # 1.5 - x,
            }
            theta2 = {
                'rgt': x_top,  #1/6.0, # 1/3.0, 
                'top': 1.0 - x_top,  #5/6.0, # 2/3.0,
                'lft': 1.0 + x_bot,  #7/6.0, # 1.5 - x,
                'bot': 2.0 - x_bot,  #11/6.0, # 1.5 + x,
            }

            # theta1 = {'rgt': -1/4.0,
            #           'top': 1/4.0,
            #           'lft': 3/4.0,
            #           'bot': 5/4.0,
            # }
            # theta2 = {'rgt': 1/4.0,
            #           'top': 3/4.0,
            #           'lft': 5/4.0,
            #           'bot': 7/4.0,
            # }

            flt = self.props['flt'].vec_data['prop']
            for fname in self.faces:
                # print fname
                face = self.faces[fname]
                num_u = face._num_cp_total['u']
                num_v = face._num_cp_total['v']
                self._shapes[fname][:,:,:] \
                    = PGMlib.computeshape(num_u, num_v,
                                          theta1[fname], theta2[fname],
                                          numpy.ones((num_v, 3),
                                                     order='F'),
                                          flt)

        return super(PGMbody, self).compute(name)
Ejemplo n.º 7
0
    def computeQs(self):
        nx = self.Qs[0].shape[1]
        ny = self.Qs[0].shape[0]
        nz = self.Qs[1].shape[0]
        v = self.variables
        b = self.bottom==2

        r0 = v['scl'] + v['thk']/2.0
        r1 = v['scl'] - v['thk']/2.0

        shapes = range(8)
        shapes[0] = PGMlib.computeshape(ny, nx,-b/4.0, 1/4.0, v['flt'], v['sR0'])
        shapes[1] = PGMlib.computeshape(nz, nx, 1/4.0, 3/4.0, v['flt'], v['sT0'])
        shapes[2] = PGMlib.computeshape(ny, nx, 3/4.0, (4+b)/4.0, v['flt'], v['sL0'])
        shapes[6] = PGMlib.computeshape(nz, nx, 5/4.0, 7/4.0, v['flt'], v['sB0'])
        shapes[5] = PGMlib.computeshape(ny, nx, 1/4.0,-b/4.0, v['flt'], v['sR1'])
        shapes[4] = PGMlib.computeshape(nz, nx, 3/4.0, 1/4.0, v['flt'], v['sT1'])
        shapes[3] = PGMlib.computeshape(ny, nx, (4+b)/4.0, 3/4.0, v['flt'], v['sL1'])
        shapes[7] = PGMlib.computeshape(nz, nx, 7/4.0, 5/4.0, v['flt'], v['sB1'])
        
        nQ = nx*(9+12*ny+12*nz) if self.bottom==2 else nx*(9+12*ny+6*nz)
        radii = [r0,r0,r0,r1,r1,r1,r0,r1]
        self.computeSections(nQ, shapes, radii=radii)