コード例 #1
0
ファイル: test_shell.py プロジェクト: umvarma/pynastran
    def test_pcomp_02(self):
        """
        symmetrical, nsm=0.0 and nsm=1.0
        """
        model = BDF()
        pid = 1
        z0 = 0.
        nsm = 0.
        sb = 0.
        ft = 'HOFF'
        TRef = 0.
        ge = 0.
        lam = 'SYM'  # isSymmetrical SYM
        Mid = [1,2,3]
        Theta = [0.,10.,20.]
        T = [.1,.2,.3]
        Sout = ['YES', 'YES', 'NO']  # 0-NO, 1-YES
        card = ['PCOMP', pid, z0, nsm, sb, ft, TRef, ge, lam,
                Mid[0], T[0], Theta[0], Sout[0],
                Mid[1], T[1], Theta[1], Sout[1],
                Mid[2], T[2], Theta[2], Sout[2]]
        card = BDFCard(card)
        p = PCOMP(model)
        p.add(card)
        p.build()
        self.assertTrue(p.is_symmetrical_by_property_id())
        self.assertTrue(p.is_symmetrical_by_property_index())
        self.assertEqual(p.get_nplies_by_property_id(), 6)

        self.assertAlmostEqual(p.get_thickness_by_property_id(), 1.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 0), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 1), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 2), 0.3)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 3), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 4), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 5), 0.3)
        with self.assertRaises(IndexError):
            p.Thickness(6)

        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 0), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 1), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 2), 20.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 3), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 4), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 5), 20.)
        with self.assertRaises(IndexError):
            p.get_theta_by_property_id_ply(pid, 6)

        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 0), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 1), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 2), 3)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 3), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 4), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 5), 3)
        with self.assertRaises(IndexError):
            p.get_material_id_by_property_id_ply(pid, 6)

        self.assertEqual(p.get_material_ids_by_property_id(), [1,2,3,1,2,3])

        self.assertEqual(p.get_sout_by_property_id_ply(pid, 0), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 1), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 2), 'NO')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 3), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 4), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 5), 'NO')
        with self.assertRaises(IndexError):
            p.get_sout_by_property_id_ply(pid, 6)


        mid = 1
        E = None
        G = None
        nu = None
        rho = 1.0
        a = None
        St = None
        Sc = None
        Ss = None
        Mcsid = None
        mat1 = [mid,E,G,nu,rho,a,TRef, ge, St, Sc, Ss, Mcsid]
        m = MAT1(data=mat1)
        for iply in range(len(p.plies)):
            mid = p.plies[iply][0]
            p.plies[iply][0] = m # MAT1

        #Rho
        self.assertAlmostEqual(p.Rho(0), 1.0)
        self.assertAlmostEqual(p.Rho(1), 1.0)
        self.assertAlmostEqual(p.Rho(2), 1.0)
        self.assertAlmostEqual(p.Rho(3), 1.0)
        self.assertAlmostEqual(p.Rho(4), 1.0)
        self.assertAlmostEqual(p.Rho(5), 1.0)
        with self.assertRaises(IndexError):
            p.Rho(6)

        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 1.2)
        self.assertAlmostEqual(p.MassPerArea(0), 0.1)
        self.assertAlmostEqual(p.MassPerArea(1), 0.2)
        self.assertAlmostEqual(p.MassPerArea(2), 0.3)
        self.assertAlmostEqual(p.MassPerArea(3), 0.1)
        self.assertAlmostEqual(p.MassPerArea(4), 0.2)
        self.assertAlmostEqual(p.MassPerArea(5), 0.3)
        with self.assertRaises(IndexError):
            p.MassPerArea(6)

        self.assertEqual(p.Nsm(), 0.0)
        #----------------------
        # change the nsm to 1.0
        p.nsm = 1.0

        self.assertEqual(p.Nsm(), 1.0)
        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 2.2)
        self.assertAlmostEqual(p.MassPerArea(0, method='nplies'), 0.1+1/6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='nplies'), 0.2+1/6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='nplies'), 0.3+1/6.)
        self.assertAlmostEqual(p.MassPerArea(3, method='nplies'), 0.1+1/6.)
        self.assertAlmostEqual(p.MassPerArea(4, method='nplies'), 0.2+1/6.)
        self.assertAlmostEqual(p.MassPerArea(5, method='nplies'), 0.3+1/6.)
        with self.assertRaises(IndexError):
            p.MassPerArea(6)
