<jupyter_start><jupyter_text>Example: Frame and bars This example is from the CALFEM MATLAB manual (exs7.m)**Purpose:** Set up a frame, consisting of both beams and bars, and illustrate the calculations byuse of graphics functions.**Description:** A frame consists of horizontal and vertical beams, and is stabilized with diagonalbars ![frame and bars](../images/frame_and_bars.png) As usual, import necessary modules.<jupyter_code>import numpy as np
import calfem.core as cfc<jupyter_output><empty_output><jupyter_text>The frame with its coordinates and loading is shown in the left figure, and the finiteelement model in the right. The matrices of the global system i.e. the stiffness matrix K, the load vector f, thecoordinate matrix Coord, and the corresponding degrees of freedom matrix Dof aredefined by<jupyter_code>K = np.zeros([18,18])
f = np.zeros([18,1])
f[12,0] = 1.0

coord = np.array([
    [0.0, 0.0],
    [1.0, 0.0],
    [0.0, 1.0],
    [1.0, 1.0],
    [0.0, 2.0],
    [1.0, 2.0]
])

dof1 = np.array([
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9],
    [10, 11, 12],
    [13, 14, 15],
    [16, 17, 18]
])

dof2 = np.array([
    [1, 2],
    [4, 5],
    [7, 8],
    [10, 11],
    [13, 14],
    [16, 17]
])<jupyter_output><empty_output><jupyter_text>The material properties, the topology, and the element coordinates for the beamsand bars respectively, are defined by<jupyter_code>ep1 = [1.0, 1.0, 1.0]

edof1 = np.array([
    [1, 2, 3, 7, 8, 9],
    [7, 8, 9, 13, 14, 15],
    [4, 5, 6, 10, 11, 12],
    [10, 11, 12, 16, 17, 18],
    [7, 8, 9, 10, 11, 12],
    [13, 14, 15, 16, 17, 18]
])

ex1, ey1 = cfc.coordxtr(edof1, coord, dof1);

ep2 = [1.0, 1.0]

edof2 = np.array([
    [1, 2, 10, 11],
    [7, 8, 16, 17],
    [7, 8, 4, 5],
    [13, 14, 10, 11]
])

ex2, ey2 = cfc.coordxtr(edof2, coord, dof2);<jupyter_output><empty_output><jupyter_text>Create and assemble element matrices<jupyter_code>for elx, ely, eltopo in zip(ex1, ey1, edof1):
    Ke = cfc.beam2e(elx, ely, ep1)
    cfc.assem(eltopo, K, Ke)
for elx, ely, eltopo in zip(ex2, ey2, edof2):
    Ke = cfc.bar2e(elx, ely, ep2)
    cfc.assem(eltopo,K,Ke)<jupyter_output><empty_output><jupyter_text>Solve equation system<jupyter_code>bc_prescr = np.array([1, 2, 3, 4, 5, 6])
a, r = cfc.solveq(K, f, bc_prescr)
print(a)<jupyter_output>[[ 0.        ]
 [ 0.        ]
 [ 0.        ]
 [ 0.        ]
 [ 0.        ]
 [ 0.        ]
 [ 0.37905924]
 [ 0.30451926]
 [-0.65956297]
 [ 0.3041448 ]
 [-0.28495132]
 [-0.54570174]
 [ 1.19791809]
 [ 0.44655174]
 [-0.85908643]
 [ 0.96969909]
 [-0.34780417]
 [-0.74373562]]
{'fraction_non_alphanumeric': 0.16926070038910507, 'fraction_numerical': 0.12295719844357976, 'mean_word_length': 3.1941272430668843, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '628646', 'license': 'MIT', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1093, 'n_words': 311, 'path': 'docs/source/examples/exs7.ipynb', 'repo_name': 'CALFEM/calfem-py', 'size': '2570'}