{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Simple beam - Geometry\n", "In this first notebook, the geometry of a simple beam with rectangular section is explored. The correlated mechanical parameters are also visualized." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# Import the packages needed\n", "import math\n", "import numpy as np \n", "from bokeh.layouts import layout, column\n", "from bokeh.models import Div, CustomJS, Slider, Spacer\n", "from bokeh.models.tickers import SingleIntervalTicker\n", "from bokeh.plotting import figure, show, ColumnDataSource\n", "from bokeh.io import output_notebook\n", "from cienpy import simplebeam as sb\n", "from cienpy import rectangular_section as beam_section\n", "from cienpy import models\n", "\n", "# output_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define the geometry:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Choose the dimensions\n", "L = 6 # [m]\n", "h = 200 # [mm]\n", "b = 100 # [mm]\n", "\n", "# compute the parameters\n", "A = beam_section.compute_area(b, h) # [mm2]\n", "Iy = beam_section.compute_inertia_y(b, h) # [mm4] strong axis\n", "Iz = beam_section.compute_inertia_z(b, h) # [mm4] weak axis\n", "\n", "# constants for the visualisation\n", "MAX_B = 3*b\n", "MAX_H = 3*h\n", "\n", "# store the values in a specific format\n", "data_beam = dict(\n", " x=[0, L],\n", " y=[0, 0]\n", ")\n", "\n", "initial_position = L\n", "data = dict( # stores every useful single variable\n", " L=[L],\n", " b=[b],\n", " h=[h],\n", " A=[A],\n", " Iy=[Iy],\n", " Iz=[Iz],\n", " x=[initial_position],\n", " y=[0]\n", ")\n", "\n", "source_beam = ColumnDataSource(data_beam)\n", "source = ColumnDataSource(data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now define the new figures, renderers and widgets:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Geometrical and mechanical parameters:
\n", " h = {round(h)} mmGeometrical and mechanical parameters:
h = \"+h+\n", " \" mm