コード例 #2
0
ファイル: test_shell.py プロジェクト: umvarma/pynastran
    def test_pcomp_02(self):
        """
        symmetrical, nsm=0.0 and nsm=1.0
        """
        model = BDF()
        pid = 1
        z0 = 0.
        nsm = 0.
        sb = 0.
        ft = 'HOFF'
        TRef = 0.
        ge = 0.
        lam = 'SYM'  # isSymmetrical SYM
        Mid = [1, 2, 3]
        Theta = [0., 10., 20.]
        T = [.1, .2, .3]
        Sout = ['YES', 'YES', 'NO']  # 0-NO, 1-YES
        card = [
            'PCOMP', pid, z0, nsm, sb, ft, TRef, ge, lam, Mid[0], T[0],
            Theta[0], Sout[0], Mid[1], T[1], Theta[1], Sout[1], Mid[2], T[2],
            Theta[2], Sout[2]
        ]
        card = BDFCard(card)
        p = PCOMP(model)
        p.add(card)
        p.build()
        self.assertTrue(p.is_symmetrical_by_property_id())
        self.assertTrue(p.is_symmetrical_by_property_index())
        self.assertEqual(p.get_nplies_by_property_id(), 6)

        self.assertAlmostEqual(p.get_thickness_by_property_id(), 1.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 0), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 1), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 2), 0.3)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 3), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 4), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 5), 0.3)
        with self.assertRaises(IndexError):
            p.Thickness(6)

        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 0), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 1), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 2), 20.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 3), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 4), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 5), 20.)
        with self.assertRaises(IndexError):
            p.get_theta_by_property_id_ply(pid, 6)

        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 0), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 1), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 2), 3)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 3), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 4), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 5), 3)
        with self.assertRaises(IndexError):
            p.get_material_id_by_property_id_ply(pid, 6)

        self.assertEqual(p.get_material_ids_by_property_id(),
                         [1, 2, 3, 1, 2, 3])

        self.assertEqual(p.get_sout_by_property_id_ply(pid, 0), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 1), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 2), 'NO')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 3), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 4), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 5), 'NO')
        with self.assertRaises(IndexError):
            p.get_sout_by_property_id_ply(pid, 6)

        mid = 1
        E = None
        G = None
        nu = None
        rho = 1.0
        a = None
        St = None
        Sc = None
        Ss = None
        Mcsid = None
        mat1 = [mid, E, G, nu, rho, a, TRef, ge, St, Sc, Ss, Mcsid]
        m = MAT1(data=mat1)
        for iply in range(len(p.plies)):
            mid = p.plies[iply][0]
            p.plies[iply][0] = m  # MAT1

        #Rho
        self.assertAlmostEqual(p.Rho(0), 1.0)
        self.assertAlmostEqual(p.Rho(1), 1.0)
        self.assertAlmostEqual(p.Rho(2), 1.0)
        self.assertAlmostEqual(p.Rho(3), 1.0)
        self.assertAlmostEqual(p.Rho(4), 1.0)
        self.assertAlmostEqual(p.Rho(5), 1.0)
        with self.assertRaises(IndexError):
            p.Rho(6)

        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 1.2)
        self.assertAlmostEqual(p.MassPerArea(0), 0.1)
        self.assertAlmostEqual(p.MassPerArea(1), 0.2)
        self.assertAlmostEqual(p.MassPerArea(2), 0.3)
        self.assertAlmostEqual(p.MassPerArea(3), 0.1)
        self.assertAlmostEqual(p.MassPerArea(4), 0.2)
        self.assertAlmostEqual(p.MassPerArea(5), 0.3)
        with self.assertRaises(IndexError):
            p.MassPerArea(6)

        self.assertEqual(p.Nsm(), 0.0)
        #----------------------
        # change the nsm to 1.0
        p.nsm = 1.0

        self.assertEqual(p.Nsm(), 1.0)
        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 2.2)
        self.assertAlmostEqual(p.MassPerArea(0, method='nplies'), 0.1 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='nplies'), 0.2 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='nplies'), 0.3 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(3, method='nplies'), 0.1 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(4, method='nplies'), 0.2 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(5, method='nplies'), 0.3 + 1 / 6.)
        with self.assertRaises(IndexError):
            p.MassPerArea(6)
