Пример #1
0
 def test_integrate_arbitrary(self):
     el = Element.Linear_1D(1.0, 1.5)
     I = el.integrate(lambda x: 2)
     self.assertAlmostEqual(I, 1.0)
     I = el.integrate(lambda x: x**3)
     self.assertAlmostEqual(I, ((1.5)**4 - 1) / 4.0)
     return
Пример #2
0
 def test_integrate_master(self):
     el = Element.Linear_1D(-1, 1)
     I = el.integrate(lambda x: 1)
     self.assertAlmostEqual(I, 2.0)
     I = el.integrate(lambda x: x**2)
     self.assertAlmostEqual(I, 2.0 / 3.0)
     return
Пример #3
0
 def test_T_arbitrary(self):
     el = Element.Linear_1D(0.5, 0.7)
     self.assertAlmostEqual(el.T(0.5), -1)
     self.assertAlmostEqual(el.T(0.6), 0)
     self.assertAlmostEqual(el.T(0.7), 1)
     self.assertAlmostEqual(el.w[0], -0.5)
     self.assertAlmostEqual(el.w[1], 0.5)
     self.assertAlmostEqual(el.xipts[0], -1)
     self.assertAlmostEqual(el.xipts[1], 1)
     return
Пример #4
0
 def test_T_master(self):
     el = Element.Linear_1D(-1, 1)
     self.assertAlmostEqual(el.T(-1), -1)
     self.assertAlmostEqual(el.T(-0.5), -0.5)
     self.assertAlmostEqual(el.T(0), 0)
     self.assertAlmostEqual(el.T(0.5), 0.5)
     self.assertAlmostEqual(el.T(1), 1)
     self.assertAlmostEqual(el.w[0], -0.5)
     self.assertAlmostEqual(el.w[1], 0.5)
     self.assertAlmostEqual(el.xipts[0], -1)
     self.assertAlmostEqual(el.xipts[1], 1)
     return
Пример #5
0
 def test_jacobian_arbitrary(self):
     el = Element.Linear_1D(-23, 51)
     self.assertAlmostEqual(el.jacobian(0), 2.0 / 74.0)
     return
Пример #6
0
 def test_jacobian_master(self):
     el = Element.Linear_1D(-1, 1)
     self.assertAlmostEqual(el.jacobian(0), 1.0)
     return