|
| 1 | +""" |
| 2 | +
|
| 3 | +""" |
| 4 | + |
| 5 | +from context import pystran |
| 6 | +from pystran import model |
| 7 | +from pystran import section |
| 8 | +from pystran import plots |
| 9 | + |
| 10 | +E = 2.0e11 |
| 11 | +G = E / (2 * (1 + 0.3)) |
| 12 | + |
| 13 | +h = 0.2 |
| 14 | +b = 3.0 |
| 15 | +A = b * h |
| 16 | +Iy = b * h**3 / 12 |
| 17 | +Iz = h * b**3 / 12 |
| 18 | +Ix = Iy + Iz |
| 19 | +J = Ix |
| 20 | +xz_vector = [0, 0, 1] |
| 21 | +sdeck = section.beam_3d_section("sdeck", E, G, A, Ix, Iy, Iz, J, xz_vector) |
| 22 | + |
| 23 | +h = 0.6 |
| 24 | +b = 0.6 |
| 25 | +A = b * h |
| 26 | +Iy = b * h**3 / 12 |
| 27 | +Iz = h * b**3 / 12 |
| 28 | +Ix = Iy + Iz |
| 29 | +J = Ix |
| 30 | +xz_vector = [0, 1, 0] |
| 31 | +spylon = section.beam_3d_section("spylon", E, G, A, Ix, Iy, Iz, J, xz_vector) |
| 32 | + |
| 33 | +h = 0.3 |
| 34 | +b = 0.3 |
| 35 | +A = b * h |
| 36 | +Iy = b * h**3 / 12 |
| 37 | +Iz = h * b**3 / 12 |
| 38 | +Ix = Iy + Iz |
| 39 | +J = Ix |
| 40 | +xz_vector = [0, 1, 0] |
| 41 | +scross = section.beam_3d_section("scross", E, G, A, Ix, Iy, Iz, J, xz_vector) |
| 42 | + |
| 43 | + |
| 44 | +h = 0.05 |
| 45 | +b = 0.05 |
| 46 | +A = b * h |
| 47 | +scable = section.truss_section("scable", E, A) |
| 48 | + |
| 49 | +m = model.create(3) |
| 50 | + |
| 51 | +model.add_joint(m, 1, [0.0, 0.0, 0.0]) |
| 52 | +model.add_joint(m, 100, [0.0, 0.0, 1.0]) |
| 53 | +model.add_joint(m, 2, [0.0, -10.0, -0.5]) |
| 54 | +model.add_joint(m, 200, [0.0, -10.0, 0.5]) |
| 55 | +model.add_joint(m, 3, [0.0, -20.0, -1.5]) |
| 56 | +model.add_joint(m, 4, [0.0, +10.0, -0.5]) |
| 57 | +model.add_joint(m, 400, [0.0, +10.0, 0.5]) |
| 58 | +model.add_joint(m, 5, [0.0, +20.0, -1.5]) |
| 59 | + |
| 60 | +model.add_joint(m, 6, [0.0, -10.0, -4.5]) |
| 61 | +model.add_joint(m, 7, [-5.0, -10.0, 2.0]) |
| 62 | +model.add_joint(m, 8, [+5.0, -10.0, 2.0]) |
| 63 | + |
| 64 | +model.add_joint(m, 9, [0.0, +10.0, -4.5]) |
| 65 | +model.add_joint(m, 10, [-5.0, +10.0, 2.0]) |
| 66 | +model.add_joint(m, 11, [+5.0, +10.0, 2.0]) |
| 67 | + |
| 68 | +model.add_joint(m, 12, [-3.0, 0.0, 0.5]) |
| 69 | +model.add_joint(m, 13, [+3.0, 0.0, 0.5]) |
| 70 | + |
| 71 | +model.add_joint(m, 14, [-4.0, -20.0, -1.5]) |
| 72 | +model.add_joint(m, 15, [+4.0, -20.0, -1.5]) |
| 73 | + |
| 74 | +model.add_joint(m, 16, [-4.0, +20.0, -1.5]) |
| 75 | +model.add_joint(m, 17, [+4.0, +20.0, -1.5]) |
| 76 | + |
| 77 | +model.add_support(m["joints"][3], model.PINNED) |
| 78 | +model.add_support(m["joints"][5], model.PINNED) |
| 79 | +model.add_support(m["joints"][6], model.CLAMPED) |
| 80 | +model.add_support(m["joints"][9], model.CLAMPED) |
| 81 | + |
| 82 | +model.add_support(m["joints"][14], model.CLAMPED) |
| 83 | +model.add_support(m["joints"][15], model.CLAMPED) |
| 84 | +model.add_support(m["joints"][16], model.CLAMPED) |
| 85 | +model.add_support(m["joints"][17], model.CLAMPED) |
| 86 | + |
| 87 | +model.add_beam_member(m, 1, [100, 200], sdeck) |
| 88 | +model.add_beam_member(m, 2, [200, 3], sdeck) |
| 89 | +model.add_beam_member(m, 3, [100, 400], sdeck) |
| 90 | +model.add_beam_member(m, 4, [400, 5], sdeck) |
| 91 | + |
| 92 | +model.add_beam_member(m, 600, [1, 100], spylon) |
| 93 | +model.add_beam_member(m, 601, [2, 200], spylon) |
| 94 | +model.add_beam_member(m, 603, [4, 400], spylon) |
| 95 | + |
| 96 | +model.add_beam_member(m, 6, [2, 6], spylon) |
| 97 | +model.add_beam_member(m, 7, [2, 7], spylon) |
| 98 | +model.add_beam_member(m, 8, [2, 8], spylon) |
| 99 | +model.add_beam_member(m, 9, [4, 9], spylon) |
| 100 | +model.add_beam_member(m, 10, [4, 10], spylon) |
| 101 | +model.add_beam_member(m, 11, [4, 11], spylon) |
| 102 | + |
| 103 | +model.add_beam_member(m, 12, [1, 12], scross) |
| 104 | +model.add_beam_member(m, 13, [1, 13], scross) |
| 105 | + |
| 106 | +model.add_truss_member(m, 1, [14, 7], scable) |
| 107 | +model.add_truss_member(m, 2, [7, 12], scable) |
| 108 | +model.add_truss_member(m, 3, [12, 10], scable) |
| 109 | +model.add_truss_member(m, 4, [10, 16], scable) |
| 110 | +model.add_truss_member(m, 5, [15, 8], scable) |
| 111 | +model.add_truss_member(m, 6, [8, 13], scable) |
| 112 | +model.add_truss_member(m, 7, [13, 11], scable) |
| 113 | +model.add_truss_member(m, 8, [11, 17], scable) |
| 114 | + |
| 115 | +model.add_load(m["joints"][1], model.U3, -5e3 - 7.5e3) |
| 116 | + |
| 117 | + |
| 118 | +model.number_dofs(m) |
| 119 | + |
| 120 | +print("Number of free degrees of freedom = ", m["nfreedof"]) |
| 121 | +print("Number of all degrees of freedom = ", m["ntotaldof"]) |
| 122 | + |
| 123 | +# print([j["dof"] for j in m["joints"].values()]) |
| 124 | + |
| 125 | +model.solve_free_vibration(m) |
| 126 | + |
| 127 | + |
| 128 | +# print([j["displacements"] for j in m["joints"].values()]) |
| 129 | + |
| 130 | +# print(m['K'][0:m['nfreedof'], 0:m['nfreedof']]) |
| 131 | + |
| 132 | +# print(m["U"][0 : m["nfreedof"]]) |
| 133 | + |
| 134 | + |
| 135 | +# if ( |
| 136 | +# norm(b["displacements"] - [0.0, 0.0, -0.02238452, 0.00419677, 0.00593197, 0.0]) |
| 137 | +# > 1.0e-5. |
| 138 | +# ): |
| 139 | +# raise ValueError("Displacement calculation error") |
| 140 | + |
| 141 | +# print("Displacement calculation OK") |
| 142 | + |
| 143 | +# print('Reference: ', [-0.02238452, 0.00419677, 0.00593197]) |
| 144 | + |
| 145 | +plots.plot_setup(m) |
| 146 | +plots.plot_members(m) |
| 147 | +model.copy_mode(m, 3) |
| 148 | +plots.plot_deformations(m, 2.0) |
| 149 | +# ax = plots.plot_shear_forces(m, scale=0.50e-3) |
| 150 | +# ax.set_title('Shear forces') |
| 151 | +plots.show(m) |
0 commit comments