示例#1
0
    def test_welded_beam(self):
        import numpy as np
        import matplotlib.pyplot as plt

        from smt.problems import WeldedBeam

        ndim = 3
        problem = WeldedBeam(ndim=ndim)

        num = 100
        x = np.ones((num, ndim))
        for i in range(ndim):
            x[:, i] = 0.5 * (problem.xlimits[i, 0] + problem.xlimits[i, 1])
        x[:, 0] = np.linspace(5., 10., num)
        y = problem(x)

        yd = np.empty((num, ndim))
        for i in range(ndim):
            yd[:, i] = problem(x, kx=i).flatten()

        print(y.shape)
        print(yd.shape)

        plt.plot(x[:, 0], y[:, 0])
        plt.xlabel('x')
        plt.ylabel('y')
        plt.show()
示例#2
0
 def test_welded_beam(self):
     self.run_test(WeldedBeam(ndim=3))