Ejemplo n.º 1
0
    def constrain_pbar(self, dcid, pid, name, rtype, eltype, allow_C, allow_T):
        """Add constraints to all stress recovery points of a bar property.

        Parameters
        ----------
        dcid : int
            Design constraint set identification number.
        pid : int
            Property id.
        name : str or list
            The name of the constraint.
        rtype : str
            The type of response. For bar elements it is usually `'STRESS'`.
        eltype : str
            The section type: `'RECT'`, `'CIRCLE'`, etc.
        allow_C : float
            The allowable for compression.
        allow_T : float
            The allowable for tension.

        """
        if not isinstance(name, Iterable):
            name = [name]
        if rtype.upper() == 'STRESS':
            label = 'minmaxS'
        region = ''
        lid_lb_ub = []
        lid_lb_ub.append('ALL')
        lid_lb_ub.append(allow_C)
        lid_lb_ub.append(allow_T)

        self.dcids.add(dcid)

        for namei in name:
            if 'Axial' in namei:
                cons_names = ['End A-Point C',
                              'End A-Point D',
                              'End A-Point E',
                              'End A-Point F',
                              'End B-Point C',
                              'End B-Point D',
                              'End B-Point E',
                              'End B-Point F']
            ptype = 'PBARL'
            for i in range(len(cons_names)):
                name = cons_names[i]
                atta = get_output_code(rtype, eltype, name)
                output_name = OUTC[rtype][eltype][atta]

                stress_type = 'positive'
                if output_name.find('Minor') > -1:
                    stress_type = 'negative'
                elif output_name.find('Normal') > -1:
                    stress_type = 'both'

                dresp1 = DRESP1(label, rtype, ptype, region, atta, pid)
                dconstr = DCONSTR(dcid, dresp1.id, lid_lb_ub, stress_type)
                self.dresps[dresp1.id] = dresp1
                self.dconstrs[dconstr.id] = dconstr
Ejemplo n.º 2
0
    def constrain_pcomp(self, dcid, pid, eltype, rtype, names, lallow=None,
            uallow=None):
        """Add constraints to the bottom and top faces of a pcomp property.

        Parameters
        ----------
        dcid : int
            Design constraint set identification number.
        pid : int
            Property id.
        eltype : str
            Element type ('CQUAD4', 'CTRIA3', etc).
        rtype : str
            The type of response. For shells it is usually `'STRESS'`.
        names : str or list of strings
            The name of the constraint, as in the quick reference guide,
            reproduced in module :mod:`.atd.sol200.output_codes`.
        lallow : float or None, optional
            Lower bound on the response quantity.
        uallow : float or None, optional
            Upper bound on the response quantity.

        """
        ptype = 'PCOMP'
        region = ''
        if lallow is None:
            lallow = ''
        if uallow is None:
            uallow = ''

        if not isinstance(names, (list, tuple)):
            names = [names]

        self.dcids.add(dcid)
        for name in names:
            atta = get_output_code(rtype, eltype, name)
            dresp1 = DRESP1(name[:8], rtype, ptype, region, atta, pid)
            dconstr = DCONSTR(dcid, dresp1.id, lallow, uallow)
            self.dresps[dresp1.id] = dresp1
            self.dconstrs[dconstr.id] = dconstr
