Exemplo n.º 1
0
    def cross_reference(self, model: BDF) -> None:
        """
        Cross links the card so referenced cards can be extracted directly

        Parameters
        ----------
        model : BDF()
            the BDF object

        """
        msg = ', which is required by PQUAD1 pid=%s' % self.pid
        if self.mid1:
            self.mid1_ref = model.Material(self.mid1, msg)
        if self.mid2 and self.mid2 != -1:
            self.mid2_ref = model.Material(self.mid2, msg)
        if self.mid3:
            self.mid3_ref = model.Material(self.mid3, msg)
        if self.t_membrane is not None:
            z1 = abs(self.z1)
            z2 = abs(self.z2)
            t = self.t_membrane
            if not ((-1.5 * t <= z1 <= 1.5 * t) or
                    (-1.5 * t <= z2 <= 1.5 * t)):
                msg = (
                    f'PQUAD1 pid={self.pid} midsurface: z1={self.z1:g} z2={self.z2:g} t={t:g} '
                    f'not in range of -1.5t < zi < 1.5t')
                model.log.warning(msg)
Exemplo n.º 2
0
    def cross_reference(self, model: BDF) -> None:
        """
        Cross links the card so referenced cards can be extracted directly

        Parameters
        ----------
        model : BDF()
            the BDF object

        """
        msg = ', which is required by PCONEAX=%s' % (self.pid)
        if self.mid1 > 0:
            self.mid1_ref = model.Material(self.mid1, msg=msg)
        if self.mid2 > 0:
            self.mid2_ref = model.Material(self.mid2, msg=msg)
        if self.mid3 > 0:
            self.mid3_ref = model.Material(self.mid3, msg=msg)
Exemplo n.º 3
0
    def cross_reference(self, model: BDF) -> None:
        """
        Cross links the card so referenced cards can be extracted directly

        Parameters
        ----------
        model : BDF()
            the BDF object
        """
        msg = ', which is required by PTUBE mid=%s' % self.mid
        self.mid_ref = model.Material(self.mid, msg=msg)
Exemplo n.º 4
0
    def cross_reference(self, model: BDF) -> None:
        """
        Cross links the card so referenced cards can be extracted directly

        Parameters
        ----------
        model : BDF()
            the BDF object

        """
        self.mid_ref = model.Material(self.mid)
Exemplo n.º 5
0
    def cross_reference(self, model: BDF) -> None:
        """
        Cross links the card so referenced cards can be extracted directly

        Parameters
        ----------
        model : BDF()
            the BDF object
        """
        msg = ' which is required by %s pid=%s' % (self.type, self.pid)
        self.mid = model.Material(self.mid, msg)
        self.mid_ref = self.mid
Exemplo n.º 6
0
    def test_solid_04(self):
        """checks linear static solid material"""
        mid = 2
        pid = 4
        rho = 0.1
        table_id = 42
        cards = [
            #$ Solid Nodes
            ['GRID', 11, 0, 0., 0., 0., 0],
            ['GRID', 12, 0, 1., 0., 0., 0],
            ['GRID', 13, 0, 1., 1., 0., 0],
            ['GRID', 14, 0, 0., 1., 0., 0],

            ['GRID', 15, 0, 0., 0., 2., 0],
            ['GRID', 16, 0, 1., 0., 2., 0],
            ['GRID', 17, 0, 1., 1., 2., 0],
            ['GRID', 18, 0, 0., 1., 2., 0],

            # Solids
            ['CHEXA', 7, pid, 11, 12, 13, 14, 15, 16, 17, 18],
            ['CTETRA', 8, pid, 11, 12, 13, 15],

            # Solid Nodes
            ['GRID', 21, 0, 0., 0., 0., 0,],
            ['GRID', 22, 0, 1., 0., 0., 0,],
            ['GRID', 23, 0, 1., 1., 0., 0,],
            ['GRID', 24, 0, 0., 0., 2., 0,],
            ['GRID', 25, 0, 1., 0., 2., 0,],
            ['GRID', 26, 0, 1., 1., 2., 0,],
            ['CPENTA', 9, pid, 21, 22, 23, 24, 25, 26],

            # static
            ['PSOLID', pid, mid, 0],
            ['MAT1', mid, 1.0, 2.0, 3.0, rho],
            ['MATS1', mid, table_id, 'PLASTIC', 0.0, 1, 1, 100000., ],
            #['TABLEST'],
            ['TABLES1', table_id, 1, None, None, None, None, None, None,
             1.0, 10.0, 2.0, 10.0, 'ENDT'],
        ]
        model = BDF(debug=False)
        for fields in cards:
            model.add_card(fields, fields[0], is_list=True)
        model.cross_reference()

        mat = model.Material(mid)
        mat.E()

        model.get_mass_breakdown(property_ids=None, stop_if_no_mass=True, detailed=False)
        model.get_mass_breakdown(property_ids=None, stop_if_no_mass=True, detailed=True)
        model.get_volume_breakdown(property_ids=None, stop_if_no_volume=True)

        save_load_deck(model)
