Skip to content

Commit cb880a1

Browse files
committed
Adding test
1 parent d59d071 commit cb880a1

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

tests/conftest.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,3 +869,82 @@ def contact_solve(mapdl):
869869
mapdl.allsel()
870870
mapdl.set("last")
871871
mapdl.mute = False
872+
873+
874+
@pytest.fixture(scope="function")
875+
def cuadratic_beam_problem(mapdl):
876+
mapdl.clear()
877+
878+
# Enter verification example mode and the pre-processing routine.
879+
mapdl.prep7()
880+
881+
# Type of analysis: static.
882+
mapdl.antype("STATIC")
883+
884+
# Element type: BEAM188.
885+
mapdl.et(1, "BEAM188")
886+
887+
# Special Features are defined by keyoptions of beam element:
888+
889+
# KEYOPT(3)
890+
# Shape functions along the length:
891+
# Cubic
892+
mapdl.keyopt(1, 3, 3) # Cubic shape function
893+
894+
# KEYOPT(9)
895+
# Output control for values extrapolated to the element
896+
# and section nodes:
897+
# Same as KEYOPT(9) = 1 plus stresses and strains at all section nodes
898+
mapdl.keyopt(1, 9, 3, mute=True)
899+
900+
mapdl.mp("EX", 1, 30e6)
901+
mapdl.mp("PRXY", 1, 0.3)
902+
print(mapdl.mplist())
903+
904+
w_f = 1.048394965
905+
w_w = 0.6856481
906+
sec_num = 1
907+
mapdl.sectype(sec_num, "BEAM", "I", "ISection")
908+
mapdl.secdata(15, 15, 28 + (2 * w_f), w_f, w_f, w_w)
909+
910+
# Define nodes
911+
for node_num in range(1, 6):
912+
mapdl.n(node_num, (node_num - 1) * 120, 0, 0)
913+
914+
# Define one node for the orientation of the beam cross-section.
915+
orient_node = mapdl.n(6, 60, 1)
916+
917+
# Print the list of the created nodes.
918+
print(mapdl.nlist())
919+
920+
for elem_num in range(1, 5):
921+
mapdl.e(elem_num, elem_num + 1, orient_node)
922+
923+
# Print the list of the created elements.
924+
print(mapdl.elist())
925+
926+
# Display elements with their nodes numbers.
927+
mapdl.eplot(show_node_numbering=True, line_width=5, cpos="xy", font_size=40)
928+
929+
# BC for the beams seats
930+
mapdl.d(2, "UX", lab2="UY")
931+
mapdl.d(4, "UY")
932+
933+
# BC for all nodes of the beam
934+
mapdl.nsel("S", "LOC", "Y", 0)
935+
mapdl.d("ALL", "UZ")
936+
mapdl.d("ALL", "ROTX")
937+
mapdl.d("ALL", "ROTY")
938+
mapdl.nsel("ALL")
939+
940+
# Parametrization of the distributed load.
941+
w = 10000 / 12
942+
943+
# Application of the surface load to the beam element.
944+
mapdl.sfbeam(1, 1, "PRES", w)
945+
mapdl.sfbeam(4, 1, "PRES", w)
946+
mapdl.finish()
947+
948+
mapdl.run("/SOLU")
949+
mapdl.solve()
950+
mapdl.finish()

tests/test_mapdl.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,3 +1890,14 @@ def test_igesin_whitespace(mapdl, cleared, tmpdir):
18901890
out = mapdl.igesin(dest)
18911891
n_ent = re.findall(r"TOTAL NUMBER OF ENTITIES \s*=\s*(\d*)", out)
18921892
assert int(n_ent[0]) > 0
1893+
1894+
1895+
def test_cuadratic_beam(mapdl, cuadratic_beam_problem):
1896+
mapdl.post1()
1897+
mapdl.set(1)
1898+
assert (
1899+
mapdl.post_processing.plot_nodal_displacement(
1900+
"NORM", line_width=10, render_lines_as_tubes=True, smooth_shading=True
1901+
)
1902+
is None
1903+
)

0 commit comments

Comments
 (0)