Ejemplo n.º 3
0
    def constrain_pbar(self, pid, name, rtype, eltype, allow_C, allow_T):
        """Add constraints to all stress recovery points of a bar property.

        Parameters
        ----------
        pid : int
            Property id.
        name : str or list
            The name of the constraint, as described in :mod:`.output_codes`,
            with only the prefix (`'Shear'`, `'Normal'`, etc).
        rtype : str
            The type of response. For bar elements it is usually `'STRESS'`.
        eltype : str
            The section type: `'RECT'`, `'CIRCLE'`, etc.
        allow_C : float
            The allowable for compression.
        allow_T : float
            The allowable for tension.

        """
        if not isinstance(name, Iterable):
            name = [name]
        if rtype.upper() == 'STRESS':
            label = 'minmaxS'
        region = ''
        lid_lb_ub = []
        lid_lb_ub.append('ALL')
        lid_lb_ub.append(allow_C)
        lid_lb_ub.append(allow_T)


        for namei in name:
            if 'Normal X' in namei:
                cons_names = ['Normal X Point 1 at end A',
                              'Normal X Point 2 at end A',
                              'Normal X Point 3 at end A',
                              'Normal X Point 4 at end A',
                              'Normal X Point 9 at end B',
                              'Normal X Point 10 at end B',
                              'Normal X Point 11 at end B',
                              'Normal X Point 12 at end B']
            elif 'Shear' in namei:
                cons_names = ['Shear XZ Point 5 at end A',
                              'Shear XY Point 6 at end A',
                              'Shear XZ Point 7 at end A',
                              'Shear XY Point 8 at end A',
                              'Shear XZ Point 13 at end B',
                              'Shear XY Point 14 at end B',
                              'Shear XZ Point 15 at end B',
                              'Shear XY Point 16 at end B']
            ptype = 'PBARL'
            for i in range(len(cons_names)):
                name = cons_names[i]
                atta = get_output_code(rtype, eltype, name)
                output_name = OUTC[rtype][eltype][atta]

                stress_type = 'positive'
                if output_name.find('Minor') > -1:
                    stress_type = 'negative'
                elif output_name.find('Normal') > -1:
                    stress_type = 'both'
                else:
                    #TODO perhaps we need a shear allowable
                    if output_name.upper().find('SHEAR') > -1:
                        stress_type = 'positive'
                        lid_lb_ub[1] = lid_lb_ub[1] / 2.
                        lid_lb_ub[2] = lid_lb_ub[2] / 2.

                dresp1 = DRESP1(label, rtype, ptype, region, atta, pid)
                dcons = DCONS(dresp1.id, lid_lb_ub, stress_type)
                self.dresps[dresp1.id] = dresp1
                self.dcons[dresp1.id] = dcons
Ejemplo n.º 4
0
    def constrain_pshell(self, pid, cname, rtype, allow_C, allow_T):
        """Add constraints to the bottom and top faces of a shell property.

        Parameters
        ----------
        pid : int
            Property id.
        cname : str or list
            The name of the constraint, as described in :mod:`.output_codes`,
            without the sufix `'Bottom'`  or `'Top'`.
        rtype : str
            The type of response. For shells it is usually `'STRESS'`.
        allow_C : float
            The allowable for compression.
        allow_T : float
            The allowable for tension.

        """
        if rtype.upper() == 'STRESS':
            label = 'minmaxS'
        ptype = 'PSHELL'
        eltype = 'SOLID'
        region = ''
        lid_lb_ub = []
        lid_lb_ub.append('ALL')
        lid_lb_ub.append(allow_C)
        lid_lb_ub.append(allow_T)

        if not isinstance(cname, Iterable):
            cname = [cname]

        for name in cname:
            name = name.strip()

            # Bottom Face
            namebot = name + ' Bottom'
            atta = get_output_code(rtype, eltype, namebot)
            output_name = OUTC[rtype][eltype][atta]

            stress_type = 'positive'
            if output_name.find('Minor') > -1:
                stress_type = 'negative'
            elif output_name.find('Normal') > -1:
                stress_type = 'both'
            else:
                #TODO perhaps we need a shear allowable
                if output_name.upper().find('SHEAR') > -1:
                    stress_type = 'positive'
                    lid_lb_ub[1] = lid_lb_ub[1] / 2.
                    lid_lb_ub[2] = lid_lb_ub[2] / 2.

            dresp1 = DRESP1(label, rtype, ptype, region, atta, pid)
            dcons = DCONS(dresp1.id, lid_lb_ub, stress_type)
            self.dresps[dresp1.id] = dresp1
            self.dcons[dresp1.id] = dcons

            # Top Face
            nametop = name + ' Top'
            atta = get_output_code(rtype, eltype, nametop)
            output_name = OUTC[rtype][eltype][atta]

            stress_type = 'positive'
            if output_name.find('Minor') > -1:
                stress_type = 'negative'
            elif output_name.find('Normal') > -1:
                stress_type = 'both'
            else:
                #TODO perhaps we need a shear allowable
                if output_name.upper().find('SHEAR') > -1:
                    stress_type = 'positive'
                    lid_lb_ub[1] = lid_lb_ub[1] / 2.
                    lid_lb_ub[2] = lid_lb_ub[2] / 2.

            region = ''
            dresp1 = DRESP1(label, rtype, ptype, region, atta, pid)
            dcons = DCONS(dresp1.id, lid_lb_ub, stress_type)
            self.dresps[dresp1.id] = dresp1
            self.dcons[dresp1.id] = dcons