Exemplo n.º 7
0
    def test_multiple_materials(self):
        """tests multiple materials"""
        model = BDF(debug=False)
        E = 3.0e7
        G = None
        nu = 0.3
        model.add_mat1(1, E, G, nu)
        e11 = e22 = 3.0e7
        nu12 = 0.3
        model.add_mat8(8, e11, e22, nu12)

        model.add_mat4(4, 10.0)
        model.add_mat5(5)

        bulk = 0.3
        rho = 0.2
        c = None
        model.add_mat10(10, bulk, rho, c)

        structural_material_ids = model.get_structural_material_ids()
        assert len(structural_material_ids) == 3, structural_material_ids

        thermal_material_ids = model.get_thermal_material_ids()
        assert len(thermal_material_ids) == 2, thermal_material_ids

        mats = model.Materials(1)
        assert len(mats) == 1, mats
        mats = model.Materials([1, 4, 5])
        assert len(mats) == 3, mats

        with self.assertRaises(KeyError):
            model.Material(-1)
        with self.assertRaises(KeyError):
            model.StructuralMaterial(-1)
        with self.assertRaises(KeyError):
            model.ThermalMaterial(-1)
Exemplo n.º 8
0
    def test_solid_03(self):
        """checks linear static solid material"""
        mid = 2
        pid = 4
        rho = 0.1
        tableID = 42
        cards = [
            #$ Solid Nodes
            ['GRID', 11, 0, 0., 0., 0., 0],
            ['GRID', 12, 0, 1., 0., 0., 0],
            ['GRID', 13, 0, 1., 1., 0., 0],
            ['GRID', 14, 0, 0., 1., 0., 0],
            ['GRID', 15, 0, 0., 0., 2., 0],
            ['GRID', 16, 0, 1., 0., 2., 0],
            ['GRID', 17, 0, 1., 1., 2., 0],
            ['GRID', 18, 0, 0., 1., 2., 0],

            # Solids
            ['CHEXA', 7, pid, 11, 12, 13, 14, 15, 16, 17, 18],
            ['CTETRA', 8, pid, 11, 12, 13, 15],

            # Solid Nodes
            [
                'GRID',
                21,
                0,
                0.,
                0.,
                0.,
                0,
            ],
            [
                'GRID',
                22,
                0,
                1.,
                0.,
                0.,
                0,
            ],
            [
                'GRID',
                23,
                0,
                1.,
                1.,
                0.,
                0,
            ],
            [
                'GRID',
                24,
                0,
                0.,
                0.,
                2.,
                0,
            ],
            [
                'GRID',
                25,
                0,
                1.,
                0.,
                2.,
                0,
            ],
            [
                'GRID',
                26,
                0,
                1.,
                1.,
                2.,
                0,
            ],
            ['CPENTA', 9, pid, 21, 22, 23, 24, 25, 26],

            # static
            ['PSOLID', pid, mid, 0],
            ['MAT1', mid, 1.0, 2.0, 3.0, rho],
            [
                'MATS1',
                mid,
                tableID,
                'PLASTIC',
                0.0,
                1,
                1,
                100000.,
            ],
            #['TABLEST'],
            [
                'TABLES1', tableID, 1, None, None, None, None, None, None, 1.0,
                10.0, 2.0, 10.0, 'ENDT'
            ],
        ]
        model = BDF(debug=False)
        for fields in cards:
            model.add_card(fields, fields[0], is_list=True)
        model.cross_reference()

        mat = model.Material(mid)
        mat.E()
