示例#1
0
    def add(self, eid, pid, nids, dofs, comment=''):
        """
        Creates a CDAMP1 card

        Parameters
        ----------
        eid : int
            element id
        pid : int
            property id (PELAS)
        nids : List[int]
            GRID/SPOINT ids; n=2
        dofs : List[int]
            node ids; n=2
        comment : str; default=''
            a comment for the card
        """
        self.model.solids.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        self._dofs.append(dofs)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#2
0
    def add(self, eid, nid, mass, cid=0, X=None, I=None, comment=''):
        """
        Creates a CONM2 card

        Parameters
        ----------
        eid : int
           element id
        nid : int
           node id
        mass : float
           the mass of the CONM2
        cid : int; default=0
           coordinate frame of the offset (-1=absolute coordinates)
        X : (3, ) List[float]; default=None -> [0., 0., 0.]
            xyz offset vector relative to nid
        I : (6, ) List[float]; default=None -> [0., 0., 0., 0., 0., 0.]
            mass moment of inertia matrix about the CG
            I11, I21, I22, I31, I32, I33 = I
        comment : str; default=''
            a comment for the card
        """
        self.model.rods.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._nid.append(nid)
        self._cid.append(cid)
        self._x.append(X)
        self._I.append(I)
        self._mass.append(mass)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#3
0
    def add(self, eid, mid, nids, A=0., j=0., c=0., nsm=0., comment=''):
        """
        Creates a CONROD card

        Parameters
        ----------
        eid : int
            element id
        mid : int
            material id
        nids : List[int, int]
            node ids
        A : float
            area
        j : float; default=0.
            polar moment of inertia
        c : float; default=0.
            stress factor
        nsm : float; default=0.
            non-structural mass per unit length
        comment : str; default=''
            a comment for the card
        """
        self.model.rods.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._nids.append(nids)
        self._mid.append(mid)
        self._A.append(A)
        self._j.append(j)
        self._c.append(c)
        self._nsm.append(nsm)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#4
0
    def add(self, eid, b, nids, dofs, comment=''):
        """
        Creates a CELAS1 card

        Parameters
        ----------
        eid : int
            element id
        b : float
            spring damping
        nids : List[int]
            GRID/SPOINT ids; n=2
        dofs : List[int]
            node ids; n=2
        ge : float
            ???
        s : float
            ???
        comment : str; default=''
            a comment for the card
        """
        self.model.solids.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._b.append(b)
        self._nids.append(nids)
        self._dofs.append(dofs)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#5
0
    def add(self, nid, xyz, cp=0, cd=0, ps='', seid=0, comment=''):
        # type: (int, Union[None, List[float], np.ndarray], int, int, str, int, str) -> None
        """
        Creates the GRID card

        Parameters
        ----------
        nid : int
            node id
        cp : int; default=0
            the xyz coordinate frame
        xyz : (3, ) float ndarray; default=None -> [0., 0., 0.]
            the xyz/r-theta-z/rho-theta-phi values
        cd : int; default=0
            the analysis coordinate frame
        ps : str; default=''
            Additional SPCs in the analysis coordinate frame (e.g. '123').
            This corresponds to DOF set ``SG``.
        seid : int; default=0
            superelement id
            TODO: how is this used by Nastran???
        comment : str; default=''
            a comment for the card
        """
        self.is_current = False
        self._nid.append(nid)
        self._xyz.append(xyz)
        self._cp.append(cp)
        self._cd.append(cd)
        self._ps.append(ps)
        self._seid.append(seid)
        if comment:
            self.comment[nid] = _format_comment(comment)