コード例 #3
0
ファイル: test_shell.py プロジェクト: umvarma/pynastran
    def test_pcomp_01(self):
        """
        asymmetrical, nsm=0.0 and nsm=1.0
        """
        #self.pid = data[0]
        #self.z0 = data[1]
        #self.nsm = data[2]
        #self.sb = data[3]
        #self.ft = data[4]
        #self.TRef = data[5]
        #self.ge = data[6]
        #self.lam = data[7]
        #Mid = data[8]
        #T = data[9]
        #Theta = data[10]
        #Sout = data[11]

        pid = 1
        z0 = 0.
        nsm = 0.
        sb = 0.
        ft = 'HILL'
        TRef = 0.
        ge = 0.
        #lam = 'NO'  # isSymmetrical YES/NO
        lam = 'BEND'  # isSymmetrical YES/NO
        Mid = [1,2,3]
        Theta = [0.,10.,20.]
        T = [.1,.2,.3]
        Sout = ['YES', 'YES', 'NO']  # 0-NO, 1-YES
        data = ['PCOMP', pid, z0, nsm, sb, ft, TRef, ge, lam,
                Mid[0], T[0], Theta[0], Sout[0],
                Mid[1], T[1], Theta[1], Sout[1],
                Mid[2], T[2], Theta[2], Sout[2],]
        model = BDF()
        card = BDFCard(data)
        p = PCOMP(model)
        #p = model.properties.pcomp
        p.add(card)
        p.build()
        #self.assertFalse(p.is_symmetrical())
        self.assertEqual(p.get_nplies_by_property_id(), 3)

        self.assertAlmostEqual(p.get_thickness_by_property_id(pid), 0.6)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 0), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 1), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 2), 0.3)
        with self.assertRaises(IndexError):
            p.get_thickness_by_property_id_ply(pid, 3)

        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 0), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 1), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 2), 20.)
        with self.assertRaises(IndexError):
            p.get_theta_by_property_id_ply(pid, 3)

        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 0), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 1), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 2), 3)
        with self.assertRaises(IndexError):
            p.get_material_id_by_property_id_ply(pid, 3)

        print('get_material_ids_by_property_id = ', p.get_material_ids_by_property_id(pid))
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][0], 1)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][0], 1)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][1], 2)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][2], 3)

        self.assertEqual(p.get_sout_by_property_id_ply(pid, 0), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 1), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 2), 'NO')
        with self.assertRaises(IndexError):
            p.get_sout_by_property_id_ply(pid, 3)

        # material...
        mid = 1
        E = 1e7
        G = None
        nu = None
        rho = 1.0
        a = None
        St = None
        Sc = None
        Ss = None
        Mcsid = None
        mat1 = ['MAT1', mid, E, G, nu, rho, a, TRef, ge, St, Sc, Ss, Mcsid]
        card = BDFCard(mat1)
        m = MAT1(model)
        m.allocate(1)
        m.add(card)
        m.build()
        #for iply in range(len(p.plies)):
            #mid = p.plies[iply][0]
            #p.plies[iply][0] = m # MAT1
            ##p.mids = [m, m, m]

        #Rho
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 0), 1.0)
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 1), 1.0)
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 2), 1.0)
        with self.assertRaises(IndexError):
            p.get_density_by_property_id_ply(pid, 3)

        # MassPerArea
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id(), 0.6)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 0), 0.1)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 1), 0.2)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 2), 0.3)
        with self.assertRaises(IndexError):
            p.MassPerArea(3)

        #----------------------
        # change the nsm to 1.0
        p.nsm = 1.0

        self.assertEqual(p.Nsm(), 1.0)
        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 1.6)
        self.assertAlmostEqual(p.MassPerArea(0, method='nplies'), 0.1+1/3.)
        self.assertAlmostEqual(p.MassPerArea(1, method='nplies'), 0.2+1/3.)
        self.assertAlmostEqual(p.MassPerArea(2, method='nplies'), 0.3+1/3.)

        self.assertAlmostEqual(p.MassPerArea(0, method='rho*t'), 0.1+1/6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='rho*t'), 0.2+2/6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='rho*t'), 0.3+3/6.)

        self.assertAlmostEqual(p.MassPerArea(0, method='t'), 0.1+1/6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='t'), 0.2+2/6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='t'), 0.3+3/6.)
        with self.assertRaises(IndexError):
            p.MassPerArea(3, method='nplies')

        z = p.get_z_locations()
        z_expected = array([0., T[0], T[0]+T[1], T[0]+T[1]+T[2]])
        for za, ze in zip(z, z_expected):
            self.assertAlmostEqual(za, ze)

        #z0  =
        p.z0 = 1.0
        z_expected = 1.0 + z_expected
        z = p.get_z_locations()
        for za, ze in zip(z, z_expected):
            self.assertAlmostEqual(za, ze)
