Example #1
0
def test_rdpostop2_jsc_cla_model():
    post = op2.rdpostop2("tests/nas2cam_extseout/cla_test_model.op2")

    assert len(post["geom1"]) == len(post["geom1_list"]) == 2

    grid = np.array([
        [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
        [2.0, 0.0, 1.0, 0.0, 0.0, 3.0, 0.0, 0.0],
        [3.0, 0.0, 2.0, 0.0, 0.0, 4.0, 0.0, 0.0],
        [4.0, 0.0, 3.0, 0.0, 0.0, 5.0, 0.0, 0.0],
        [5.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0],
    ])
    assert (post["geom1"][0]["grid"] == grid).all()

    extrn = np.array([
        [5, 123456],
        [90560001, 1],
        [90560002, 1],
        [90560003, 1],
        [90560004, 1],
        [90560005, 1],
        [90560006, 1],
        [-1, -1],
    ])
    assert (post["geom1"][56]["extrn"] == extrn).all()
Example #2
0
def test_rdpostop2_assemble():
    post = op2.rdpostop2("tests/nas2cam_extseout/assemble.op2", 1, 1)
    assert np.all(post["selist"] == [[101, 0], [102, 0], [0, 0]])
    sebulk = np.array([[101, 5, -1, 2, 0.0, 1, 3, 101],
                       [102, 5, -1, 2, 0.0, 1, 3, 102]])
    assert np.all(post["sebulk"] == sebulk)

    with op2.OP2("tests/nas2cam_extseout/assemble.op2") as o2:
        o2._rowsCutoff = 0
        # fpos = o2.dbnames['GEOM1S'][2][0][0]
        # o2._fileh.seek(fpos)
        o2.set_position("GEOM1S", 2)
        name, trailer, dbtype = o2.rdop2nt()
        # (cords, sebulk, selist, seload, seconct) = o2._rdop2geom1cord2()
        dct = o2._rdop2geom1cord2()
        assert np.all(post["selist"] == dct["selist"])
        assert np.all(post["sebulk"] == dct["sebulk"])
Example #3
0
def test_rdpostop2():
    post = op2.rdpostop2("tests/nas2cam_extseout/inboard.op2", 1, 1, 1, 1)

    dof = post["mats"]["ougv1"][0]["dof"]
    lam = post["mats"]["ougv1"][0]["lambda"]
    ougv1 = post["mats"]["ougv1"][0]["ougv1"]

    o4 = op4.load("tests/nas2cam_extseout/inboard.op4")
    mug1 = o4["mug1"][0]
    tug1 = nastran.rddtipch("tests/nas2cam_extseout/inboard.pch")
    tef1 = nastran.rddtipch("tests/nas2cam_extseout/inboard.pch", "TEF1")
    tes1 = nastran.rddtipch("tests/nas2cam_extseout/inboard.pch", "TES1")

    # ougv1, oef1, oes1 ... they don't have the constraint modes
    # or the resflex modes! How can they be useful? Anyway, this
    # checks the values present:

    # mug1 has 24 b-set ... get first 3 modes (rest are resflex):
    modes = mug1[:, 24:27]

    pv = locate.mat_intersect(tug1, dof)[0]
    assert np.allclose(modes[pv], ougv1)

    assert np.allclose(o4["mef1"][0][:, 24:27], post["mats"]["oef1"][0][0])
    assert np.all(post["mats"]["oef1"][0][1][:, 0] == tef1[:, 0])
    assert np.all(post["mats"]["oef1"][0][1][:, 1] == 34)

    pv = np.ones(15, bool)
    pv[5:7] = False
    pv[11:15] = False
    pv = np.hstack((pv, pv, pv))

    assert np.allclose(o4["mes1"][0][:, 24:27], post["mats"]["oes1"][0][0][pv])
    assert np.all(post["mats"]["oes1"][0][1][pv, 0] == tes1[:, 0])
    assert np.all(post["mats"]["oes1"][0][1][:, 1] == 34)

    with op2.OP2("tests/nas2cam_extseout/inboard.op2") as o2:
        o2._rowsCutoff = 0
        fpos = o2.dbnames["OUGV1"][0][0][0]
        o2._fileh.seek(fpos)
        name, trailer, dbtype = o2.rdop2nt()
        oug = o2._rdop2ougv1("OUGV1")

    assert np.all(oug["ougv1"] == ougv1)
    assert np.all(oug["dof"] == dof)
    assert np.all(oug["lambda"] == lam)
Example #4
0
def test_rdpostop2_many_nodes():
    post = op2.rdpostop2("tests/nas2cam_extseout/cant_beam.op2")
    assert (post["geom1"][0]["grid"][:, 0].astype(int) == np.arange(8222) +
            1).all()