示例#6
0
    def add(self,
            eid,
            pid,
            nids,
            x,
            g0,
            offt='GGG',
            pin_flags=None,
            wa=None,
            wb=None,
            comment=''):
        """
        Adds a CBAR card

        Parameters
        ----------
        pid : int
            property id
        mid : int
            material id
        nids : List[int, int]
            node ids; connected grid points at ends A and B
        x : List[float, float, float]
            Components of orientation vector, from GA, in the displacement
            coordinate system at GA (default), or in the basic coordinate system
        g0 : int
            Alternate method to supply the orientation vector using grid
            point G0. Direction of is from GA to G0. is then transferred
            to End A
        offt : str; default='GGG'
            Offset vector interpretation flag
        pin_flags : List[int, int]; default=None
            None : [0, 0]; don't release the DOFs
            Pin Flag at End A/B.  Releases the specified DOFs
        wa / wb : List[float, float, float]
            Components of offset vectors from the grid points to the end
            points of the axis of the shear center
        comment : str; default=''
            a comment for the card
        """
        self.model.bars.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        if g0 is None:
            g0 = 0
        self._x.append(x)
        self._g0.append(g0)
        self._offt.append(offt)
        if pin_flags is None:
            pin_flags = [0, 0]
        self._pin_flags.append(pin_flags)
        self._wa_offset.append(wa)
        self._wb_offset.append(wb)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#7
0
    def add(self,
            sid,
            eid,
            pressures,
            g1,
            g34,
            cid=0,
            nvector=None,
            surf_or_line='SURF',
            line_load_dir='NORM',
            comment=''):
        """
        Creates a PLOAD4 card

        Parameters
        ----------
        sid : int
            the load id
        eids : List[int, ...]
            shells : the range of element ids; must be sequential
            solids : must be length 1
        pressures : List[float, float, float, float]
            tri : must be length 4 (the last value should be the same as the 0th value)
            quad : must be length 4
        g1 : int/None
            only used for solid elements
        g34 : int / None
            only used for solid elements
        cid : int; default=0
            the coordinate system for ???
        nvector : (3, ) float ndarray
           blank : load acts normal to the face
           the local pressure vector
        surf_or_line : str; default='SURF'
           SURF : surface load
           LINE : line load    (only defined for QUADR, TRIAR)
           not supported
        line_load_dir : str; default='NORM'
           direction of the line load (see surf_or_line); {X, Y, Z, TANG, NORM}
           not supported
        comment : str; default=''
            a comment for the card

        TODO: fix the way "pressures" works
        """
        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid.append(sid)
        self._eid.append(eid)
        self._cid.append(cid)
        self._pressures.append(pressures)
        self._g1.append(g1)
        self._g34.append(g34)
        self._nvector.append(nvector)
        self._surf_or_line.append(surf_or_line)
        self._line_load_dir.append(line_load_dir)
示例#8
0
文件: bush.py 项目: ratalex/pyNastran
    def add(self, eid, pid, nids, x, g0, cid=None, s=0.5, ocid=-1, si=None, comment=''):
        """
        Creates a CBUSH card

        Parameters
        ----------
        eid : int
            Element id
        pid : int
            Property id (PBUSH)
        nids : List[int, int]
            node ids; connected grid points at ends A and B
            The nodes may be coincident, but then cid is required.
        x : List[float, float, float]; None
            List : the directional vector used to define the stiffnesses
                   or damping from the PBUSH card
            None : use g0
        g0 : int/None
            int : the directional vector used to define the stiffnesses
                  or damping from the PBUSH card
            None : use x
        cid : int; default=None
            Element coordinate system identification. A 0 means the basic
            coordinate system. If CID is blank, then the element coordinate
            system is determined from GO or Xi.
        s: float; default=0.5
            Location of spring damper (0 <= s <= 1.0)
        ocid : int; default=-1
            Coordinate system identification of spring-damper offset.
            (Integer > -1; Default = -1, which means the offset
            point lies on the line between GA and GB)
        si : List[float, float, float]; default=None
            Components of spring-damper offset in the OCID coordinate system
            if OCID > 0.
            None : [None, None, None]
        comment : str; default=''
            a comment for the card
        """
        if cid is None:
            cid = -1
        self.model.bushes.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        self._cid.append(cid)
        self._ocid.append(ocid)
        self._s.append(s)
        self._si.append(si)
        #self._nsm.append(nsm)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#9