コード例 #4
0
ファイル: test_shell.py プロジェクト: umvarma/pynastran
    def test_pcomp_01(self):
        """
        asymmetrical, nsm=0.0 and nsm=1.0
        """
        #self.pid = data[0]
        #self.z0 = data[1]
        #self.nsm = data[2]
        #self.sb = data[3]
        #self.ft = data[4]
        #self.TRef = data[5]
        #self.ge = data[6]
        #self.lam = data[7]
        #Mid = data[8]
        #T = data[9]
        #Theta = data[10]
        #Sout = data[11]

        pid = 1
        z0 = 0.
        nsm = 0.
        sb = 0.
        ft = 'HILL'
        TRef = 0.
        ge = 0.
        #lam = 'NO'  # isSymmetrical YES/NO
        lam = 'BEND'  # isSymmetrical YES/NO
        Mid = [1, 2, 3]
        Theta = [0., 10., 20.]
        T = [.1, .2, .3]
        Sout = ['YES', 'YES', 'NO']  # 0-NO, 1-YES
        data = [
            'PCOMP',
            pid,
            z0,
            nsm,
            sb,
            ft,
            TRef,
            ge,
            lam,
            Mid[0],
            T[0],
            Theta[0],
            Sout[0],
            Mid[1],
            T[1],
            Theta[1],
            Sout[1],
            Mid[2],
            T[2],
            Theta[2],
            Sout[2],
        ]
        model = BDF()
        card = BDFCard(data)
        p = PCOMP(model)
        #p = model.properties.pcomp
        p.add(card)
        p.build()
        #self.assertFalse(p.is_symmetrical())
        self.assertEqual(p.get_nplies_by_property_id(), 3)

        self.assertAlmostEqual(p.get_thickness_by_property_id(pid), 0.6)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 0), 0.1)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 1), 0.2)
        self.assertAlmostEqual(p.get_thickness_by_property_id_ply(pid, 2), 0.3)
        with self.assertRaises(IndexError):
            p.get_thickness_by_property_id_ply(pid, 3)

        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 0), 0.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 1), 10.)
        self.assertAlmostEqual(p.get_theta_by_property_id_ply(pid, 2), 20.)
        with self.assertRaises(IndexError):
            p.get_theta_by_property_id_ply(pid, 3)

        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 0), 1)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 1), 2)
        self.assertEqual(p.get_material_id_by_property_id_ply(pid, 2), 3)
        with self.assertRaises(IndexError):
            p.get_material_id_by_property_id_ply(pid, 3)

        print('get_material_ids_by_property_id = ',
              p.get_material_ids_by_property_id(pid))
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][0], 1)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][0], 1)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][1], 2)
        self.assertEqual(p.get_material_ids_by_property_id(pid)[0][2], 3)

        self.assertEqual(p.get_sout_by_property_id_ply(pid, 0), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 1), 'YES')
        self.assertEqual(p.get_sout_by_property_id_ply(pid, 2), 'NO')
        with self.assertRaises(IndexError):
            p.get_sout_by_property_id_ply(pid, 3)

        # material...
        mid = 1
        E = 1e7
        G = None
        nu = None
        rho = 1.0
        a = None
        St = None
        Sc = None
        Ss = None
        Mcsid = None
        mat1 = ['MAT1', mid, E, G, nu, rho, a, TRef, ge, St, Sc, Ss, Mcsid]
        card = BDFCard(mat1)
        m = MAT1(model)
        m.allocate(1)
        m.add(card)
        m.build()
        #for iply in range(len(p.plies)):
        #mid = p.plies[iply][0]
        #p.plies[iply][0] = m # MAT1
        ##p.mids = [m, m, m]

        #Rho
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 0), 1.0)
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 1), 1.0)
        self.assertAlmostEqual(p.get_density_by_property_id_ply(pid, 2), 1.0)
        with self.assertRaises(IndexError):
            p.get_density_by_property_id_ply(pid, 3)

        # MassPerArea
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id(), 0.6)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 0),
                               0.1)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 1),
                               0.2)
        self.assertAlmostEqual(p.get_mass_per_area_by_property_id_iply(pid, 2),
                               0.3)
        with self.assertRaises(IndexError):
            p.MassPerArea(3)

        #----------------------
        # change the nsm to 1.0
        p.nsm = 1.0

        self.assertEqual(p.Nsm(), 1.0)
        # MassPerArea
        self.assertAlmostEqual(p.MassPerArea(), 1.6)
        self.assertAlmostEqual(p.MassPerArea(0, method='nplies'), 0.1 + 1 / 3.)
        self.assertAlmostEqual(p.MassPerArea(1, method='nplies'), 0.2 + 1 / 3.)
        self.assertAlmostEqual(p.MassPerArea(2, method='nplies'), 0.3 + 1 / 3.)

        self.assertAlmostEqual(p.MassPerArea(0, method='rho*t'), 0.1 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='rho*t'), 0.2 + 2 / 6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='rho*t'), 0.3 + 3 / 6.)

        self.assertAlmostEqual(p.MassPerArea(0, method='t'), 0.1 + 1 / 6.)
        self.assertAlmostEqual(p.MassPerArea(1, method='t'), 0.2 + 2 / 6.)
        self.assertAlmostEqual(p.MassPerArea(2, method='t'), 0.3 + 3 / 6.)
        with self.assertRaises(IndexError):
            p.MassPerArea(3, method='nplies')

        z = p.get_z_locations()
        z_expected = array([0., T[0], T[0] + T[1], T[0] + T[1] + T[2]])
        for za, ze in zip(z, z_expected):
            self.assertAlmostEqual(za, ze)

        #z0  =
        p.z0 = 1.0
        z_expected = 1.0 + z_expected
        z = p.get_z_locations()
        for za, ze in zip(z, z_expected):
            self.assertAlmostEqual(za, ze)