Exemplo n.º 9
0
    def test_multiple_materials(self):
        """tests multiple materials"""
        model = BDF(debug=False)
        E = 3.0e7
        G = None
        nu = 0.3
        mat1 = model.add_mat1(1, E, G, nu)
        e11 = e22 = 3.0e7
        nu12 = 0.3
        model.add_mat8(8, e11, e22, nu12)

        model.add_mat4(4, 10.0)
        mat5 = model.add_mat5(5)
        mat9 = model.add_mat9(9,
                              G11=0.,
                              G12=0.,
                              G13=0.,
                              G14=0.,
                              G15=0.,
                              G16=0.,
                              G22=0.,
                              G23=0.,
                              G24=0.,
                              G25=0.,
                              G26=0.,
                              G33=0.,
                              G34=0.,
                              G35=0.,
                              G36=0.,
                              G44=0.,
                              G45=0.,
                              G46=0.,
                              G55=0.,
                              G56=0.,
                              G66=0.,
                              rho=0.,
                              A=None,
                              tref=0.,
                              ge=0.,
                              comment='mat9')

        bulk = 0.3
        rho = 0.2
        c = None
        model.add_mat10(10, bulk, rho, c)

        e1 = 1.
        e2 = 2.
        e3 = 3.
        nu13 = 0.3
        nu23 = 0.3
        g12 = 12.
        g13 = 13.
        g23 = 23.
        mat11 = model.add_mat11(11,
                                e1,
                                e2,
                                e3,
                                nu12,
                                nu13,
                                nu23,
                                g12,
                                g13,
                                g23,
                                rho=0.0,
                                a1=0.0,
                                a2=0.0,
                                a3=0.0,
                                tref=0.0,
                                ge=0.0,
                                comment='mat11')

        mat1.raw_fields()
        mat5.raw_fields()
        mat9.raw_fields()
        mat11.raw_fields()

        structural_material_ids = model.get_structural_material_ids()
        assert len(structural_material_ids) == 5, structural_material_ids

        thermal_material_ids = model.get_thermal_material_ids()
        assert len(thermal_material_ids) == 2, thermal_material_ids

        mats = model.Materials(1)
        assert len(mats) == 1, mats
        mats = model.Materials([1, 4, 5])
        assert len(mats) == 3, mats

        with self.assertRaises(KeyError):
            model.Material(-1)
        with self.assertRaises(KeyError):
            model.StructuralMaterial(-1)
        with self.assertRaises(KeyError):
            model.ThermalMaterial(-1)
Exemplo n.º 10
0
 def cross_reference(self, model: BDF) -> None:
     """cross reference method for a PSOLID"""
     msg = ', which is required by PSOLID pid=%s' % (self.pid)
     self.mid_ref = model.Material(self.mid, msg)
Exemplo n.º 11
0
 def cross_reference(self, model: BDF) -> None:
     msg = ', which is required by PSOLID pid=%s' % self.pid
     self.mids_ref = []
     for mid in self.mids:
         mid_ref = model.Material(mid, msg=msg)
         self.mids_ref.append(mid_ref)