0
    def add(self, sid, temperatures, comment=''):
        """
        Creates an TEMPD card

        Parameters
        ----------
        sid : List[int]
            constraint ids
        temperatures : List[float]
            the nodal temperature
        """
        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid += sid
        self._temperatures += temperatures
示例#10
0
    def add(self,
            sid,
            eid,
            load_type,
            scale,
            x1,
            p1,
            x2=None,
            p2=None,
            comment=''):
        """
        Creates a PLOAD1 card, which may be applied to a CBAR/CBEAM

        Parameters
        ----------
        sid : int
            load id
        eid : int
            element to apply the load to
        load_type : str
            type of load that's applied
            valid_types = {FX, FY, FZ, FXE, FYE, FZE,
                           MX, MY, MZ, MXE, MYE, MZE}
        scale : float
            local pressure scaling factor
        x1 / x2 : float / float
            the starting/end position for the load application
            the default for x2 is x1
        p1 / p2 : float / float
            the magnitude of the load at x1 and x2
            the default for p2 is p1
        comment : str; default=''
            a comment for the card

        Point Load       : x1 == x2
        Distributed Load : x1 != x2
        """

        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid.append(sid)
        self._eid.append(eid)
        self._scale.append(scale)
        self._load_type.append(load_type)
        self._p12.append((p1, p2))
        self._x12.append((x1, x2))
示例#11
0
    def add(self, eid, nids, comment=''):
        """
        Adds a PLOTEL card from ``BDF.add_card(...)``

        Parameters
        ----------
        card : BDFCard()
            a BDFCard object
        comment : str; default=''
            a comment for the card
        """
        self.model.bushes.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._nids.append(nids)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#12
0
    def add(self, sid, nodes, temperatures, comment=''):
        """
        Creates an TEMP card

        Parameters
        ----------
        sid : List[int]
            constraint ids
        nodes : List[int]
            GRID/SPOINT ids
        temperatures : List[float]
            the nodal temperature
        enforced : List[float]
            the constrained value for the given node (typically 0.0)
        """
        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid += sid
        self._nid += nodes
        self._temperatures += temperatures
示例#13
0
    def add(self, sid, pressure, eids, comment=''):
        """
        Creates a PLOAD2 card, which defines an applied load normal to the quad/tri face

        Parameters
        ----------
        sid : int
            load id
        pressure : float
            the pressure to apply to the elements
        eids : List[int]
            the elements to apply pressure to
            n < 6 or a continouus monotonic list of elements (e.g., [1, 2, ..., 1000])
        comment : str; default=''
            a comment for the card
        """
        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid.append(sid)
        self._pressure.append(pressure)
        self._eid.append(eids)
示例#14
0
    def add(self, eid, pid, nids, comment=''):
        """
        Creates a CTUBE card

        Parameters
        ----------
        eid : int
            element id
        pid : int
            property id
        nids : List[int, int]
            node ids
        comment : str; default=''
            a comment for the card
        """
        self.model.rods.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#15
0
    def add(self, eid, pid, nids, comment=''):
        """
        Creates a CTETRA4, CPENTA6, CHEXA8, CPYRAM5, CTETRA10, CPENTA15, CHEXA20, or CPYRAM13

        Parameters
        ----------
        eid : int
            element id
        pid : int
            property id (PSOLID, PLSOLID)
        nids : List[int]
            node ids; n=4
        comment : str; default=''
            a comment for the card
        """
        self.model.solids.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#16
0
    def add(self, eid, b, nids, comment=''):
        """
        Creates a CDAMP4 card

        Parameters
        ----------
        eid : int
            element id
        b : float
            spring damping
        nids : List[int]
            SPOINT ids; n=2
        comment : str; default=''
            a comment for the card
        """
        self.model.springs.add(eid)
        self.is_current = False
        self._eid.append(eid)
        assert isinstance(b, float), b
        self._b.append(b)
        self._nids.append(nids)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#17
0
    def add(self, eid, k, nids, comment=''):
        """
        Creates a CELAS4 card

        Parameters
        ----------
        eid : int
            element id
        k : float
            spring stiffness
        nids : List[int]
            SPOINT ids; n=2
        comment : str; default=''
            a comment for the card
        """
        self.model.springs.add(eid)
        self.is_current = False
        self._eid.append(eid)
        assert isinstance(k, float), k
        self._k.append(k)
        self._nids.append(nids)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#18
0
    def add(self, sid, pressure, nids, comment=''):
        """
        Creates a PLOAD card, which defines a uniform pressure load on a
        shell/solid face or arbitrarily defined quad/tri face.

        Parameters
        ----------
        sid : int
            load id
        pressure : float
            the pressure to apply
        nodes : List[int]
            The nodes that are used to define the normal are defined
            using the same method as the CTRIA3/CQUAD4 normal.
            n = 3 or 4
        comment : str; default=''
            a comment for the card
        """
        if comment:
            self.comment[len(self)] = _format_comment(comment)
        self.is_current = False
        self._sid.append(sid)
        self._pressure.append(pressure)
        self._nids.append(nids)
示例#19
0
 def set_comment(self, idi, new_comment):
     """sets a comment"""
     self._comments[idi] = _format_comment(new_comment)
示例#20
0
 def set_comment(self, idi, new_comment):
     """sets a comment"""
     self._comments[idi] = _format_comment(new_comment)
示例#21
0
 def comment(self, new_comment):
     """sets a comment"""
     #comment = new_comment.rstrip()
     #self._comment = comment + '\n' if comment else ''
     self._comment = _format_comment(new_comment)
示例#22
0
    def add(self,
            eid,
            pid,
            nids,
            x,
            g0,
            offt='GGG',
            bit=None,
            pin_flags=None,
            wa=None,
            wb=None,
            sa=0,
            sb=0,
            comment=''):
        """
        Adds a CBEAM card

        Parameters
        ----------
        pid : int
            property id
        mid : int
            material id
        nids : List[int, int]
            node ids; connected grid points at ends A and B
        x : List[float, float, float]
            Components of orientation vector, from GA, in the displacement
            coordinate system at GA (default), or in the basic coordinate system
        g0 : int
            Alternate method to supply the orientation vector using grid
            point G0. Direction of is from GA to G0. is then transferred
            to End A
        offt : str; default='GGG'
            Offset vector interpretation flag
            None : bit is active
        bit : float; default=None
            Built-in twist of the cross-sectional axes about the beam axis
            at end B relative to end A.
            For beam p-elements ONLY!
            None : offt is active
        pin_flags : List[int, int]; default=None
            None : [0, 0]; don't release the DOFs
            Pin Flag at End A/B.  Releases the specified DOFs
        wa / wb : List[float, float, float]
            Components of offset vectors from the grid points to the end
            points of the axis of the shear center
        sa / sb : int; default=0
            Scalar or grid point identification numbers for the ends A and B,
            respectively. The degrees-of-freedom at these points are the
            warping variables . SA and SB cannot be specified for
            beam p-elements
        comment : str; default=''
            a comment for the card

        offt/bit are MSC specific fields

        """
        if g0 is None:
            g0 = -1
        else:
            x = [np.nan, np.nan, np.nan]
        if pin_flags is None:
            pin_flags = [0, 0]

        self.model.bars.add(eid)
        self.is_current = False
        self._eid.append(eid)
        self._pid.append(pid)
        self._nids.append(nids)
        self._x.append(x)
        self._g0.append(g0)
        self._offt.append(offt)
        self._wa_offset.append(wa)
        self._wb_offset.append(wb)
        self._sab_warping.append([sa, sb])
        self._pin_flags.append(pin_flags)
        #self._offset.append(wa_offset)
        if comment:
            self.comment[eid] = _format_comment(comment)
示例#23
0
 def comment(self, new_comment):
     """sets a comment"""
     #comment = new_comment.rstrip()
     #self._comment = comment + '\n' if comment else ''
     self._comment = _format_comment(new_comment)