diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle deleted file mode 100644 index c1c44160..00000000 Binary files a/docs/build/doctrees/environment.pickle and /dev/null differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree deleted file mode 100644 index cb688648..00000000 Binary files a/docs/build/doctrees/index.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/analysis.doctree b/docs/build/doctrees/rst/analysis.doctree deleted file mode 100644 index 6e7519b1..00000000 Binary files a/docs/build/doctrees/rst/analysis.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/api.doctree b/docs/build/doctrees/rst/api.doctree deleted file mode 100644 index 46f5fcc9..00000000 Binary files a/docs/build/doctrees/rst/api.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/examples.doctree b/docs/build/doctrees/rst/examples.doctree deleted file mode 100644 index c2e16c96..00000000 Binary files a/docs/build/doctrees/rst/examples.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/geom_mesh.doctree b/docs/build/doctrees/rst/geom_mesh.doctree deleted file mode 100644 index e81dd08b..00000000 Binary files a/docs/build/doctrees/rst/geom_mesh.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/installation.doctree b/docs/build/doctrees/rst/installation.doctree deleted file mode 100644 index 929fbad7..00000000 Binary files a/docs/build/doctrees/rst/installation.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/post.doctree b/docs/build/doctrees/rst/post.doctree deleted file mode 100644 index 3e97b54f..00000000 Binary files a/docs/build/doctrees/rst/post.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/structure.doctree b/docs/build/doctrees/rst/structure.doctree deleted file mode 100644 index 73473850..00000000 Binary files a/docs/build/doctrees/rst/structure.doctree and /dev/null differ diff --git a/docs/build/doctrees/rst/theory.doctree b/docs/build/doctrees/rst/theory.doctree deleted file mode 100644 index 096fdc6a..00000000 Binary files a/docs/build/doctrees/rst/theory.doctree and /dev/null differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo deleted file mode 100644 index acd7e905..00000000 --- a/docs/build/html/.buildinfo +++ /dev/null @@ -1,4 +0,0 @@ -# Sphinx build info version 1 -# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 8b636fd0f90ce03ce85756794396e940 -tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_images/advanced.png b/docs/build/html/_images/advanced.png deleted file mode 100644 index ac3b56ac..00000000 Binary files a/docs/build/html/_images/advanced.png and /dev/null differ diff --git a/docs/build/html/_images/advanced1.png b/docs/build/html/_images/advanced1.png deleted file mode 100644 index ac3b56ac..00000000 Binary files a/docs/build/html/_images/advanced1.png and /dev/null differ diff --git a/docs/build/html/_images/advanced2.png b/docs/build/html/_images/advanced2.png deleted file mode 100644 index f4898986..00000000 Binary files a/docs/build/html/_images/advanced2.png and /dev/null differ diff --git a/docs/build/html/_images/angle_centroids.png b/docs/build/html/_images/angle_centroids.png deleted file mode 100644 index 74020f0e..00000000 Binary files a/docs/build/html/_images/angle_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/angle_geometry.png b/docs/build/html/_images/angle_geometry.png deleted file mode 100644 index 50db319d..00000000 Binary files a/docs/build/html/_images/angle_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/angle_mesh.png b/docs/build/html/_images/angle_mesh.png deleted file mode 100644 index e85564a0..00000000 Binary files a/docs/build/html/_images/angle_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/bar_geometry.png b/docs/build/html/_images/bar_geometry.png deleted file mode 100644 index 5e637ab8..00000000 Binary files a/docs/build/html/_images/bar_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/bar_mesh.png b/docs/build/html/_images/bar_mesh.png deleted file mode 100644 index ba94fc66..00000000 Binary files a/docs/build/html/_images/bar_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/box1_geometry.png b/docs/build/html/_images/box1_geometry.png deleted file mode 100644 index a1077cef..00000000 Binary files a/docs/build/html/_images/box1_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/box1_mesh.png b/docs/build/html/_images/box1_mesh.png deleted file mode 100644 index c72540a3..00000000 Binary files a/docs/build/html/_images/box1_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/box_geometry.png b/docs/build/html/_images/box_geometry.png deleted file mode 100644 index db0b6c39..00000000 Binary files a/docs/build/html/_images/box_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/box_girder_geometry.png b/docs/build/html/_images/box_girder_geometry.png deleted file mode 100644 index c335f3a7..00000000 Binary files a/docs/build/html/_images/box_girder_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/box_girder_mesh.png b/docs/build/html/_images/box_girder_mesh.png deleted file mode 100644 index 752f996f..00000000 Binary files a/docs/build/html/_images/box_girder_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/box_mesh.png b/docs/build/html/_images/box_mesh.png deleted file mode 100644 index 1c8fa6ba..00000000 Binary files a/docs/build/html/_images/box_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/cee_geometry.png b/docs/build/html/_images/cee_geometry.png deleted file mode 100644 index 24446c63..00000000 Binary files a/docs/build/html/_images/cee_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/cee_mesh.png b/docs/build/html/_images/cee_mesh.png deleted file mode 100644 index 0c282b61..00000000 Binary files a/docs/build/html/_images/cee_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/chan1_geometry.png b/docs/build/html/_images/chan1_geometry.png deleted file mode 100644 index b64ffba2..00000000 Binary files a/docs/build/html/_images/chan1_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/chan1_mesh.png b/docs/build/html/_images/chan1_mesh.png deleted file mode 100644 index 9e3fe295..00000000 Binary files a/docs/build/html/_images/chan1_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/chan2_geometry.png b/docs/build/html/_images/chan2_geometry.png deleted file mode 100644 index 376502c5..00000000 Binary files a/docs/build/html/_images/chan2_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/chan2_mesh.png b/docs/build/html/_images/chan2_mesh.png deleted file mode 100644 index a4db62c5..00000000 Binary files a/docs/build/html/_images/chan2_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/chan_geometry.png b/docs/build/html/_images/chan_geometry.png deleted file mode 100644 index 66ec5855..00000000 Binary files a/docs/build/html/_images/chan_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/chan_mesh.png b/docs/build/html/_images/chan_mesh.png deleted file mode 100644 index b7dc9720..00000000 Binary files a/docs/build/html/_images/chan_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/chs_geometry.png b/docs/build/html/_images/chs_geometry.png deleted file mode 100644 index 8450f0c2..00000000 Binary files a/docs/build/html/_images/chs_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/chs_mesh.png b/docs/build/html/_images/chs_mesh.png deleted file mode 100644 index fe9e1656..00000000 Binary files a/docs/build/html/_images/chs_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/circle_geometry.png b/docs/build/html/_images/circle_geometry.png deleted file mode 100644 index 42f16a04..00000000 Binary files a/docs/build/html/_images/circle_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/circle_mesh.png b/docs/build/html/_images/circle_mesh.png deleted file mode 100644 index bd63c629..00000000 Binary files a/docs/build/html/_images/circle_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/composite_centroids.png b/docs/build/html/_images/composite_centroids.png deleted file mode 100644 index a0920722..00000000 Binary files a/docs/build/html/_images/composite_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/composite_geometry.png b/docs/build/html/_images/composite_geometry.png deleted file mode 100644 index d31d2c8b..00000000 Binary files a/docs/build/html/_images/composite_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/composite_mesh.png b/docs/build/html/_images/composite_mesh.png deleted file mode 100644 index 3e88b17d..00000000 Binary files a/docs/build/html/_images/composite_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/composite_mesh1.png b/docs/build/html/_images/composite_mesh1.png deleted file mode 100644 index 69921a87..00000000 Binary files a/docs/build/html/_images/composite_mesh1.png and /dev/null differ diff --git a/docs/build/html/_images/composite_stress_m.png b/docs/build/html/_images/composite_stress_m.png deleted file mode 100644 index 424fbc99..00000000 Binary files a/docs/build/html/_images/composite_stress_m.png and /dev/null differ diff --git a/docs/build/html/_images/composite_stress_n.png b/docs/build/html/_images/composite_stress_n.png deleted file mode 100644 index 07dba7cb..00000000 Binary files a/docs/build/html/_images/composite_stress_n.png and /dev/null differ diff --git a/docs/build/html/_images/composite_stress_v.png b/docs/build/html/_images/composite_stress_v.png deleted file mode 100644 index 1950fd46..00000000 Binary files a/docs/build/html/_images/composite_stress_v.png and /dev/null differ diff --git a/docs/build/html/_images/cross_geometry.png b/docs/build/html/_images/cross_geometry.png deleted file mode 100644 index 6d54a8ee..00000000 Binary files a/docs/build/html/_images/cross_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/cross_mesh.png b/docs/build/html/_images/cross_mesh.png deleted file mode 100644 index b0648aa4..00000000 Binary files a/docs/build/html/_images/cross_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/cruciform_geometry.png b/docs/build/html/_images/cruciform_geometry.png deleted file mode 100644 index fe31dfae..00000000 Binary files a/docs/build/html/_images/cruciform_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/cruciform_mesh.png b/docs/build/html/_images/cruciform_mesh.png deleted file mode 100644 index edfaea86..00000000 Binary files a/docs/build/html/_images/cruciform_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/custom_centroids.png b/docs/build/html/_images/custom_centroids.png deleted file mode 100644 index 0cfa1a4f..00000000 Binary files a/docs/build/html/_images/custom_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/custom_geometry.png b/docs/build/html/_images/custom_geometry.png deleted file mode 100644 index f2b1d71c..00000000 Binary files a/docs/build/html/_images/custom_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/custom_geometry1.png b/docs/build/html/_images/custom_geometry1.png deleted file mode 100644 index 4a3fd3be..00000000 Binary files a/docs/build/html/_images/custom_geometry1.png and /dev/null differ diff --git a/docs/build/html/_images/custom_mesh.png b/docs/build/html/_images/custom_mesh.png deleted file mode 100644 index b3f1b1f0..00000000 Binary files a/docs/build/html/_images/custom_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/custom_mesh1.png b/docs/build/html/_images/custom_mesh1.png deleted file mode 100644 index f9f92afe..00000000 Binary files a/docs/build/html/_images/custom_mesh1.png and /dev/null differ diff --git a/docs/build/html/_images/dbox_geometry.png b/docs/build/html/_images/dbox_geometry.png deleted file mode 100644 index 261ee19f..00000000 Binary files a/docs/build/html/_images/dbox_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/dbox_mesh.png b/docs/build/html/_images/dbox_mesh.png deleted file mode 100644 index 29e81bad..00000000 Binary files a/docs/build/html/_images/dbox_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/ehs_geometry.png b/docs/build/html/_images/ehs_geometry.png deleted file mode 100644 index 7d1bb131..00000000 Binary files a/docs/build/html/_images/ehs_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/ehs_mesh.png b/docs/build/html/_images/ehs_mesh.png deleted file mode 100644 index ffdcc918..00000000 Binary files a/docs/build/html/_images/ehs_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/ellipse_geometry.png b/docs/build/html/_images/ellipse_geometry.png deleted file mode 100644 index 864dc1f3..00000000 Binary files a/docs/build/html/_images/ellipse_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/ellipse_mesh.png b/docs/build/html/_images/ellipse_mesh.png deleted file mode 100644 index 127b11a7..00000000 Binary files a/docs/build/html/_images/ellipse_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/fcross_geometry.png b/docs/build/html/_images/fcross_geometry.png deleted file mode 100644 index 97be58cf..00000000 Binary files a/docs/build/html/_images/fcross_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/fcross_mesh.png b/docs/build/html/_images/fcross_mesh.png deleted file mode 100644 index 82dcd2df..00000000 Binary files a/docs/build/html/_images/fcross_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/frame_graph.png b/docs/build/html/_images/frame_graph.png deleted file mode 100644 index 3148ce3f..00000000 Binary files a/docs/build/html/_images/frame_graph.png and /dev/null differ diff --git a/docs/build/html/_images/gbox_geometry.png b/docs/build/html/_images/gbox_geometry.png deleted file mode 100644 index 4be70fb0..00000000 Binary files a/docs/build/html/_images/gbox_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/gbox_mesh.png b/docs/build/html/_images/gbox_mesh.png deleted file mode 100644 index f094e6d2..00000000 Binary files a/docs/build/html/_images/gbox_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/h_geometry.png b/docs/build/html/_images/h_geometry.png deleted file mode 100644 index 03ebe60f..00000000 Binary files a/docs/build/html/_images/h_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/h_mesh.png b/docs/build/html/_images/h_mesh.png deleted file mode 100644 index 385fcb8c..00000000 Binary files a/docs/build/html/_images/h_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/hat1_geometry.png b/docs/build/html/_images/hat1_geometry.png deleted file mode 100644 index 491e99b9..00000000 Binary files a/docs/build/html/_images/hat1_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/hat1_mesh.png b/docs/build/html/_images/hat1_mesh.png deleted file mode 100644 index 3284f20d..00000000 Binary files a/docs/build/html/_images/hat1_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/hat_geometry.png b/docs/build/html/_images/hat_geometry.png deleted file mode 100644 index ab0676d8..00000000 Binary files a/docs/build/html/_images/hat_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/hat_mesh.png b/docs/build/html/_images/hat_mesh.png deleted file mode 100644 index f52c5b3e..00000000 Binary files a/docs/build/html/_images/hat_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/hexa_geometry.png b/docs/build/html/_images/hexa_geometry.png deleted file mode 100644 index 62815175..00000000 Binary files a/docs/build/html/_images/hexa_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/hexa_mesh.png b/docs/build/html/_images/hexa_mesh.png deleted file mode 100644 index 93bc995e..00000000 Binary files a/docs/build/html/_images/hexa_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/i1_geometry.png b/docs/build/html/_images/i1_geometry.png deleted file mode 100644 index 376a9644..00000000 Binary files a/docs/build/html/_images/i1_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/i1_mesh.png b/docs/build/html/_images/i1_mesh.png deleted file mode 100644 index 8ae714d5..00000000 Binary files a/docs/build/html/_images/i1_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/isection_geometry.png b/docs/build/html/_images/isection_geometry.png deleted file mode 100644 index 62908350..00000000 Binary files a/docs/build/html/_images/isection_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/isection_mesh.png b/docs/build/html/_images/isection_mesh.png deleted file mode 100644 index f19ce63b..00000000 Binary files a/docs/build/html/_images/isection_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/l_geometry.png b/docs/build/html/_images/l_geometry.png deleted file mode 100644 index b146c5b8..00000000 Binary files a/docs/build/html/_images/l_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/l_mesh.png b/docs/build/html/_images/l_mesh.png deleted file mode 100644 index 651eda8d..00000000 Binary files a/docs/build/html/_images/l_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/logo.png b/docs/build/html/_images/logo.png deleted file mode 100644 index a2ffa652..00000000 Binary files a/docs/build/html/_images/logo.png and /dev/null differ diff --git a/docs/build/html/_images/merged_centroids.png b/docs/build/html/_images/merged_centroids.png deleted file mode 100644 index 97e2d3c6..00000000 Binary files a/docs/build/html/_images/merged_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/merged_geometry.png b/docs/build/html/_images/merged_geometry.png deleted file mode 100644 index 363e056d..00000000 Binary files a/docs/build/html/_images/merged_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/merged_geometry1.png b/docs/build/html/_images/merged_geometry1.png deleted file mode 100644 index 5bac6209..00000000 Binary files a/docs/build/html/_images/merged_geometry1.png and /dev/null differ diff --git a/docs/build/html/_images/merged_mesh.png b/docs/build/html/_images/merged_mesh.png deleted file mode 100644 index 8c02bcbf..00000000 Binary files a/docs/build/html/_images/merged_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/merged_mesh1.png b/docs/build/html/_images/merged_mesh1.png deleted file mode 100644 index 807903b4..00000000 Binary files a/docs/build/html/_images/merged_mesh1.png and /dev/null differ diff --git a/docs/build/html/_images/mirr_rot_centroids.png b/docs/build/html/_images/mirr_rot_centroids.png deleted file mode 100644 index d09ab6b6..00000000 Binary files a/docs/build/html/_images/mirr_rot_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/mirr_rot_geometry.png b/docs/build/html/_images/mirr_rot_geometry.png deleted file mode 100644 index eedcb9c4..00000000 Binary files a/docs/build/html/_images/mirr_rot_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/mirr_rot_mesh.png b/docs/build/html/_images/mirr_rot_mesh.png deleted file mode 100644 index 4e9e1511..00000000 Binary files a/docs/build/html/_images/mirr_rot_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/monoisection_geometry.png b/docs/build/html/_images/monoisection_geometry.png deleted file mode 100644 index 24a62efe..00000000 Binary files a/docs/build/html/_images/monoisection_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/monoisection_mesh.png b/docs/build/html/_images/monoisection_mesh.png deleted file mode 100644 index c79c9f01..00000000 Binary files a/docs/build/html/_images/monoisection_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/ni_geometry.png b/docs/build/html/_images/ni_geometry.png deleted file mode 100644 index e4457713..00000000 Binary files a/docs/build/html/_images/ni_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/ni_mesh.png b/docs/build/html/_images/ni_mesh.png deleted file mode 100644 index a5e2bc88..00000000 Binary files a/docs/build/html/_images/ni_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/pfc_centroids.png b/docs/build/html/_images/pfc_centroids.png deleted file mode 100644 index aa2bfb22..00000000 Binary files a/docs/build/html/_images/pfc_centroids.png and /dev/null differ diff --git a/docs/build/html/_images/pfc_geometry.png b/docs/build/html/_images/pfc_geometry.png deleted file mode 100644 index ae14cc48..00000000 Binary files a/docs/build/html/_images/pfc_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/pfc_mesh.png b/docs/build/html/_images/pfc_mesh.png deleted file mode 100644 index 8d205e51..00000000 Binary files a/docs/build/html/_images/pfc_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/polygon_geometry.png b/docs/build/html/_images/polygon_geometry.png deleted file mode 100644 index 159975f2..00000000 Binary files a/docs/build/html/_images/polygon_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/polygon_mesh.png b/docs/build/html/_images/polygon_mesh.png deleted file mode 100644 index 792175b9..00000000 Binary files a/docs/build/html/_images/polygon_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/rectangle_geometry.png b/docs/build/html/_images/rectangle_geometry.png deleted file mode 100644 index 21badcb1..00000000 Binary files a/docs/build/html/_images/rectangle_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/rectangle_mesh.png b/docs/build/html/_images/rectangle_mesh.png deleted file mode 100644 index ea25e792..00000000 Binary files a/docs/build/html/_images/rectangle_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/rhs_geometry.png b/docs/build/html/_images/rhs_geometry.png deleted file mode 100644 index 29316153..00000000 Binary files a/docs/build/html/_images/rhs_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/rhs_mesh.png b/docs/build/html/_images/rhs_mesh.png deleted file mode 100644 index f2bfbcb0..00000000 Binary files a/docs/build/html/_images/rhs_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/rod_geometry.png b/docs/build/html/_images/rod_geometry.png deleted file mode 100644 index 40ae598d..00000000 Binary files a/docs/build/html/_images/rod_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/rod_mesh.png b/docs/build/html/_images/rod_mesh.png deleted file mode 100644 index 0a174c6d..00000000 Binary files a/docs/build/html/_images/rod_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/stress_m.png b/docs/build/html/_images/stress_m.png deleted file mode 100644 index 688bc6df..00000000 Binary files a/docs/build/html/_images/stress_m.png and /dev/null differ diff --git a/docs/build/html/_images/stress_m11_zz.png b/docs/build/html/_images/stress_m11_zz.png deleted file mode 100644 index 53585b79..00000000 Binary files a/docs/build/html/_images/stress_m11_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_m22_zz.png b/docs/build/html/_images/stress_m22_zz.png deleted file mode 100644 index 3f30108d..00000000 Binary files a/docs/build/html/_images/stress_m22_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_m_zz.png b/docs/build/html/_images/stress_m_zz.png deleted file mode 100644 index 82dc986b..00000000 Binary files a/docs/build/html/_images/stress_m_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_mxx_zz.png b/docs/build/html/_images/stress_mxx_zz.png deleted file mode 100644 index 41f65389..00000000 Binary files a/docs/build/html/_images/stress_mxx_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_myy_zz.png b/docs/build/html/_images/stress_myy_zz.png deleted file mode 100644 index 3528b3ce..00000000 Binary files a/docs/build/html/_images/stress_myy_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_mzz.png b/docs/build/html/_images/stress_mzz.png deleted file mode 100644 index fa41d860..00000000 Binary files a/docs/build/html/_images/stress_mzz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_mzz_zx.png b/docs/build/html/_images/stress_mzz_zx.png deleted file mode 100644 index 9c220114..00000000 Binary files a/docs/build/html/_images/stress_mzz_zx.png and /dev/null differ diff --git a/docs/build/html/_images/stress_mzz_zxy.png b/docs/build/html/_images/stress_mzz_zxy.png deleted file mode 100644 index 8923ceb8..00000000 Binary files a/docs/build/html/_images/stress_mzz_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_mzz_zy.png b/docs/build/html/_images/stress_mzz_zy.png deleted file mode 100644 index 1d4b2bb0..00000000 Binary files a/docs/build/html/_images/stress_mzz_zy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_n_zz.png b/docs/build/html/_images/stress_n_zz.png deleted file mode 100644 index 5e83c128..00000000 Binary files a/docs/build/html/_images/stress_n_zz.png and /dev/null differ diff --git a/docs/build/html/_images/stress_v.png b/docs/build/html/_images/stress_v.png deleted file mode 100644 index add1ffc0..00000000 Binary files a/docs/build/html/_images/stress_v.png and /dev/null differ diff --git a/docs/build/html/_images/stress_v_zx.png b/docs/build/html/_images/stress_v_zx.png deleted file mode 100644 index d4325a5b..00000000 Binary files a/docs/build/html/_images/stress_v_zx.png and /dev/null differ diff --git a/docs/build/html/_images/stress_v_zxy.png b/docs/build/html/_images/stress_v_zxy.png deleted file mode 100644 index d1cf32c5..00000000 Binary files a/docs/build/html/_images/stress_v_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_v_zy.png b/docs/build/html/_images/stress_v_zy.png deleted file mode 100644 index fdd62413..00000000 Binary files a/docs/build/html/_images/stress_v_zy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vm.png b/docs/build/html/_images/stress_vm.png deleted file mode 100644 index 668334ad..00000000 Binary files a/docs/build/html/_images/stress_vm.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vm1.png b/docs/build/html/_images/stress_vm1.png deleted file mode 100644 index 0bc637f6..00000000 Binary files a/docs/build/html/_images/stress_vm1.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vm2.png b/docs/build/html/_images/stress_vm2.png deleted file mode 100644 index a10c0d91..00000000 Binary files a/docs/build/html/_images/stress_vm2.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vx_zx.png b/docs/build/html/_images/stress_vx_zx.png deleted file mode 100644 index dd392f93..00000000 Binary files a/docs/build/html/_images/stress_vx_zx.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vx_zxy.png b/docs/build/html/_images/stress_vx_zxy.png deleted file mode 100644 index f53db2a2..00000000 Binary files a/docs/build/html/_images/stress_vx_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vx_zy.png b/docs/build/html/_images/stress_vx_zy.png deleted file mode 100644 index 3b89f0b3..00000000 Binary files a/docs/build/html/_images/stress_vx_zy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vy_zx.png b/docs/build/html/_images/stress_vy_zx.png deleted file mode 100644 index c13569c1..00000000 Binary files a/docs/build/html/_images/stress_vy_zx.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vy_zxy.png b/docs/build/html/_images/stress_vy_zxy.png deleted file mode 100644 index ef8a4aab..00000000 Binary files a/docs/build/html/_images/stress_vy_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_vy_zy.png b/docs/build/html/_images/stress_vy_zy.png deleted file mode 100644 index 9943dc52..00000000 Binary files a/docs/build/html/_images/stress_vy_zy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_zx.png b/docs/build/html/_images/stress_zx.png deleted file mode 100644 index d57b5487..00000000 Binary files a/docs/build/html/_images/stress_zx.png and /dev/null differ diff --git a/docs/build/html/_images/stress_zxy.png b/docs/build/html/_images/stress_zxy.png deleted file mode 100644 index 9122f310..00000000 Binary files a/docs/build/html/_images/stress_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_zy.png b/docs/build/html/_images/stress_zy.png deleted file mode 100644 index c9232692..00000000 Binary files a/docs/build/html/_images/stress_zy.png and /dev/null differ diff --git a/docs/build/html/_images/stress_zz.png b/docs/build/html/_images/stress_zz.png deleted file mode 100644 index a5f86a23..00000000 Binary files a/docs/build/html/_images/stress_zz.png and /dev/null differ diff --git a/docs/build/html/_images/t1_geometry.png b/docs/build/html/_images/t1_geometry.png deleted file mode 100644 index 83578fa0..00000000 Binary files a/docs/build/html/_images/t1_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/t1_mesh.png b/docs/build/html/_images/t1_mesh.png deleted file mode 100644 index 2aaa6b71..00000000 Binary files a/docs/build/html/_images/t1_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/t2_geometry.png b/docs/build/html/_images/t2_geometry.png deleted file mode 100644 index e8ef838d..00000000 Binary files a/docs/build/html/_images/t2_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/t2_mesh.png b/docs/build/html/_images/t2_mesh.png deleted file mode 100644 index 38ecebb7..00000000 Binary files a/docs/build/html/_images/t2_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/t_geometry.png b/docs/build/html/_images/t_geometry.png deleted file mode 100644 index 3d389791..00000000 Binary files a/docs/build/html/_images/t_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/t_mesh.png b/docs/build/html/_images/t_mesh.png deleted file mode 100644 index c5ff8ced..00000000 Binary files a/docs/build/html/_images/t_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/taperedchannel_geometry.png b/docs/build/html/_images/taperedchannel_geometry.png deleted file mode 100644 index 5065cea9..00000000 Binary files a/docs/build/html/_images/taperedchannel_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/taperedchannel_mesh.png b/docs/build/html/_images/taperedchannel_mesh.png deleted file mode 100644 index 5cde9f53..00000000 Binary files a/docs/build/html/_images/taperedchannel_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/taperedisection_geometry.png b/docs/build/html/_images/taperedisection_geometry.png deleted file mode 100644 index 40c699c8..00000000 Binary files a/docs/build/html/_images/taperedisection_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/taperedisection_mesh.png b/docs/build/html/_images/taperedisection_mesh.png deleted file mode 100644 index 73c7b9fd..00000000 Binary files a/docs/build/html/_images/taperedisection_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/tee_geometry.png b/docs/build/html/_images/tee_geometry.png deleted file mode 100644 index 89306a91..00000000 Binary files a/docs/build/html/_images/tee_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/tee_mesh.png b/docs/build/html/_images/tee_mesh.png deleted file mode 100644 index b8971196..00000000 Binary files a/docs/build/html/_images/tee_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/tube2_geometry.png b/docs/build/html/_images/tube2_geometry.png deleted file mode 100644 index b1681947..00000000 Binary files a/docs/build/html/_images/tube2_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/tube2_mesh.png b/docs/build/html/_images/tube2_mesh.png deleted file mode 100644 index 96ecc929..00000000 Binary files a/docs/build/html/_images/tube2_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/tube_geometry.png b/docs/build/html/_images/tube_geometry.png deleted file mode 100644 index b1681947..00000000 Binary files a/docs/build/html/_images/tube_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/tube_mesh.png b/docs/build/html/_images/tube_mesh.png deleted file mode 100644 index 96ecc929..00000000 Binary files a/docs/build/html/_images/tube_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/vector_mzz_zxy.png b/docs/build/html/_images/vector_mzz_zxy.png deleted file mode 100644 index 18af895e..00000000 Binary files a/docs/build/html/_images/vector_mzz_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/vector_v_zxy.png b/docs/build/html/_images/vector_v_zxy.png deleted file mode 100644 index 2eea1ddb..00000000 Binary files a/docs/build/html/_images/vector_v_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/vector_vx_zxy.png b/docs/build/html/_images/vector_vx_zxy.png deleted file mode 100644 index 2aa04011..00000000 Binary files a/docs/build/html/_images/vector_vx_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/vector_vy_zxy.png b/docs/build/html/_images/vector_vy_zxy.png deleted file mode 100644 index 0bfa8ee1..00000000 Binary files a/docs/build/html/_images/vector_vy_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/vector_zxy.png b/docs/build/html/_images/vector_zxy.png deleted file mode 100644 index 08fe12a0..00000000 Binary files a/docs/build/html/_images/vector_zxy.png and /dev/null differ diff --git a/docs/build/html/_images/z_geometry.png b/docs/build/html/_images/z_geometry.png deleted file mode 100644 index 727aa11f..00000000 Binary files a/docs/build/html/_images/z_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/z_mesh.png b/docs/build/html/_images/z_mesh.png deleted file mode 100644 index ad568037..00000000 Binary files a/docs/build/html/_images/z_mesh.png and /dev/null differ diff --git a/docs/build/html/_images/zed_geometry.png b/docs/build/html/_images/zed_geometry.png deleted file mode 100644 index 3a73817a..00000000 Binary files a/docs/build/html/_images/zed_geometry.png and /dev/null differ diff --git a/docs/build/html/_images/zed_mesh.png b/docs/build/html/_images/zed_mesh.png deleted file mode 100644 index 65205548..00000000 Binary files a/docs/build/html/_images/zed_mesh.png and /dev/null differ diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html deleted file mode 100644 index b30b670f..00000000 --- a/docs/build/html/_modules/index.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -
- - - - -
-import copy
-import numpy as np
-from scipy.sparse import csc_matrix, coo_matrix, linalg
-from scipy.optimize import brentq
-import matplotlib.pyplot as plt
-import matplotlib.tri as tri
-import matplotlib.cm as cm
-import matplotlib.patches as mpatches
-from matplotlib.colors import ListedColormap
-import meshpy.triangle as triangle
-import sectionproperties.pre.pre as pre
-import sectionproperties.analysis.fea as fea
-import sectionproperties.analysis.solver as solver
-import sectionproperties.post.post as post
-
-
-[docs]class CrossSection:
- """Class for structural cross-sections.
-
- Stores the finite element geometry, mesh and material information and provides methods to
- compute the cross-section properties. The element type used in this program is the six-noded
- quadratic triangular element.
-
- The constructor extracts information from the provided mesh object and creates and stores the
- corresponding Tri6 finite element objects.
-
- :param geometry: Cross-section geometry object used to generate the mesh
- :type geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :param mesh: Mesh object returned by meshpy
- :type mesh: :class:`meshpy.triangle.MeshInfo`
- :param materials: A list of material properties corresponding to various regions in the
- geometry and mesh. Note that if materials are specified, the number of material objects
- ust equal the number of regions in the geometry. If no materials are specified, only a
- purely geometric analysis can take place, and all regions will be assigned a default
- material with an elastic modulus and yield strength equal to 1, and a Poisson's ratio
- equal to 0.
- :type materials: list[:class:`~sectionproperties.pre.pre.Material`]
- :param bool time_info: If set to True, a detailed description of the computation and the time
- cost is printed to the terminal.
-
- The following example creates a :class:`~sectionproperties.analysis.cross_section.CrossSection`
- object of a 100D x 50W rectangle using a mesh size of 5::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.RectangularSection(d=100, b=50)
- mesh = geometry.create_mesh(mesh_sizes=[5])
- section = CrossSection(geometry, mesh)
-
- The following example creates a 100D x 50W rectangle, with the top half of the section
- comprised of timber and the bottom half steel. The timber section is meshed with a maximum area
- of 10 and the steel section mesh with a maximum area of 5::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.pre.pre import Material
- from sectionproperties.analysis.cross_section import CrossSection
-
- geom_steel = sections.RectangularSection(d=50, b=50)
- geom_timber = sections.RectangularSection(d=50, b=50, shift=[0, 50])
- geometry = sections.MergedSection([geom_steel, geom_timber])
- geometry.clean_geometry()
-
- mesh = geometry.create_mesh(mesh_sizes=[5, 10])
-
- steel = Material(name='Steel', elastic_modulus=200e3, poissons_ratio=0.3,
- yield_strength=250, color='grey'
- )
- timber = Material(name='Timber', elastic_modulus=8e3, poissons_ratio=0.35,
- yield_strength=20, color='burlywood'
- )
-
- section = CrossSection(geometry, mesh, [steel, timber])
- section.plot_mesh(materials=True, alpha=0.5)
-
- :cvar elements: List of finite element objects describing the cross-section mesh
- :vartype elements: list[:class:`~sectionproperties.analysis.fea.Tri6`]
- :cvar int num_nodes: Number of nodes in the finite element mesh
- :cvar geometry: Cross-section geometry object used to generate the mesh
- :vartype geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :cvar mesh: Mesh object returned by meshpy
- :vartype mesh: :class:`meshpy.triangle.MeshInfo`
- :cvar mesh_nodes: Array of node coordinates from the mesh
- :vartype mesh_nodes: :class:`numpy.ndarray`
- :cvar mesh_elements: Array of connectivities from the mesh
- :vartype mesh_elements: :class:`numpy.ndarray`
- :cvar mesh_attributes: Array of attributes from the mesh
- :vartype mesh_attributes: :class:`numpy.ndarray`
- :cvar materials: List of materials
- :type materials: list[:class:`~sectionproperties.pre.pre.Material`]
- :cvar material_groups: List of objects containing the elements in each defined material
- :type materials_groups: list[:class:`~sectionproperties.pre.pre.MaterialGroup`]
- :cvar section_props: Class to store calculated section properties
- :vartype section_props: :class:`~sectionproperties.analysis.cross_section.SectionProperties`
-
- :raises AssertionError: If the number of materials does not equal the number of regions
- """
-
- def __init__(self, geometry, mesh, materials=None, time_info=False):
- """Inits the CrossSection class."""
-
- def init():
- self.geometry = geometry # save geometry data
-
- # extract mesh data
- nodes = np.array(mesh.points, dtype=np.dtype(float))
- elements = np.array(mesh.elements, dtype=np.dtype(int))
- attributes = np.array(mesh.element_attributes, dtype=np.dtype(int))
-
- # swap mid-node order to retain node ordering consistency
- elements[:, [3, 4, 5]] = elements[:, [5, 3, 4]]
-
- # save total number of nodes in mesh
- self.num_nodes = len(nodes)
-
- # initialise material_sections variable
- self.material_groups = []
-
- # if materials are specified, check that the right number of material properties are
- # specified and then populate material_groups list
- if materials is not None:
- str = "Number of materials ({0}), ".format(len(materials))
- str += "should match the number of regions ({0}).".format(
- max(attributes) + 1)
- assert(len(materials) == max(attributes) + 1), str
-
- # add a MaterialGroup object to the material_groups list for each uniquely
- # encountered material
- for (i, material) in enumerate(materials):
- # add the first material to the list
- if i == 0:
- self.material_groups.append(MaterialGroup(material, self.num_nodes))
- else:
- # if the material hasn't been encountered
- if material not in materials[:i]:
- self.material_groups.append(MaterialGroup(material, self.num_nodes))
- # if there are no materials defined, add only the default material
- else:
- default_material = pre.Material('default', 1, 0, 1)
- self.material_groups.append(MaterialGroup(default_material, self.num_nodes))
-
- self.materials = materials # save the input materials list
-
- self.elements = [] # initialise list holding all element objects
-
- # build the mesh one element at a time
- for (i, node_ids) in enumerate(elements):
- x1 = nodes[node_ids[0]][0]
- y1 = nodes[node_ids[0]][1]
- x2 = nodes[node_ids[1]][0]
- y2 = nodes[node_ids[1]][1]
- x3 = nodes[node_ids[2]][0]
- y3 = nodes[node_ids[2]][1]
- x4 = nodes[node_ids[3]][0]
- y4 = nodes[node_ids[3]][1]
- x5 = nodes[node_ids[4]][0]
- y5 = nodes[node_ids[4]][1]
- x6 = nodes[node_ids[5]][0]
- y6 = nodes[node_ids[5]][1]
-
- # create a list containing the vertex and mid-node coordinates
- coords = np.array([[x1, x2, x3, x4, x5, x6], [y1, y2, y3, y4, y5, y6]])
-
- # if materials are specified, get the material
- if materials is not None:
- # get attribute index of current element
- att_el = attributes[i]
-
- # fetch the material
- material = materials[att_el]
- # if there are no materials specified, use a default material
- else:
- material = default_material
-
- # add tri6 elements to the mesh
- new_element = fea.Tri6(i, coords, node_ids, material)
- self.elements.append(new_element)
-
- # add element to relevant MaterialGroup
- for group in self.material_groups:
- if material is group.material:
- group.add_element(new_element)
- break
-
- # save mesh input
- self.mesh = mesh
- self.mesh_nodes = nodes
- self.mesh_elements = elements
- self.mesh_attributes = attributes
-
- # initialise class storing section properties
- self.section_props = SectionProperties()
-
- if time_info:
- text = "--Initialising the CrossSection class..."
- solver.function_timer(text, init)
- print("")
- else:
- init()
-
-[docs] def calculate_geometric_properties(self, time_info=False):
- """Calculates the geometric properties of the cross-section and stores them in the
- :class:`~sectionproperties.analysis.cross_section.SectionProperties` object contained in
- the ``section_props`` class variable.
-
- :param bool time_info: If set to True, a detailed description of the computation and the
- time cost is printed to the terminal.
-
- The following geometric section properties are calculated:
-
- * Cross-sectional area
- * Cross-sectional perimeter
- * Modulus weighted area (axial rigidity)
- * First moments of area
- * Second moments of area about the global axis
- * Second moments of area about the centroidal axis
- * Elastic centroid
- * Centroidal section moduli
- * Radii of gyration
- * Principal axis properties
-
- If materials are specified for the cross-section, the moments of area and section moduli
- are elastic modulus weighted.
-
- The following example demonstrates the use of this method::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- """
-
- def calculate_geom():
- # initialise properties
- self.section_props.area = 0
- self.section_props.perimeter = 0
- self.section_props.ea = 0
- self.section_props.ga = 0
- self.section_props.qx = 0
- self.section_props.qy = 0
- self.section_props.ixx_g = 0
- self.section_props.iyy_g = 0
- self.section_props.ixy_g = 0
-
- # caclulate perimeter
- self.section_props.perimeter = self.geometry.calculate_perimeter()
-
- # calculate global geometric properties
- for el in self.elements:
- (area, qx, qy, ixx_g, iyy_g, ixy_g, e, g) = el.geometric_properties()
-
- self.section_props.area += area
- self.section_props.ea += area * e
- self.section_props.ga += area * g
- self.section_props.qx += qx * e
- self.section_props.qy += qy * e
- self.section_props.ixx_g += ixx_g * e
- self.section_props.iyy_g += iyy_g * e
- self.section_props.ixy_g += ixy_g * e
-
- self.section_props.nu_eff = self.section_props.ea / (2 * self.section_props.ga) - 1
- self.section_props.calculate_elastic_centroid()
- self.section_props.calculate_centroidal_properties(self.mesh)
-
- if time_info:
- text = "--Calculating geometric section properties..."
- solver.function_timer(text, calculate_geom)
- print("")
- else:
- calculate_geom()
-
-[docs] def calculate_warping_properties(self, time_info=False, solver_type='direct'):
- """Calculates all the warping properties of the cross-section and stores them in the
- :class:`~sectionproperties.analysis.cross_section.SectionProperties` object contained in
- the ``section_props`` class variable.
-
- :param bool time_info: If set to True, a detailed description of the computation and the
- time cost is printed to the terminal.
- :param string solver_type: Solver used for solving systems of linear equations, either
- using the *'direct'* method or *'cgs'* iterative method
-
- The following warping section properties are calculated:
-
- * Torsion constant
- * Shear centre
- * Shear area
- * Warping constant
- * Monosymmetry constant
-
- If materials are specified, the values calculated for the torsion constant, warping
- constant and shear area are elastic modulus weighted.
-
- Note that the geometric properties must be calculated first for the calculation of the
- warping properties to be correct::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
-
- :raises RuntimeError: If the geometric properties have not been
- calculated prior to calling this method
- """
-
- # check that a geometric analysis has been performed
- if None in [self.section_props.area, self.section_props.ixx_c, self.section_props.cx]:
- err = "Cacluate geometric properties before performing a warping analysis."
- raise RuntimeError(err)
-
- # create a new CrossSection with the origin shifted to the centroid for calculation of the
- # warping properties such that the Lagrangian multiplier approach can be utilised
- warping_section = CrossSection(self.geometry, self.mesh, self.materials)
-
- # shift the coordinates of each element N.B. the mesh class attribute remains unshifted!
- for el in warping_section.elements:
- el.coords[0, :] -= self.section_props.cx
- el.coords[1, :] -= self.section_props.cy
-
- # assemble stiffness matrix and load vector for warping function
- if time_info:
- text = "--Assembing {0}x{0} stiffness matrix and load vector...".format(self.num_nodes)
- (k, k_lg, f_torsion) = solver.function_timer(text, warping_section.assemble_torsion)
- else:
- (k, k_lg, f_torsion) = warping_section.assemble_torsion()
-
- # ILU decomposition of stiffness matrices
- def ilu_decomp():
- # ILU decomposition on regular stiffness matrix
- k_precond = linalg.LinearOperator(
- (self.num_nodes, self.num_nodes), linalg.spilu(k).solve
- )
-
- # ILU decomposition on Lagrangian stiffness matrix
- k_lg_precond = linalg.LinearOperator(
- (self.num_nodes + 1, self.num_nodes + 1), linalg.spilu(k_lg).solve
- )
-
- return (k_precond, k_lg_precond)
-
- # if the cgs method is used, perform ILU decomposition
- if solver_type == 'cgs':
- if time_info:
- text = "--Performing ILU decomposition on the stiffness matrices..."
- (k_precond, k_lg_precond) = solver.function_timer(text, ilu_decomp)
- else:
- (k_precond, k_lg_precond) = ilu_decomp()
-
- # solve for warping function
- def solve_warping():
- if solver_type == 'cgs':
- omega = solver.solve_cgs(k, f_torsion, k_precond)
- elif solver_type == 'direct':
- omega = solver.solve_direct(k, f_torsion)
-
- return omega
-
- if time_info:
- text = "--Solving for the warping function using the {0} solver...".format(solver_type)
- omega = solver.function_timer(text, solve_warping)
- else:
- omega = solve_warping()
-
- # save the warping function
- self.section_props.omega = omega
-
- # determine the torsion constant
- def j_func():
- return (
- self.section_props.ixx_c + self.section_props.iyy_c -
- omega.dot(k.dot(np.transpose(omega)))
- )
-
- if time_info:
- text = "--Computing the torsion constant..."
- self.section_props.j = solver.function_timer(text, j_func)
- else:
- self.section_props.j = j_func()
-
- # assemble shear function load vectors
- def assemble_shear_load():
- f_psi = np.zeros(self.num_nodes)
- f_phi = np.zeros(self.num_nodes)
-
- for el in warping_section.elements:
- (f_psi_el, f_phi_el) = el.shear_load_vectors(
- self.section_props.ixx_c, self.section_props.iyy_c,
- self.section_props.ixy_c, self.section_props.nu_eff)
- f_psi[el.node_ids] += f_psi_el
- f_phi[el.node_ids] += f_phi_el
-
- return (f_psi, f_phi)
-
- if time_info:
- text = "--Assembling shear function load vectors..."
- (f_psi, f_phi) = solver.function_timer(text, assemble_shear_load)
- else:
- (f_psi, f_phi) = assemble_shear_load()
-
- # solve for shear functions psi and phi
- def solve_shear_functions():
- if solver_type == 'cgs':
- psi_shear = solver.solve_cgs_lagrange(k_lg, f_psi, m=k_lg_precond)
- phi_shear = solver.solve_cgs_lagrange(k_lg, f_phi, m=k_lg_precond)
- elif solver_type == 'direct':
- psi_shear = solver.solve_direct_lagrange(k_lg, f_psi)
- phi_shear = solver.solve_direct_lagrange(k_lg, f_phi)
-
- return (psi_shear, phi_shear)
-
- if time_info:
- text = "--Solving for the shear functions using the {0} solver...".format(solver_type)
- (psi_shear, phi_shear) = solver.function_timer(text, solve_shear_functions)
- else:
- (psi_shear, phi_shear) = solve_shear_functions()
-
- # save the shear functions
- self.section_props.psi_shear = psi_shear
- self.section_props.phi_shear = phi_shear
-
- # assemble shear centre and warping moment integrals
- def assemle_sc_warping_integrals():
- sc_xint = 0
- sc_yint = 0
- q_omega = 0
- i_omega = 0
- i_xomega = 0
- i_yomega = 0
-
- for el in warping_section.elements:
- (sc_xint_el, sc_yint_el, q_omega_el, i_omega_el, i_xomega_el,
- i_yomega_el) = el.shear_warping_integrals(
- self.section_props.ixx_c, self.section_props.iyy_c,
- self.section_props.ixy_c, omega[el.node_ids]
- )
-
- sc_xint += sc_xint_el
- sc_yint += sc_yint_el
- q_omega += q_omega_el
- i_omega += i_omega_el
- i_xomega += i_xomega_el
- i_yomega += i_yomega_el
-
- return (sc_xint, sc_yint, q_omega, i_omega, i_xomega, i_yomega)
-
- if time_info:
- text = "--Assembling shear centre and warping moment integrals..."
- (sc_xint, sc_yint, q_omega, i_omega, i_xomega, i_yomega) = (
- solver.function_timer(text, assemle_sc_warping_integrals))
- else:
- (sc_xint, sc_yint, q_omega, i_omega, i_xomega, i_yomega) = (
- assemle_sc_warping_integrals())
-
- # calculate shear centres
- def shear_centres():
- # calculate shear centres (elasticity approach)
- Delta_s = (
- 2 * (1 + self.section_props.nu_eff) * (
- self.section_props.ixx_c * self.section_props.iyy_c -
- self.section_props.ixy_c ** 2)
- )
- x_se = (
- (1 / Delta_s) * ((self.section_props.nu_eff / 2 *
- sc_xint) - f_torsion.dot(phi_shear))
- )
- y_se = (
- (1 / Delta_s) * ((self.section_props.nu_eff / 2 *
- sc_yint) + f_torsion.dot(psi_shear))
- )
- (x11_se, y22_se) = fea.principal_coordinate(self.section_props.phi, x_se, y_se)
-
- # calculate shear centres (Trefftz's approach)
- x_st = (
- (self.section_props.ixy_c * i_xomega - self.section_props.iyy_c * i_yomega) / (
- self.section_props.ixx_c * self.section_props.iyy_c -
- self.section_props.ixy_c ** 2)
- )
- y_st = (
- (self.section_props.ixx_c * i_xomega - self.section_props.ixy_c * i_yomega) / (
- self.section_props.ixx_c * self.section_props.iyy_c -
- self.section_props.ixy_c ** 2)
- )
-
- return (Delta_s, x_se, y_se, x11_se, y22_se, x_st, y_st)
-
- if time_info:
- text = "--Calculating shear centres..."
- (Delta_s, x_se, y_se, x11_se, y22_se, x_st, y_st) = solver.function_timer(
- text, shear_centres)
- else:
- (Delta_s, x_se, y_se, x11_se, y22_se, x_st, y_st) = shear_centres()
-
- # save shear centres
- self.section_props.Delta_s = Delta_s
- self.section_props.x_se = x_se
- self.section_props.y_se = y_se
- self.section_props.x11_se = x11_se
- self.section_props.y22_se = y22_se
- self.section_props.x_st = x_st
- self.section_props.y_st = y_st
-
- # calculate warping constant
- self.section_props.gamma = (
- i_omega - q_omega ** 2 / self.section_props.ea - y_se * i_xomega + x_se * i_yomega
- )
-
- def assemble_shear_deformation():
- # assemble shear deformation coefficients
- kappa_x = 0
- kappa_y = 0
- kappa_xy = 0
-
- for el in warping_section.elements:
- (kappa_x_el, kappa_y_el, kappa_xy_el) = el.shear_coefficients(
- self.section_props.ixx_c, self.section_props.iyy_c,
- self.section_props.ixy_c, psi_shear[el.node_ids], phi_shear[el.node_ids],
- self.section_props.nu_eff
- )
-
- kappa_x += kappa_x_el
- kappa_y += kappa_y_el
- kappa_xy += kappa_xy_el
-
- return (kappa_x, kappa_y, kappa_xy)
-
- if time_info:
- text = "--Assembling shear deformation coefficients..."
- (kappa_x, kappa_y, kappa_xy) = solver.function_timer(text, assemble_shear_deformation)
- else:
- (kappa_x, kappa_y, kappa_xy) = assemble_shear_deformation()
-
- # calculate shear areas wrt global axis
- self.section_props.A_sx = Delta_s ** 2 / kappa_x
- self.section_props.A_sy = Delta_s ** 2 / kappa_y
- self.section_props.A_sxy = Delta_s ** 2 / kappa_xy
-
- # calculate shear areas wrt principal bending axis:
- alpha_xx = kappa_x * self.section_props.area / Delta_s ** 2
- alpha_yy = kappa_y * self.section_props.area / Delta_s ** 2
- alpha_xy = kappa_xy * self.section_props.area / Delta_s ** 2
-
- # rotate the tensor by the principal axis angle
- phi_rad = self.section_props.phi * np.pi / 180
- R = np.array([
- [np.cos(phi_rad), np.sin(phi_rad)],
- [-np.sin(phi_rad), np.cos(phi_rad)]
- ])
-
- rotatedAlpha = R.dot(np.array([
- [alpha_xx, alpha_xy],
- [alpha_xy, alpha_yy]
- ])).dot(np.transpose(R))
-
- # recalculate the shear area based on the rotated alpha value
- self.section_props.A_s11 = self.section_props.area / rotatedAlpha[0, 0]
- self.section_props.A_s22 = self.section_props.area / rotatedAlpha[1, 1]
-
- # calculate the monosymmetry consants
- def calculate_monosymmetry_integrals():
- int_x = 0
- int_y = 0
- int_11 = 0
- int_22 = 0
-
- for el in warping_section.elements:
- (int_x_el, int_y_el, int_11_el, int_22_el) = el.monosymmetry_integrals(
- self.section_props.phi
- )
-
- int_x += int_x_el
- int_y += int_y_el
- int_11 += int_11_el
- int_22 += int_22_el
-
- return (int_x, int_y, int_11, int_22)
-
- if time_info:
- text = "--Assembling monosymmetry integrals..."
- (int_x, int_y, int_11, int_22) = solver.function_timer(
- text, calculate_monosymmetry_integrals
- )
- print("")
- else:
- (int_x, int_y, int_11, int_22) = calculate_monosymmetry_integrals()
-
- # calculate the monosymmetry constants
- self.section_props.beta_x_plus = (
- -int_x / self.section_props.ixx_c + 2 * self.section_props.y_se
- )
- self.section_props.beta_x_minus = (
- int_x / self.section_props.ixx_c - 2 * self.section_props.y_se
- )
- self.section_props.beta_y_plus = (
- -int_y / self.section_props.iyy_c + 2 * self.section_props.x_se
- )
- self.section_props.beta_y_minus = (
- int_y / self.section_props.iyy_c - 2 * self.section_props.x_se
- )
- self.section_props.beta_11_plus = (
- -int_11 / self.section_props.i11_c + 2 * self.section_props.y22_se
- )
- self.section_props.beta_11_minus = (
- int_11 / self.section_props.i11_c - 2 * self.section_props.y22_se
- )
- self.section_props.beta_22_plus = (
- -int_22 / self.section_props.i22_c + 2 * self.section_props.x11_se
- )
- self.section_props.beta_22_minus = (
- int_22 / self.section_props.i22_c - 2 * self.section_props.x11_se
- )
-
-[docs] def calculate_frame_properties(self, time_info=False, solver_type='direct'):
- """Calculates and returns the properties required for a frame analysis. The properties are
- also stored in the :class:`~sectionproperties.analysis.cross_section.SectionProperties`
- object contained in the ``section_props`` class variable.
-
- :param bool time_info: If set to True, a detailed description of the computation and the
- time cost is printed to the terminal.
- :param string solver_type: Solver used for solving systems of linear equations, either
- using the *'direct'* method or *'cgs'* iterative method
-
- :return: Cross-section properties to be used for a frame analysis *(area, ixx, iyy, ixy, j,
- phi)*
- :rtype: tuple(float, float, float, float, float, float)
-
- The following section properties are calculated:
-
- * Cross-sectional area *(area)*
- * Second moments of area about the centroidal axis *(ixx, iyy, ixy)*
- * Torsion constant *(j)*
- * Principal axis angle *(phi)*
-
- If materials are specified for the cross-section, the area, second moments of area and
- torsion constant are elastic moulus weighted.
-
- The following example demonstrates the use of this method::
-
- section = CrossSection(geometry, mesh)
- (area, ixx, iyy, ixy, j, phi) = section.calculate_frame_properties()
- """
-
- def calculate_frame():
- # initialise geometric properties
- self.section_props.area = 0
- self.section_props.ea = 0
- self.section_props.qx = 0
- self.section_props.qy = 0
- self.section_props.ixx_g = 0
- self.section_props.iyy_g = 0
- self.section_props.ixy_g = 0
- self.section_props.ixx_c = 0
- self.section_props.iyy_c = 0
- self.section_props.ixy_c = 0
- self.section_props.j = 0
- self.section_props.phi = 0
-
- # calculate global geometric properties
- for el in self.elements:
- (area, qx, qy, ixx_g,
- iyy_g, ixy_g, e, _) = el.geometric_properties()
-
- self.section_props.area += area
- self.section_props.ea += area * e
- self.section_props.qx += qx * e
- self.section_props.qy += qy * e
- self.section_props.ixx_g += ixx_g * e
- self.section_props.iyy_g += iyy_g * e
- self.section_props.ixy_g += ixy_g * e
-
- # calculate elastic centroid location
- self.section_props.calculate_elastic_centroid()
-
- # calculate second moments of area about the centroidal xy axis
- self.section_props.ixx_c = (
- self.section_props.ixx_g - self.section_props.qx ** 2 / self.section_props.ea
- )
- self.section_props.iyy_c = (
- self.section_props.iyy_g - self.section_props.qy ** 2 / self.section_props.ea
- )
- self.section_props.ixy_c = (
- self.section_props.ixy_g - self.section_props.qx * self.section_props.qy /
- self.section_props.ea
- )
-
- # calculate the principal axis angle
- Delta = (
- ((self.section_props.ixx_c - self.section_props.iyy_c) / 2) ** 2 +
- self.section_props.ixy_c ** 2
- ) ** 0.5
-
- i11_c = (
- (self.section_props.ixx_c + self.section_props.iyy_c) / 2 + Delta
- )
-
- # calculate initial principal axis angle
- if abs(self.section_props.ixx_c - i11_c) < 1e-12 * i11_c:
- self.section_props.phi = 0
- else:
- self.section_props.phi = np.arctan2(
- self.section_props.ixx_c - self.section_props.i11_c,
- self.section_props.ixy_c
- ) * 180 / np.pi
-
- # create a new CrossSection with the origin shifted to the centroid for calculation of
- # the warping properties
- warping_section = CrossSection(self.geometry, self.mesh, self.materials)
-
- # shift the coordinates of each element N.B. the mesh class attribute remains unshifted
- for el in warping_section.elements:
- el.coords[0, :] -= self.section_props.cx
- el.coords[1, :] -= self.section_props.cy
-
- (k, _, f) = warping_section.assemble_torsion(lg=False)
-
- # if the cgs method is used, perform ILU decomposition
- if solver_type == 'cgs':
- k_precond = linalg.LinearOperator(
- (self.num_nodes, self.num_nodes), linalg.spilu(k).solve
- )
-
- # solve for warping function
- if solver_type == 'cgs':
- omega = solver.solve_cgs(k, f, k_precond)
- elif solver_type == 'direct':
- omega = solver.solve_direct(k, f)
-
- # calculate the torsion constant
- self.section_props.j = (
- self.section_props.ixx_c + self.section_props.iyy_c - omega.dot(k.dot(
- np.transpose(omega)))
- )
-
- if time_info:
- text = "--Calculating frame section properties..."
- solver.function_timer(text, calculate_frame)
- print("")
- else:
- calculate_frame()
-
- return (
- self.section_props.ea, self.section_props.ixx_c,
- self.section_props.iyy_c, self.section_props.ixy_c,
- self.section_props.j, self.section_props.phi)
-
-[docs] def calculate_plastic_properties(self, time_info=False, verbose=False, debug=False):
- """Calculates the plastic properties of the cross-section and stores the, in the
- :class:`~sectionproperties.analysis.cross_section.SectionProperties` object contained in
- the ``section_props`` class variable.
-
- :param bool time_info: If set to True, a detailed description of the computation and the
- time cost is printed to the terminal.
- :param bool verbose: If set to True, the number of iterations required for each plastic
- axis is printed to the terminal.
- :param bool debug: If set to True, the geometry is plotted each time a new mesh is
- generated by the plastic centroid algorithm.
-
- The following warping section properties are calculated:
-
- * Plastic centroid for bending about the centroidal and principal axes
- * Plastic section moduli for bending about the centroidal and principal axes
- * Shape factors for bending about the centroidal and principal axes
-
- If materials are specified for the cross-section, the plastic section moduli are displayed
- as plastic moments (i.e :math:`M_p = f_y S`) and the shape factors are not calculated.
-
- Note that the geometric properties must be calculated before the plastic properties are
- calculated::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
-
- :raises RuntimeError: If the geometric properties have not been calculated prior to calling
- this method
- """
-
- # check that a geometric analysis has been performed
- if self.section_props.cx is None:
- err = "Cacluate geometric properties before performing a plastic analysis."
- raise RuntimeError(err)
-
- def calc_plastic():
- plastic_section = PlasticSection(self.geometry, self.materials, debug)
-
- # calculate plastic properties
- try:
- plastic_section.calculate_plastic_properties(self, verbose)
- except ValueError:
- str = "Plastic section properties calculation failed. Contact "
- str += "robbie.vanleeuwen@gmail.com with your analysis parameters."
- raise RuntimeError(str)
-
- if time_info:
- text = "--Calculating plastic properties..."
- solver.function_timer(text, calc_plastic)
- print("")
- else:
- calc_plastic()
-
-[docs] def calculate_stress(self, N=0, Vx=0, Vy=0, Mxx=0, Myy=0, M11=0, M22=0,
- Mzz=0, time_info=False):
- """Calculates the cross-section stress resulting from design actions and returns a
- :class:`~sectionproperties.analysis.cross_section.StressPost` object allowing
- post-processing of the stress results.
-
- :param float N: Axial force
- :param float Vx: Shear force acting in the x-direction
- :param float Vy: Shear force acting in the y-direction
- :param float Mxx: Bending moment about the centroidal xx-axis
- :param float Myy: Bending moment about the centroidal yy-axis
- :param float M11: Bending moment about the centroidal 11-axis
- :param float M22: Bending moment about the centroidal 22-axis
- :param float Mzz: Torsion moment about the centroidal zz-axis
- :param bool time_info: If set to True, a detailed description of the computation and the
- time cost is printed to the terminal.
- :return: Object for post-processing cross-section stresses
- :rtype: :class:`~sectionproperties.analysis.cross_section.StressPost`
-
- Note that a geometric and warping analysis must be performed before a stress analysis is
- carried out::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(N=1e3, Vy=3e3, Mxx=1e6)
-
- :raises RuntimeError: If a geometric and warping analysis have not been performed prior to
- calling this method
- """
-
- # check that a geometric and warping analysis has been performed
- if None in [
- self.section_props.area, self.section_props.ixx_c, self.section_props.cx,
- self.section_props.j
- ]:
- err = "Perform a geometric and warping analysis before carrying out a stress analysis."
- raise RuntimeError(err)
-
- def calc_stress():
- # create stress post object
- stress_post = StressPost(self)
-
- # get relevant section properties
- ea = self.section_props.ea
- cx = self.section_props.cx
- cy = self.section_props.cy
- ixx = self.section_props.ixx_c
- iyy = self.section_props.iyy_c
- ixy = self.section_props.ixy_c
- i11 = self.section_props.i11_c
- i22 = self.section_props.i22_c
- phi = self.section_props.phi
- j = self.section_props.j
- Delta_s = self.section_props.Delta_s
- nu = self.section_props.nu_eff
-
- # loop through all material groups
- for group in stress_post.material_groups:
- # allocate nodal weights vector for nodal averaging
- nodal_weights = np.zeros(self.num_nodes)
-
- # loop through all elements in the material group
- for el in group.elements:
- (
- sig_zz_n_el, sig_zz_mxx_el, sig_zz_myy_el, sig_zz_m11_el, sig_zz_m22_el,
- sig_zx_mzz_el, sig_zy_mzz_el, sig_zx_vx_el, sig_zy_vx_el, sig_zx_vy_el,
- sig_zy_vy_el, weights
- ) = el.element_stress(
- N, Mxx, Myy, M11, M22, Mzz, Vx, Vy, ea, cx, cy, ixx, iyy, ixy, i11, i22,
- phi, j, nu, self.section_props.omega[el.node_ids],
- self.section_props.psi_shear[el.node_ids],
- self.section_props.phi_shear[el.node_ids], Delta_s
- )
-
- # add stresses to global vectors
- group.stress_result.sig_zz_n[el.node_ids] += sig_zz_n_el * weights
- group.stress_result.sig_zz_mxx[el.node_ids] += sig_zz_mxx_el * weights
- group.stress_result.sig_zz_myy[el.node_ids] += sig_zz_myy_el * weights
- group.stress_result.sig_zz_m11[el.node_ids] += sig_zz_m11_el * weights
- group.stress_result.sig_zz_m22[el.node_ids] += sig_zz_m22_el * weights
- group.stress_result.sig_zx_mzz[el.node_ids] += sig_zx_mzz_el * weights
- group.stress_result.sig_zy_mzz[el.node_ids] += sig_zy_mzz_el * weights
- group.stress_result.sig_zx_vx[el.node_ids] += sig_zx_vx_el * weights
- group.stress_result.sig_zy_vx[el.node_ids] += sig_zy_vx_el * weights
- group.stress_result.sig_zx_vy[el.node_ids] += sig_zx_vy_el * weights
- group.stress_result.sig_zy_vy[el.node_ids] += sig_zy_vy_el * weights
-
- # add nodal weights
- nodal_weights[el.node_ids] += weights
-
- # nodal averaging
- for (i, weight) in enumerate(nodal_weights):
- if weight != 0:
- group.stress_result.sig_zz_n[i] *= 1 / weight
- group.stress_result.sig_zz_mxx[i] *= 1 / weight
- group.stress_result.sig_zz_myy[i] *= 1 / weight
- group.stress_result.sig_zz_m11[i] *= 1 / weight
- group.stress_result.sig_zz_m22[i] *= 1 / weight
- group.stress_result.sig_zx_mzz[i] *= 1 / weight
- group.stress_result.sig_zy_mzz[i] *= 1 / weight
- group.stress_result.sig_zx_vx[i] *= 1 / weight
- group.stress_result.sig_zy_vx[i] *= 1 / weight
- group.stress_result.sig_zx_vy[i] *= 1 / weight
- group.stress_result.sig_zy_vy[i] *= 1 / weight
-
- # calculate combined stresses
- group.stress_result.calculate_combined_stresses()
-
- return stress_post
-
- if time_info:
- text = "--Calculating cross-section stresses..."
- stress_post = solver.function_timer(text, calc_stress)
- print("")
- else:
- stress_post = calc_stress()
-
- # return the stress_post object
- return stress_post
-
-[docs] def assemble_torsion(self, lg=True):
- """Assembles stiffness matrices to be used for the computation of warping properties and
- the torsion load vector (f_torsion). Both a regular (k) and Lagrangian multiplier (k_lg)
- stiffness matrix are returned. The stiffness matrices are assembled using the sparse COO
- format and returned in the sparse CSC format.
-
- :param bool lg: Whether or not to calculate the Lagrangian multiplier stiffness matrix
-
- :return: Regular stiffness matrix, Lagrangian multiplier stiffness matrix and torsion load
- vector *(k, k_lg, f_torsion)*
- :rtype: tuple(:class:`scipy.sparse.csc_matrix`, :class:`scipy.sparse.csc_matrix`,
- :class:`numpy.ndarray`)
- """
-
- # initialise variables
- N = self.num_nodes # size of matrix
- row = [] # list holding row indices
- col = [] # list holding column indices
- data = [] # list holding stiffness matrix entries
- f_torsion = np.zeros(N) # force vector array
-
- # loop through all elements in the mesh
- for el in self.elements:
- # determine number of nodes in the current element
- n = len(el.node_ids)
-
- # calculate the element stiffness matrix and torsion load vector
- (k_el, f_el) = el.torsion_properties()
-
- # assemble the torsion load vector
- f_torsion[el.node_ids] += f_el
-
- # create row index vector
- r = np.repeat(el.node_ids, n)
-
- # create column index vector
- c = np.tile(el.node_ids, n)
-
- # flatten element stiffness matrix
- k = k_el.flatten()
-
- # add to global arrays
- row = np.hstack((row, r))
- col = np.hstack((col, c))
- data = np.hstack((data, k))
-
- k = coo_matrix((data, (row, col)), shape=(N, N))
-
- if not lg:
- return (csc_matrix(k), None, f_torsion)
-
- # construct Lagrangian multiplier matrix:
- # column vector of ones
- row = np.hstack((row, range(N)))
- col = np.hstack((col, np.repeat(N, N)))
- data = np.hstack((data, np.repeat(1, N)))
-
- # row vector of ones
- row = np.hstack((row, np.repeat(N, N)))
- col = np.hstack((col, range(N)))
- data = np.hstack((data, np.repeat(1, N)))
-
- # zero in bottom right corner
- row = np.hstack((row, N))
- col = np.hstack((col, N))
- data = np.hstack((data, 0))
-
- k_lg = coo_matrix((data, (row, col)), shape=(N+1, N+1))
-
- return (csc_matrix(k), csc_matrix(k_lg), f_torsion)
-
-[docs] def plot_mesh(self, ax=None, pause=True, alpha=1, materials=False, mask=None):
- """Plots the finite element mesh. If no axes object is supplied a new figure and axis is
- created.
-
- :param ax: Axes object on which the mesh is plotted
- :type ax: :class:`matplotlib.axes.Axes`
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
- :param float alpha: Transparency of the mesh outlines: :math:`0 \leq \\alpha \leq 1`
- :param bool materials: If set to true and material properties have been provided to the
- :class:`~sectionproperties.analysis.cross_section.CrossSection` object, shades the
- elements with the specified material colours
- :param mask: Mask array, of length ``num_nodes``, to mask out triangles
- :type mask: list[bool]
-
- The following example plots the mesh generated for the second example
- listed under the :class:`~sectionproperties.analysis.cross_section.CrossSection` object
- definition::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.pre.pre import Material
- from sectionproperties.analysis.cross_section import CrossSection
-
- geom_steel = sections.RectangularSection(d=50, b=50)
- geom_timber = sections.RectangularSection(d=50, b=50, shift=[50, 0])
- geometry = sections.MergedSection([geom_steel, geom_timber])
- geometry.clean_geometry()
-
- mesh = geometry.create_mesh(mesh_sizes=[5, 10])
-
- steel = Material(
- name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=250,
- color='grey'
- )
- timber = Material(
- name='Timber', elastic_modulus=8e3, poissons_ratio=0.35, yield_strength=20,
- color='burlywood'
- )
-
- section = CrossSection(geometry, mesh, [steel, timber])
- section.plot_mesh(materials=True, alpha=0.5)
-
- .. figure:: ../images/composite_mesh.png
- :align: center
- :scale: 75 %
-
- Finite element mesh generated by the above example.
- """
-
- # if no axes object is supplied, create and setup the plot
- if ax is None:
- ax_supplied = False
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, pause)
- else:
- ax_supplied = True
-
- # plot the mesh
- ax.triplot(
- self.mesh_nodes[:, 0], self.mesh_nodes[:, 1], self.mesh_elements[:, 0:3], lw=0.5,
- color='black', alpha=alpha, mask=mask
- )
-
- # if the material colours are to be displayed
- if materials and self.materials is not None:
- color_array = []
- legend_list = []
-
- # create an array of finite element colours
- for element in self.elements:
- color_array.append(element.material.color)
-
- # create a list of unique material legend entries
- for (i, material) in enumerate(self.materials):
- # if the material has not be entered yet
- if i == 0 or material not in self.materials[0:i]:
- # add the material colour and name to the legend list
- legend_list.append(mpatches.Patch(color=material.color, label=material.name))
-
- cmap = ListedColormap(color_array) # custom colormap
- c = np.arange(len(color_array)) # indicies of elements
-
- # plot the mesh colours
- ax.tripcolor(
- self.mesh_nodes[:, 0], self.mesh_nodes[:, 1], self.mesh_elements[:, 0:3], c,
- cmap=cmap
- )
-
- # display the legend
- ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), handles=legend_list)
-
- # if no axes object is supplied, finish the plot
- if not ax_supplied:
- post.finish_plot(ax, pause, title='Finite Element Mesh')
-
-[docs] def plot_centroids(self, pause=True):
- """Plots the elastic centroid, the shear centre, the plastic centroids and the principal
- axis, if they have been calculated, on top of the finite element mesh.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example analyses a 200 PFC section and displays a plot of
- the centroids::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.PfcSection(d=200, b=75, t_f=12, t_w=6, r=12, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- section.calculate_plastic_properties()
-
- section.plot_centroids()
-
- .. figure:: ../images/pfc_centroids.png
- :align: center
- :scale: 75 %
-
- Plot of the centroids generated by the above example.
-
- The following example analyses a 150x90x12 UA section and displays a plot of the
- centroids::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- section.calculate_plastic_properties()
-
- section.plot_centroids()
-
- .. figure:: ../images/angle_centroids.png
- :align: center
- :scale: 75 %
-
- Plot of the centroids generated by the above example.
- """
-
- # create plot and setup the plot
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, pause)
-
- # plot the finite element mesh
- self.plot_mesh(ax, pause, alpha=0.5)
-
- # if the elastic centroid has been calculated
- if self.section_props.cx is not None:
- ax.scatter(
- self.section_props.cx, self.section_props.cy, edgecolors='r', facecolors='none',
- marker='o', s=100, label='Elastic centroid'
- )
-
- # if the shear centre has been calculated
- if self.section_props.x_se is not None:
- (x_s, y_s) = self.get_sc()
- ax.scatter(x_s, y_s, c='r', marker='+', s=100, label='Shear centre')
-
- # if the global plastic centroid has been calculated
- if self.section_props.x_pc is not None:
- (x_pc, y_pc) = self.get_pc()
- ax.scatter(x_pc, y_pc, c='r', marker='x', s=100, label='Global plastic centroid')
-
- # if the principal plastic centroid has been calculated
- if self.section_props.x11_pc is not None:
- (x11_pc, y22_pc) = self.get_pc_p()
- ax.scatter(
- x11_pc, y22_pc, edgecolors='r', facecolors='none', marker='s', s=100,
- label='Principal plastic centroid'
- )
-
- # if the principal axis has been calculated
- if self.section_props.phi is not None:
- post.draw_principal_axis(
- ax, self.section_props.phi * np.pi / 180, self.section_props.cx,
- self.section_props.cy
- )
-
- # display the legend
- ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
-
- # finish the plot
- post.finish_plot(ax, pause, title='Centroids')
-
-[docs] def display_mesh_info(self):
- """Prints mesh statistics (number of nodes, elements and regions) to the command window.
-
- The following example displays the mesh statistics for a Tee section merged from two
- rectangles::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- rec1 = sections.RectangularSection(d=100, b=25, shift=[-12.5, 0])
- rec2 = sections.RectangularSection(d=25, b=100, shift=[-50, 100])
- geometry = sections.MergedSection([rec1, rec2])
- mesh = geometry.create_mesh(mesh_sizes=[5, 2.5])
- section = CrossSection(geometry, mesh)
- section.display_mesh_info()
-
- >>>Mesh Statistics:
- >>>--4920 nodes
- >>>--2365 elements
- >>>--2 regions
- """
-
- print("Mesh Statistics:")
- print("--{0} nodes".format(self.num_nodes))
- print("--{0} elements".format(len(self.elements)))
-
- regions = max(self.mesh_attributes) + 1
- text = "--{0} region".format(regions)
-
- if regions == 1:
- text += "\n"
- else:
- text += "s\n"
-
- print(text)
-
-[docs] def display_results(self, fmt='8.6e'):
- """Prints the results that have been calculated to the terminal.
-
- :param string fmt: Number formatting string
-
- The following example displays the geometric section properties for a 100D x 50W rectangle
- with three digits after the decimal point::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.RectangularSection(d=100, b=50)
- mesh = geometry.create_mesh(mesh_sizes=[5])
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
-
- section.display_results(fmt='.3f')
- """
-
- post.print_results(self, fmt)
-
-[docs] def get_area(self):
- """
- :return: Cross-section area
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- area = section.get_area()
- """
-
- return self.section_props.area
-
-[docs] def get_perimeter(self):
- """
- :return: Cross-section perimeter
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- perimeter = section.get_perimeter()
- """
-
- return self.section_props.perimeter
-
-[docs] def get_ea(self):
- """
- :return: Modulus weighted area (axial rigidity)
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- ea = section.get_ea()
- """
-
- return self.section_props.ea
-
-[docs] def get_q(self):
- """
- :return: First moments of area about the global axis *(qx, qy)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (qx, qy) = section.get_q()
- """
-
- return (self.section_props.qx, self.section_props.qy)
-
-[docs] def get_ig(self):
- """
- :return: Second moments of area about the global axis *(ixx_g, iyy_g, ixy_g)*
- :rtype: tuple(float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (ixx_g, iyy_g, ixy_g) = section.get_ig()
- """
-
- return (self.section_props.ixx_g, self.section_props.iyy_g, self.section_props.ixy_g)
-
-[docs] def get_c(self):
- """
- :return: Elastic centroid *(cx, cy)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (cx, cy) = section.get_c()
- """
-
- return (self.section_props.cx, self.section_props.cy)
-
-[docs] def get_ic(self):
- """
- :return: Second moments of area centroidal axis *(ixx_c, iyy_c, ixy_c)*
- :rtype: tuple(float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (ixx_c, iyy_c, ixy_c) = section.get_ic()
- """
-
- return (self.section_props.ixx_c, self.section_props.iyy_c, self.section_props.ixy_c)
-
-[docs] def get_z(self):
- """
- :return: Elastic section moduli about the centroidal axis with respect to the top and
- bottom fibres *(zxx_plus, zxx_minus, zyy_plus, zyy_minus)*
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (zxx_plus, zxx_minus, zyy_plus, zyy_minus) = section.get_z()
- """
-
- return (
- self.section_props.zxx_plus, self.section_props.zxx_minus, self.section_props.zyy_plus,
- self.section_props.zyy_minus
- )
-
-[docs] def get_rc(self):
- """
- :return: Radii of gyration about the centroidal axis *(rx, ry)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (rx, ry) = section.get_rc()
- """
-
- return (self.section_props.rx_c, self.section_props.ry_c)
-
-[docs] def get_ip(self):
- """
- :return: Second moments of area about the principal axis *(i11_c, i22_c)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (i11_c, i22_c) = section.get_ip()
- """
-
- return (self.section_props.i11_c, self.section_props.i22_c)
-
-[docs] def get_phi(self):
- """
- :return: Principal bending axis angle
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- phi = section.get_phi()
- """
-
- return self.section_props.phi
-
-[docs] def get_zp(self):
- """
- :return: Elastic section moduli about the principal axis with respect to the top and bottom
- fibres *(z11_plus, z11_minus, z22_plus, z22_minus)*
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (z11_plus, z11_minus, z22_plus, z22_minus) = section.get_zp()
- """
-
- return (
- self.section_props.z11_plus, self.section_props.z11_minus, self.section_props.z22_plus,
- self.section_props.z22_minus
- )
-
-[docs] def get_rp(self):
- """
- :return: Radii of gyration about the principal axis *(r11, r22)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- (r11, r22) = section.get_rp()
- """
-
- return (self.section_props.r11_c, self.section_props.r22_c)
-
-[docs] def get_j(self):
- """
- :return: St. Venant torsion constant
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- j = section.get_j()
- """
-
- return self.section_props.j
-
-[docs] def get_sc(self):
- """
- :return: Centroidal axis shear centre (elasticity approach) *(x_se, y_se)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (x_se, y_se) = section.get_sc()
- """
-
- if self.section_props.x_se is None:
- return (None, None)
- else:
- # add centroid location to move section back to original location
- x_se = self.section_props.x_se + self.section_props.cx
- y_se = self.section_props.y_se + self.section_props.cy
-
- return (x_se, y_se)
-
-[docs] def get_sc_p(self):
- """
- :return: Principal axis shear centre (elasticity approach) *(x11_se, y22_se)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (x11_se, y22_se) = section.get_sc_p()
- """
-
- if self.section_props.x11_se is None:
- return (None, None)
- else:
- x11_se = self.section_props.x11_se
- y22_se = self.section_props.y22_se
-
- return (x11_se, y22_se)
-
-[docs] def get_sc_t(self):
- """
- :return: Centroidal axis shear centre (Trefftz's approach) *(x_st, y_st)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (x_st, y_st) = section.get_sc_t()
- """
-
- if self.section_props.x_st is None:
- return (None, None)
- else:
- # add centroid location to move section back to original location
- x_st = self.section_props.x_st + self.section_props.cx
- y_st = self.section_props.y_st + self.section_props.cy
-
- return (x_st, y_st)
-
-[docs] def get_gamma(self):
- """
- :return: Warping constant
- :rtype: float
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- gamma = section.get_gamma()
- """
-
- return self.section_props.gamma
-
-[docs] def get_As(self):
- """
- :return: Shear area for loading about the centroidal axis *(A_sx, A_sy)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (A_sx, A_sy) = section.get_As()
- """
-
- return (self.section_props.A_sx, self.section_props.A_sy)
-
-[docs] def get_As_p(self):
- """
- :return: Shear area for loading about the principal bending axis *(A_s11, A_s22)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (A_s11, A_s22) = section.get_As_p()
- """
-
- return (self.section_props.A_s11, self.section_props.A_s22)
-
-[docs] def get_beta(self):
- """
- :return: Monosymmetry constant for bending about both global axes *(beta_x_plus,
- beta_x_minus, beta_y_plus, beta_y_minus)*. The *plus* value relates to the top flange
- in compression and the *minus* value relates to the bottom flange in compression.
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (beta_x_plus, beta_x_minus, beta_y_plus, beta_y_minus) = section.get_beta()
- """
-
- return (
- self.section_props.beta_x_plus, self.section_props.beta_x_minus,
- self.section_props.beta_y_plus, self.section_props.beta_y_minus
- )
-
-[docs] def get_beta_p(self):
- """
- :return: Monosymmetry constant for bending about both principal axes *(beta_11_plus,
- beta_11_minus, beta_22_plus, beta_22_minus)*. The *plus* value relates to the top
- flange in compression and the *minus* value relates to the bottom flange in
- compression.
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- (beta_11_plus, beta_11_minus, beta_22_plus, beta_22_minus) = section.get_beta_p()
- """
-
- return (
- self.section_props.beta_11_plus, self.section_props.beta_11_minus,
- self.section_props.beta_22_plus, self.section_props.beta_22_minus
- )
-
-[docs] def get_pc(self):
- """
- :return: Centroidal axis plastic centroid *(x_pc, y_pc)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (x_pc, y_pc) = section.get_pc()
- """
-
- if self.section_props.x_pc is None:
- return (None, None)
- else:
- # add centroid location to move section back to original location
- x_pc = self.section_props.x_pc + self.section_props.cx
- y_pc = self.section_props.y_pc + self.section_props.cy
-
- return (x_pc, y_pc)
-
-[docs] def get_pc_p(self):
- """
- :return: Principal bending axis plastic centroid *(x11_pc, y22_pc)*
- :rtype: tuple(float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (x11_pc, y22_pc) = section.get_pc_p()
- """
-
- if self.section_props.x11_pc is None:
- return (None, None)
- else:
- # determine the position of the plastic centroid in the global axis
- (x_pc, y_pc) = fea.global_coordinate(
- self.section_props.phi, self.section_props.x11_pc, self.section_props.y22_pc
- )
-
- # add centroid location to move section back to original location
- return (x_pc + self.section_props.cx, y_pc + self.section_props.cy)
-
-[docs] def get_s(self):
- """
- :return: Plastic section moduli about the centroidal axis *(sxx, syy)*
- :rtype: tuple(float, float)
-
- If material properties have been specified, returns the plastic moment :math:`M_p = f_y S`.
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (sxx, syy) = section.get_s()
- """
-
- return (self.section_props.sxx, self.section_props.syy)
-
-[docs] def get_sp(self):
- """
- :return: Plastic section moduli about the principal bending axis *(s11, s22)*
- :rtype: tuple(float, float)
-
- If material properties have been specified, returns the plastic moment
- :math:`M_p = f_y S`.
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (s11, s22) = section.get_sp()
- """
-
- return (self.section_props.s11, self.section_props.s22)
-
-[docs] def get_sf(self):
- """
- :return: Centroidal axis shape factors with respect to the top and bottom fibres
- *(sf_xx_plus, sf_xx_minus, sf_yy_plus, sf_yy_minus)*
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (sf_xx_plus, sf_xx_minus, sf_yy_plus, sf_yy_minus) = section.get_sf()
- """
-
- return (
- self.section_props.sf_xx_plus, self.section_props.sf_xx_minus,
- self.section_props.sf_yy_plus, self.section_props.sf_yy_minus
- )
-
-[docs] def get_sf_p(self):
- """
- :return: Principal bending axis shape factors with respect to the top and bottom fibres
- *(sf_11_plus, sf_11_minus, sf_22_plus, sf_22_minus)*
- :rtype: tuple(float, float, float, float)
-
- ::
-
- section = CrossSection(geometry, mesh)
- section.calculate_geometric_properties()
- section.calculate_plastic_properties()
- (sf_11_plus, sf_11_minus, sf_22_plus, sf_22_minus) = section.get_sf_p()
- """
-
- return (
- self.section_props.sf_11_plus, self.section_props.sf_11_minus,
- self.section_props.sf_22_plus, self.section_props.sf_22_minus
- )
-
-
-[docs]class PlasticSection:
- """Class for the plastic analysis of cross-sections.
-
- Stores the finite element geometry and material information and provides methods to compute the
- plastic section properties.
-
- :param geometry: Cross-section geometry object
- :type geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :param materials: A list of material properties corresponding to various regions in the
- geometry and mesh.
- :type materials: list[:class:`~sectionproperties.pre.pre.Material`]
- :param bool debug: If set to True, the geometry is plotted each time a new mesh is generated by
- the plastic centroid algorithm.
-
- :cvar geometry: Deep copy of the cross-section geometry object provided to the constructor
- :vartype geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :cvar materials: A list of material properties corresponding to various regions in the geometry
- and mesh.
- :vartype materials: list[:class:`~sectionproperties.pre.pre.Material`]
- :cvar bool debug: If set to True, the geometry is plotted each time a new mesh is generated by
- the plastic centroid algorithm.
- :cvar mesh: Mesh object returned by meshpy
- :vartype mesh: :class:`meshpy.triangle.MeshInfo`
- :cvar mesh_nodes: Array of node coordinates from the mesh
- :vartype mesh_nodes: :class:`numpy.ndarray`
- :cvar mesh_elements: Array of connectivities from the mesh
- :vartype mesh_elements: :class:`numpy.ndarray`
- :cvar elements: List of finite element objects describing the cross-section mesh
- :vartype elements: list[:class:`~sectionproperties.analysis.fea.Tri6`]
- :cvar float f_top: Current force in the top region
- :cvar c_top: Centroid of the force in the top region *(c_top_x, c_top_y)*
- :type c_top: list[float, float]
- :cvar c_bot: Centroid of the force in the bottom region *(c_bot_x, c_bot_y)*
- :type c_bot: list[float, float]
- """
-
- def __init__(self, geometry, materials, debug):
- """Inits the PlasticSection class."""
-
- # make a deepcopy of the geometry & materials so that we can modify it
- self.geometry = copy.deepcopy(geometry)
- self.materials = copy.deepcopy(materials)
- self.debug = debug
-
- if self.materials is not None:
- # create dummy control point at the start of the list
- (x_min, x_max, y_min, y_max) = geometry.calculate_extents()
- self.geometry.control_points.insert(0, [x_min - 1, y_min - 1])
-
- # create matching dummy material
- self.materials.insert(0, pre.Material('default', 1, 0, 1))
-
- # create simple mesh of the geometry
- mesh = self.create_plastic_mesh()
-
- # get the elements of the mesh
- (_, _, elements) = self.get_elements(mesh)
-
- # calculate centroid of the mesh
- (cx, cy) = self.calculate_centroid(elements)
-
- # shift geometry such that the origin is at the centroid
- self.geometry.shift = [-cx, -cy]
- self.geometry.shift_section()
-
- # remesh the geometry and store the mesh
- self.mesh = self.create_plastic_mesh()
-
- # store the nodes, elements and list of elements in the mesh
- (self.mesh_nodes, self.mesh_elements, self.elements) = self.get_elements(self.mesh)
-
-[docs] def get_elements(self, mesh):
- """Extracts finite elements from the provided mesh and returns Tri6 finite elements with
- their associated material properties.
-
- :param mesh: Mesh object returned by meshpy
- :type mesh: :class:`meshpy.triangle.MeshInfo`
- :return: A tuple containing an array of the nodes locations, element indicies and a list of
- the finite elements.
- :rtype: tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`,
- list[:class:`~sectionproperties.analysis.fea.Tri6`])
- """
-
- # extract mesh data
- nodes = np.array(mesh.points, dtype=np.dtype(float))
- elements = np.array(mesh.elements, dtype=np.dtype(int))
- attributes = np.array(mesh.element_attributes, dtype=np.dtype(int))
-
- # swap mid-node order to retain node ordering consistency
- elements[:, [3, 4, 5]] = elements[:, [5, 3, 4]]
-
- # initialise list of Tri6 elements
- element_list = []
-
- # build the element list one element at a time
- for (i, node_ids) in enumerate(elements):
- x1 = nodes[node_ids[0]][0]
- y1 = nodes[node_ids[0]][1]
- x2 = nodes[node_ids[1]][0]
- y2 = nodes[node_ids[1]][1]
- x3 = nodes[node_ids[2]][0]
- y3 = nodes[node_ids[2]][1]
- x4 = nodes[node_ids[3]][0]
- y4 = nodes[node_ids[3]][1]
- x5 = nodes[node_ids[4]][0]
- y5 = nodes[node_ids[4]][1]
- x6 = nodes[node_ids[5]][0]
- y6 = nodes[node_ids[5]][1]
-
- # create a list containing the vertex and mid-node coordinates
- coords = np.array([[x1, x2, x3, x4, x5, x6], [y1, y2, y3, y4, y5, y6]])
-
- # if materials are specified, get the material
- if self.materials is not None:
- # get attribute index of current element
- att_el = attributes[i]
-
- # if the current element is assigned the default attribute
- if att_el == 0:
- # determine point within current element (centroid)
- pt = [(x1 + x2 + x3) / 3, (y1 + y2 + y3) / 3]
-
- # search within original elements - find coinciding element
- for el in self.elements:
- # if the point lies within the current element
- if el.point_within_element(pt):
- material = el.material
- break
- else:
- # fetch the material
- material = self.materials[att_el]
- # if there are no materials specified, use a default material
- else:
- material = pre.Material('default', 1, 0, 1)
-
- # add tri6 elements to the element list
- element_list.append(fea.Tri6(i, coords, node_ids, material))
-
- return (nodes, elements, element_list)
-
-[docs] def calculate_centroid(self, elements):
- """Calculates the elastic centroid from a list of finite elements.
-
- :param elements: A list of Tri6 finite elements.
- :type elements: list[:class:`~sectionproperties.analysis.fea.Tri6`]
- :return: A tuple containing the x and y location of the elastic centroid.
- :rtype: tuple(float, float)
- """
-
- ea = 0
- qx = 0
- qy = 0
-
- # loop through all the elements
- for el in elements:
- (area, qx_el, qy_el, _, _, _, e, _) = el.geometric_properties()
- ea += area * e
- qx += qx_el * e
- qy += qy_el * e
-
- return (qy / ea, qx / ea)
-
-[docs] def calculate_plastic_properties(self, cross_section, verbose):
- """Calculates the location of the plastic centroid with respect to the centroidal and
- principal bending axes, the plastic section moduli and shape factors and stores the results
- to the supplied :class:`~sectionproperties.analysis.cross_section.CrossSection` object.
-
- :param cross_section: Cross section object that uses the same geometry and materials
- specified in the class constructor
- :type cross_section: :class:`~sectionproperties.analysis.cross_section.CrossSection`
- :param bool verbose: If set to True, the number of iterations required for each plastic
- axis is printed to the terminal.
- """
-
- # 1) Calculate plastic properties for centroidal axis
- # calculate distances to the extreme fibres
- fibres = self.calculate_extreme_fibres(0)
-
- # 1a) Calculate x-axis plastic centroid
- (y_pc, r, f, c_top, c_bot) = self.pc_algorithm(
- np.array([1, 0]), fibres[2:], 1, verbose)
-
- self.check_convergence(r, 'x-axis')
- cross_section.section_props.y_pc = y_pc
- cross_section.section_props.sxx = f * abs(c_top[1] - c_bot[1])
-
- if verbose:
- self.print_verbose(y_pc, r, 'x-axis')
-
- # 1b) Calculate y-axis plastic centroid
- (x_pc, r, f, c_top, c_bot) = self.pc_algorithm(np.array([0, 1]), fibres[0:2], 2, verbose)
-
- self.check_convergence(r, 'y-axis')
- cross_section.section_props.x_pc = x_pc
- cross_section.section_props.syy = f * abs(c_top[0] - c_bot[0])
-
- if verbose:
- self.print_verbose(x_pc, r, 'y-axis')
-
- # 2) Calculate plastic properties for principal axis
- # convert principal axis angle to radians
- angle = cross_section.section_props.phi * np.pi / 180
-
- # unit vectors in the axis directions
- ux = np.array([np.cos(angle), np.sin(angle)])
- uy = np.array([-np.sin(angle), np.cos(angle)])
-
- # calculate distances to the extreme fibres in the principal axis
- fibres = self.calculate_extreme_fibres(cross_section.section_props.phi)
-
- # 2a) Calculate 11-axis plastic centroid
- (y22_pc, r, f, c_top, c_bot) = self.pc_algorithm(ux, fibres[2:], 1, verbose)
-
- # calculate the centroids in the principal coordinate system
- c_top_p = fea.principal_coordinate(cross_section.section_props.phi, c_top[0], c_top[1])
- c_bot_p = fea.principal_coordinate(cross_section.section_props.phi, c_bot[0], c_bot[1])
-
- self.check_convergence(r, '11-axis')
- cross_section.section_props.y22_pc = y22_pc
- cross_section.section_props.s11 = f * abs(c_top_p[1] - c_bot_p[1])
-
- if verbose:
- self.print_verbose(y22_pc, r, '11-axis')
-
- # 2b) Calculate 22-axis plastic centroid
- (x11_pc, r, f, c_top, c_bot) = self.pc_algorithm(uy, fibres[0:2], 2, verbose)
-
- # calculate the centroids in the principal coordinate system
- c_top_p = fea.principal_coordinate(cross_section.section_props.phi, c_top[0], c_top[1])
- c_bot_p = fea.principal_coordinate(cross_section.section_props.phi, c_bot[0], c_bot[1])
-
- self.check_convergence(r, '22-axis')
- cross_section.section_props.x11_pc = x11_pc
- cross_section.section_props.s22 = f * abs(c_top_p[0] - c_bot_p[0])
-
- if verbose:
- self.print_verbose(x11_pc, r, '22-axis')
-
- # if there are no materials specified, calculate shape factors
- if cross_section.materials is None:
- cross_section.section_props.sf_xx_plus = (
- cross_section.section_props.sxx / cross_section.section_props.zxx_plus
- )
- cross_section.section_props.sf_xx_minus = (
- cross_section.section_props.sxx / cross_section.section_props.zxx_minus
- )
- cross_section.section_props.sf_yy_plus = (
- cross_section.section_props.syy / cross_section.section_props.zyy_plus
- )
- cross_section.section_props.sf_yy_minus = (
- cross_section.section_props.syy / cross_section.section_props.zyy_minus
- )
-
- cross_section.section_props.sf_11_plus = (
- cross_section.section_props.s11 / cross_section.section_props.z11_plus
- )
- cross_section.section_props.sf_11_minus = (
- cross_section.section_props.s11 / cross_section.section_props.z11_minus
- )
- cross_section.section_props.sf_22_plus = (
- cross_section.section_props.s22 / cross_section.section_props.z22_plus
- )
- cross_section.section_props.sf_22_minus = (
- cross_section.section_props.s22 / cross_section.section_props.z22_minus
- )
-
-[docs] def check_convergence(self, root_result, axis):
- """Checks that the function solver converged and if not, raises a helpful error.
-
- :param root_result: Result object from the root finder
- :type root_result: :class:`scipy.optimize.RootResults`
- :param string axis: Axis being considered by the function sovler
- :raises RuntimeError: If the function solver did not converge
- """
-
- if not root_result.converged:
- str = "Plastic centroid calculation about the {0}".format(axis)
- str += " failed. Contact robbie.vanleeuwen@gmail.com with your"
- str += " analysis parameters. Termination flag: {0}".format(root_result.flag)
-
- raise RuntimeError(str)
-
-[docs] def print_verbose(self, d, root_result, axis):
- """Prints information related to the function solver convergence to the terminal.
-
- :param float d: Location of the plastic centroid axis
- :param root_result: Result object from the root finder
- :type root_result: :class:`scipy.optimize.RootResults`
- :param string axis: Axis being considered by the function sovler
- """
-
- str = "---{0} plastic centroid calculation converged at ".format(axis)
- str += "{0:.5e} in {1} iterations.".format(d, root_result.iterations)
- print(str)
-
-[docs] def calculate_extreme_fibres(self, angle):
- """Calculates the locations of the extreme fibres along and perpendicular to the axis
- specified by 'angle' using the elements stored in `self.elements`.
-
- :param float angle: Angle (in radians) along which to calculate the extreme fibre locations
- :return: The location of the extreme fibres parallel (u) and perpendicular (v) to the axis
- *(u_min, u_max, v_min, v_max)*
- :rtype: tuple(float, float, float, float)
- """
-
- # loop through all nodes in the mesh
- for (i, pt) in enumerate(self.mesh_nodes):
- # determine the coordinate of the point wrt the axis
- (u, v) = fea.principal_coordinate(angle, pt[0], pt[1])
-
- # initialise min, max variables
- if i == 0:
- u_min = u
- u_max = u
- v_min = v
- v_max = v
-
- # update the mins and maxs where necessary
- u_min = min(u_min, u)
- u_max = max(u_max, u)
- v_min = min(v_min, v)
- v_max = max(v_max, v)
-
- return (u_min, u_max, v_min, v_max)
-
-[docs] def evaluate_force_eq(self, d, u, u_p, verbose):
- """Given a distance *d* from the centroid to an axis (defined by unit vector *u*), creates
- a mesh including the new and axis and calculates the force equilibrium. The resultant
- force, as a ratio of the total force, is returned.
-
- :param float d: Distance from the centroid to current axis
- :param u: Unit vector defining the direction of the axis
- :type u: :class:`numpy.ndarray`
- :param u_p: Unit vector perpendicular to the direction of the axis
- :type u_p: :class:`numpy.ndarray`
- :param bool verbose: If set to True, the number of iterations required for each plastic
- axis is printed to the terminal.
- :return: The force equilibrium norm
- :rtype: float
- """
-
- p = np.array([d * u_p[0], d * u_p[1]])
-
- # create a mesh with the axis included
- mesh = self.create_plastic_mesh([p, u])
- (nodes, elements, element_list) = self.get_elements(mesh)
-
- if self.debug:
- self.plot_mesh(nodes, elements, element_list, self.materials)
-
- # calculate force equilibrium
- (f_top, f_bot) = self.calculate_plastic_force(element_list, u, p)
-
- # calculate the force norm
- f_norm = (f_top - f_bot) / (f_top + f_bot)
-
- # print verbose results
- if verbose:
- print("d = {0}; f_norm = {1}".format(d, f_norm))
-
- # return the force norm
- return f_norm
-
-[docs] def pc_algorithm(self, u, dlim, axis, verbose):
- """An algorithm used for solving for the location of the plastic centroid. The algorithm
- searches for the location of the axis, defined by unit vector *u* and within the section
- depth, that satisfies force equilibrium.
-
- :param u: Unit vector defining the direction of the axis
- :type u: :class:`numpy.ndarray`
- :param dlim: List [dmax, dmin] containing the distances from the centroid to the extreme
- fibres perpendicular to the axis
- :type dlim: list[float, float]
- :param int axis: The current axis direction: 1 (e.g. x or 11) or 2 (e.g. y or 22)
- :param bool verbose: If set to True, the number of iterations required for each plastic
- axis is printed to the terminal.
- :return: The distance to the plastic centroid axis *d*, the result object *r*, the force in
- the top of the section *f_top* and the location of the centroids of the top and bottom
- areas *c_top* and *c_bottom*
- :rtype: tuple(float, :class:`scipy.optimize.RootResults`, float, list[float, float],
- list[float, float])
- """
-
- # calculate vector perpendicular to u
- if axis == 1:
- u_p = np.array([-u[1], u[0]])
- else:
- u_p = np.array([u[1], -u[0]])
-
- a = dlim[0]
- b = dlim[1]
-
- (d, r) = brentq(
- self.evaluate_force_eq, a, b, args=(u, u_p, verbose), full_output=True, disp=False,
- xtol=1e-6, rtol=1e-6
- )
-
- return (d, r, self.f_top, self.c_top, self.c_bot)
-
-[docs] def calculate_plastic_force(self, elements, u, p):
- """Sums the forces above and below the axis defined by unit vector *u* and point *p*. Also
- returns the force centroid of the forces above and below the axis.
-
- :param elements: A list of Tri6 finite elements.
- :type elements: list[:class:`~sectionproperties.analysis.fea.Tri6`]
- :param u: Unit vector defining the direction of the axis
- :type u: :class:`numpy.ndarray`
- :param p: Point on the axis
- :type p: :class:`numpy.ndarray`
- :return: Force in the top and bottom areas *(f_top, f_bot)*
- :rtype: tuple(float, float)
- """
-
- # initialise variables
- (f_top, f_bot) = (0, 0)
- (ea_top, ea_bot) = (0, 0)
- (qx_top, qx_bot) = (0, 0)
- (qy_top, qy_bot) = (0, 0)
-
- # loop through all elements in the mesh
- for el in elements:
- # calculate element force and area properties
- (f_el, ea_el, qx_el, qy_el, is_above) = el.plastic_properties(u, p)
-
- # assign force and area properties to the top or bottom segments
- if is_above:
- f_top += f_el
- ea_top += ea_el
- qx_top += qx_el
- qy_top += qy_el
- else:
- f_bot += f_el
- ea_bot += ea_el
- qx_bot += qx_el
- qy_bot += qy_el
-
- # if there are no elements in the top/bottom prevent division by zero N.B. the algorithm
- # will never converge at this point, this is purely done to ensure a 100% search range
- if ea_top == 0:
- ea_top = 1
- if ea_bot == 0:
- ea_bot = 1
-
- # calculate the centroid of the top and bottom segments and save
- self.c_top = [qy_top / ea_top, qx_top / ea_top]
- self.c_bot = [qy_bot / ea_bot, qx_bot / ea_bot]
- self.f_top = f_top
-
- return (f_top, f_bot)
-
-[docs] def create_plastic_mesh(self, new_line=None):
- """Generates a triangular mesh of a deep copy of the geometry stored in `self.geometry`.
- Optionally, a line can be added to the copied geometry, which is defined by a point *p* and
- a unit vector *u*.
-
- :param new_line: A point p and a unit vector u defining a line to add to the mesh
- (new_line: p -> p + u) [*p*, *u*]
- :type new_line: list[:class:`numpy.ndarray`, :class:`numpy.ndarray`]
- :param mesh: Mesh object returned by meshpy
- :type mesh: :class:`meshpy.triangle.MeshInfo`
- """
-
- # start with the initial geometry
- geom = copy.deepcopy(self.geometry)
-
- # add line at new_line
- if new_line is not None:
- self.add_line(geom, new_line)
-
- # fast clean the geometry after adding the line
- clean = pre.GeometryCleaner(geom, verbose=False)
- clean.zip_points()
- clean.remove_zero_length_facets()
- clean.remove_unused_points()
- geom = clean.geometry
-
- if self.debug:
- if new_line is not None:
- geom.plot_geometry(labels=True)
-
- # build mesh object
- mesh = triangle.MeshInfo() # create mesh info object
- mesh.set_points(geom.points) # set points
- mesh.set_facets(geom.facets) # set facets
- mesh.set_holes(geom.holes) # set holes
-
- # set regions
- mesh.regions.resize(len(geom.control_points))
- region_id = 0 # initialise region ID variable
-
- for (i, cp) in enumerate(geom.control_points):
- mesh.regions[i] = [cp[0], cp[1], region_id, 1]
- region_id += 1
-
- mesh = triangle.build(mesh, mesh_order=2, quality_meshing=False, attributes=True)
-
- return mesh
-
-[docs] def add_line(self, geometry, line):
- """Adds a line a geometry object. Finds the intersection points of the line with the
- current facets and splits the existing facets to accomodate the new line.
-
- :param geometry: Cross-section geometry object used to generate the mesh
- :type geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :param line: A point p and a unit vector u defining a line to add to the mesh
- (line: p -> p + u)
- :type line: list[:class:`numpy.ndarray`, :class:`numpy.ndarray`]
- """
-
- # initialise intersection points and facet index list
- int_pts = []
- fct_idx = []
-
- # get current number of points in the geometry object
- num_pts = len(geometry.points)
-
- # line: p -> p + r
- p = line[0]
- r = line[1]
-
- # loop through all the facets in the geometry to find intersection pts
- for (idx, fct) in enumerate(geometry.facets):
- # facet: q -> q + s
- q = np.array(geometry.points[fct[0]])
- s = geometry.points[fct[1]] - q
-
- # cacluate intersection point between p -> p + r and q -> q + s N.B. make line
- # p -> p + r inifintely long to find all intersects if the lines are not parallel
- if np.cross(r, s) != 0:
- # calculate t and u
- t = np.cross(q - p, s) / np.cross(r, s)
- u = np.cross(p - q, r) / np.cross(s, r)
-
- new_pt = p + t * r
-
- # if the line lies within q -> q + s and the point hasn't already been added
- # (ignore t as it is infinitely long)
- if (u >= 0 and u <= 1 and list(new_pt) not in [list(item) for item in int_pts]):
- int_pts.append(new_pt)
- fct_idx.append(idx)
-
- # if less than 2 intersection points are found, we are at the edge of the section,
- # therefore no line to add
- if len(int_pts) < 2:
- return
-
- # sort intersection points and facet list first by x, then by y
- int_pts = np.array(int_pts)
- idx_sort = np.lexsort((int_pts[:, 0], int_pts[:, 1]))
- int_pts = int_pts[idx_sort]
- fct_idx = list(np.array(fct_idx)[idx_sort])
-
- # add points to the geometry object
- for pt in int_pts:
- geometry.points.append([pt[0], pt[1]])
-
- # add new facets by looping from the second facet index to the end
- for (i, idx) in enumerate(fct_idx[1:]):
- # get mid-point of proposed new facet
- mid_pt = 0.5 * (int_pts[i] + int_pts[i+1])
-
- # check to see if the mid-point is not in a hole
- # add the facet
- if self.point_within_element(mid_pt):
- geometry.facets.append([num_pts + i, num_pts + i + 1])
-
- # rebuild the intersected facet
- self.rebuild_parent_facet(geometry, idx, num_pts + i + 1)
-
- # rebuild the first facet the looped skipped
- if i == 0:
- self.rebuild_parent_facet(geometry, fct_idx[0], num_pts + i)
-
- # sort list of facet indices (to be removed) in reverse order so as not to comprimise the
- # indices during deletion
- idx_to_remove = sorted(fct_idx, reverse=True)
-
- for idx in idx_to_remove:
- geometry.facets.pop(idx)
-
-[docs] def rebuild_parent_facet(self, geometry, fct_idx, pt_idx):
- """Splits and rebuilds a facet at a given point.
-
- :param geometry: Cross-section geometry object used to generate the mesh
- :type geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :param int fct_idx: Index of the facet to be split
- :param int pt_idx: Index of the point to insert into the facet
- """
-
- # get current facet
- fct = geometry.facets[fct_idx]
-
- # rebuild facet
- geometry.facets.append([fct[0], pt_idx])
- geometry.facets.append([pt_idx, fct[1]])
-
-[docs] def point_within_element(self, pt):
- """Determines whether a point lies within an element in the mesh stored in
- `self.mesh_elements`.
-
- :param pt: Point to check
- :type pt: :class:`numpy.ndarray`
- :return: Whether the point lies within an element
- :rtype: bool
- """
-
- px = pt[0]
- py = pt[1]
-
- # loop through elements in the mesh
- for el in self.mesh_elements:
- # get coordinates of corner points
- x1 = self.mesh_nodes[el[0]][0]
- y1 = self.mesh_nodes[el[0]][1]
- x2 = self.mesh_nodes[el[1]][0]
- y2 = self.mesh_nodes[el[1]][1]
- x3 = self.mesh_nodes[el[2]][0]
- y3 = self.mesh_nodes[el[2]][1]
-
- # compute variables alpha, beta and gamma
- alpha = (
- ((y2 - y3) * (px - x3) + (x3 - x2) * (py - y3)) /
- ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3))
- )
- beta = (
- ((y3 - y1) * (px - x3) + (x1 - x3) * (py - y3)) /
- ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3))
- )
- gamma = 1.0 - alpha - beta
-
- # if the point lies within an element
- if alpha >= 0 and beta >= 0 and gamma >= 0:
- return True
-
- return False
-
-[docs] def plot_mesh(self, nodes, elements, element_list, materials):
- """Watered down implementation of the CrossSection method to plot the finite element mesh,
- showing material properties."""
-
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, True)
-
- # plot the mesh
- ax.triplot(nodes[:, 0], nodes[:, 1], elements[:, 0:3], lw=0.5,
- color='black')
-
- color_array = []
- legend_list = []
-
- if materials is not None:
- # create an array of finite element colours
- for el in element_list:
- color_array.append(el.material.color)
-
- # create a list of unique material legend entries
- for (i, mat) in enumerate(materials):
- # if the material has not be entered yet
- if i == 0 or mat not in materials[0:i]:
- # add the material colour and name to the legend list
- legend_list.append(mpatches.Patch(color=mat.color, label=mat.name))
-
- cmap = ListedColormap(color_array) # custom colormap
- c = np.arange(len(color_array)) # indicies of elements
-
- # plot the mesh colours
- ax.tripcolor(nodes[:, 0], nodes[:, 1], elements[:, 0:3], c, cmap=cmap)
-
- # display the legend
- ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), handles=legend_list)
-
- # finish the plot
- post.finish_plot(ax, True, title='Finite Element Mesh')
-
-
-[docs]class StressPost:
- """Class for post-processing finite element stress results.
-
- A StressPost object is created when a stress analysis is carried out and is returned as an
- object to allow post-processing of the results. The StressPost object creates a deep copy of
- the MaterialGroups within the cross-section to allow the calculation of stresses for each
- material. Methods for post-processing the calculated stresses are provided.
-
- :param cross_section: Cross section object for stress calculation
- :type cross_section: :class:`~sectionproperties.analysis.cross_section.CrossSection`
-
- :cvar cross_section: Cross section object for stress calculation
- :vartype cross_section: :class:`~sectionproperties.analysis.cross_section.CrossSection`
- :cvar material_groups: A deep copy of the `cross_section` material groups to allow a new stress
- analysis
- :vartype material_groups: list[:class:`~sectionproperties.pre.pre.MaterialGroup`]
- """
-
- def __init__(self, cross_section):
- """Inits the StressPost class."""
-
- self.cross_section = cross_section
-
- # make a deep copy of the material groups to the StressPost object such that stress results
- # can be saved to a new material group
- self.material_groups = copy.deepcopy(cross_section.material_groups)
-
-[docs] def plot_stress_contour(self, sigs, title, pause):
- """Plots filled stress contours over the finite element mesh.
-
- :param sigs: List of nodal stress values for each material
- :type sigs: list[:class:`numpy.ndarray`]
- :param string title: Plot title
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
- """
-
- # create plot and setup the plot
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, pause)
-
- # plot the finite element mesh
- self.cross_section.plot_mesh(ax, pause, alpha=0.5)
-
- # set up the colormap
- cmap = cm.get_cmap(name='jet')
-
- # create triangulation
- triang = tri.Triangulation(
- self.cross_section.mesh_nodes[:, 0], self.cross_section.mesh_nodes[:, 1],
- self.cross_section.mesh_elements[:, 0:3]
- )
-
- # determine minimum and maximum stress values for the contour list
- sig_min = min([min(x) for x in sigs])
- sig_max = max([max(x) for x in sigs])
- v = np.linspace(sig_min, sig_max, 15, endpoint=True)
-
- if np.isclose(v[0], v[-1], atol=1e-12):
- v = 15
- ticks = None
- else:
- ticks = v
-
- # plot the filled contour, looping through the materials
- for (i, sig) in enumerate(sigs):
- # create and set the mask for the current material
- mask_array = np.ones(len(self.cross_section.elements), dtype=bool)
- mask_array[self.material_groups[i].el_ids] = False
- triang.set_mask(mask_array)
-
- # plot the filled contour
- trictr = ax.tricontourf(triang, sig, v, cmap=cmap)
-
- # display the colourbar
- fig.colorbar(trictr, label='Stress', format='%.4e', ticks=ticks)
-
- # TODO: display stress values in the toolbar (format_coord)
-
- # finish the plot
- post.finish_plot(ax, pause, title)
-
-[docs] def plot_stress_vector(self, sigxs, sigys, title, pause):
- """Plots stress vectors over the finite element mesh.
-
- :param sigxs: List of x-components of the nodal stress values for each material
- :type sigxs: list[:class:`numpy.ndarray`]
- :param sigys: List of y-components of the nodal stress values for each material
- :type sigys: list[:class:`numpy.ndarray`]
- :param string title: Plot title
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
- """
-
- # create plot and setup the plot
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, pause)
-
- # plot the finite element mesh
- self.cross_section.plot_mesh(ax, pause, alpha=0.5)
-
- # set up the colormap
- cmap = cm.get_cmap(name='jet')
-
- # initialise quiver plot list max scale
- quiv_list = []
- max_scale = 0
-
- # plot the vectors
- for (i, sigx) in enumerate(sigxs):
- sigy = sigys[i]
-
- # scale the colour with respect to the magnitude of the vector
- c = np.hypot(sigx, sigy)
-
- quiv = ax.quiver(
- self.cross_section.mesh_nodes[:, 0], self.cross_section.mesh_nodes[:, 1], sigx,
- sigy, c, cmap=cmap
- )
-
- # get the scale and store the max value
- quiv._init()
- max_scale = max(max_scale, quiv.scale)
- quiv_list.append(quiv)
-
- # update the colormap values
- if i == 0:
- c_min = min(c)
- c_max = max(c)
- else:
- c_min = min(c_min, min(c))
- c_max = max(c_max, max(c))
-
- # apply the scale
- for quiv_plot in quiv_list:
- quiv_plot.scale = max_scale
-
- # apply the colourbar
- v1 = np.linspace(c_min, c_max, 15, endpoint=True)
- fig.colorbar(quiv, label='Stress', ticks=v1, format='%.4e')
-
- # finish the plot
- post.finish_plot(ax, pause, title=title)
-
-[docs] def get_stress(self):
- """Returns the stresses within each material belonging to the current
- :class:`~sectionproperties.analysis.cross_section.StressPost` object.
-
- :return: A list of dictionaries containing the cross-section stresses for each material.
- :rtype: list[dict]
-
- A dictionary is returned for each material in the cross-section, containing the following
- keys and values:
-
- * *'Material'*: Material name
- * *'sig_zz_n'*: Normal stress :math:`\sigma_{zz,N}` resulting from the axial load :math:`N`
- * *'sig_zz_mxx'*: Normal stress :math:`\sigma_{zz,Mxx}` resulting from the bending moment
- :math:`M_{xx}`
- * *'sig_zz_myy'*: Normal stress :math:`\sigma_{zz,Myy}` resulting from the bending moment
- :math:`M_{yy}`
- * *'sig_zz_m11'*: Normal stress :math:`\sigma_{zz,M11}` resulting from the bending moment
- :math:`M_{11}`
- * *'sig_zz_m22'*: Normal stress :math:`\sigma_{zz,M22}` resulting from the bending moment
- :math:`M_{22}`
- * *'sig_zz_m'*: Normal stress :math:`\sigma_{zz,\Sigma M}` resulting from all bending
- moments
- * *'sig_zx_mzz'*: *x*-component of the shear stress :math:`\sigma_{zx,Mzz}` resulting from
- the torsion moment
- * *'sig_zy_mzz'*: *y*-component of the shear stress :math:`\sigma_{zy,Mzz}` resulting from
- the torsion moment
- * *'sig_zxy_mzz'*: Resultant shear stress :math:`\sigma_{zxy,Mzz}` resulting from the
- torsion moment
- * *'sig_zx_vx'*: *x*-component of the shear stress :math:`\sigma_{zx,Vx}` resulting from
- the shear force :math:`V_{x}`
- * *'sig_zy_vx'*: *y*-component of the shear stress :math:`\sigma_{zy,Vx}` resulting from
- the shear force :math:`V_{x}`
- * *'sig_zxy_vx'*: Resultant shear stress :math:`\sigma_{zxy,Vx}` resulting from the shear
- force :math:`V_{x}`
- * *'sig_zx_vy'*: *x*-component of the shear stress :math:`\sigma_{zx,Vy}` resulting from
- the shear force :math:`V_{y}`
- * *'sig_zy_vy'*: *y*-component of the shear stress :math:`\sigma_{zy,Vy}` resulting from
- the shear force :math:`V_{y}`
- * *'sig_zxy_vy'*: Resultant shear stress :math:`\sigma_{zxy,Vy}` resulting from the shear
- force :math:`V_{y}`
- * *'sig_zx_v'*: *x*-component of the shear stress :math:`\sigma_{zx,\Sigma V}` resulting
- from all shear forces
- * *'sig_zy_v'*: *y*-component of the shear stress :math:`\sigma_{zy,\Sigma V}` resulting
- from all shear forces
- * *'sig_zxy_v'*: Resultant shear stress :math:`\sigma_{zxy,\Sigma V}` resulting from all
- shear forces
- * *'sig_zz'*: Combined normal stress :math:`\sigma_{zz}` resulting from all actions
- * *'sig_zx'*: *x*-component of the shear stress :math:`\sigma_{zx}` resulting from all
- actions
- * *'sig_zy'*: *y*-component of the shear stress :math:`\sigma_{zy}` resulting from all
- actions
- * *'sig_zxy'*: Resultant shear stress :math:`\sigma_{zxy}` resulting from all actions
- * *'sig_vm'*: von Mises stress :math:`\sigma_{vM}` resulting from all actions
-
- The following example returns the normal stress within a 150x90x12 UA section resulting
- from an axial force of 10 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(N=10e3)
-
- stresses = stress_post.get_stress()
- print('Material: {0}'.format(stresses[0]['Material']))
- print('Axial Stresses: {0}'.format(stresses[0]['sig_zz_n']))
-
- $ Material: default
- $ Axial Stresses: [3.6402569 3.6402569 3.6402569 ... 3.6402569 3.6402569 3.6402569]
- """
-
- stress = []
-
- for group in self.material_groups:
- stress.append({
- 'Material': group.material.name,
- 'sig_zz_n': group.stress_result.sig_zz_n,
- 'sig_zz_mxx': group.stress_result.sig_zz_mxx,
- 'sig_zz_myy': group.stress_result.sig_zz_myy,
- 'sig_zz_m11': group.stress_result.sig_zz_m11,
- 'sig_zz_m22': group.stress_result.sig_zz_m22,
- 'sig_zz_m': group.stress_result.sig_zz_m,
- 'sig_zx_mzz': group.stress_result.sig_zx_mzz,
- 'sig_zy_mzz': group.stress_result.sig_zy_mzz,
- 'sig_zxy_mzz': group.stress_result.sig_zxy_mzz,
- 'sig_zx_vx': group.stress_result.sig_zx_vx,
- 'sig_zy_vx': group.stress_result.sig_zy_vx,
- 'sig_zxy_vx': group.stress_result.sig_zxy_vx,
- 'sig_zx_vy': group.stress_result.sig_zx_vy,
- 'sig_zy_vy': group.stress_result.sig_zy_vy,
- 'sig_zxy_vy': group.stress_result.sig_zxy_vy,
- 'sig_zx_v': group.stress_result.sig_zx_v,
- 'sig_zy_v': group.stress_result.sig_zy_v,
- 'sig_zxy_v': group.stress_result.sig_zxy_v,
- 'sig_zz': group.stress_result.sig_zz,
- 'sig_zx': group.stress_result.sig_zx,
- 'sig_zy': group.stress_result.sig_zy,
- 'sig_zxy': group.stress_result.sig_zxy,
- 'sig_vm': group.stress_result.sig_vm
- })
-
- return stress
-
-[docs] def plot_stress_n_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,N}` resulting from the
- axial load :math:`N`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- an axial force of 10 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(N=10e3)
-
- stress_post.plot_stress_n_zz()
-
- .. figure:: ../images/stress/stress_n_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the axial stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,N}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_n)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_mxx_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,Mxx}` resulting from the
- bending moment :math:`M_{xx}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- a bending moment about the x-axis of 5 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mxx=5e6)
-
- stress_post.plot_stress_mxx_zz()
-
- .. figure:: ../images/stress/stress_mxx_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the bending stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,Mxx}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_mxx)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_myy_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,Myy}` resulting from the
- bending moment :math:`M_{yy}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- a bending moment about the y-axis of 2 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Myy=2e6)
-
- stress_post.plot_stress_myy_zz()
-
- .. figure:: ../images/stress/stress_myy_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the bending stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,Myy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_myy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_m11_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,M11}` resulting from the
- bending moment :math:`M_{11}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- a bending moment about the 11-axis of 5 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(M11=5e6)
-
- stress_post.plot_stress_m11_zz()
-
- .. figure:: ../images/stress/stress_m11_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the bending stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,M11}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_m11)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_m22_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,M22}` resulting from the
- bending moment :math:`M_{22}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- a bending moment about the 22-axis of 2 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(M22=5e6)
-
- stress_post.plot_stress_m22_zz()
-
- .. figure:: ../images/stress/stress_m22_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the bending stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,M22}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_m22)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_m_zz(self, pause=True):
- """Produces a contour plot of the normal stress :math:`\sigma_{zz,\Sigma M}` resulting from
- all bending moments :math:`M_{xx} + M_{yy} + M_{11} + M_{22}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- a bending moment about the x-axis of 5 kN.m, a bending moment about the y-axis of 2 kN.m
- and a bending moment of 3 kN.m about the 11-axis::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mxx=5e6, Myy=2e6, M11=3e6)
-
- stress_post.plot_stress_m_zz()
-
- .. figure:: ../images/stress/stress_m_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the bending stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz,\Sigma M}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz_m)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_mzz_zx(self, pause=True):
- """Produces a contour plot of the *x*-component of the shear stress :math:`\sigma_{zx,Mzz}`
- resulting from the torsion moment :math:`M_{zz}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the x-component of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6)
-
- stress_post.plot_stress_mzz_zx()
-
- .. figure:: ../images/stress/stress_mzz_zx.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zx,Mzz}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zx_mzz)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_mzz_zy(self, pause=True):
- """Produces a contour plot of the *y*-component of the shear stress :math:`\sigma_{zy,Mzz}`
- resulting from the torsion moment :math:`M_{zz}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the y-component of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6)
-
- stress_post.plot_stress_mzz_zy()
-
- .. figure:: ../images/stress/stress_mzz_zy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zy,Mzz}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zy_mzz)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_mzz_zxy(self, pause=True):
- """Produces a contour plot of the resultant shear stress :math:`\sigma_{zxy,Mzz}` resulting
- from the torsion moment :math:`M_{zz}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the resultant shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6)
-
- stress_post.plot_stress_mzz_zxy()
-
- .. figure:: ../images/stress/stress_mzz_zxy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zxy,Mzz}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zxy_mzz)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_vector_mzz_zxy(self, pause=True):
- """Produces a vector plot of the resultant shear stress :math:`\sigma_{zxy,Mzz}` resulting
- from the torsion moment :math:`M_{zz}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example generates a vector plot of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6)
-
- stress_post.plot_vector_mzz_zxy()
-
- .. figure:: ../images/stress/vector_mzz_zxy.png
- :align: center
- :scale: 75 %
-
- Vector plot of the shear stress.
- """
-
- title = 'Stress Vector Plot - $\sigma_{zxy,Mzz}$'
- sigxs = []
- sigys = []
-
- for group in self.material_groups:
- sigxs.append(group.stress_result.sig_zx_mzz)
- sigys.append(group.stress_result.sig_zy_mzz)
-
- self.plot_stress_vector(sigxs, sigys, title, pause)
-
-[docs] def plot_stress_vx_zx(self, pause=True):
- """Produces a contour plot of the *x*-component of the shear stress :math:`\sigma_{zx,Vx}`
- resulting from the shear force :math:`V_{x}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the x-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the x-direction of 15 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3)
-
- stress_post.plot_stress_vx_zx()
-
- .. figure:: ../images/stress/stress_vx_zx.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zx,Vx}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zx_vx)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_vx_zy(self, pause=True):
- """Produces a contour plot of the *y*-component of the shear stress :math:`\sigma_{zy,Vx}`
- resulting from the shear force :math:`V_{x}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the y-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the x-direction of 15 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3)
-
- stress_post.plot_stress_vx_zy()
-
- .. figure:: ../images/stress/stress_vx_zy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zy,Vx}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zy_vx)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_vx_zxy(self, pause=True):
- """Produces a contour plot of the resultant shear stress :math:`\sigma_{zxy,Vx}` resulting
- from the shear force :math:`V_{x}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the resultant shear stress within a 150x90x12 UA
- section resulting from a shear force in the x-direction of 15 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3)
-
- stress_post.plot_stress_vx_zxy()
-
- .. figure:: ../images/stress/stress_vx_zxy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zxy,Vx}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zxy_vx)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_vector_vx_zxy(self, pause=True):
- """Produces a vector plot of the resultant shear stress :math:`\sigma_{zxy,Vx}` resulting
- from the shear force :math:`V_{x}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example generates a vector plot of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the x-direction of 15 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3)
-
- stress_post.plot_vector_vx_zxy()
-
- .. figure:: ../images/stress/vector_vx_zxy.png
- :align: center
- :scale: 75 %
-
- Vector plot of the shear stress.
- """
-
- title = 'Stress Vector Plot - $\sigma_{zxy,Vx}$'
- sigxs = []
- sigys = []
-
- for group in self.material_groups:
- sigxs.append(group.stress_result.sig_zx_vx)
- sigys.append(group.stress_result.sig_zy_vx)
-
- self.plot_stress_vector(sigxs, sigys, title, pause)
-
-[docs] def plot_stress_vy_zx(self, pause=True):
- """Produces a contour plot of the *x*-component of the shear stress :math:`\sigma_{zx,Vy}`
- resulting from the shear force :math:`V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the x-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the y-direction of 30 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vy=30e3)
-
- stress_post.plot_stress_vy_zx()
-
- .. figure:: ../images/stress/stress_vy_zx.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zx,Vy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zx_vy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_vy_zy(self, pause=True):
- """Produces a contour plot of the *y*-component of the shear stress :math:`\sigma_{zy,Vy}`
- resulting from the shear force :math:`V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the y-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the y-direction of 30 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vy=30e3)
-
- stress_post.plot_stress_vy_zy()
-
- .. figure:: ../images/stress/stress_vy_zy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zy,Vy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zy_vy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_vy_zxy(self, pause=True):
- """Produces a contour plot of the resultant shear stress :math:`\sigma_{zxy,Vy}` resulting
- from the shear force :math:`V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the resultant shear stress within a 150x90x12 UA
- section resulting from a shear force in the y-direction of 30 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vy=30e3)
-
- stress_post.plot_stress_vy_zxy()
-
- .. figure:: ../images/stress/stress_vy_zxy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zxy,Vy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zxy_vy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_vector_vy_zxy(self, pause=True):
- """Produces a vector plot of the resultant shear stress :math:`\sigma_{zxy,Vy}` resulting
- from the shear force :math:`V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example generates a vector plot of the shear stress within a 150x90x12 UA
- section resulting from a shear force in the y-direction of 30 kN::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vy=30e3)
-
- stress_post.plot_vector_vy_zxy()
-
- .. figure:: ../images/stress/vector_vy_zxy.png
- :align: center
- :scale: 75 %
-
- Vector plot of the shear stress.
- """
-
- title = 'Stress Vector Plot - $\sigma_{zxy,Vy}$'
- sigxs = []
- sigys = []
-
- for group in self.material_groups:
- sigxs.append(group.stress_result.sig_zx_vy)
- sigys.append(group.stress_result.sig_zy_vy)
-
- self.plot_stress_vector(sigxs, sigys, title, pause)
-
-[docs] def plot_stress_v_zx(self, pause=True):
- """Produces a contour plot of the *x*-component of the shear stress
- :math:`\sigma_{zx,\Sigma V}` resulting from the sum of the applied shear forces
- :math:`V_{x} + V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the x-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force of 15 kN in the x-direction and 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3, Vy=30e3)
-
- stress_post.plot_stress_v_zx()
-
- .. figure:: ../images/stress/stress_v_zx.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zx,\Sigma V}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zx_v)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_v_zy(self, pause=True):
- """Produces a contour plot of the *y*-component of the shear stress
- :math:`\sigma_{zy,\Sigma V}` resulting from the sum of the applied shear forces
- :math:`V_{x} + V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the y-component of the shear stress within a 150x90x12 UA
- section resulting from a shear force of 15 kN in the x-direction and 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3, Vy=30e3)
-
- stress_post.plot_stress_v_zy()
-
- .. figure:: ../images/stress/stress_v_zy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zy,\Sigma V}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zy_v)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_v_zxy(self, pause=True):
- """Produces a contour plot of the resultant shear stress
- :math:`\sigma_{zxy,\Sigma V}` resulting from the sum of the applied shear forces
- :math:`V_{x} + V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the resultant shear stress within a 150x90x12 UA
- section resulting from a shear force of 15 kN in the x-direction and 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3, Vy=30e3)
-
- stress_post.plot_stress_v_zxy()
-
- .. figure:: ../images/stress/stress_v_zxy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zxy,\Sigma V}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zxy_v)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_vector_v_zxy(self, pause=True):
- """Produces a vector plot of the resultant shear stress
- :math:`\sigma_{zxy,\Sigma V}` resulting from the sum of the applied shear forces
- :math:`V_{x} + V_{y}`.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example generates a vector plot of the shear stress within a 150x90x12 UA
- section resulting from a shear force of 15 kN in the x-direction and 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Vx=15e3, Vy=30e3)
-
- stress_post.plot_vector_v_zxy()
-
- .. figure:: ../images/stress/vector_v_zxy.png
- :align: center
- :scale: 75 %
-
- Vector plot of the shear stress.
- """
-
- title = 'Stress Vector Plot - $\sigma_{zxy,\Sigma V}$'
- sigxs = []
- sigys = []
-
- for group in self.material_groups:
- sigxs.append(group.stress_result.sig_zx_v)
- sigys.append(group.stress_result.sig_zy_v)
-
- self.plot_stress_vector(sigxs, sigys, title, pause)
-
-[docs] def plot_stress_zz(self, pause=True):
- """Produces a contour plot of the combined normal stress :math:`\sigma_{zz}` resulting from
- all actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the normal stress within a 150x90x12 UA section resulting from
- an axial force of 100 kN, a bending moment about the x-axis of 5 kN.m and a bending moment
- about the y-axis of 2 kN.m::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(N=100e3, Mxx=5e6, Myy=2e6)
-
- stress_post.plot_stress_zz()
-
- .. figure:: ../images/stress/stress_zz.png
- :align: center
- :scale: 75 %
-
- Contour plot of the normal stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zz}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zz)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_zx(self, pause=True):
- """Produces a contour plot of the *x*-component of the shear stress :math:`\sigma_{zx}`
- resulting from all actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the x-component of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m and a shear force of 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6, Vy=30e3)
-
- stress_post.plot_stress_zx()
-
- .. figure:: ../images/stress/stress_zx.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zx}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zx)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_zy(self, pause=True):
- """Produces a contour plot of the *y*-component of the shear stress :math:`\sigma_{zy}`
- resulting from all actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots the y-component of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m and a shear force of 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6, Vy=30e3)
-
- stress_post.plot_stress_zy()
-
- .. figure:: ../images/stress/stress_zy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_stress_zxy(self, pause=True):
- """Produces a contour plot of the resultant shear stress :math:`\sigma_{zxy}` resulting
- from all actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the resultant shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m and a shear force of 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6, Vy=30e3)
-
- stress_post.plot_stress_zxy()
-
- .. figure:: ../images/stress/stress_zxy.png
- :align: center
- :scale: 75 %
-
- Contour plot of the shear stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{zxy}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_zxy)
-
- self.plot_stress_contour(sigs, title, pause)
-
-[docs] def plot_vector_zxy(self, pause=True):
- """Produces a vector plot of the resultant shear stress :math:`\sigma_{zxy}` resulting
- from all actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example generates a vector plot of the shear stress within a 150x90x12 UA
- section resulting from a torsion moment of 1 kN.m and a shear force of 30 kN in the
- y-direction::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(Mzz=1e6, Vy=30e3)
-
- stress_post.plot_vector_zxy()
-
- .. figure:: ../images/stress/vector_zxy.png
- :align: center
- :scale: 75 %
-
- Vector plot of the shear stress.
- """
-
- title = 'Stress Vector Plot - $\sigma_{zxy}$'
- sigxs = []
- sigys = []
-
- for group in self.material_groups:
- sigxs.append(group.stress_result.sig_zx)
- sigys.append(group.stress_result.sig_zy)
-
- self.plot_stress_vector(sigxs, sigys, title, pause)
-
-[docs] def plot_stress_vm(self, pause=True):
- """Produces a contour plot of the von Mises stress :math:`\sigma_{vM}` resulting from all
- actions.
-
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
-
- The following example plots a contour of the von Mises stress within a 150x90x12 UA section
- resulting from the following actions:
-
- * :math:`N = 50` kN
- * :math:`M_{xx} = -5` kN.m
- * :math:`M_{22} = 2.5` kN.m
- * :math:`M_{zz} = 1.5` kN.m
- * :math:`V_{x} = 10` kN
- * :math:`V_{y} = 5` kN
-
- ::
-
- import sectionproperties.pre.sections as sections
- from sectionproperties.analysis.cross_section import CrossSection
-
- geometry = sections.AngleSection(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
- section = CrossSection(geometry, mesh)
-
- section.calculate_geometric_properties()
- section.calculate_warping_properties()
- stress_post = section.calculate_stress(
- N=50e3, Mxx=-5e6, M22=2.5e6, Mzz=0.5e6, Vx=10e3, Vy=5e3
- )
-
- stress_post.plot_stress_vm()
-
- .. figure:: ../images/stress/stress_vm.png
- :align: center
- :scale: 75 %
-
- Contour plot of the von Mises stress.
- """
-
- title = 'Stress Contour Plot - $\sigma_{vM}$'
- sigs = []
-
- for group in self.material_groups:
- sigs.append(group.stress_result.sig_vm)
-
- self.plot_stress_contour(sigs, title, pause)
-
-
-[docs]class MaterialGroup:
- """Class for storing elements of different materials.
-
- A MaterialGroup object contains the finite element objects for a specified `material`. The
- `stress_result` variable provides storage for stresses related each material.
-
- :param material: Material object for the current MaterialGroup
- :type material: :class:`~sectionproperties.pre.pre.Material`
- :param int num_nods: Number of nodes for the entire cross-section
-
- :cvar material: Material object for the current MaterialGroup
- :vartype material: :class:`~sectionproperties.pre.pre.Material`
- :cvar stress_result: A StressResult object for saving the stresses of the current material
- :vartype stress_result: :class:`~sectionproperties.analysis.cross_section.StressResult`
- :cvar elements: A list of finite element objects that are of the current material type
- :vartype elements: list[:class:`~sectionproperties.analysis.fea.Tri6`]
- :cvar el_ids: A list of the element IDs of the elements that are of the current material type
- :vartype el_ids: list[int]
- """
-
- def __init__(self, material, num_nodes):
- """Inits the MaterialGroup class."""
-
- self.material = material
- self.stress_result = StressResult(num_nodes)
- self.elements = []
- self.el_ids = []
-
-[docs] def add_element(self, element):
- """Adds an element and its element ID to the MaterialGroup.
-
- :param element: Element to add to the MaterialGroup
- :type element: :class:`~sectionproperties.analysis.fea.Tri6`
- """
-
- # add Tri6 element to the list of elements
- self.elements.append(element)
- self.el_ids.append(element.el_id)
-
-
-[docs]class StressResult:
- """Class for storing a stress result.
-
- Provides variables to store the results from a cross-section stress analysis. Also provides a
- method to calculate combined stresses.
-
- :param int num_nodes: Number of nodes in the finite element mesh
-
- :cvar sig_zz_n: Normal stress (:math:`\sigma_{zz,N}`) resulting from an axial force
- :vartype sig_zz_n: :class:`numpy.ndarray`
- :cvar sig_zz_mxx: Normal stress (:math:`\sigma_{zz,Mxx}`) resulting from a bending moment about
- the xx-axis
- :vartype sig_zz_mxx: :class:`numpy.ndarray`
- :cvar sig_zz_myy: Normal stress (:math:`\sigma_{zz,Myy}`) resulting from a bending moment about
- the yy-axis
- :vartype sig_zz_myy: :class:`numpy.ndarray`
- :cvar sig_zz_m11: Normal stress (:math:`\sigma_{zz,M11}`) resulting from a bending moment about
- the 11-axis
- :vartype sig_zz_m11: :class:`numpy.ndarray`
- :cvar sig_zz_m22: Normal stress (:math:`\sigma_{zz,M22}`) resulting from a bending moment about
- the 22-axis
- :vartype sig_zz_m22: :class:`numpy.ndarray`
- :cvar sig_zx_mzz: Shear stress (:math:`\sigma_{zx,Mzz}`) resulting from a torsion moment about
- the zz-axis
- :vartype sig_zx_mzz: :class:`numpy.ndarray`
- :cvar sig_zy_mzz: Shear stress (:math:`\sigma_{zy,Mzz}`) resulting from a torsion moment about
- the zz-axis
- :vartype sig_zy_mzz: :class:`numpy.ndarray`
- :cvar sig_zx_vx: Shear stress (:math:`\sigma_{zx,Vx}`) resulting from a shear force in the
- x-direction
- :vartype sig_zx_vx: :class:`numpy.ndarray`
- :cvar sig_zy_vx: Shear stress (:math:`\sigma_{zy,Vx}`) resulting from a shear force in the
- x-direction
- :vartype sig_zy_vx: :class:`numpy.ndarray`
- :cvar sig_zx_vy: Shear stress (:math:`\sigma_{zx,Vy}`) resulting from a shear force in the
- y-direction
- :vartype sig_zx_vy: :class:`numpy.ndarray`
- :cvar sig_zy_vy: Shear stress (:math:`\sigma_{zy,Vy}`) resulting from a shear force in the
- y-direction
- :vartype sig_zy_vy: :class:`numpy.ndarray`
- :cvar sig_zz_m: Normal stress (:math:`\sigma_{zz,\Sigma M}`) resulting from all bending moments
- :vartype sig_zz_m: :class:`numpy.ndarray`
- :cvar sig_zxy_mzz: Resultant shear stress (:math:`\sigma_{zxy,Mzz}`) resulting from a torsion
- moment in the zz-direction
- :vartype sig_zxy_mzz: :class:`numpy.ndarray`
- :cvar sig_zxy_vx: Resultant shear stress (:math:`\sigma_{zxy,Vx}`) resulting from a a shear
- force in the x-direction
- :vartype sig_zxy_vx: :class:`numpy.ndarray`
- :cvar sig_zxy_vy: Resultant shear stress (:math:`\sigma_{zxy,Vy}`) resulting from a a shear
- force in the y-direction
- :vartype sig_zxy_vy: :class:`numpy.ndarray`
- :cvar sig_zx_v: Shear stress (:math:`\sigma_{zx,\Sigma V}`) resulting from all shear forces
- :vartype sig_zx_v: :class:`numpy.ndarray`
- :cvar sig_zy_v: Shear stress (:math:`\sigma_{zy,\Sigma V}`) resulting from all shear forces
- :vartype sig_zy_v: :class:`numpy.ndarray`
- :cvar sig_zxy_v: Resultant shear stress (:math:`\sigma_{zxy,\Sigma V}`) resulting from all
- shear forces
- :vartype sig_zxy_v: :class:`numpy.ndarray`
- :cvar sig_zz: Combined normal force (:math:`\sigma_{zz}`) resulting from all actions
- :vartype sig_zz: :class:`numpy.ndarray`
- :cvar sig_zx: Combined shear stress (:math:`\sigma_{zx}`) resulting from all actions
- :vartype sig_zx: :class:`numpy.ndarray`
- :cvar sig_zy: Combined shear stress (:math:`\sigma_{zy}`) resulting from all actions
- :vartype sig_zy: :class:`numpy.ndarray`
- :cvar sig_zxy: Combined resultant shear stress (:math:`\sigma_{zxy}`) resulting from all
- actions
- :vartype sig_zxy: :class:`numpy.ndarray`
- :cvar sig_vm: von Mises stress (:math:`\sigma_{VM}`) resulting from all actions
- :vartype sig_vm: :class:`numpy.ndarray`
- """
-
- def __init__(self, num_nodes):
- """Inits the StressResult class."""
-
- # allocate stresses arising directly from actions
- self.sig_zz_n = np.zeros(num_nodes)
- self.sig_zz_mxx = np.zeros(num_nodes)
- self.sig_zz_myy = np.zeros(num_nodes)
- self.sig_zz_m11 = np.zeros(num_nodes)
- self.sig_zz_m22 = np.zeros(num_nodes)
- self.sig_zx_mzz = np.zeros(num_nodes)
- self.sig_zy_mzz = np.zeros(num_nodes)
- self.sig_zx_vx = np.zeros(num_nodes)
- self.sig_zy_vx = np.zeros(num_nodes)
- self.sig_zx_vy = np.zeros(num_nodes)
- self.sig_zy_vy = np.zeros(num_nodes)
-
- # allocate combined stresses
- self.sig_zz_m = np.zeros(num_nodes)
- self.sig_zxy_mzz = np.zeros(num_nodes)
- self.sig_zxy_vx = np.zeros(num_nodes)
- self.sig_zxy_vy = np.zeros(num_nodes)
- self.sig_zx_v = np.zeros(num_nodes)
- self.sig_zy_v = np.zeros(num_nodes)
- self.sig_zxy_v = np.zeros(num_nodes)
- self.sig_zz = np.zeros(num_nodes)
- self.sig_zx = np.zeros(num_nodes)
- self.sig_zy = np.zeros(num_nodes)
- self.sig_zxy = np.zeros(num_nodes)
- self.sig_vm = np.zeros(num_nodes)
-
-[docs] def calculate_combined_stresses(self):
- """Calculates the combined cross-section stresses."""
-
- self.sig_zz_m = self.sig_zz_mxx + self.sig_zz_myy + self.sig_zz_m11 + self.sig_zz_m22
- self.sig_zxy_mzz = (self.sig_zx_mzz ** 2 + self.sig_zy_mzz ** 2) ** 0.5
- self.sig_zxy_vx = (self.sig_zx_vx ** 2 + self.sig_zy_vx ** 2) ** 0.5
- self.sig_zxy_vy = (self.sig_zx_vy ** 2 + self.sig_zy_vy ** 2) ** 0.5
- self.sig_zx_v = self.sig_zx_vx + self.sig_zx_vy
- self.sig_zy_v = self.sig_zy_vx + self.sig_zy_vy
- self.sig_zxy_v = (self.sig_zx_v ** 2 + self.sig_zy_v ** 2) ** 0.5
- self.sig_zz = self.sig_zz_n + self.sig_zz_m
- self.sig_zx = self.sig_zx_mzz + self.sig_zx_v
- self.sig_zy = self.sig_zy_mzz + self.sig_zy_v
- self.sig_zxy = (self.sig_zx ** 2 + self.sig_zy ** 2) ** 0.5
- self.sig_vm = (self.sig_zz ** 2 + 3 * self.sig_zxy ** 2) ** 0.5
-
-
-[docs]class SectionProperties:
- """Class for storing section properties.
-
- Stores calculated section properties. Also provides methods to calculate section properties
- entirely derived from other section properties.
-
- :cvar float area: Cross-sectional area
- :cvar float perimeter: Cross-sectional perimeter
- :cvar float ea: Modulus weighted area (axial rigidity)
- :cvar float ga: Modulus weighted product of shear modulus and area
- :cvar float nu_eff: Effective Poisson's ratio
- :cvar float qx: First moment of area about the x-axis
- :cvar float qy: First moment of area about the y-axis
- :cvar float ixx_g: Second moment of area about the global x-axis
- :cvar float iyy_g: Second moment of area about the global y-axis
- :cvar float ixy_g: Second moment of area about the global xy-axis
- :cvar float cx: X coordinate of the elastic centroid
- :cvar float cy: Y coordinate of the elastic centroid
- :cvar float ixx_c: Second moment of area about the centroidal x-axis
- :cvar float iyy_c: Second moment of area about the centroidal y-axis
- :cvar float ixy_c: Second moment of area about the centroidal xy-axis
- :cvar float zxx_plus: Section modulus about the centroidal x-axis for stresses at the positive
- extreme value of y
- :cvar float zxx_minus: Section modulus about the centroidal x-axis for stresses at the negative
- extreme value of y
- :cvar float zyy_plus: Section modulus about the centroidal y-axis for stresses at the positive
- extreme value of x
- :cvar float zyy_minus: Section modulus about the centroidal y-axis for stresses at the negative
- extreme value of x
- :cvar float rx_c: Radius of gyration about the centroidal x-axis.
- :cvar float ry_c: Radius of gyration about the centroidal y-axis.
- :cvar float i11_c: Second moment of area about the centroidal 11-axis
- :cvar float i22_c: Second moment of area about the centroidal 22-axis
- :cvar float phi: Principal axis angle
- :cvar float z11_plus: Section modulus about the principal 11-axis for stresses at the positive
- extreme value of the 22-axis
- :cvar float z11_minus: Section modulus about the principal 11-axis for stresses at the negative
- extreme value of the 22-axis
- :cvar float z22_plus: Section modulus about the principal 22-axis for stresses at the positive
- extreme value of the 11-axis
- :cvar float z22_minus: Section modulus about the principal 22-axis for stresses at the negative
- extreme value of the 11-axis
- :cvar float r11_c: Radius of gyration about the principal 11-axis.
- :cvar float r22_c: Radius of gyration about the principal 22-axis.
- :cvar float j: Torsion constant
- :cvar omega: Warping function
- :vartype omega: :class:`numpy.ndarray`
- :cvar psi_shear: Psi shear function
- :vartype psi_shear: :class:`numpy.ndarray`
- :cvar phi_shear: Phi shear function
- :vartype phi_shear: :class:`numpy.ndarray`
- :cvar float Delta_s: Shear factor
- :cvar float x_se: X coordinate of the shear centre (elasticity approach)
- :cvar float y_se: Y coordinate of the shear centre (elasticity approach)
- :cvar float x11_se: 11 coordinate of the shear centre (elasticity approach)
- :cvar float y22_se: 22 coordinate of the shear centre (elasticity approach)
- :cvar float x_st: X coordinate of the shear centre (Trefftz's approach)
- :cvar float y_st: Y coordinate of the shear centre (Trefftz's approach)
- :cvar float gamma: Warping constant
- :cvar float A_sx: Shear area about the x-axis
- :cvar float A_sy: Shear area about the y-axis
- :cvar float A_sxy: Shear area about the xy-axis
- :cvar float A_s11: Shear area about the 11 bending axis
- :cvar float A_s22: Shear area about the 22 bending axis
- :cvar float beta_x_plus: Monosymmetry constant for bending about the x-axis with the top flange
- in compression
- :cvar float beta_x_minus: Monosymmetry constant for bending about the x-axis with the bottom
- flange in compression
- :cvar float beta_y_plus: Monosymmetry constant for bending about the y-axis with the top flange
- in compression
- :cvar float beta_y_minus: Monosymmetry constant for bending about the y-axis with the bottom
- flange in compression
- :cvar float beta_11_plus: Monosymmetry constant for bending about the 11-axis with the top
- flange in compression
- :cvar float beta_11_minus: Monosymmetry constant for bending about the 11-axis with the bottom
- flange in compression
- :cvar float beta_22_plus: Monosymmetry constant for bending about the 22-axis with the top
- flange in compression
- :cvar float beta_22_minus: Monosymmetry constant for bending about the 22-axis with the bottom
- flange in compression
- :cvar float x_pc: X coordinate of the global plastic centroid
- :cvar float y_pc: Y coordinate of the global plastic centroid
- :cvar float x11_pc: 11 coordinate of the principal plastic centroid
- :cvar float y22_pc: 22 coordinate of the principal plastic centroid
- :cvar float sxx: Plastic section modulus about the centroidal x-axis
- :cvar float syy: Plastic section modulus about the centroidal y-axis
- :cvar float sf_xx_plus: Shape factor for bending about the x-axis with respect to the top fibre
- :cvar float sf_xx_minus: Shape factor for bending about the x-axis with respect to the bottom
- fibre
- :cvar float sf_yy_plus: Shape factor for bending about the y-axis with respect to the top fibre
- :cvar float sf_yy_minus: Shape factor for bending about the y-axis with respect to the bottom
- fibre
- :cvar float s11: Plastic section modulus about the 11-axis
- :cvar float s22: Plastic section modulus about the 22-axis
- :cvar float sf_11_plus: Shape factor for bending about the 11-axis with respect to the top
- fibre
- :cvar float sf_11_minus: Shape factor for bending about the 11-axis with respect to the bottom
- fibre
- :cvar float sf_22_plus: Shape factor for bending about the 22-axis with respect to the top
- fibre
- :cvar float sf_22_minus: Shape factor for bending about the 22-axis with respect to the bottom
- fibre
- """
-
- def __init__(self):
- """Inits the SectionProperties class."""
-
- self.area = None
- self.perimeter = None
- self.ea = None
- self.ga = None
- self.nu_eff = None
- self.qx = None
- self.qy = None
- self.ixx_g = None
- self.iyy_g = None
- self.ixy_g = None
- self.cx = None
- self.cy = None
- self.ixx_c = None
- self.iyy_c = None
- self.ixy_c = None
- self.zxx_plus = None
- self.zxx_minus = None
- self.zyy_plus = None
- self.zyy_minus = None
- self.rx_c = None
- self.ry_c = None
- self.i11_c = None
- self.i22_c = None
- self.phi = None
- self.z11_plus = None
- self.z11_minus = None
- self.z22_plus = None
- self.z22_minus = None
- self.r11_c = None
- self.r22_c = None
- self.j = None
- self.omega = None
- self.psi_shear = None
- self.phi_shear = None
- self.Delta_s = None
- self.x_se = None
- self.y_se = None
- self.x11_se = None
- self.y22_se = None
- self.x_st = None
- self.y_st = None
- self.gamma = None
- self.A_sx = None
- self.A_sy = None
- self.A_sxy = None
- self.A_s11 = None
- self.A_s22 = None
- self.beta_x_plus = None
- self.beta_x_minus = None
- self.beta_y_plus = None
- self.beta_y_minus = None
- self.beta_11_plus = None
- self.beta_11_minus = None
- self.beta_22_plus = None
- self.beta_22_minus = None
- self.x_pc = None
- self.y_pc = None
- self.x11_pc = None
- self.y22_pc = None
- self.sxx = None
- self.syy = None
- self.sf_xx_plus = None
- self.sf_xx_minus = None
- self.sf_yy_plus = None
- self.sf_yy_minus = None
- self.s11 = None
- self.s22 = None
- self.sf_11_plus = None
- self.sf_11_minus = None
- self.sf_22_plus = None
- self.sf_22_minus = None
-
-[docs] def calculate_elastic_centroid(self):
- """Calculates the elastic centroid based on the cross-section area and first moments of
- area.
- """
-
- self.cx = self.qy / self.ea
- self.cy = self.qx / self.ea
-
-[docs] def calculate_centroidal_properties(self, mesh):
- """Calculates the geometric section properties about the centroidal and principal axes
- based on the results about the global axis.
- """
-
- # calculate second moments of area about the centroidal xy axis
- self.ixx_c = self.ixx_g - self.qx ** 2 / self.ea
- self.iyy_c = self.iyy_g - self.qy ** 2 / self.ea
- self.ixy_c = self.ixy_g - self.qx * self.qy / self.ea
-
- # calculate section moduli about the centroidal xy axis
- nodes = np.array(mesh.points)
- xmax = nodes[:, 0].max()
- xmin = nodes[:, 0].min()
- ymax = nodes[:, 1].max()
- ymin = nodes[:, 1].min()
- self.zxx_plus = self.ixx_c / abs(ymax - self.cy)
- self.zxx_minus = self.ixx_c / abs(ymin - self.cy)
- self.zyy_plus = self.iyy_c / abs(xmax - self.cx)
- self.zyy_minus = self.iyy_c / abs(xmin - self.cx)
-
- # calculate radii of gyration about centroidal xy axis
- self.rx_c = (self.ixx_c / self.ea) ** 0.5
- self.ry_c = (self.iyy_c / self.ea) ** 0.5
-
- # calculate prinicpal 2nd moments of area about the centroidal xy axis
- Delta = (((self.ixx_c - self.iyy_c) / 2) ** 2 + self.ixy_c ** 2) ** 0.5
- self.i11_c = (self.ixx_c + self.iyy_c) / 2 + Delta
- self.i22_c = (self.ixx_c + self.iyy_c) / 2 - Delta
-
- # calculate initial principal axis angle
- if abs(self.ixx_c - self.i11_c) < 1e-12 * self.i11_c:
- self.phi = 0
- else:
- self.phi = np.arctan2(
- self.ixx_c - self.i11_c, self.ixy_c) * 180 / np.pi
-
- # calculate section moduli about the principal axis
- for (i, pt) in enumerate(nodes):
- x = pt[0] - self.cx
- y = pt[1] - self.cy
- # determine the coordinate of the point wrt the principal axis
- (x1, y2) = fea.principal_coordinate(self.phi, x, y)
-
- # initialise min, max variables
- if i == 0:
- x1max = x1
- x1min = x1
- y2max = y2
- y2min = y2
-
- # update the mins and maxs where necessary
- x1max = max(x1max, x1)
- x1min = min(x1min, x1)
- y2max = max(y2max, y2)
- y2min = min(y2min, y2)
-
- # evaluate principal section moduli
- self.z11_plus = self.i11_c / abs(y2max)
- self.z11_minus = self.i11_c / abs(y2min)
- self.z22_plus = self.i22_c / abs(x1max)
- self.z22_minus = self.i22_c / abs(x1min)
-
- # calculate radii of gyration about centroidal principal axis
- self.r11_c = (self.i11_c / self.ea) ** 0.5
- self.r22_c = (self.i22_c / self.ea) ** 0.5
-
-import numpy as np
-
-
-[docs]class Tri6:
- """Class for a six noded quadratic triangular element.
-
- Provides methods for the calculation of section properties based on the finite element method.
-
- :param int el_id: Unique element id
- :param coords: A 2 x 6 array of the coordinates of the tri-6 nodes. The first three columns
- relate to the vertices of the triangle and the last three columns correspond to the
- mid-nodes.
- :type coords: :class:`numpy.ndarray`
- :param node_ids: A list of the global node ids for the current element
- :type node_ids: list[int]
- :param material: Material object for the current finite element.
- :type material: :class:`~sectionproperties.pre.pre.Material`
-
- :cvar int el_id: Unique element id
- :cvar coords: A 2 x 6 array of the coordinates of the tri-6 nodes. The first three columns
- relate to the vertices of the triangle and the last three columns correspond to the
- mid-nodes.
- :vartype coords: :class:`numpy.ndarray`
- :cvar node_ids: A list of the global node ids for the current element
- :vartype node_ids: list[int]
- :cvar material: Material of the current finite element.
- :vartype material: :class:`~sectionproperties.pre.pre.Material`
- """
-
- def __init__(self, el_id, coords, node_ids, material):
- """Inits the Tri6 class."""
-
- self.el_id = el_id
- self.coords = coords
- self.node_ids = node_ids
- self.material = material
-
-[docs] def geometric_properties(self):
- """Calculates the geometric properties for the current finite element.
-
- :return: Tuple containing the geometric properties and the elastic and shear moduli of the
- element: *(area, qx, qy, ixx, iyy, ixy, e, g)*
- :rtype: tuple(float)
- """
-
- # initialise geometric properties
- area = 0
- qx = 0
- qy = 0
- ixx = 0
- iyy = 0
- ixy = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- # loop through each Gauss point
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, _, j) = shape_function(self.coords, gp)
-
- area += gp[0] * j
- qx += gp[0] * np.dot(N, np.transpose(self.coords[1, :])) * j
- qy += gp[0] * np.dot(N, np.transpose(self.coords[0, :])) * j
- ixx += gp[0] * np.dot(N, np.transpose(self.coords[1, :])) ** 2 * j
- iyy += gp[0] * np.dot(N, np.transpose(self.coords[0, :])) ** 2 * j
- ixy += (
- gp[0] * np.dot(N, np.transpose(self.coords[1, :])) * np.dot(
- N, np.transpose(self.coords[0, :])) * j
- )
-
- return (
- area, qx, qy, ixx, iyy, ixy, self.material.elastic_modulus, self.material.shear_modulus
- )
-
-[docs] def torsion_properties(self):
- """Calculates the element stiffness matrix used for warping analysis and the torsion load
- vector.
-
- :return: Element stiffness matrix *(k_el)* and element torsion load vector *(f_el)*
- :rtype: tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`)
- """
-
- # initialise stiffness matrix and load vector
- k_el = 0
- f_el = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, B, j) = shape_function(self.coords, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(self.coords[0, :]))
- Ny = np.dot(N, np.transpose(self.coords[1, :]))
-
- # calculated modulus weighted stiffness matrix and load vector
- k_el += gp[0] * np.dot(np.transpose(B), B) * j * (self.material.elastic_modulus)
- f_el += (
- gp[0] * np.dot(np.transpose(B), np.transpose(np.array([Ny, -Nx]))) *
- j * self.material.elastic_modulus
- )
-
- return (k_el, f_el)
-
-[docs] def shear_load_vectors(self, ixx, iyy, ixy, nu):
- """Calculates the element shear load vectors used to evaluate the shear functions.
-
- :param float ixx: Second moment of area about the centroidal x-axis
- :param float iyy: Second moment of area about the centroidal y-axis
- :param float ixy: Second moment of area about the centroidal xy-axis
- :param float nu: Effective Poisson's ratio for the cross-section
-
- :return: Element shear load vector psi *(f_psi)* and phi *(f_phi)*
- :rtype: tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`)
- """
-
- # initialise force vectors
- f_psi = 0
- f_phi = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, B, j) = shape_function(self.coords, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(self.coords[0, :]))
- Ny = np.dot(N, np.transpose(self.coords[1, :]))
-
- # determine shear parameters
- r = Nx ** 2 - Ny ** 2
- q = 2 * Nx * Ny
- d1 = ixx * r - ixy * q
- d2 = ixy * r + ixx * q
- h1 = -ixy * r + iyy * q
- h2 = -iyy * r - ixy * q
-
- f_psi += (
- gp[0] * (nu / 2 * np.transpose(np.transpose(B).dot(np.array([[d1], [d2]])))[0] +
- 2 * (1 + nu) * np.transpose(N) * (ixx * Nx - ixy * Ny)) * j *
- self.material.elastic_modulus
- )
- f_phi += (
- gp[0] * (nu / 2 * np.transpose(np.transpose(B).dot(np.array([[h1], [h2]])))[0] +
- 2 * (1 + nu) * np.transpose(N) * (iyy * Ny - ixy * Nx)) * j *
- self.material.elastic_modulus
- )
-
- return (f_psi, f_phi)
-
-[docs] def shear_warping_integrals(self, ixx, iyy, ixy, omega):
- """Calculates the element shear centre and warping integrals required for shear analysis of
- the cross-section.
-
- :param float ixx: Second moment of area about the centroidal x-axis
- :param float iyy: Second moment of area about the centroidal y-axis
- :param float ixy: Second moment of area about the centroidal xy-axis
- :param omega: Values of the warping function at the element nodes
- :type omega: :class:`numpy.ndarray`
-
- :return: Shear centre integrals about the x and y-axes *(sc_xint, sc_yint)*, warping
- integrals *(q_omega, i_omega, i_xomega, i_yomega)*
- :rtype: tuple(float, float, float, float, float, float)
- """
-
- # initialise integrals
- sc_xint = 0
- sc_yint = 0
- q_omega = 0
- i_omega = 0
- i_xomega = 0
- i_yomega = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, B, j) = shape_function(self.coords, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(self.coords[0, :]))
- Ny = np.dot(N, np.transpose(self.coords[1, :]))
- Nomega = np.dot(N, np.transpose(omega))
-
- sc_xint += (
- gp[0] * (iyy * Nx + ixy * Ny) * (Nx ** 2 + Ny ** 2) *
- j * self.material.elastic_modulus
- )
- sc_yint += (
- gp[0] * (ixx * Ny + ixy * Nx) * (Nx ** 2 + Ny ** 2) *
- j * self.material.elastic_modulus
- )
- q_omega += gp[0] * Nomega * j * self.material.elastic_modulus
- i_omega += gp[0] * Nomega ** 2 * j * self.material.elastic_modulus
- i_xomega += gp[0] * Nx * Nomega * j * self.material.elastic_modulus
- i_yomega += gp[0] * Ny * Nomega * j * self.material.elastic_modulus
-
- return (sc_xint, sc_yint, q_omega, i_omega, i_xomega, i_yomega)
-
-[docs] def shear_coefficients(self, ixx, iyy, ixy, psi_shear, phi_shear, nu):
- """Calculates the variables used to determine the shear deformation coefficients.
-
- :param float ixx: Second moment of area about the centroidal x-axis
- :param float iyy: Second moment of area about the centroidal y-axis
- :param float ixy: Second moment of area about the centroidal xy-axis
- :param psi_shear: Values of the psi shear function at the element nodes
- :type psi_shear: :class:`numpy.ndarray`
- :param phi_shear: Values of the phi shear function at the element nodes
- :type phi_shear: :class:`numpy.ndarray`
- :param float nu: Effective Poisson's ratio for the cross-section
-
- :return: Shear deformation variables *(kappa_x, kappa_y, kappa_xy)*
- :rtype: tuple(float, float, float)
- """
-
- # initialise properties
- kappa_x = 0
- kappa_y = 0
- kappa_xy = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, B, j) = shape_function(self.coords, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(self.coords[0, :]))
- Ny = np.dot(N, np.transpose(self.coords[1, :]))
-
- # determine shear parameters
- r = Nx ** 2 - Ny ** 2
- q = 2 * Nx * Ny
- d1 = ixx * r - ixy * q
- d2 = ixy * r + ixx * q
- h1 = -ixy * r + iyy * q
- h2 = -iyy * r - ixy * q
-
- kappa_x += (
- gp[0] * (psi_shear.dot(np.transpose(B)) - nu / 2 * np.array([d1, d2])).dot(
- B.dot(psi_shear) - nu / 2 * np.array([d1, d2])) * j *
- self.material.elastic_modulus
- )
- kappa_y += (
- gp[0] * (phi_shear.dot(np.transpose(B)) - nu / 2 * np.array([h1, h2])).dot(
- B.dot(phi_shear) - nu / 2 * np.array([h1, h2])) * j *
- self.material.elastic_modulus
- )
- kappa_xy += (
- gp[0] * (psi_shear.dot(np.transpose(B)) - nu / 2 * np.array([d1, d2])).dot(
- B.dot(phi_shear) - nu / 2 * np.array([h1, h2])) * j *
- self.material.elastic_modulus
- )
-
- return (kappa_x, kappa_y, kappa_xy)
-
-[docs] def monosymmetry_integrals(self, phi):
- """Calculates the integrals used to evaluate the monosymmetry constant about both global
- axes and both prinicipal axes.
-
- :param float phi: Principal bending axis angle
-
- :return: Integrals used to evaluate the monosymmetry constants *(int_x, int_y, int_11,
- int_22)*
- :rtype: tuple(float, float, float, float)
- """
-
- # initialise properties
- int_x = 0
- int_y = 0
- int_11 = 0
- int_22 = 0
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for gp in gps:
- # determine shape function and jacobian
- (N, _, j) = shape_function(self.coords, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(self.coords[0, :]))
- Ny = np.dot(N, np.transpose(self.coords[1, :]))
-
- # determine 11 and 22 position at Gauss point
- (Nx_11, Ny_22) = principal_coordinate(phi, Nx, Ny)
-
- # weight the monosymmetry integrals by the section elastic modulus
- int_x += gp[0] * (Nx * Nx * Ny + Ny * Ny * Ny) * j * self.material.elastic_modulus
- int_y += gp[0] * (Ny * Ny * Nx + Nx * Nx * Nx) * j * self.material.elastic_modulus
- int_11 += (
- gp[0] * (Nx_11 * Nx_11 * Ny_22 + Ny_22 * Ny_22 * Ny_22) * j *
- self.material.elastic_modulus
- )
- int_22 += (
- gp[0] * (Ny_22 * Ny_22 * Nx_11 + Nx_11 * Nx_11 * Nx_11) * j *
- self.material.elastic_modulus
- )
-
- return (int_x, int_y, int_11, int_22)
-
-[docs] def plastic_properties(self, u, p):
- """Calculates total force resisted by the element when subjected to a stress equal to the
- yield strength. Also returns the modulus weighted area and first moments of area, and
- determines whether or not the element is above or below the line defined by the unit
- vector *u* and point *p*.
-
- :param u: Unit vector in the direction of the line
- :type u: :class:`numpy.ndarray`
- :param p: Point on the line
- :type p: :class:`numpy.ndarray`
-
- :return: Element force *(force)*, modulus weighted area properties *(ea, e.qx, e.qy)* and
- whether or not the element is above the line
- :rtype: tuple(float, float, float, float, bool)
- """
-
- # initialise geometric properties
- e = self.material.elastic_modulus
- area = 0
- qx = 0
- qy = 0
- force = 0
-
- # Gauss points for 3 point Gaussian integration
- gps = gauss_points(3)
-
- # loop through each Gauss point
- for gp in gps:
- # determine shape function, shape function derivative and jacobian
- (N, _, j) = shape_function(self.coords, gp)
-
- area += gp[0] * j
- qx += gp[0] * np.dot(N, np.transpose(self.coords[1, :])) * j
- qy += gp[0] * np.dot(N, np.transpose(self.coords[0, :])) * j
- force += gp[0] * j * self.material.yield_strength
-
- # calculate element centroid
- (cx, cy) = (qy / area, qx / area)
-
- # determine if the element is above the line p + u
- is_above = point_above_line(u, p[0], p[1], cx, cy)
-
- return (force, area * e, qx * e, qy * e, is_above)
-
-[docs] def element_stress(self, N, Mxx, Myy, M11, M22, Mzz, Vx, Vy, ea, cx, cy, ixx, iyy, ixy, i11,
- i22, phi, j, nu, omega, psi_shear, phi_shear, Delta_s):
- """Calculates the stress within an element resulting from a specified loading. Also returns
- the shape function weights.
-
- :param float N: Axial force
- :param float Mxx: Bending moment about the centroidal xx-axis
- :param float Myy: Bending moment about the centroidal yy-axis
- :param float M11: Bending moment about the centroidal 11-axis
- :param float M22: Bending moment about the centroidal 22-axis
- :param float Mzz: Torsion moment about the centroidal zz-axis
- :param float Vx: Shear force acting in the x-direction
- :param float Vy: Shear force acting in the y-direction
- :param float ea: Modulus weighted area
- :param float cx: x position of the elastic centroid
- :param float cy: y position of the elastic centroid
- :param float ixx: Second moment of area about the centroidal x-axis
- :param float iyy: Second moment of area about the centroidal y-axis
- :param float ixy: Second moment of area about the centroidal xy-axis
- :param float i11: Second moment of area about the principal 11-axis
- :param float i22: Second moment of area about the principal 22-axis
- :param float phi: Principal bending axis angle
- :param float j: St. Venant torsion constant
- :param float nu: Effective Poisson's ratio for the cross-section
- :param omega: Values of the warping function at the element nodes
- :type omega: :class:`numpy.ndarray`
- :param psi_shear: Values of the psi shear function at the element nodes
- :type psi_shear: :class:`numpy.ndarray`
- :param phi_shear: Values of the phi shear function at the element nodes
- :type phi_shear: :class:`numpy.ndarray`
- :param float Delta_s: Cross-section shear factor
- :return: Tuple containing element stresses and integration weights
- (:math:`\sigma_{zz,n}`, :math:`\sigma_{zz,mxx}`,
- :math:`\sigma_{zz,myy}`, :math:`\sigma_{zz,m11}`,
- :math:`\sigma_{zz,m22}`, :math:`\sigma_{zx,mzz}`,
- :math:`\sigma_{zy,mzz}`, :math:`\sigma_{zx,vx}`,
- :math:`\sigma_{zy,vx}`, :math:`\sigma_{zx,vy}`,
- :math:`\sigma_{zy,vy}`, :math:`w_i`)
- :rtype: tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`, ...)
- """
-
- # calculate axial stress
- sig_zz_n = N * np.ones(6) * self.material.elastic_modulus / ea
-
- # initialise stresses at the gauss points
- sig_zz_mxx_gp = np.zeros((6, 1))
- sig_zz_myy_gp = np.zeros((6, 1))
- sig_zz_m11_gp = np.zeros((6, 1))
- sig_zz_m22_gp = np.zeros((6, 1))
- sig_zxy_mzz_gp = np.zeros((6, 2))
- sig_zxy_vx_gp = np.zeros((6, 2))
- sig_zxy_vy_gp = np.zeros((6, 2))
-
- # Gauss points for 6 point Gaussian integration
- gps = gauss_points(6)
-
- for (i, gp) in enumerate(gps):
- # determine x and y positions with respect to the centroidal axis
- coords_c = np.zeros((2, 6))
- coords_c[0, :] = self.coords[0, :] - cx
- coords_c[1, :] = self.coords[1, :] - cy
-
- # determine shape function, shape function derivative and jacobian
- (N, B, _) = shape_function(coords_c, gp)
-
- # determine x and y position at Gauss point
- Nx = np.dot(N, np.transpose(coords_c[0, :]))
- Ny = np.dot(N, np.transpose(coords_c[1, :]))
-
- # determine 11 and 22 position at Gauss point
- (Nx_11, Ny_22) = principal_coordinate(phi, Nx, Ny)
-
- # determine shear parameters
- r = Nx ** 2 - Ny ** 2
- q = 2 * Nx * Ny
- d1 = ixx * r - ixy * q
- d2 = ixy * r + ixx * q
- h1 = -ixy * r + iyy * q
- h2 = -iyy * r - ixy * q
-
- # calculate element stresses
- sig_zz_mxx_gp[i, :] = (
- self.material.elastic_modulus * (-(ixy * Mxx) / (ixx * iyy - ixy ** 2) * Nx + (
- iyy * Mxx) / (ixx * iyy - ixy ** 2) * Ny)
- )
- sig_zz_myy_gp[i, :] = (
- self.material.elastic_modulus * (-(ixx * Myy) / (ixx * iyy - ixy ** 2) * Nx + (
- ixy * Myy) / (ixx * iyy - ixy ** 2) * Ny)
- )
- sig_zz_m11_gp[i, :] = self.material.elastic_modulus * M11 / i11 * Ny_22
- sig_zz_m22_gp[i, :] = self.material.elastic_modulus * -M22 / i22 * Nx_11
-
- if Mzz != 0:
- sig_zxy_mzz_gp[i, :] = (
- self.material.elastic_modulus * Mzz / j * (B.dot(omega) - np.array([Ny, -Nx]))
- )
-
- if Vx != 0:
- sig_zxy_vx_gp[i, :] = (
- self.material.elastic_modulus * Vx / Delta_s * (
- B.dot(psi_shear) - nu / 2 * np.array([d1, d2]))
- )
-
- if Vy != 0:
- sig_zxy_vy_gp[i, :] = (
- self.material.elastic_modulus * Vy / Delta_s * (
- B.dot(phi_shear) - nu / 2 * np.array([h1, h2]))
- )
-
- # extrapolate results to nodes
- sig_zz_mxx = extrapolate_to_nodes(sig_zz_mxx_gp[:, 0])
- sig_zz_myy = extrapolate_to_nodes(sig_zz_myy_gp[:, 0])
- sig_zz_m11 = extrapolate_to_nodes(sig_zz_m11_gp[:, 0])
- sig_zz_m22 = extrapolate_to_nodes(sig_zz_m22_gp[:, 0])
- sig_zx_mzz = extrapolate_to_nodes(sig_zxy_mzz_gp[:, 0])
- sig_zy_mzz = extrapolate_to_nodes(sig_zxy_mzz_gp[:, 1])
- sig_zx_vx = extrapolate_to_nodes(sig_zxy_vx_gp[:, 0])
- sig_zy_vx = extrapolate_to_nodes(sig_zxy_vx_gp[:, 1])
- sig_zx_vy = extrapolate_to_nodes(sig_zxy_vy_gp[:, 0])
- sig_zy_vy = extrapolate_to_nodes(sig_zxy_vy_gp[:, 1])
-
- return (sig_zz_n, sig_zz_mxx, sig_zz_myy, sig_zz_m11, sig_zz_m22, sig_zx_mzz, sig_zy_mzz,
- sig_zx_vx, sig_zy_vx, sig_zx_vy, sig_zy_vy, gps[:, 0])
-
-[docs] def point_within_element(self, pt):
- """Determines whether a point lies within the current element.
-
- :param pt: Point to check *(x, y)*
- :type pt: list[float, float]
- :return: Whether the point lies within an element
- :rtype: bool
- """
-
- px = pt[0]
- py = pt[1]
-
- # get coordinates of corner points
- x1 = self.coords[0][0]
- y1 = self.coords[1][0]
- x2 = self.coords[0][1]
- y2 = self.coords[1][1]
- x3 = self.coords[0][2]
- y3 = self.coords[1][2]
-
- # compute variables alpha, beta and gamma
- alpha = (
- ((y2 - y3) * (px - x3) + (x3 - x2) * (py - y3)) /
- ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3))
- )
- beta = (
- ((y3 - y1) * (px - x3) + (x1 - x3) * (py - y3)) /
- ((y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3))
- )
- gamma = 1.0 - alpha - beta
-
- # if the point lies within an element
- if alpha >= 0 and beta >= 0 and gamma >= 0:
- return True
- else:
- return False
-
-
-[docs]def gauss_points(n):
- """Returns the Gaussian weights and locations for *n* point Gaussian integration of a quadratic
- triangular element.
-
- :param int n: Number of Gauss points (1, 3 or 6)
- :return: An *n x 4* matrix consisting of the integration weight and the eta, xi and zeta
- locations for *n* Gauss points
- :rtype: :class:`numpy.ndarray`
- """
-
- if n == 1:
- # one point gaussian integration
- return np.array([[1, 1.0 / 3, 1.0 / 3, 1.0 / 3]])
-
- elif n == 3:
- # three point gaussian integration
- return np.array([
- [1.0 / 3, 2.0 / 3, 1.0 / 6, 1.0 / 6],
- [1.0 / 3, 1.0 / 6, 2.0 / 3, 1.0 / 6],
- [1.0 / 3, 1.0 / 6, 1.0 / 6, 2.0 / 3]
- ])
- elif n == 6:
- # six point gaussian integration
- g1 = 1.0 / 18 * (8 - np.sqrt(10) + np.sqrt(38 - 44 * np.sqrt(2.0 / 5)))
- g2 = 1.0 / 18 * (8 - np.sqrt(10) - np.sqrt(38 - 44 * np.sqrt(2.0 / 5)))
- w1 = (620 + np.sqrt(213125 - 53320 * np.sqrt(10))) / 3720
- w2 = (620 - np.sqrt(213125 - 53320 * np.sqrt(10))) / 3720
-
- return np.array([
- [w2, 1 - 2 * g2, g2, g2],
- [w2, g2, 1 - 2 * g2, g2],
- [w2, g2, g2, 1 - 2 * g2],
- [w1, g1, g1, 1 - 2 * g1],
- [w1, 1 - 2 * g1, g1, g1],
- [w1, g1, 1 - 2 * g1, g1]
- ])
-
-
-[docs]def shape_function(coords, gauss_point):
- """Computes shape functions, shape function derivatives and the determinant of the Jacobian
- matrix for a tri 6 element at a given Gauss point.
-
- :param coords: Global coordinates of the quadratic triangle vertices [2 x 6]
- :type coords: :class:`numpy.ndarray`
- :param gauss_point: Gaussian weight and isoparametric location of the Gauss point
- :type gauss_point: :class:`numpy.ndarray`
- :return: The value of the shape functions *N(i)* at the given Gauss point [1 x 6], the
- derivative of the shape functions in the j-th global direction *B(i,j)* [2 x 6] and the
- determinant of the Jacobian matrix *j*
- :rtype: tuple(:class:`numpy.ndarray`, :class:`numpy.ndarray`, float)
- """
-
- # location of isoparametric co-ordinates for each Gauss point
- eta = gauss_point[1]
- xi = gauss_point[2]
- zeta = gauss_point[3]
-
- # value of the shape functions
- N = np.array([
- eta * (2 * eta - 1),
- xi * (2 * xi - 1),
- zeta * (2 * zeta - 1),
- 4 * eta * xi,
- 4 * xi * zeta,
- 4 * eta * zeta
- ])
-
- # derivatives of the shape functions wrt the isoparametric co-ordinates
- B_iso = np.array([
- [4 * eta - 1, 0, 0, 4 * xi, 0, 4 * zeta],
- [0, 4 * xi - 1, 0, 4 * eta, 4 * zeta, 0],
- [0, 0, 4 * zeta - 1, 0, 4 * xi, 4 * eta]
- ])
-
- # form Jacobian matrix
- J_upper = np.array([[1, 1, 1]])
- J_lower = np.dot(coords, np.transpose(B_iso))
- J = np.vstack((J_upper, J_lower))
-
- # calculate the jacobian
- j = 0.5 * np.linalg.det(J)
-
- # if the area of the element is not zero
- if j != 0:
- # cacluate the P matrix
- P = np.dot(np.linalg.inv(J), np.array([[0, 0], [1, 0], [0, 1]]))
-
- # calculate the B matrix in terms of cartesian co-ordinates
- B = np.transpose(np.dot(np.transpose(B_iso), P))
- else:
- B = np.zeros((2, 6)) # empty B matrix
-
- return (N, B, j)
-
-
-[docs]def extrapolate_to_nodes(w):
- """Extrapolates results at six Gauss points to the six noes of a quadratic triangular element.
-
- :param w: Result at the six Gauss points [1 x 6]
- :type w: :class:`numpy.ndarray`
- :return: Extrapolated nodal values at the six nodes [1 x 6]
- :rtype: :class:`numpy.ndarray`
- """
-
- H_inv = np.array([
- [1.87365927351160, 0.138559587411935, 0.138559587411935,
- -0.638559587411936, 0.126340726488397, -0.638559587411935],
- [0.138559587411935, 1.87365927351160, 0.138559587411935,
- -0.638559587411935, -0.638559587411935, 0.126340726488397],
- [0.138559587411935, 0.138559587411935, 1.87365927351160,
- 0.126340726488396, -0.638559587411935, -0.638559587411935],
- [0.0749010751157440, 0.0749010751157440, 0.180053080734478,
- 1.36051633430762, -0.345185782636792, -0.345185782636792],
- [0.180053080734478, 0.0749010751157440, 0.0749010751157440,
- -0.345185782636792, 1.36051633430762, -0.345185782636792],
- [0.0749010751157440, 0.180053080734478, 0.0749010751157440,
- -0.345185782636792, -0.345185782636792, 1.36051633430762]
- ])
-
- return H_inv.dot(w)
-
-
-[docs]def principal_coordinate(phi, x, y):
- """Determines the coordinates of the cartesian point *(x, y)* in the
- principal axis system given an axis rotation angle phi.
-
- :param float phi: Prinicpal bending axis angle (degrees)
- :param float x: x coordinate in the global axis
- :param float y: y coordinate in the global axis
- :return: Principal axis coordinates *(x1, y2)*
- :rtype: tuple(float, float)
- """
-
- # convert principal axis angle to radians
- phi_rad = phi * np.pi / 180
-
- # form rotation matrix
- R = np.array([
- [np.cos(phi_rad), np.sin(phi_rad)],
- [-np.sin(phi_rad), np.cos(phi_rad)]
- ])
-
- # calculate rotated x and y coordinates
- x_rotated = R.dot(np.array([x, y]))
-
- return (x_rotated[0], x_rotated[1])
-
-
-[docs]def global_coordinate(phi, x11, y22):
- """Determines the global coordinates of the principal axis point *(x1, y2)* given principal
- axis rotation angle phi.
-
- :param float phi: Prinicpal bending axis angle (degrees)
- :param float x11: 11 coordinate in the principal axis
- :param float y22: 22 coordinate in the principal axis
- :return: Global axis coordinates *(x, y)*
- :rtype: tuple(float, float)
- """
-
- # convert principal axis angle to radians
- phi_rad = phi * np.pi / 180
-
- # form transposed rotation matrix
- R = np.array([
- [np.cos(phi_rad), -np.sin(phi_rad)],
- [np.sin(phi_rad), np.cos(phi_rad)]
- ])
- # calculate rotated x_1 and y_2 coordinates
- x_rotated = R.dot(np.array([x11, y22]))
-
- return (x_rotated[0], x_rotated[1])
-
-
-[docs]def point_above_line(u, px, py, x, y):
- """Determines whether a point *(x, y)* is a above or below the line defined by the parallel
- unit vector *u* and the point *(px, py)*.
-
- :param u: Unit vector parallel to the line [1 x 2]
- :type u: :class:`numpy.ndarray`
- :param float px: x coordinate of a point on the line
- :param float py: y coordinate of a point on the line
- :param float x: x coordinate of the point to be tested
- :param float y: y coordinate of the point to be tested
- :return: This method returns *True* if the point is above the line or *False* if the point is
- below the line
- :rtype: bool
- """
-
- # vector from point to point on line
- PQ = np.array([px - x, py - y])
- return np.cross(PQ, u) > 0
-
-import time
-import numpy as np
-from scipy.sparse import linalg
-from scipy.sparse.linalg import spsolve
-
-
-[docs]def solve_cgs(k, f, m=None, tol=1e-5):
- """Solves a linear system of equations (Ku = f) using the CGS iterative method.
-
- :param k: N x N matrix of the linear system
- :type k: :class:`scipy.sparse.csc_matrix`
- :param f: N x 1 right hand side of the linear system
- :type f: :class:`numpy.ndarray`
- :param float tol: Tolerance for the solver to acheieve. The algorithm terminates when either
- the relative or the absolute residual is below tol.
- :param m: Preconditioner for the linear matrix approximating the inverse of k
- :type m: :class:`scipy.linalg.LinearOperator`
-
- :return: The solution vector to the linear system of equations
- :rtype: :class:`numpy.ndarray`
-
- :raises RuntimeError: If the CGS iterative method does not converge
- """
-
- (u, exit) = linalg.cgs(k, f, tol=tol, M=m)
-
- if (exit != 0):
- raise RuntimeError("CGS iterative method did not converge.")
-
- return u
-
-
-[docs]def solve_cgs_lagrange(k_lg, f, tol=1e-5, m=None):
- """Solves a linear system of equations (Ku = f) using the CGS iterative method and the
- Lagrangian multiplier method.
-
- :param k: (N+1) x (N+1) Lagrangian multiplier matrix of the linear system
- :type k: :class:`scipy.sparse.csc_matrix`
- :param f: N x 1 right hand side of the linear system
- :type f: :class:`numpy.ndarray`
- :param float tol: Tolerance for the solver to acheieve. The algorithm terminates when either
- the relative or the absolute residual is below tol.
- :param m: Preconditioner for the linear matrix approximating the inverse of k
- :type m: :class:`scipy.linalg.LinearOperator`
-
- :return: The solution vector to the linear system of equations
- :rtype: :class:`numpy.ndarray`
-
- :raises RuntimeError: If the CGS iterative method does not converge or the error from the
- Lagrangian multiplier method exceeds the tolerance
- """
-
- (u, exit) = linalg.cgs(k_lg, np.append(f, 0), tol=tol, M=m)
-
- if (exit != 0):
- raise RuntimeError("CGS iterative method did not converge.")
-
- # compute error
- err = u[-1] / max(np.absolute(u))
-
- if err > tol:
- err = "Lagrangian multiplier method error exceeds tolerance."
- raise RuntimeError(err)
-
- return u[:-1]
-
-
-[docs]def solve_direct(k, f):
- """Solves a linear system of equations (Ku = f) using the direct solver method.
-
- :param k: N x N matrix of the linear system
- :type k: :class:`scipy.sparse.csc_matrix`
- :param f: N x 1 right hand side of the linear system
- :type f: :class:`numpy.ndarray`
-
- :return: The solution vector to the linear system of equations
- :rtype: :class:`numpy.ndarray`
- """
-
- return spsolve(k, f)
-
-
-[docs]def solve_direct_lagrange(k_lg, f):
- """Solves a linear system of equations (Ku = f) using the direct solver method and the
- Lagrangian multiplier method.
-
- :param k: (N+1) x (N+1) Lagrangian multiplier matrix of the linear system
- :type k: :class:`scipy.sparse.csc_matrix`
- :param f: N x 1 right hand side of the linear system
- :type f: :class:`numpy.ndarray`
-
- :return: The solution vector to the linear system of equations
- :rtype: :class:`numpy.ndarray`
-
- :raises RuntimeError: If the Lagrangian multiplier method exceeds a tolerance of 1e-5
- """
-
- u = spsolve(k_lg, np.append(f, 0))
-
- # compute error
- err = u[-1] / max(np.absolute(u))
-
- if err > 1e-5:
- err = "Lagrangian multiplier method error exceeds tolerance of 1e-5."
- raise RuntimeError(err)
-
- return u[:-1]
-
-
-[docs]def function_timer(text, function, *args):
- """Displays the message *text* and returns the time taken for a function, with arguments
- *args*, to execute. The value returned by the timed function is also returned.
-
- :param string text: Message to display
- :param function: Function to time and execute
- :type function: function
- :param args: Function arguments
- :return: Value returned from the function
- """
-
- start_time = time.time()
-
- if text != "":
- print(text)
-
- result = function(*args)
-
- if text != "":
- print("----completed in {0:.6f} seconds---".format(
- time.time() - start_time))
-
- return result
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-
-[docs]def setup_plot(ax, pause):
- """Executes code required to set up a matplotlib figure.
-
- :param ax: Axes object on which to plot
- :type ax: :class:`matplotlib.axes.Axes`
- :param bool pause: If set to true, the figure pauses the script until the window is closed. If
- set to false, the script continues immediately after the window is rendered.
- """
-
- if not pause:
- plt.ion()
- plt.show()
- else:
- plt.ioff()
-
-
-[docs]def finish_plot(ax, pause, title=''):
- """Executes code required to finish a matplotlib figure.
-
- :param ax: Axes object on which to plot
- :type ax: :class:`matplotlib.axes.Axes`
- :param bool pause: If set to true, the figure pauses the script until the window is closed. If
- set to false, the script continues immediately after the window is rendered.
- :param string title: Plot title
- """
-
- ax.set_title(title)
- ax.set_aspect('equal', anchor='C')
- plt.tight_layout()
-
- if pause:
- plt.show()
- else:
- plt.draw()
- plt.pause(0.001)
-
-
-[docs]def draw_principal_axis(ax, phi, cx, cy):
- """
- Draws the principal axis on a plot.
-
- :param ax: Axes object on which to plot
- :type ax: :class:`matplotlib.axes.Axes`
- :param float phi: Principal axis angle in radians
- :param float cx: x-location of the centroid
- :param float cy: y-location of the centroid
- """
-
- # get current axis limits
- (xmin, xmax) = ax.get_xlim()
- (ymin, ymax) = ax.get_ylim()
- lims = [xmin, xmax, ymin, ymax]
-
- # form rotation matrix
- R = np.array([[np.cos(phi), -np.sin(phi)],
- [np.sin(phi), np.cos(phi)]])
-
- # get basis vectors in the directions of the principal axes
- x11_basis = R.dot(np.array([1, 0]))
- y22_basis = R.dot(np.array([0, 1]))
-
- def add_point(vec, basis, centroid, num, denom):
- """Adds a point to the list *vec* if there is an intersection."""
-
- if denom != 0:
- point = basis * num / denom + centroid
- vec.append([point[0], point[1]])
-
- def get_prinicipal_points(basis, lims, centroid):
- """Determines the intersections of the prinicpal axis with the four lines defining a
- bounding box around the limits of the cross-section. The middle two intersection points are
- returned for plotting.
-
- :param basis: Basis (unit) vector in the direction of the principal axis
- :type basis: :class:`numpy.ndarray`
- :param lims: Tuple containing the axis limits *(xmin, xmax, ymin, ymax)*
- :type lims: tuple(float, float, float, float)
- :param centroid: Centroid *(cx, cy)* of the cross-section, through which the principal axis
- passes
- :type centroid: list[float, float]
- """
-
- pts = [] # initialise list containing the intersection points
-
- # add intersection points to the list
- add_point(pts, basis, centroid, lims[0] - centroid[0], basis[0])
- add_point(pts, basis, centroid, lims[1] - centroid[0], basis[0])
- add_point(pts, basis, centroid, lims[2] - centroid[1], basis[1])
- add_point(pts, basis, centroid, lims[3] - centroid[1], basis[1])
-
- # sort point vector
- pts = np.array(pts)
- pts = pts[pts[:, 0].argsort()] # stackoverflow sort numpy array by col
-
- # if there are four points, take the middle two points
- if len(pts) == 4:
- return pts[1:3, :]
-
- return pts
-
- # get intersection points for the 11 and 22 axes
- x11 = get_prinicipal_points(x11_basis, lims, [cx, cy])
- y22 = get_prinicipal_points(y22_basis, lims, [cx, cy])
-
- # plot the principal axis
- ax.plot(x11[:, 0], x11[:, 1], 'k--', alpha=0.5, label='11-axis')
- ax.plot(y22[:, 0], y22[:, 1], 'k-.', alpha=0.5, label='22-axis')
-
-
-[docs]def print_results(cross_section, fmt):
- """Prints the results that have been calculated to the terminal.
-
- :param cross_section: Structural cross-section object
- :type cross_section: :class:`~sectionproperties.analysis.cross_section.CrossSection`
- :param string fmt: Number format
- """
-
- if cross_section.materials is not None:
- str = "E."
- else:
- str = ""
-
- area = cross_section.get_area()
- if area is not None:
- print("Section Properties:")
- print("A\t = {:>{fmt}}".format(area, fmt=fmt))
-
- perimeter = cross_section.get_perimeter()
- if perimeter is not None:
- print("Perim.\t = {:>{fmt}}".format(perimeter, fmt=fmt))
-
- if cross_section.materials is not None:
- ea = cross_section.get_ea()
- if ea is not None:
- print("E.A\t = {:>{fmt}}".format(ea, fmt=fmt))
-
- (qx, qy) = cross_section.get_q()
- if qx is not None:
- print(str + "Qx\t = {:>{fmt}}".format(qx, fmt=fmt))
- print(str + "Qy\t = {:>{fmt}}".format(qy, fmt=fmt))
-
- (cx, cy) = cross_section.get_c()
- if cx is not None:
- print("cx\t = {:>{fmt}}".format(cx, fmt=fmt))
- print("cy\t = {:>{fmt}}".format(cy, fmt=fmt))
-
- (ixx_g, iyy_g, ixy_g) = cross_section.get_ig()
- if ixx_g is not None:
- print(str + "Ixx_g\t = {:>{fmt}}".format(ixx_g, fmt=fmt))
- print(str + "Iyy_g\t = {:>{fmt}}".format(iyy_g, fmt=fmt))
- print(str + "Ixy_g\t = {:>{fmt}}".format(ixy_g, fmt=fmt))
-
- (ixx_c, iyy_c, ixy_c) = cross_section.get_ic()
- if ixx_c is not None:
- print(str + "Ixx_c\t = {:>{fmt}}".format(ixx_c, fmt=fmt))
- print(str + "Iyy_c\t = {:>{fmt}}".format(iyy_c, fmt=fmt))
- print(str + "Ixy_c\t = {:>{fmt}}".format(ixy_c, fmt=fmt))
-
- (zxx_plus, zxx_minus, zyy_plus, zyy_minus) = cross_section.get_z()
- if zxx_plus is not None:
- print(str + "Zxx+\t = {:>{fmt}}".format(zxx_plus, fmt=fmt))
- print(str + "Zxx-\t = {:>{fmt}}".format(zxx_minus, fmt=fmt))
- print(str + "Zyy+\t = {:>{fmt}}".format(zyy_plus, fmt=fmt))
- print(str + "Zyy-\t = {:>{fmt}}".format(zyy_minus, fmt=fmt))
-
- (rx, ry) = cross_section.get_rc()
- if rx is not None:
- print("rx\t = {:>{fmt}}".format(rx, fmt=fmt))
- print("ry\t = {:>{fmt}}".format(ry, fmt=fmt))
-
- phi = cross_section.get_phi()
- (i11_c, i22_c) = cross_section.get_ip()
- if phi is not None:
- print("phi\t = {:>{fmt}}".format(phi, fmt=fmt))
- print(str + "I11_c\t = {:>{fmt}}".format(i11_c, fmt=fmt))
- print(str + "I22_c\t = {:>{fmt}}".format(i22_c, fmt=fmt))
-
- (z11_plus, z11_minus, z22_plus, z22_minus) = cross_section.get_zp()
- if z11_plus is not None:
- print(str + "Z11+\t = {:>{fmt}}".format(z11_plus, fmt=fmt))
- print(str + "Z11-\t = {:>{fmt}}".format(z11_minus, fmt=fmt))
- print(str + "Z22+\t = {:>{fmt}}".format(z22_plus, fmt=fmt))
- print(str + "Z22-\t = {:>{fmt}}".format(z22_minus, fmt=fmt))
-
- (r11, r22) = cross_section.get_rp()
- if r11 is not None:
- print("r11\t = {:>{fmt}}".format(r11, fmt=fmt))
- print("r22\t = {:>{fmt}}".format(r22, fmt=fmt))
-
- j = cross_section.get_j()
- if j is not None:
- if cross_section.materials is not None:
- print(
- "G.J\t = {:>{fmt}}".format(
- j / (2 * (1 + cross_section.section_props.nu_eff)), fmt=fmt)
- )
- else:
- print("J\t = {:>{fmt}}".format(j, fmt=fmt))
-
- gamma = cross_section.get_gamma()
- if gamma is not None:
- if cross_section.materials is not None:
- print(
- "G.Iw\t = {:>{fmt}}".format(
- gamma / (2 * (1 + cross_section.section_props.nu_eff)), fmt=fmt)
- )
- else:
- print("Iw\t = {:>{fmt}}".format(gamma, fmt=fmt))
-
- (x_se, y_se) = cross_section.get_sc()
- if x_se is not None:
- print("x_se\t = {:>{fmt}}".format(x_se, fmt=fmt))
- print("y_se\t = {:>{fmt}}".format(y_se, fmt=fmt))
-
- (x_st, y_st) = cross_section.get_sc_t()
- if x_se is not None:
- print("x_st\t = {:>{fmt}}".format(x_st, fmt=fmt))
- print("y_st\t = {:>{fmt}}".format(y_st, fmt=fmt))
-
- (x1_se, y2_se) = cross_section.get_sc_p()
- if x1_se is not None:
- print("x1_se\t = {:>{fmt}}".format(x1_se, fmt=fmt))
- print("y2_se\t = {:>{fmt}}".format(y2_se, fmt=fmt))
-
- (A_sx, A_sy) = cross_section.get_As()
- if A_sx is not None:
- if cross_section.materials is not None:
- print(
- "A_sx\t = {:>{fmt}}".format(
- A_sx * cross_section.section_props.area / cross_section.section_props.ea,
- fmt=fmt)
- )
- print(
- "A_sy\t = {:>{fmt}}".format(
- A_sy * cross_section.section_props.area / cross_section.section_props.ea,
- fmt=fmt)
- )
- else:
- print("A_sx\t = {:>{fmt}}".format(A_sx, fmt=fmt))
- print("A_sy\t = {:>{fmt}}".format(A_sy, fmt=fmt))
-
- (A_s11, A_s22) = cross_section.get_As_p()
- if A_s11 is not None:
- if cross_section.materials is not None:
- print(
- "A_s11\t = {:>{fmt}}".format(
- A_s11 * cross_section.section_props.area / cross_section.section_props.ea,
- fmt=fmt)
- )
- print(
- "A_s22\t = {:>{fmt}}".format(
- A_s22 * cross_section.section_props.area / cross_section.section_props.ea,
- fmt=fmt)
- )
- else:
- print("A_s11\t = {:>{fmt}}".format(A_s11, fmt=fmt))
- print("A_s22\t = {:>{fmt}}".format(A_s22, fmt=fmt))
-
- (beta_x_plus, beta_x_minus, beta_y_plus, beta_y_minus) = cross_section.get_beta()
- if beta_x_plus is not None:
- print("betax+\t = {:>{fmt}}".format(beta_x_plus, fmt=fmt))
- print("betax-\t = {:>{fmt}}".format(beta_x_minus, fmt=fmt))
- print("betay+\t = {:>{fmt}}".format(beta_y_plus, fmt=fmt))
- print("betay-\t = {:>{fmt}}".format(beta_y_minus, fmt=fmt))
-
- (beta_11_plus, beta_11_minus, beta_22_plus, beta_22_minus) = cross_section.get_beta_p()
- if beta_x_plus is not None:
- print("beta11+\t = {:>{fmt}}".format(beta_11_plus, fmt=fmt))
- print("beta11-\t = {:>{fmt}}".format(beta_11_minus, fmt=fmt))
- print("beta22+\t = {:>{fmt}}".format(beta_22_plus, fmt=fmt))
- print("beta22-\t = {:>{fmt}}".format(beta_22_minus, fmt=fmt))
-
- (x_pc, y_pc) = cross_section.get_pc()
- if x_pc is not None:
- print("x_pc\t = {:>{fmt}}".format(x_pc, fmt=fmt))
- print("y_pc\t = {:>{fmt}}".format(y_pc, fmt=fmt))
-
- (sxx, syy) = cross_section.get_s()
- if sxx is not None:
- if cross_section.materials is not None:
- print("M_p,xx\t = {:>{fmt}}".format(sxx, fmt=fmt))
- print("M_p,yy\t = {:>{fmt}}".format(syy, fmt=fmt))
- else:
- print("Sxx\t = {:>{fmt}}".format(sxx, fmt=fmt))
- print("Syy\t = {:>{fmt}}".format(syy, fmt=fmt))
-
- (sf_xx_plus, sf_xx_minus, sf_yy_plus, sf_yy_minus) = cross_section.get_sf()
- if sf_xx_plus is not None:
- print("SF_xx+\t = {:>{fmt}}".format(sf_xx_plus, fmt=fmt))
- print("SF_xx-\t = {:>{fmt}}".format(sf_xx_minus, fmt=fmt))
- print("SF_yy+\t = {:>{fmt}}".format(sf_yy_plus, fmt=fmt))
- print("SF_yy-\t = {:>{fmt}}".format(sf_yy_minus, fmt=fmt))
-
- (x11_pc, y22_pc) = cross_section.get_pc_p()
- if x_pc is not None:
- print("x11_pc\t = {:>{fmt}}".format(x11_pc, fmt=fmt))
- print("y22_pc\t = {:>{fmt}}".format(y22_pc, fmt=fmt))
-
- (s11, s22) = cross_section.get_sp()
- if s11 is not None:
- if cross_section.materials is not None:
- print("M_p,11\t = {:>{fmt}}".format(s11, fmt=fmt))
- print("M_p,22\t = {:>{fmt}}".format(s22, fmt=fmt))
- else:
- print("S11\t = {:>{fmt}}".format(s11, fmt=fmt))
- print("S22\t = {:>{fmt}}".format(s22, fmt=fmt))
-
- (sf_11_plus, sf_11_minus, sf_22_plus, sf_22_minus) = cross_section.get_sf_p()
- if sf_11_plus is not None:
- print("SF_11+\t = {:>{fmt}}".format(sf_11_plus, fmt=fmt))
- print("SF_11-\t = {:>{fmt}}".format(sf_11_minus, fmt=fmt))
- print("SF_22+\t = {:>{fmt}}".format(sf_22_plus, fmt=fmt))
- print("SF_22-\t = {:>{fmt}}".format(sf_22_minus, fmt=fmt))
-
- print("")
-
-from sectionproperties.pre.sections import (
- Geometry, RectangularSection, CustomSection, MergedSection
-)
-from sectionproperties.pre.pre import create_mesh
-import numpy as np
-
-
-[docs]class BARSection(Geometry):
- """Constructs a BAR section with the center at the origin *(0, 0)*, with two parameters
- defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ [5]_ for definition of
- parameters. Added by JohnDN90.
-
- :param float DIM1: Width (x) of bar
- :param float DIM2: Depth (y) of bar
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a BAR cross-section with a depth of 1.5 and width of 2.0, and
- generates a mesh with a maximum triangular area of 0.001::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.BARSection(DIM1=2.0, DIM2=1.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.001])
-
- .. figure:: ../images/sections/bar_geometry.png
- :align: center
- :scale: 75 %
-
- BAR section geometry.
-
- .. figure:: ../images/sections/bar_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, shift=[0, 0]):
- """Inits the BARSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
-
- # assign control point
- control_points = [[0., 0.]]
-
- # shift = [-0.5*DIM1+shift[0], -0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [-0.5*DIM1, -0.5*DIM2], [0.5*DIM1, -0.5*DIM2],
- [0.5*DIM1, 0.5*DIM2], [-0.5*DIM1, 0.5*DIM2]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
- D = (0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class BOXSection(Geometry):
- """ Constructs a BOX section with the center at the origin *(0, 0)*, with four parameters
- defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ [5]_ for definition of
- parameters. Added by JohnDN90.
-
- :param float DIM1: Width (x) of box
- :param float DIM2: Depth (y) of box
- :param float DIM3: Thickness of box in y direction
- :param float DIM4: Thickness of box in x direction
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a BOX cross-section with a depth of 3.0 and width of 4.0, and
- generates a mesh with a maximum triangular area of 0.001::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.BOXSection(DIM1=4.0, DIM2=3.0, DIM3=0.375, DIM4=0.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.001])
-
- .. figure:: ../images/sections/box_geometry.png
- :align: center
- :scale: 75 %
-
- BOX section geometry.
-
- .. figure:: ../images/sections/box_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the BOXSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(2.0*DIM4 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(2.0*DIM3 < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0., 0.5*DIM2 - 0.5*DIM3]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the Box
- self.holes = [[0., 0.]]
-
- # construct the points and facets
- self.points = [
- [-0.5*DIM1, -0.5*DIM2], [0.5*DIM1, -0.5*DIM2], [0.5*DIM1, 0.5*DIM2],
- [-0.5*DIM1, 0.5*DIM2], [-0.5*DIM1 + DIM4, -0.5*DIM2 + DIM3],
- [0.5*DIM1 - DIM4, -0.5*DIM2 + DIM3], [0.5*DIM1 - DIM4, 0.5*DIM2 - DIM3],
- [-0.5*DIM1 + DIM4, 0.5*DIM2 - DIM3]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
- D = (0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class BOX1Section(Geometry):
- """Constructs a BOX1 section with the center at the origin *(0, 0)*, with six parameters
- defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details. Added by
- JohnDN90.
-
- :param float DIM1: Width (x) of box
- :param float DIM2: Depth (y) of box
- :param float DIM3: Thickness of top wall
- :param float DIM4: Thickness of bottom wall
- :param float DIM5: Thickness of left wall
- :param float DIM6: Thickness of right wall
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a BOX1 cross-section with a depth of 3.0 and width of 4.0, and
- generates a mesh with a maximum triangular area of 0.007::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.BOX1Section(
- DIM1=4.0, DIM2=3.0, DIM3=0.375, DIM4=0.5, DIM5=0.25, DIM6=0.75
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.007])
-
- .. figure:: ../images/sections/box1_geometry.png
- :align: center
- :scale: 75 %
-
- BOX1 section geometry.
-
- .. figure:: ../images/sections/box1_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, DIM6, shift=[0, 0]):
- """Inits the Box1Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- DIM6 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
- self.DIM6 = DIM6
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM5+DIM6 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM3+DIM4 < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM4]]
-
- shift = [-0.5*DIM1+shift[0], -0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the Box
- self.holes = [[DIM6 + 0.5*(DIM1-DIM5), DIM4+0.5*(DIM2-DIM3)]]
-
- # construct the points and facets
- self.points = [
- [0., 0.], [DIM1, 0.], [DIM1, DIM2], [0., DIM2], [DIM6, DIM4], [DIM1-DIM5, DIM4],
- [DIM1-DIM5, DIM2-DIM3], [DIM6, DIM2-DIM3]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """ Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
- D = (0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class CHANSection(Geometry):
- """ Constructs a CHAN (C-Channel) section with the web's middle center at the origin *(0, 0)*,
- with four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for
- more details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of the CHAN-section
- :param float DIM2: Depth (y) of the CHAN-section
- :param float DIM3: Thickness of web (vertical portion)
- :param float DIM4: Thickness of flanges (top/bottom portion)
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a CHAN cross-section with a depth of 4.0 and width of 2.0, and
- generates a mesh with a maximum triangular area of 0.008::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.CHANSection(DIM1=2.0, DIM2=4.0, DIM3=0.25, DIM4=0.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.008])
-
- .. figure:: ../images/sections/chan_geometry.png
- :align: center
- :scale: 75 %
-
- CHAN section geometry.
-
- .. figure:: ../images/sections/chan_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the CHANSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(2.0*DIM4 < DIM2, "Invalid geometry specified.")
- np.testing.assert_(DIM3 < DIM1, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM4]]
-
- shift = [-0.5*DIM3+shift[0], -0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [0., 0.], [DIM1, 0.], [DIM1, DIM4], [DIM3, DIM4], [DIM3, DIM2-DIM4], [DIM1, DIM2-DIM4],
- [DIM1, DIM2], [0., DIM2]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """ Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (self.DIM1-0.5*self.DIM3-shift[0], 0.5*self.DIM2-shift[1])
- D = (self.DIM1-0.5*self.DIM3-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM3-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM3-shift[0], 0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class CHAN1Section(Geometry):
- """ Constructs a CHAN1 (C-Channel) section with the web's middle center at the origin *(0, 0)*,
- with four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for
- more details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of channels
- :param float DIM2: Thicknesss (x) of web
- :param float DIM3: Spacing between channels (length of web)
- :param float DIM4: Depth (y) of CHAN1-section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a CHAN1 cross-section with a depth of 4.0 and width of 1.75, and
- generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.CHAN1Section(DIM1=0.75, DIM2=1.0, DIM3=3.5, DIM4=4.0)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/chan1_geometry.png
- :align: center
- :scale: 75 %
-
- CHAN1 section geometry.
-
- .. figure:: ../images/sections/chan1_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the CHAN1Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 > DIM3, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM4]]
-
- shift = [-0.5*DIM2+shift[0], -0.5*DIM4+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- tf = 0.5 * (DIM4 - DIM3)
- self.points = [
- [0, 0], [DIM1+DIM2, 0], [DIM1+DIM2, tf], [DIM2, tf], [DIM2, tf+DIM3],
- [DIM2+DIM1, tf+DIM3], [DIM2+DIM1, DIM4], [0, DIM4]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """ Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM2+self.DIM1-shift[0], 0.5*self.DIM4-shift[1])
- D = (0.5*self.DIM2+self.DIM1-shift[0], -0.5*self.DIM4-shift[1])
- E = (-0.5*self.DIM2-shift[0], -0.5*self.DIM4-shift[1])
- F = (-0.5*self.DIM2-shift[0], 0.5*self.DIM4-shift[1])
-
- return C, D, E, F
-
-
-[docs]class CHAN2Section(Geometry):
- """ Constructs a CHAN2 (C-Channel) section with the bottom web's middle center at the origin
- *(0, 0)*, with four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_
- [4]_ for more details. Added by JohnDN90.
-
- :param float DIM1: Thickness of channels
- :param float DIM2: Thickness of web
- :param float DIM3: Depth (y) of CHAN2-section
- :param float DIM4: Width (x) of CHAN2-section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a CHAN2 cross-section with a depth of 2.0 and width of 4.0, and
- generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.CHAN2Section(DIM1=0.375, DIM2=0.5, DIM3=2.0, DIM4=4.0)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/chan2_geometry.png
- :align: center
- :scale: 75 %
-
- CHAN2 section geometry.
-
- .. figure:: ../images/sections/chan2_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the CHAN2Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 > 2.0*DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM3 > DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM4, 0.5*DIM2]]
-
- shift = [-0.5*DIM4+shift[0], -0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [0., 0.], [DIM4, 0.], [DIM4, DIM3], [DIM4-DIM1, DIM3], [DIM4-DIM1, DIM2], [DIM1, DIM2],
- [DIM1, DIM3], [0., DIM3]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """ Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM4-shift[0], self.DIM3-0.5*self.DIM2-shift[1])
- D = (0.5*self.DIM4-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM4-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM4-shift[0], self.DIM3-0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class CROSSSection(Geometry):
- """ Constructs Nastran's cruciform/cross section with the intersection's middle center at the
- origin *(0, 0)*, with four parameters defining dimensions. See Nastran documentation [1]_ [2]_
- [3]_ [4]_ for more details. Added by JohnDN90.
-
- :param float DIM1: Twice the width of horizontal member protruding from the vertical center
- member
- :param float DIM2: Thickness of the vertical member
- :param float DIM3: Depth (y) of the CROSS-section
- :param float DIM4: Thickness of the horizontal members
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a rectangular cross-section with a depth of 3.0 and width of
- 1.875, and generates a mesh with a maximum triangular area of 0.008::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.CROSSSection(DIM1=1.5, DIM2=0.375, DIM3=3.0, DIM4=0.25)
- mesh = geometry.create_mesh(mesh_sizes=[0.008])
-
- .. figure:: ../images/sections/cross_geometry.png
- :align: center
- :scale: 75 %
-
- Cruciform/cross section geometry.
-
- .. figure:: ../images/sections/cross_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the CROSSSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM3, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1+0.5*DIM2, 0.5*DIM3]]
-
- shift = [-(0.5*DIM1+0.5*DIM2)+shift[0], -(0.5*DIM3)+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- d = 0.5*(DIM3 - DIM4)
- self.points = [
- [0.5*DIM1, 0], [0.5*DIM1+DIM2, 0], [0.5*DIM1+DIM2, d], [DIM1+DIM2, d],
- [DIM1+DIM2, d+DIM4], [0.5*DIM1+DIM2, d+DIM4], [0.5*DIM1+DIM2, DIM3], [0.5*DIM1, DIM3],
- [0.5*DIM1, d+DIM4], [0, d+DIM4], [0, d], [0.5*DIM1, d]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], 0.5*self.DIM3-shift[1])
- D = (0.5*(self.DIM1+self.DIM2)-shift[0], -shift[1])
- E = (-shift[0], -0.5*self.DIM3-shift[1])
- F = (-0.5*(self.DIM1+self.DIM2)-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class FCROSSSection(Geometry):
- """ Constructs a flanged cruciform/cross section with the intersection's middle center at the
- origin *(0, 0)*, with eight parameters defining dimensions. Added by JohnDN90.
-
- :param float DIM1: Depth (y) of flanged cruciform
- :param float DIM2: Width (x) of flanged cruciform
- :param float DIM3: Thickness of vertical web
- :param float DIM4: Thickness of horizontal web
- :param float DIM5: Length of flange attached to vertical web
- :param float DIM6: Thickness of flange attached to vertical web
- :param float DIM7: Length of flange attached to horizontal web
- :param float DIM8: Thickness of flange attached to horizontal web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example demonstrates the creation of a flanged cross section::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.FCROSSSection(
- DIM1=9.0, DIM2=6.0, DIM3=0.75, DIM4=0.625, DIM5=2.1, DIM6=0.375, DIM7=4.5, DIM8=0.564
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.03])
-
- .. figure:: ../images/sections/fcross_geometry.png
- :align: center
- :scale: 75 %
-
- Flanged Cruciform/cross section geometry.
-
- .. figure:: ../images/sections/fcross_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, DIM6, DIM7, DIM8, shift=[0, 0]):
- """Inits the FCROSSSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- DIM6 *= 1.0
- DIM7 *= 1.0
- DIM8 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
- self.DIM6 = DIM6
- self.DIM7 = DIM7
- self.DIM7 = DIM8
-
- # Ensure dimensions are physically relevant
- # TODO: Finish dimension checks.
- np.testing.assert_(DIM5 > DIM3, "Invalid geometry specified.")
- np.testing.assert_(DIM7 > DIM4, "Invalid geometry specified.")
- np.testing.assert_(DIM7 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM5 < DIM2, "Invalid geometry specified.")
- np.testing.assert_(DIM8 < (0.5*DIM2-0.5*DIM3), "Invalid geometry specified.")
- np.testing.assert_(DIM6 < (0.5*DIM1-0.5*DIM4), "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.0, 0.0]]
-
- shift = [shift[0], shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [0.5*DIM3, -0.5*DIM4], [0.5*DIM2-DIM8, -0.5*DIM4], [0.5*DIM2-DIM8, -0.5*DIM7],
- [0.5*DIM2, -0.5*DIM7], [0.5*DIM2, 0.5*DIM7], [0.5*DIM2-DIM8, 0.5*DIM7],
- [0.5*DIM2-DIM8, 0.5*DIM4], [0.5*DIM3, 0.5*DIM4], [0.5*DIM3, 0.5*DIM1-DIM6],
- [0.5*DIM5, 0.5*DIM1-DIM6], [0.5*DIM5, 0.5*DIM1], [-0.5*DIM5, 0.5*DIM1],
- [-0.5*DIM5, 0.5*DIM1-DIM6], [-0.5*DIM3, 0.5*DIM1-DIM6], [-0.5*DIM3, 0.5*DIM4],
- [-0.5*DIM2+DIM8, 0.5*DIM4], [-0.5*DIM2+DIM8, 0.5*DIM7], [-0.5*DIM2, 0.5*DIM7],
- [-0.5*DIM2, -0.5*DIM7], [-0.5*DIM2+DIM8, -0.5*DIM7], [-0.5*DIM2+DIM8, -0.5*DIM4],
- [-0.5*DIM3, -0.5*DIM4], [-0.5*DIM3, -0.5*DIM1+DIM6], [-0.5*DIM5, -0.5*DIM1+DIM6],
- [-0.5*DIM5, -0.5*DIM1], [0.5*DIM5, -0.5*DIM1], [0.5*DIM5, -0.5*DIM1+DIM6],
- [0.5*DIM3, -0.5*DIM1+DIM6]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 12], [12, 13], [13, 14], [14, 15], [15, 16], [16, 17], [17, 18],
- [18, 19], [19, 20], [20, 21], [21, 22], [22, 23], [23, 24], [24, 25], [25, 26],
- [26, 27], [27, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], 0.5*self.DIM1-shift[1])
- D = (0.5*self.DIM2-shift[0], -shift[1])
- E = (-shift[0], -0.5*self.DIM1-shift[1])
- F = (-0.5*self.DIM2-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class DBOXSection(Geometry):
- """ Constructs a DBOX section with the center at the origin *(0, 0)*, with ten parameters
- defining dimensions. See MSC Nastran documentation [1]_ for more details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of the DBOX-section
- :param float DIM2: Depth (y) of the DBOX-section
- :param float DIM3: Width (x) of left-side box
- :param float DIM4: Thickness of left wall
- :param float DIM5: Thickness of center wall
- :param float DIM6: Thickness of right wall
- :param float DIM7: Thickness of top left wall
- :param float DIM8: Thickness of bottom left wall
- :param float DIM9: Thickness of top right wall
- :param float DIM10: Thickness of bottom right wall
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a DBOX cross-section with a depth of 3.0 and width of 8.0, and
- generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.DBOXSection(
- DIM1=8.0, DIM2=3.0, DIM3=3.0, DIM4=0.5, DIM5=0.625, DIM6=0.75, DIM7=0.375, DIM8=0.25,
- DIM9=0.5, DIM10=0.375
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/dbox_geometry.png
- :align: center
- :scale: 75 %
-
- DBOX section geometry.
-
- .. figure:: ../images/sections/dbox_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, DIM6, DIM7, DIM8, DIM9, DIM10, shift=[0, 0]):
- """Inits the DBOXSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- DIM6 *= 1.0
- DIM7 *= 1.0
- DIM8 *= 1.0
- DIM9 *= 1.0
- DIM10 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
- self.DIM6 = DIM6
- self.DIM7 = DIM7
- self.DIM8 = DIM8
- self.DIM9 = DIM9
- self.DIM10 = DIM10
-
- # Ensure dimensions are physically relevant
- np.testing.assert_((DIM4+DIM5+DIM6) < DIM1, "Invalid geometry specified.")
- np.testing.assert_((DIM4+0.5*DIM5) < DIM3, "Invalid geometry specified.")
- np.testing.assert_((DIM7+DIM8) < DIM2, "Invalid geometry specified.")
- np.testing.assert_((DIM9+DIM10) < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM3, 0.5*DIM8]]
-
- shift = [-0.5*DIM1+shift[0], -0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the Box
- d2 = 0.5*(DIM1 - DIM6 - DIM3 - 0.5*DIM5)
- self.holes = [
- [DIM4 + 0.5*(DIM3 - DIM4 - 0.5*DIM5), DIM8 + 0.5*(DIM2 - DIM8 - DIM7)],
- [DIM3 + 0.5*DIM5 + d2, DIM10 + 0.5*(DIM2 - DIM10 - DIM9)]
- ]
-
- # construct the points and facets
- self.points = [
- [0., 0.], [DIM1, 0.], [DIM1, DIM2], [0., DIM2], [DIM4, DIM8], [DIM3-DIM5/2., DIM8],
- [DIM3-DIM5/2., DIM2-DIM7], [DIM4, DIM2-DIM7], [DIM3+DIM5/2., DIM10],
- [DIM1-DIM6, DIM10], [DIM1-DIM6, DIM2-DIM9], [DIM3+DIM5/2., DIM2-DIM9]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4], [8, 9], [9, 10],
- [10, 11], [11, 8]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """
- Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5 * self.DIM1 - shift[0], 0.5 * self.DIM2 - shift[1])
- D = (0.5 * self.DIM1 - shift[0], -0.5 * self.DIM2 - shift[1])
- E = (-0.5 * self.DIM1 - shift[0], -0.5 * self.DIM2 - shift[1])
- F = (-0.5 * self.DIM1 - shift[0], 0.5 * self.DIM2 - shift[1])
-
- return C, D, E, F
-
-
-[docs]class GBOXSection(Geometry):
- """ Constructs a GBOX section with the center at the origin *(0, 0)*, with six parameters
- defining dimensions. See ASTROS documentation [5]_ for more details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of the GBOX-section
- :param float DIM2: Depth (y) of the GBOX-section
- :param float DIM3: Thickness of top flange
- :param float DIM4: Thickness of bottom flange
- :param float DIM5: Thickness of webs
- :param float DIM6: Spacing between webs
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a GBOX cross-section with a depth of 2.5 and width of 6.0, and
- generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.GBOXSection(
- DIM1=6.0, DIM2=2.5, DIM3=0.375, DIM4=0.25, DIM5=0.625, DIM6=1.0
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/gbox_geometry.png
- :align: center
- :scale: 75 %
-
- GBOX section geometry.
-
- .. figure:: ../images/sections/gbox_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, DIM6, shift=[0, 0]):
- """Inits the GBOXSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- DIM6 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
- self.DIM6 = DIM6
-
- # Ensure dimensions are physically relevant
- np.testing.assert_((DIM3+DIM4) < DIM2, "Invalid geometry specified.")
- np.testing.assert_((2.0*DIM5+DIM6) < DIM1, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM4]]
-
- shift = [-(0.5*DIM1)+shift[0], -(DIM4 + 0.5*(DIM2-DIM3-DIM4))+shift[1]]
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the GBOX
- self.holes = [[0.5*DIM1, 0.5*DIM2]]
-
- # construct the points and facets
- d = 0.5*(DIM1 - DIM6 - 2.0 * DIM5)
- self.points = [
- [0., 0.], [DIM1, 0.], [DIM1, DIM4], [d + 2. * DIM5 + DIM6, DIM4],
- [d + 2. * DIM5 + DIM6, DIM2 - DIM3], [DIM1, DIM2 - DIM3], [DIM1, DIM2], [0., DIM2],
- [0., DIM2 - DIM3], [d, DIM2 - DIM3], [d, DIM4], [0., DIM4], [d + DIM5, DIM4],
- [d + DIM5 + DIM6, DIM4], [d + DIM5 + DIM6, DIM2 - DIM3], [d + DIM5, DIM2 - DIM3]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0], [12, 13], [13, 14], [14, 15], [15, 12]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
- D = (0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- E = (-0.5*self.DIM1-shift[0], -0.5*self.DIM2-shift[1])
- F = (-0.5*self.DIM1-shift[0], 0.5*self.DIM2-shift[1])
-
- return C, D, E, F
-
-
-[docs]class HSection(Geometry):
- """Constructs a H section with the middle web's middle center at the origin *(0, 0)*, with four
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details.
- Added by JohnDN90.
-
- :param float DIM1: Spacing between vertical flanges (length of web)
- :param float DIM2: Twice the thickness of the vertical flanges
- :param float DIM3: Depth (y) of the H-section
- :param float DIM4: Thickness of the middle web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a H cross-section with a depth of 3.5 and width of 2.75, and
- generates a mesh with a maximum triangular area of 0.005::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.HSection(DIM1=2.0, DIM2=0.75, DIM3=3.5, DIM4=0.25)
- mesh = geometry.create_mesh(mesh_sizes=[0.005])
-
- .. figure:: ../images/sections/h_geometry.png
- :align: center
- :scale: 75 %
-
- H section geometry.
-
- .. figure:: ../images/sections/h_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the HSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM3, "Invalid geometry specified.")
-
- d1 = 0.5 * (DIM3 - DIM4)
- d2 = 0.5 * DIM2
-
- # assign control point
- control_points = [[0.5*d2, 0.5*DIM3]]
-
- shift = [-0.5*(DIM2+DIM1)+shift[0], -0.5*DIM3+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [0, 0], [d2, 0], [d2, d1], [d2+DIM1, d1], [d2+DIM1, 0], [DIM1+DIM2, 0],
- [DIM1+DIM2, DIM3], [DIM1+DIM2-d2, DIM3], [DIM1+DIM2-d2, d1+DIM4], [d2, d1+DIM4],
- [d2, DIM3], [0, DIM3]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*(self.DIM1+self.DIM2)-shift[0], 0.5*self.DIM3-shift[1])
- D = (0.5*(self.DIM1+self.DIM2)-shift[0], -0.5*self.DIM3-shift[1])
- E = (-0.5*(self.DIM1+self.DIM2)-shift[0], -0.5*self.DIM3-shift[1])
- F = (-0.5*(self.DIM1+self.DIM2)-shift[0], 0.5*self.DIM3-shift[1])
-
- return C, D, E, F
-
-
-[docs]class HATSection(Geometry):
- """Constructs a Hat section with the top most section's middle center at the origin *(0, 0)*,
- with four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for
- more details. Note that HAT in ASTROS is actually HAT1 in this code. Added by JohnDN90.
-
- :param float DIM1: Depth (y) of HAT-section
- :param float DIM2: Thickness of HAT-section
- :param float DIM3: Width (x) of top most section
- :param float DIM4: Width (x) of bottom sections
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a HAT cross-section with a depth of 1.25 and width of 2.5, and
- generates a mesh with a maximum triangular area of 0.001::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.HATSection(DIM1=1.25, DIM2=0.25, DIM3=1.5, DIM4=0.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.001])
-
- .. figure:: ../images/sections/hat_geometry.png
- :align: center
- :scale: 75 %
-
- HAT section geometry.
-
- .. figure:: ../images/sections/hat_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the HATSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(2.0*DIM2 < DIM1, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM4, 0.5*DIM2]]
-
- shift = [-DIM4-0.5*DIM3+shift[0], -DIM1+0.5*DIM2+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [0., 0.], [DIM4+DIM2, 0.], [DIM4+DIM2, DIM1-DIM2], [DIM4+DIM3-DIM2, DIM1-DIM2],
- [DIM4+DIM3-DIM2, 0.], [2*DIM4+DIM3, 0.], [2.*DIM4+DIM3, DIM2], [DIM4+DIM3, DIM2],
- [DIM4+DIM3, DIM1], [DIM4, DIM1], [DIM4, DIM2], [0., DIM2]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the origin by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM3 - shift[0], 0.5*self.DIM2 - shift[1])
- D = (0.5*self.DIM3 + self.DIM4 - shift[0], -self.DIM1 + self.DIM2 - shift[1])
- E = (-0.5*self.DIM3 - self.DIM4 - shift[0], -self.DIM1 + self.DIM2 - shift[1])
- F = (-0.5*self.DIM3 - shift[0], 0.5*self.DIM2 - shift[1])
-
- return C, D, E, F
-
-
-[docs]class HAT1Section(Geometry):
- """ Constructs a HAT1 section with the bottom plate's bottom center at the origin *(0, 0)*,
- with five parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [5]_ for
- definition of parameters. Note that in ASTROS, HAT1 is called HAT. Added by JohnDN90.
-
- :param float DIM1: Width(x) of the HAT1-section
- :param float DIM2: Depth (y) of the HAT1-section
- :param float DIM3: Width (x) of hat's top flange
- :param float DIM4: Thickness of hat stiffener
- :param float DIM5: Thicknesss of bottom plate
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a HAT1 cross-section with a depth of 2.0 and width of 4.0, and
- generates a mesh with a maximum triangular area of 0.005::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.HAT1Section(DIM1=4.0, DIM2=2.0, DIM3=1.5, DIM4=0.1875, DIM5=0.375)
- mesh = geometry.create_mesh(mesh_sizes=[0.005])
-
- .. figure:: ../images/sections/hat1_geometry.png
- :align: center
- :scale: 75 %
-
- HAT1 section geometry.
-
- .. figure:: ../images/sections/hat1_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, shift=[0, 0]):
- """Inits the HAT1Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
-
- # Ensure dimensions are physically relevant
- np.testing.assert_((2.0*DIM4+DIM5) < DIM2, "Invalid geometry specified.")
- np.testing.assert_(DIM3 < DIM1, "Invalid geometry specified.")
-
- shift = [-0.5*DIM1+shift[0], shift[1]]
-
- # create bottom rectangular plate
- bottom_plate = RectangularSection(d=DIM5, b=DIM1, shift=shift)
-
- # create the hat stiffener
- d1 = DIM2 - DIM5
- d2 = DIM4
- d4 = 0.5*(DIM1 - DIM3)
-
- # specify a hole in the combined plate and hat structure
- holes = [[0.5*DIM1, 0.5*DIM2]]
-
- # assign control point
- control_points = [[0.5*d4, DIM5 + 0.5*DIM4]]
-
- super().__init__(control_points, shift)
-
- # construct the points and facets
- points = [
- [0., DIM5 + 0.], [d4 + d2, DIM5 + 0.], [d4 + d2, DIM5 + d1 - d2],
- [d4 + DIM3 - d2, DIM5 + d1 - d2], [d4 + DIM3 - d2, DIM5 + 0.],
- [2. * d4 + DIM3, DIM5 + 0.], [2. * d4 + DIM3, DIM5 + d2], [d4 + DIM3, DIM5 + d2],
- [d4 + DIM3, DIM5 + d1], [d4, DIM5 + d1], [d4, DIM5 + d2], [0, DIM5 + d2]
- ]
- facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- hat = CustomSection(points, facets, holes, control_points, shift=shift)
-
- # Create a list of the sections to merge
- section_list = [bottom_plate, hat]
-
- # Merge the three sections into one geometry
- geometry = MergedSection(section_list)
-
- # Clean the geometry and print information to the terminal
- geometry.clean_geometry(verbose=False)
-
- self.control_points = geometry.control_points
- self.shift = geometry.shift
- self.points = geometry.points
- self.facets = geometry.facets
- self.holes = geometry.holes
-
-[docs] def create_mesh(self, mesh_sizes):
- """Creates a quadratic triangular mesh from the Geometry object. This is overloaded here to
- allow specifying only one mesh_size which is used for both regions in the Hat1 section.
-
- :param mesh_sizes: A list of maximum element areas corresponding to each region within the
- cross-section geometry.
- :type mesh_size: list[float]
-
- :return: Object containing generated mesh data
- :rtype: :class:`meshpy.triangle.MeshInfo`
-
- :raises AssertionError: If the number of mesh sizes does not match the number of regions
- """
-
- mesh_sizes *= 2
-
- str = "Number of mesh_sizes ({0}), should match the number of regions ({1})".format(
- len(mesh_sizes), len(self.control_points)
- )
- assert(len(mesh_sizes) == len(self.control_points)), str
-
- return create_mesh(self.points, self.facets, self.holes, self.control_points, mesh_sizes)
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """ Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the origin by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-0.5*self.DIM1 - shift[0], -shift[1])
- D = (0.5*self.DIM1 - shift[0], -shift[1])
- E = (-0.5*self.DIM3 - shift[0], self.DIM2 - shift[1])
- F = (0.5*self.DIM3 - shift[0], self.DIM2 - shift[1])
-
- return C, D, E, F
-
-
-[docs]class HEXASection(Geometry):
- """ Constructs a HEXA (hexagon) section with the center at the origin *(0, 0)*, with three
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details.
- Added by JohnDN90.
-
- :param float DIM1: Spacing between bottom right point and right most point
- :param float DIM2: Width (x) of hexagon
- :param float DIM3: Depth (y) of hexagon
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a rectangular cross-section with a depth of 1.5 and width of 2.0,
- and generates a mesh with a maximum triangular area of 0.005::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.HEXASection(DIM1=0.5, DIM2=2.0, DIM3=1.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.005])
-
- .. figure:: ../images/sections/hexa_geometry.png
- :align: center
- :scale: 75 %
-
- HEXA section geometry.
-
- .. figure:: ../images/sections/hexa_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, shift=[0, 0]):
- """Inits the HEXASection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM2 > DIM1, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM2, 0.5*DIM3]]
-
- shift = [-0.5*DIM2+shift[0], -0.5*DIM3+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [
- [DIM1, 0.], [DIM2-DIM1, 0.], [DIM2, 0.5*DIM3], [DIM2-DIM1, DIM3], [DIM1, DIM3],
- [0., 0.5*DIM3]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], 0.5*self.DIM3-shift[1])
- D = (-shift[0], -0.5*self.DIM3-shift[1])
- E = (0.5*self.DIM2-shift[0], -shift[1])
- F = (-0.5*self.DIM2-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class NISection(Geometry):
- """Constructs Nastran's I section with the bottom flange's middle center at the origin
- *(0, 0)*, with six parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_
- [4]_ for definition of parameters. Added by JohnDN90.
-
- :param float DIM1: Depth(y) of the I-section
- :param float DIM2: Width (x) of bottom flange
- :param float DIM3: Width (x) of top flange
- :param float DIM4: Thickness of web
- :param float DIM5: Thickness of bottom web
- :param float DIM6: Thickness of top web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a Nastran I cross-section with a depth of 5.0, and generates a
- mesh with a maximum triangular area of 0.008::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.NISection(
- DIM1=5.0, DIM2=2.0, DIM3=3.0, DIM4=0.25, DIM5=0.375, DIM6=0.5
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.008])
-
- .. figure:: ../images/sections/ni_geometry.png
- :align: center
- :scale: 75 %
-
- Nastran's I section geometry.
-
- .. figure:: ../images/sections/ni_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, DIM5, DIM6, shift=[0, 0]):
- """Inits the NISection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- DIM5 *= 1.0
- DIM6 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
- self.DIM5 = DIM5
- self.DIM6 = DIM6
-
- # Ensure dimensions are physically relevant
- np.testing.assert_((DIM5 + DIM6) < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM4 < DIM3, "Invalid geometry specified.")
- np.testing.assert_(DIM4 < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM2, 0.5*DIM5]]
-
- shift = [-0.5*DIM2+shift[0], -0.5*DIM1+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- db = 0.5*(DIM2 - DIM4)
- dt = 0.5*(DIM3 - DIM4)
- self.points = [
- [0., 0.], [DIM2, 0.], [DIM2, DIM5], [db+DIM4, DIM5], [db + DIM4, DIM1-DIM6],
- [db+DIM4+dt, DIM1-DIM6], [db+DIM4+dt, DIM1], [db-dt, DIM1], [db-dt, DIM1-DIM6],
- [db, DIM1-DIM6], [db, DIM5], [0, DIM5]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM3-shift[0], 0.5*self.DIM1-shift[1])
- D = (0.5*self.DIM3-shift[0], -0.5*self.DIM1-shift[1])
- E = (-0.5*self.DIM3-shift[0], -0.5*self.DIM1-shift[1])
- F = (-0.5*self.DIM3-shift[0], 0.5*self.DIM1-shift[1])
-
- return C, D, E, F
-
-
-[docs]class I1Section(Geometry):
- """Constructs a I1 section with the web's middle center at the origin *(0, 0)*, with four
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details.
- Added by JohnDN90.
-
- :param float DIM1: Twice distance from web end to flange end
- :param float DIM2: Thickness of web
- :param float DIM3: Length of web (spacing between flanges)
- :param float DIM4: Depth (y) of the I1-section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a I1 cross-section with a depth of
- 5.0 and width of 1.75, and generates a mesh with a maximum triangular area of
- 0.02::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.I1Section(DIM1=1.0, DIM2=0.75, DIM3=4.0, DIM4=5.0)
- mesh = geometry.create_mesh(mesh_sizes=[0.02])
-
- .. figure:: ../images/sections/i1_geometry.png
- :align: center
- :scale: 75 %
-
- I1 section geometry.
-
- .. figure:: ../images/sections/i1_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the I1section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 > DIM3, "Invalid geometry specified.")
-
- shift = [-0.5*(DIM1+DIM2)+shift[0], -0.5*DIM4+shift[1]]
-
- # assign control point
- control_points = [[0.5*(DIM1+DIM2), 0.5*DIM4]]
-
- super().__init__(control_points, shift)
-
- # construct the points and facets
- t = 0.5*(DIM4 - DIM3)
- self.points = [
- [0., 0.], [DIM1+DIM2, 0.], [DIM1+DIM2, t], [0.5*DIM1+DIM2, t], [0.5*DIM1+DIM2, t+DIM3],
- [DIM1+DIM2, t+DIM3], [DIM1+DIM2, DIM4], [0., DIM4], [0., t+DIM3], [0.5*DIM1, t+DIM3],
- [0.5*DIM1, t], [0., t]
- ]
- self.facets = [
- [0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10],
- [10, 11], [11, 0]
- ]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*(self.DIM1+self.DIM2)-shift[0], 0.5*self.DIM4-shift[1])
- D = (0.5*(self.DIM1+self.DIM2)-shift[0], -0.5*self.DIM4-shift[1])
- E = (-0.5*(self.DIM1+self.DIM2)-shift[0], -0.5*self.DIM4-shift[1])
- F = (-0.5*(self.DIM1+self.DIM2)-shift[0], 0.5*self.DIM4-shift[1])
-
- return C, D, E, F
-
-
-[docs]class LSection(Geometry):
- """Constructs a L section with the intersection's center at the origin *(0, 0)*, with four
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ for more details.
- Added by JohnDN90.
-
- :param float DIM1: Width (x) of the L-section
- :param float DIM2: Depth (y) of the L-section
- :param float DIM3: Thickness of flange (horizontal portion)
- :param float DIM4: Thickness of web (vertical portion)
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a L cross-section with a depth of 6.0 and width of 3.0, and
- generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.LSection(DIM1=3.0, DIM2=6.0, DIM3=0.375, DIM4=0.625)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/l_geometry.png
- :align: center
- :scale: 75 %
-
- L section geometry.
-
- .. figure:: ../images/sections/l_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the LSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM3 < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM3]]
-
- shift = [-0.5*DIM4+shift[0], -0.5*DIM3+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [[0, 0], [DIM1, 0], [DIM1, DIM3], [DIM4, DIM3], [DIM4, DIM2], [0, DIM2]]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM4-shift[0], self.DIM2-0.5*self.DIM3-shift[1])
- D = (self.DIM1-0.5*self.DIM4-shift[0], -0.5*self.DIM3-shift[1])
- E = (-0.5*self.DIM4-shift[0], -0.5*self.DIM3-shift[1])
- F = (-0.5*self.DIM4-shift[0], self.DIM2-0.5*self.DIM3-shift[1])
-
- return C, D, E, F
-
-
-[docs]class RODSection(Geometry):
- """Constructs a circular rod section with the center at the origin *(0, 0)*, with one parameter
- defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details. Added by
- JohnDN90.
-
- :param float DIM1: Radius of the circular rod section
- :param int n: Number of points discretising the circle
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a circular rod with a radius of 3.0 and 50 points discretizing
- the boundary, and generates a mesh with a maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.RODSection(DIM1=3.0, n=50)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/rod_geometry.png
- :align: center
- :scale: 75 %
-
- Rod section geometry.
-
- .. figure:: ../images/sections/rod_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, n, shift=[0, 0]):
- """Inits the RODSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- self.DIM1 = DIM1
-
- # assign control point
- control_points = [[0, 0]]
-
- super().__init__(control_points, shift)
-
- # loop through each point on the circle
- d = 2.0*DIM1
-
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of the point
- x = 0.5 * d * np.cos(theta)
- y = 0.5 * d * np.sin(theta)
-
- # append the current point to the points list
- self.points.append([x, y])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i, 0])
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param float DIM1: Radius of the circular rod section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], self.DIM1-shift[1])
- D = (self.DIM1-shift[0], -shift[1])
- E = (-shift[0], -self.DIM1-shift[1])
- F = (-self.DIM1-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class TSection(Geometry):
- """Constructs a T section with the top flange's middle center at the origin *(0, 0)*, with four
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ [5]_ for more
- details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of top flange
- :param float DIM2: Depth (y) of the T-section
- :param float DIM3: Thickness of top flange
- :param float DIM4: Thickness of web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a T cross-section with a depth of 4.0 and width of 3.0, and
- generates a mesh with a maximum triangular area of 0.001::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.TSection(DIM1=3.0, DIM2=4.0, DIM3=0.375, DIM4=0.25)
- mesh = geometry.create_mesh(mesh_sizes=[0.001])
-
- .. figure:: ../images/sections/t_geometry.png
- :align: center
- :scale: 75 %
-
- T section geometry.
-
- .. figure:: ../images/sections/t_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the TSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM3 < DIM2, "Invalid geometry specified.")
-
- d = DIM2
- b = DIM1
- t_f = DIM3
- t_w = DIM4
- r = 0
- n_r = 1
- shift = [-DIM1/2.0+shift[0], -(DIM2-DIM3/2.0)+shift[1]]
-
- # assign control point
- control_points = [[b * 0.5, d - t_f * 0.5]]
-
- super().__init__(control_points, shift)
-
- # add first two points
- self.points.append([b * 0.5 - t_w * 0.5, 0])
- self.points.append([b * 0.5 + t_w * 0.5, 0])
-
- # construct the top right radius
- pt = [b * 0.5 + t_w * 0.5 + r, d - t_f - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add next four points
- self.points.append([b, d - t_f])
- self.points.append([b, d])
- self.points.append([0, d])
- self.points.append([0, d - t_f])
-
- # construct the top left radius
- pt = [b * 0.5 - t_w * 0.5 - r, d - t_f - r]
- self.draw_radius(pt, r, 0.5 * np.pi, n_r, False)
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """
- Returns the coordinates of the stress evaluation points relative to the origin
- of the cross-section. The shift parameter can be used to make the coordinates
- relative to the centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], 0.5*self.DIM3-shift[1])
- D = (0.5*self.DIM1-shift[0], 0.5*self.DIM3-shift[1])
- E = (-shift[0], 0.5*self.DIM3-self.DIM2-shift[1])
- F = (-0.5*self.DIM1-shift[0], 0.5*self.DIM3-shift[1])
-
- return C, D, E, F
-
-
-[docs]class T1Section(Geometry):
- """Constructs a T1 section with the right flange's middle center at the origin *(0, 0)*, with
- four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more
- details. Added by JohnDN90.
-
- :param float DIM1: Depth (y) of T1-section
- :param float DIM2: Length (x) of web
- :param float DIM3: Thickness of right flange
- :param float DIM4: Thickness of web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a T1 cross-section with a depth of 3.0 and width of 3.875, and
- generates a mesh with a maximum triangular area of 0.001::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.T1Section(DIM1=3.0, DIM2=3.5, DIM3=0.375, DIM4=0.25)
- mesh = geometry.create_mesh(mesh_sizes=[0.001])
-
- .. figure:: ../images/sections/t1_geometry.png
- :align: center
- :scale: 75 %
-
- T1 section geometry.
-
- .. figure:: ../images/sections/t1_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the T1section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM1, "Invalid geometry specified.")
-
- shift = [-0.5*DIM3+shift[0], -0.5*DIM1+shift[1]]
-
- # assign control point
- control_points = [[0.5*DIM3, 0.5*DIM1]]
-
- super().__init__(control_points, shift)
-
- # construct the points and facets
- d1 = (DIM1 - DIM4) / 2.0
- self.points = [
- [0, 0], [DIM3, 0], [DIM3, DIM1], [0, DIM1], [0, d1 + DIM4], [-DIM2, d1 + DIM4],
- [-DIM2, d1], [0, d1]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM3-shift[0], -shift[1])
- D = (0.5*self.DIM3-shift[0], -0.5*self.DIM1-shift[1])
- E = (-0.5*self.DIM3-self.DIM2-shift[0], -shift[1])
- F = (0.5*self.DIM3-shift[0], 0.5*self.DIM1-shift[1])
-
- return C, D, E, F
-
-
-[docs]class T2Section(Geometry):
- """Constructs a T2 section with the bottom flange's middle center at the origin *(0, 0)*, with
- four parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more
- details. Added by JohnDN90.
-
- :param float DIM1: Width (x) of T2-section
- :param float DIM2: Depth (y) of T2-section
- :param float DIM3: Thickness of bottom flange
- :param float DIM4: Thickness of web
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a T2 cross-section with a depth of 4.0 and width of 3.0, and
- generates a mesh with a maximum triangular area of 0.005::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.T2Section(DIM1=3.0, DIM2=4.0, DIM3=0.375, DIM4=0.5)
- mesh = geometry.create_mesh(mesh_sizes=[0.005])
-
- .. figure:: ../images/sections/t2_geometry.png
- :align: center
- :scale: 75 %
-
- T2 section geometry.
-
- .. figure:: ../images/sections/t2_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the T2Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 < DIM1, "Invalid geometry specified.")
- np.testing.assert_(DIM3 < DIM2, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[0.5*DIM1, 0.5*DIM3]]
-
- shift = [-0.5*DIM1+shift[0], -0.5*DIM3+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- d1 = 0.5*(DIM1 - DIM4)
- self.points = [
- [0., 0.], [DIM1, 0.], [DIM1, DIM3], [DIM1-d1, DIM3], [DIM1-d1, DIM2], [d1, DIM2],
- [d1, DIM3], [0, DIM3]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM4-shift[0], self.DIM2-0.5*self.DIM3-shift[1])
- D = (0.5*self.DIM1-shift[0], -0.5*self.DIM3-shift[1])
- E = (-0.5*self.DIM1-shift[0], -0.5*self.DIM3-shift[1])
- F = (-0.5*self.DIM4-shift[0], self.DIM2-0.5*self.DIM3-shift[1])
-
- return C, D, E, F
-
-
-[docs]class TUBESection(Geometry):
- """Constructs a circular tube section with the center at the origin *(0, 0)*, with two
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more
- details. Added by JohnDN90.
-
- :param float DIM1: Outer radius of the circular tube section
- :param float DIM2: Inner radius of the circular tube section
- :param int n: Number of points discretising the circle
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a circular tube cross-section with an outer radius of 3.0 and an
- inner radius of 2.5, and generates a mesh with 37 points discretizing the boundaries and a
- maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.TUBESection(DIM1=3.0, DIM2=2.5, n=37)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/tube_geometry.png
- :align: center
- :scale: 75 %
-
- TUBE section geometry.
-
- .. figure:: ../images/sections/tube_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, n, shift=[0, 0]):
- """Inits the TUBESection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM2 < DIM1, "Invalid geometry specified.")
-
- d = 2.0*DIM1
- t = DIM1-DIM2
-
- # assign control point
- control_points = [[d * 0.5 - t * 0.5, 0]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the CHS
- self.holes = [[0., 0.]]
-
- # loop through each point of the CHS
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of outer and inner points
- x_outer = 0.5 * d * np.cos(theta)
- y_outer = 0.5 * d * np.sin(theta)
- x_inner = (0.5 * d - t) * np.cos(theta)
- y_inner = (0.5 * d - t) * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x_outer, y_outer])
- self.points.append([x_inner, y_inner])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i * 2, i * 2 + 2])
- self.facets.append([i * 2 + 1, i * 2 + 3])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i * 2, 0])
- self.facets.append([i * 2 + 1, 1])
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], self.DIM1-shift[1])
- D = (self.DIM1-shift[0], -shift[1])
- E = (-shift[0], -self.DIM1-shift[1])
- F = (-self.DIM1-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class TUBE2Section(Geometry):
- """Constructs a circular TUBE2 section with the center at the origin *(0, 0)*, with two
- parameters defining dimensions. See MSC Nastran documentation [1]_ for more details. Added by
- JohnDN90.
-
- :param float DIM1: Outer radius of the circular tube section
- :param float DIM2: Thickness of wall
- :param int n: Number of points discretising the circle
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a ciruclar TUBE2 cross-section with an outer radius of 3.0 and a
- wall thickness of 0.5, and generates a mesh with 37 point discritizing the boundary and a
- maximum triangular area of 0.01::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.TUBE2Section(DIM1=3.0, DIM2=0.5, n=37)
- mesh = geometry.create_mesh(mesh_sizes=[0.01])
-
- .. figure:: ../images/sections/tube2_geometry.png
- :align: center
- :scale: 75 %
-
- TUBE2 section geometry.
-
- .. figure:: ../images/sections/tube2_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, n, shift=[0, 0]):
- """Inits the TUBE2Section class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM2 < DIM1, "Invalid geometry specified.")
-
- d = 2.0*DIM1
- t = DIM2
-
- # assign control point
- control_points = [[d * 0.5 - t * 0.5, 0]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the section
- self.holes = [[0., 0.]]
-
- # loop through each point of the section
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of outer and inner points
- x_outer = 0.5 * d * np.cos(theta)
- y_outer = 0.5 * d * np.sin(theta)
- x_inner = (0.5 * d - t) * np.cos(theta)
- y_inner = (0.5 * d - t) * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x_outer, y_outer])
- self.points.append([x_inner, y_inner])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i * 2, i * 2 + 2])
- self.facets.append([i * 2 + 1, i * 2 + 3])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i * 2, 0])
- self.facets.append([i * 2 + 1, 1])
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (-shift[0], self.DIM1-shift[1])
- D = (self.DIM1-shift[0], -shift[1])
- E = (-shift[0], -self.DIM1-shift[1])
- F = (-self.DIM1-shift[0], -shift[1])
-
- return C, D, E, F
-
-
-[docs]class ZSection(Geometry):
- """Constructs a Z section with the web's middle center at the origin *(0, 0)*, with four
- parameters defining dimensions. See Nastran documentation [1]_ [2]_ [3]_ [4]_ for more details.
- Added by JohnDN90.
-
- :param float DIM1: Width (x) of horizontal members
- :param float DIM2: Thickness of web
- :param float DIM3: Spacing between horizontal members (length of web)
- :param float DIM4: Depth (y) of Z-section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a rectangular cross-section with a depth of 4.0 and width of
- 2.75, and generates a mesh with a maximum triangular area of 0.005::
-
- import sectionproperties.pre.nastran_sections as nsections
-
- geometry = nsections.ZSection(DIM1=1.125, DIM2=0.5, DIM3=3.5, DIM4=4.0)
- mesh = geometry.create_mesh(mesh_sizes=[0.005])
-
- .. figure:: ../images/sections/z_geometry.png
- :align: center
- :scale: 75 %
-
- Z section geometry.
-
- .. figure:: ../images/sections/z_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, DIM1, DIM2, DIM3, DIM4, shift=[0, 0]):
- """Inits the ZSection class."""
-
- # force dimensions to be floating point values
- DIM1 *= 1.0
- DIM2 *= 1.0
- DIM3 *= 1.0
- DIM4 *= 1.0
- self.DIM1 = DIM1
- self.DIM2 = DIM2
- self.DIM3 = DIM3
- self.DIM4 = DIM4
-
- # Ensure dimensions are physically relevant
- np.testing.assert_(DIM4 > DIM3, "Invalid geometry specified.")
-
- # assign control point
- control_points = [[DIM1+0.5*DIM2, 0.5*DIM4]]
-
- shift = [-0.5*(DIM1+DIM2)+shift[0], -0.5*DIM4+shift[1]]
- super().__init__(control_points, shift)
-
- # construct the points and facets
- t = 0.5*(DIM4 - DIM3)
- self.points = [
- [DIM1, 0.], [2.*DIM1+DIM2, 0.], [2.*DIM1+DIM2, t], [DIM1+DIM2, t], [DIM1+DIM2, DIM4],
- [0., DIM4], [0., DIM4-t], [DIM1, DIM4-t]
- ]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 0]]
-
- self.shift_section()
-
-[docs] def getStressPoints(self, shift=(0., 0.)):
- """Returns the coordinates of the stress evaluation points relative to the origin of the
- cross-section. The shift parameter can be used to make the coordinates relative to the
- centroid or the shear center.
-
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: tuple(float, float)
- :returns: Stress evaluation points relative to shifted origin - C, D, E, F
- """
-
- C = (0.5*self.DIM2-shift[0], 0.5*self.DIM4-shift[1])
- D = (0.5*self.DIM2+self.DIM1-shift[0], -0.5*self.DIM4-shift[1])
- E = (-0.5*self.DIM2-shift[0], -0.5*self.DIM4-shift[1])
- F = (-0.5*self.DIM2-self.DIM1-shift[0], 0.5*self.DIM4-shift[1])
-
- return C, D, E, F
-
-import numpy as np
-import meshpy.triangle as triangle
-
-
-[docs]class Material:
- """Class for structural materials.
-
- Provides a way of storing material properties related to a specific material. The color can be
- a multitude of different formats, refer to https://matplotlib.org/api/colors_api.html and
- https://matplotlib.org/examples/color/named_colors.html for more information.
-
- :param string name: Material name
- :param float elastic_modulus: Material modulus of elasticity
- :param float poissons_ratio: Material Poisson's ratio
- :param float yield_strength: Material yield strength
- :param color: Material color for rendering
- :type color: :class:`matplotlib.colors`
-
- :cvar string name: Material name
- :cvar float elastic_modulus: Material modulus of elasticity
- :cvar float poissons_ratio: Material Poisson's ratio
- :cvar float shear_modulus: Material shear modulus, derived from the elastic modulus and
- Poisson's ratio assuming an isotropic material
- :cvar float yield_strength: Material yield strength
- :cvar color: Material color for rendering
- :vartype color: :class:`matplotlib.colors`
-
- The following example creates materials for concrete, steel and timber::
-
- from sectionproperties.pre.pre import Material
-
- concrete = Material(
- name='Concrete', elastic_modulus=30.1e3, poissons_ratio=0.2, yield_strength=32,
- color='lightgrey'
- )
- steel = Material(
- name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=500,
- color='grey'
- )
- timber = Material(
- name='Timber', elastic_modulus=8e3, poissons_ratio=0.35, yield_strength=20,
- color='burlywood'
- )
- """
-
- def __init__(self, name, elastic_modulus, poissons_ratio, yield_strength,
- color='w'):
- """Inits the Material class"""
-
- self.name = name
- self.elastic_modulus = elastic_modulus
- self.poissons_ratio = poissons_ratio
- self.shear_modulus = elastic_modulus / (2 * (1 + poissons_ratio))
- self.yield_strength = yield_strength
- self.color = color
-
-
-[docs]class GeometryCleaner:
- """Class for cleaning :class:`~sectionproperties.pre.sections.Geometry` objects.
-
- :param geometry: Geometry object to clean
- :type geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :param bool verbose: If set to true, information related to the geometry cleaning process is
- printed to the terminal.
-
- Provides methods to clean various aspects of the geometry including:
-
- * Zipping nodes - Find nodes that are close together (relative and absolute tolerance) and
- deletes one of the nodes and rejoins the facets to the remaining node.
- * Removing zero length facets - Removes facets that start and end at the same point.
- * Remove duplicate facets - Removes facets that have the same starting and ending point as an
- existing facet.
- * Removing overlapping facets - Searches for facets that overlap each other, given a tolerance
- angle, and reconstructs a unique set of facets along the overlapping region.
- * Remove unused points - Removes points that are not connected to any facets.
- * Intersect facets - Searches for intersections between two facets and adds the intersection
- point to the points list and splits the intersected facets.
-
- Note that a geometry cleaning method is provided to all
- :class:`~sectionproperties.pre.sections.Geometry` objects.
-
- :cvar geometry: Geometry object to clean
- :vartype geometry: :class:`~sectionproperties.pre.sections.Geometry`
- :cvar bool verbose: If set to true, information related to the geometry cleaning process is
- printed to the terminal.
-
- The following example creates a back-to-back 200PFC geometry, rotates the geometry by 30
- degrees, and cleans the geometry before meshing::
-
- import sectionproperties.pre.sections as sections
-
- pfc_right = sections.PfcSection(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=8)
- pfc_left = sections.PfcSection(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=8)
- pfc_left.mirror_section(axis='y', mirror_point=[0, 0])
- geometry = sections.MergedSection([pfc_left, pfc_right])
- geometry.rotate_section(angle=30)
- geometry.clean_geometry(verbose=True)
- mesh = geometry.create_mesh(mesh_sizes=[5, 5])
-
- .. warning:: If the geometry were not cleaned in the previous example, the meshing algorithm
- would crash (most likely return a segment error). Cleaning the geometry is always recommended
- when creating a merged section, which may result in overlapping or intersecting facets, or
- duplicate nodes.
- """
-
- def __init__(self, geometry, verbose):
- """Inits the GeometryCleaner class."""
-
- self.geometry = geometry
- self.verbose = verbose
-
-[docs] def clean_geometry(self):
- """Performs a full geometry clean on the `geometry` object."""
-
- self.zip_points()
- self.remove_zero_length_facets()
- self.remove_duplicate_facets()
- self.remove_overlapping_facets()
- self.remove_unused_points()
- self.intersect_facets()
-
- return self.geometry
-
-[docs] def zip_points(self, atol=1e-8, rtol=1e-5):
- """Zips points that are close to each other. Searches through the point list and merges two
- points if there are deemed to be sufficiently close. The average value of the coordinates
- is used for the new point. One of the points is deleted from the point list and the facet
- list is updated to remove references to the old points and renumber the remaining point
- indices in the facet list.
-
- :param float atol: Absolute tolerance for point zipping
- :param float rtol: Relative tolerance (to geometry extents) for point zipping
- """
-
- idx_to_remove = []
-
- # determine rtol
- (x_min, x_max, y_min, y_max) = self.geometry.calculate_extents()
- geom_range = max(x_max - x_min, y_max - y_min)
- rel_tol = rtol * geom_range
-
- # loop through the list of points
- for (i, pt1) in enumerate(self.geometry.points):
- # check all other points
- for (j, pt2) in enumerate(self.geometry.points[i + 1:]):
- # get point indices
- idx_1 = i
- idx_2 = i + j + 1
-
- # determine distance between two points
- dist = ((pt2[0] - pt1[0]) ** 2 + (pt2[1] - pt1[1]) ** 2) ** 0.5
-
- # if the points are close together and the point has not already been removed
- if (dist < atol or dist < rel_tol) and idx_2 not in idx_to_remove:
- # update point1 (average of point1 + point2)
- pt1[0] = 0.5 * (pt1[0] + pt2[0])
- pt1[1] = 0.5 * (pt1[1] + pt2[1])
-
- # join facets connected to pt2 to pt1 instead
- self.replace_point_id(idx_2, idx_1)
-
- # add pt2 to the list of points to remove
- idx_to_remove.append(idx_2)
-
- if self.verbose:
- str = "Zipped point {0} to point {1}".format(idx_2, idx_1)
- print(str)
-
- # sort list of indices to remove in reverse order so as not to comprimise the indices
- idx_to_remove = sorted(idx_to_remove, reverse=True)
-
- for idx in idx_to_remove:
- self.remove_point_id(idx)
-
-[docs] def remove_zero_length_facets(self):
- """Searches through all facets and removes those that have the same starting and ending
- point."""
-
- idx_to_remove = []
-
- # loop through the list of facets
- for (idx, fct) in enumerate(self.geometry.facets):
- if fct[0] == fct[1]:
- idx_to_remove.append(idx)
-
- # sort list of indices to remove in reverse order so as not to comprimise the indices
- idx_to_remove = sorted(idx_to_remove, reverse=True)
-
- for idx in idx_to_remove:
- self.geometry.facets.pop(idx)
-
- if self.verbose:
- print("Removed zero length facet {0}".format(idx))
-
-[docs] def remove_overlapping_facets(self):
- """Searches through all facet combinations and fixes facets that overlap within a
- tolerance."""
-
- cleaning = True
-
- while cleaning:
- # loop through the list of facets
- for (i, fct1) in enumerate(self.geometry.facets):
- broken = False
-
- # check all other facets
- for (j, fct2) in enumerate(self.geometry.facets[i + 1:]):
- # get facet indices
- idx_1 = i
- idx_2 = i + j + 1
-
- # get facets points
- # facet 1: p -> p + r
- p = np.array(self.geometry.points[fct1[0]])
- r = self.geometry.points[fct1[1]] - p
-
- # facet 2: q -> q + s
- q = np.array(self.geometry.points[fct2[0]])
- s = self.geometry.points[fct2[1]] - q
-
- pts = self.is_overlap(p, q, r, s, fct1, fct2)
-
- if pts is not None:
- # delete both facets
- idx_to_remove = sorted([idx_1, idx_2], reverse=True)
- for idx in idx_to_remove:
- self.geometry.facets.pop(idx)
-
- # add new facets
- for i in range(len(pts) - 1):
- self.geometry.facets.append([pts[i], pts[i + 1]])
-
- # remove duplicate facets
- self.remove_duplicate_facets()
-
- if self.verbose:
- str = "Removed overlapping facets {0}...".format(idx_to_remove)
- str += "Rebuilt with points: {0}".format(pts)
- print(str)
-
- # break both loops and loop through all facets again
- broken = True
- break
-
- if broken:
- break
-
- # if we've arrived at the end without detecting any overlaps
- if not broken:
- cleaning = False
-
-[docs] def remove_unused_points(self):
- """Searches through all facets and removes points that are not connected to any facets."""
-
- idx_to_remove = []
- facet_flattened = [i for fct in self.geometry.facets for i in fct]
-
- # loop through number of points
- for pt in range(len(self.geometry.points)):
- if pt not in facet_flattened:
- idx_to_remove.append(pt)
-
- if self.verbose:
- print("Removed unused point {0}".format(pt))
-
- # sort list of indices to remove in reverse order so as not to comprimise the indices
- idx_to_remove = sorted(idx_to_remove, reverse=True)
-
- for idx in idx_to_remove:
- self.remove_point_id(idx)
-
-[docs] def intersect_facets(self):
- """Searches through all facet combinations and finds facets that intersect each other. The
- intersection point is added and the facets rebuilt."""
-
- cleaning = True
-
- while cleaning:
- # loop through the list of facets
- for (i, fct1) in enumerate(self.geometry.facets):
- broken = False
-
- # check all other facets
- for (j, fct2) in enumerate(self.geometry.facets[i + 1:]):
- # get facet indices
- idx_1 = i
- idx_2 = i + j + 1
-
- # get facets points
- # facet 1: p -> p + r
- p = np.array(self.geometry.points[fct1[0]])
- r = self.geometry.points[fct1[1]] - p
-
- # facet 2: q -> q + s
- q = np.array(self.geometry.points[fct2[0]])
- s = self.geometry.points[fct2[1]] - q
-
- pt = self.is_intersect(p, q, r, s)
-
- if pt is not None:
- # add point
- self.geometry.points.append([pt[0], pt[1]])
- pt_idx = len(self.geometry.points) - 1
-
- # delete both facets
- idx_to_remove = sorted([idx_1, idx_2], reverse=True)
- for idx in idx_to_remove:
- self.geometry.facets.pop(idx)
-
- # rebuild facet 1
- self.geometry.facets.append([fct1[0], pt_idx])
- self.geometry.facets.append([pt_idx, fct1[1]])
-
- # rebuild facet 2
- self.geometry.facets.append([fct2[0], pt_idx])
- self.geometry.facets.append([pt_idx, fct2[1]])
-
- if self.verbose:
- str = "Intersected facets"
- str += " {0} and {1}".format(idx_1, idx_2)
- str += " at point: {0}".format(pt)
- print(str)
-
- # break both loops and loop through all facets again
- broken = True
- break
-
- if broken:
- break
-
- # if we've arrived at the end without detecting any overlaps
- if not broken:
- cleaning = False
-
-[docs] def replace_point_id(self, id_old, id_new):
- """Searches all facets and replaces references to point id_old with id_new.
-
- :param int id_old: Point index to be replaced
- :param int id_new: Point index to replace point id_old
- """
-
- # loop through all facets
- for (i, facet) in enumerate(self.geometry.facets):
- # loop through the point indices defining the facet
- for (j, point_id) in enumerate(facet):
- if point_id == id_old:
- self.geometry.facets[i][j] = id_new
-
-[docs] def remove_point_id(self, point_id):
- """Removes point point_id from the points list and renumbers the references to points after
- point_id in the facet list.
-
- :param int point_id: Index of point to be removed
- """
-
- # remove index point_id from the points list
- self.geometry.points.pop(point_id)
-
- # renumber facet references to points after point_id
- for (i, facet) in enumerate(self.geometry.facets):
- # loop through the point indices defining the facet
- for (j, p_id) in enumerate(facet):
- # if the point index is greater the point to be deleted
- if p_id > point_id:
- # decrement the point index
- self.geometry.facets[i][j] -= 1
-
-[docs] def is_duplicate_facet(self, fct1, fct2):
- """Checks to see if to facets are duplicates.
-
- :param fct1: First facet to compare
- :type fct1: list[int, int]
- :param fct2: Second facet to compare
- :type fct2: list[int, int]
- :return: Whether or not the facets are identical
- :rtype: bool
- """
-
- # check for a facet duplicate
- if fct1 == fct2 or fct1 == list(reversed(fct2)):
- return True
- else:
- return False
-
-[docs] def is_intersect(self, p, q, r, s):
- """Determines if the line segment p->p+r intersects q->q+s. Implements Gareth Rees's
- answer: https://stackoverflow.com/questions/563198.
-
- :param p: Starting point of the first line segment
- :type p: :class:`numpy.ndarray` [float, float]
- :param q: Starting point of the second line segment
- :type q: :class:`numpy.ndarray` [float, float]
- :param r: Vector of the first line segment
- :type r: :class:`numpy.ndarray` [float, float]
- :param s: Vector of the second line segment
- :type s: :class:`numpy.ndarray` [float, float]
- :returns: The intersection point of the line segments. If there is no intersection, returns
- None.
- :rtype: :class:`numpy.ndarray` [float, float]
- """
-
- if np.cross(r, s) != 0:
- # calculate t and u
- t = np.cross(q - p, s) / np.cross(r, s)
- u = np.cross(p - q, r) / np.cross(s, r)
-
- # modify from closed inequality (<=) to open (<) so end intersections are not picked up
- if (t > 0 and t < 1) and (u > 0 and u < 1):
- return p + t * r
- else:
- return None
-
-[docs] def is_overlap(self, p, q, r, s, fct1, fct2):
- """Determines if the line segment p->p+r overlaps q->q+s. Implements Gareth Rees's answer:
- https://stackoverflow.com/questions/563198.
-
- :param p: Starting point of the first line segment
- :type p: :class:`numpy.ndarray` [float, float]
- :param q: Starting point of the second line segment
- :type q: :class:`numpy.ndarray` [float, float]
- :param r: Vector of the first line segment
- :type r: :class:`numpy.ndarray` [float, float]
- :param s: Vector of the second line segment
- :type s: :class:`numpy.ndarray` [float, float]
- :param fct1: sadkjas;dkas;dj
- :returns: A list containing the points required for facet rebuilding. If there is no
- rebuild to be done, returns None.
- :rtype: list[list[float, float]]
- """
-
- tol = 1e-3 # minimum angle tolerance (smaller is considered overlap)
- float_tol = 1e-12 # rounding error tolerance
-
- # relativise tolerance by length of smallest vector
- tol *= min(np.linalg.norm(r), np.linalg.norm(s))
-
- # are the line segments collinear?
- if abs(np.cross(r, s)) < tol:
- if abs(np.cross(q - p, r)) < tol:
- # CASE 1: two line segments are collinear
- # calculate end points of second segment in terms of the equation of the first line
- # segment (p + t * r)
- if np.dot(s, r) >= 0:
- t0 = np.dot(q - p, r) / np.dot(r, r)
- t1 = np.dot(q + s - p, r) / np.dot(r, r)
- else:
- t0 = np.dot(q + s - p, r) / np.dot(r, r)
- t1 = np.dot(q - p, r) / np.dot(r, r)
-
- # check interval [t0, t1] intersects (0, 1)
- if t0 < 1 - float_tol and float_tol < t1:
- # recalculate t0 and t1 based on original assumptions
- t0 = np.dot(q - p, r) / np.dot(r, r)
- t1 = np.dot(q + s - p, r) / np.dot(r, r)
-
- t = sorted(list(set([0.0, t0, 1.0, t1])))
- idx_list = []
-
- # loop through new points
- for pt in t:
- if pt == 0.0:
- idx_list.append(fct1[0])
- elif pt == 1.0:
- idx_list.append(fct1[1])
- elif pt == t0:
- idx_list.append(fct2[0])
- elif pt == t1:
- idx_list.append(fct2[1])
-
- return idx_list
- else:
- # collinear and disjoint
- return None
- else:
- return None
-
-[docs] def remove_duplicate_facets(self):
- """Searches through all facets and removes facets that are duplicates, independent of the
- point order."""
-
- idx_to_remove = []
-
- # loop through the list of facets
- for (i, fct1) in enumerate(self.geometry.facets):
- # check all other facets
- for (j, fct2) in enumerate(self.geometry.facets[i + 1:]):
- # get facet indices
- idx_1 = i
- idx_2 = i + j + 1
-
- # check for a duplicate facet that has not already been deleted
- if (self.is_duplicate_facet(fct1, fct2) and
- idx_2 not in idx_to_remove):
- idx_to_remove.append(idx_2)
-
- if self.verbose:
- str = "Removed duplicate facet: {0}".format(idx_2)
- str += " (identical to facet: {0})".format(idx_1)
- print(str)
-
- # sort list of indices to remove in reverse order so as not to comprimise the indices
- idx_to_remove = sorted(idx_to_remove, reverse=True)
-
- for idx in idx_to_remove:
- self.geometry.facets.pop(idx)
-
-
-[docs]def create_mesh(points, facets, holes, control_points, mesh_sizes):
- """Creates a quadratic triangular mesh using the meshpy module, which utilises the code
- 'Triangle', by Jonathan Shewchuk.
-
- :param points: List of points *(x, y)* defining the vertices of the cross-section
- :type points: list[list[float, float]]
- :param facets: List of point index pairs *(p1, p2)* defining the edges of the cross-section
- :type points: list[list[int, int]]
- :param holes: List of points *(x, y)* defining the locations of holes within the cross-section.
- If there are no holes, provide an empty list [].
- :type holes: list[list[float, float]]
- :param control_points: A list of points *(x, y)* that define different regions of the
- cross-section. A control point is an arbitrary point within a region enclosed by facets.
- :type control_points: list[list[float, float]]
- :param mesh_sizes: List of maximum element areas for each region defined by a control point
- :type mesh_sizes: list[float]
-
- :return: Object containing generated mesh data
- :rtype: :class:`meshpy.triangle.MeshInfo`
- """
-
- mesh = triangle.MeshInfo() # create mesh info object
- mesh.set_points(points) # set points
- mesh.set_facets(facets) # set facets
- mesh.set_holes(holes) # set holes
-
- # set regions
- mesh.regions.resize(len(control_points)) # resize regions list
- region_id = 0 # initialise region ID variable
-
- for (i, cp) in enumerate(control_points):
- mesh.regions[i] = [cp[0], cp[1], region_id, mesh_sizes[i]]
- region_id += 1
-
- mesh = triangle.build(
- mesh, min_angle=30, mesh_order=2, quality_meshing=True,
- attributes=True, volume_constraints=True)
-
- return mesh
-
-import numpy as np
-import matplotlib.pyplot as plt
-import sectionproperties.pre.pre as pre
-import sectionproperties.post.post as post
-
-
-[docs]class Geometry:
- """Parent class for a cross-section geometry input.
-
- Provides an interface for the user to specify the geometry defining a cross-section. A method
- is provided for generating a triangular mesh, for translating the cross-section by *(x, y)* and
- for plotting the geometry.
-
- :cvar points: List of points *(x, y)* defining the vertices of the cross-section
- :vartype points: list[list[float, float]]
- :cvar facets: List of point index pairs *(p1, p2)* defining the edges of the cross-section
- :vartype facets: list[list[int, int]]
- :cvar holes: List of points *(x, y)* defining the locations of holes within the cross-section.
- If there are no holes, provide an empty list [].
- :vartype holes: list[list[float, float]]
- :cvar control_points: A list of points *(x, y)* that define different regions of the
- cross-section. A control point is an arbitrary point within a region enclosed by facets.
- :vartype control_points: list[list[float, float]]
- :cvar shift: Vector that shifts the cross-section by *(x, y)*
- :vartype shift: list[float, float]
- :cvar perimeter: List of facet indices defining the perimeter of the cross-section
- :vartype perimeter: list[int]
- """
-
- def __init__(self, control_points, shift):
- """Inits the Geometry class."""
-
- self.control_points = control_points
- self.shift = shift
- self.points = []
- self.facets = []
- self.holes = []
- self.perimeter = []
-
-[docs] def create_mesh(self, mesh_sizes):
- """Creates a quadratic triangular mesh from the Geometry object.
-
- :param mesh_sizes: A list of maximum element areas corresponding to each region within the
- cross-section geometry.
- :type mesh_size: list[float]
-
- :return: Object containing generated mesh data
- :rtype: :class:`meshpy.triangle.MeshInfo`
-
- :raises AssertionError: If the number of mesh sizes does not match the number of regions
-
- The following example creates a circular cross-section with a diameter of 50 with 64
- points, and generates a mesh with a maximum triangular area of 2.5::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.CircularSection(d=50, n=64)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
-
- .. figure:: ../images/sections/circle_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- str = "Number of mesh_sizes ({0}), should match the number of regions ({1})".format(
- len(mesh_sizes), len(self.control_points)
- )
- assert(len(mesh_sizes) == len(self.control_points)), str
-
- return pre.create_mesh(
- self.points, self.facets, self.holes, self.control_points, mesh_sizes)
-
-[docs] def shift_section(self):
- """Shifts the cross-section parameters by the class variable vector *shift*."""
-
- for point in self.points:
- point[0] += self.shift[0]
- point[1] += self.shift[1]
-
- for hole in self.holes:
- hole[0] += self.shift[0]
- hole[1] += self.shift[1]
-
- for cp in self.control_points:
- cp[0] += self.shift[0]
- cp[1] += self.shift[1]
-
-[docs] def rotate_section(self, angle, rot_point=None):
- """Rotates the geometry and specified angle about a point. If the rotation point is not
- provided, rotates the section about the first control point in the list of control points
- of the :class:`~sectionproperties.pre.sections.Geometry` object.
-
- :param float angle: Angle (degrees) by which to rotate the section. A positive angle leads
- to a counter-clockwise rotation.
- :param rot_point: Point *(x, y)* about which to rotate the section
- :type rot_point: list[float, float]
-
- The following example rotates a 200UB25 section clockwise by 30 degrees::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.ISection(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=8)
- geometry.rotate_section(angle=-30)
- """
-
- # convert angle to radians
- rot_phi = angle * np.pi / 180
-
- def get_r(pt1, pt2):
- """Returns the distance between two points."""
-
- return ((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2) ** 0.5
-
- def get_phi(pt1, pt2):
- """Returns the angle between two points."""
-
- return np.arctan2(pt1[1] - pt2[1], pt1[0] - pt2[0])
-
- def rotate_point(pt, rot_point, rot_phi):
- """Rotates a point given a rotation point and rotation angle."""
-
- r = get_r(pt, rot_point)
- phi = get_phi(pt, rot_point)
-
- pt[0] = r * np.cos(phi + rot_phi) + rot_point[0]
- pt[1] = r * np.sin(phi + rot_phi) + rot_point[1]
-
- # use the first control point if no rotation point is specified
- if rot_point is None:
- rot_point = self.control_points[0]
-
- # rotate all the points
- for point in self.points:
- rotate_point(point, rot_point, rot_phi)
-
- # rotate all the holes
- for hole in self.holes:
- rotate_point(hole, rot_point, rot_phi)
-
- # rotate all the control points
- for cp in self.control_points:
- rotate_point(cp, rot_point, rot_phi)
-
-[docs] def mirror_section(self, axis='x', mirror_point=None):
- """Mirrors the geometry about a point on either the x or y-axis. If no point is provided,
- mirrors the geometry about the first control point in the list of control points of the
- :class:`~sectionproperties.pre.sections.Geometry` object.
-
- :param string axis: Axis about which to mirror the geometry, *'x'* or *'y'*
- :param mirror_point: Point about which to mirror the geometry *(x, y)*
- :type mirror_point: list[float, float]
-
- The following example mirrors a 200PFC section about the y-axis and the point (0, 0)::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.PfcSection(d=200, b=75, t_f=12, t_w=6, r=12, n_r=8)
- geometry.mirror_section(axis='y', mirror_point=[0, 0])
- """
-
- # use the first control point if no mirror point is specified
- if mirror_point is None:
- mirror_point = self.control_points[0]
-
- # select the axis to mirror
- if axis == 'x':
- i = 1
- elif axis == 'y':
- i = 0
- else:
- raise RuntimeError("Enter a valid axis: 'x' or 'y'")
-
- # mirror all points
- for point in self.points:
- point[i] = 2 * mirror_point[i] - point[i]
-
- # mirror all holes
- for hole in self.holes:
- hole[i] = 2 * mirror_point[i] - hole[i]
-
- # mirror all control points
- for cp in self.control_points:
- cp[i] = 2 * mirror_point[i] - cp[i]
-
-[docs] def add_point(self, point):
- """Adds a point to the geometry and returns the added point id.
-
- :param point: Location of the point
- :type point: list[float, float]
- :return: Point id
- :rtype: int
- """
-
- self.points.append(point)
- return len(self.points) - 1
-
-[docs] def add_facet(self, facet):
- """Adds a facet to the geometry and returns the added facet id.
-
- :param facet: Point indices of the facet
- :type facet: list[float, float]
- :return: Facet id
- :rtype: int
- """
-
- self.facets.append(facet)
- return len(self.facets) - 1
-
-[docs] def add_hole(self, hole):
- """Adds a hole location to the geometry and returns the added hole id.
-
- :param hole: Location of the hole
- :type hole: list[float, float]
- :return: Hole id
- :rtype: int
- """
-
- self.holes.append(hole)
- return len(self.holes) - 1
-
-[docs] def add_control_point(self, control_point):
- """Adds a control point to the geometry and returns the added control
- point id.
-
- :param hole: Location of the control point
- :type hole: list[float, float]
- :return: Control point id
- :rtype: int
- """
-
- self.control_points.append(control_point)
- return len(self.control_points) - 1
-
-[docs] def clean_geometry(self, verbose=False):
- """Peforms a full clean on the geometry.
-
- :param bool verbose: If set to true, information related to the geometry cleaning process
- is printed to the terminal.
-
- .. note:: Cleaning the geometry is always recommended when creating a merged section,
- which may result in overlapping or intersecting facets, or duplicate nodes.
- """
-
- self = pre.GeometryCleaner(self, verbose).clean_geometry()
-
-[docs] def plot_geometry(self, ax=None, pause=True, labels=False, perimeter=False):
- """Plots the geometry defined by the input section. If no axes object is supplied a new
- figure and axis is created.
-
- :param ax: Axes object on which the mesh is plotted
- :type ax: :class:`matplotlib.axes.Axes`
- :param bool pause: If set to true, the figure pauses the script until the window is closed.
- If set to false, the script continues immediately after the window is rendered.
- :param bool labels: If set to true, node and facet labels are displayed
- :param bool perimeter: If set to true, boldens the perimeter of the cross-section
-
- The following example creates a CHS discretised with 64 points, with a diameter of 48 and
- thickness of 3.2, and plots the geometry::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.Chs(d=48, t=3.2, n=64)
- geometry.plot_geometry()
-
- .. figure:: ../images/sections/chs_geometry.png
- :align: center
- :scale: 75 %
-
- Geometry generated by the above example.
- """
-
- # if no axes object is supplied, create and setup the plot
- if ax is None:
- ax_supplied = False
- (fig, ax) = plt.subplots()
- post.setup_plot(ax, pause)
- else:
- ax_supplied = True
-
- for (i, f) in enumerate(self.facets):
- if perimeter:
- if i in self.perimeter:
- linewidth = 3
- else:
- linewidth = 1.5
- else:
- linewidth = 1.5
-
- # plot the points and facets
- if i == 0:
- ax.plot([self.points[f[0]][0], self.points[f[1]][0]],
- [self.points[f[0]][1], self.points[f[1]][1]],
- 'ko-', markersize=2, linewidth=linewidth, label='Points & Facets')
- else:
- ax.plot([self.points[f[0]][0], self.points[f[1]][0]],
- [self.points[f[0]][1], self.points[f[1]][1]],
- 'ko-', markersize=2, linewidth=linewidth)
-
- for (i, h) in enumerate(self.holes):
- # plot the holes
- if i == 0:
- ax.plot(h[0], h[1], 'rx', markerSize=5, label='Holes')
- else:
- ax.plot(h[0], h[1], 'rx', markerSize=5)
-
- for (i, cp) in enumerate(self.control_points):
- # plot the control points
- if i == 0:
- ax.plot(cp[0], cp[1], 'bo', markerSize=5,
- label='Control Points')
- else:
- ax.plot(cp[0], cp[1], 'bo', markerSize=5)
-
- # display the legend
- ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
-
- # display the labels
- if labels:
- # plot node labels
- for (i, pt) in enumerate(self.points):
- ax.annotate(str(i), xy=pt, color='r')
-
- # plot facet labels
- for (i, fct) in enumerate(self.facets):
- pt1 = self.points[fct[0]]
- pt2 = self.points[fct[1]]
- xy = [(pt1[0] + pt2[0]) / 2, (pt1[1] + pt2[1]) / 2]
-
- ax.annotate(str(i), xy=xy, color='b')
-
- # if no axes object is supplied, finish the plot
- if not ax_supplied:
- post.finish_plot(ax, pause, title='Cross-Section Geometry')
-
-[docs] def calculate_extents(self):
- """Calculates the minimum and maximum x and y-values amongst the list of points.
-
- :return: Minimum and maximum x and y-values *(x_min, x_max, y_min, y_max)*
- :rtype: tuple(float, float, float, float)
- """
-
- # loop through all points
- for (i, pt) in enumerate(self.points):
- x = pt[0]
- y = pt[1]
-
- # initialise min, max variables
- if i == 0:
- x_min = x
- x_max = x
- y_min = y
- y_max = y
-
- # update the mins and maxs where necessary
- x_min = min(x_min, x)
- x_max = max(x_max, x)
- y_min = min(y_min, y)
- y_max = max(y_max, y)
-
- return (x_min, x_max, y_min, y_max)
-
-[docs] def draw_radius(self, pt, r, theta, n, anti=True):
- """Adds a quarter radius of points to the points list - centered at point *pt*, with radius
- *r*, starting at angle *theta*, with *n* points. If r = 0, adds pt only.
-
- :param pt: Centre of radius *(x,y)*
- :type pt: list[float, float]
- :param float r: Radius
- :param float theta: Initial angle
- :param int n: Number of points
- :param bool anti: Anticlockwise rotation?
- """
-
- if r == 0:
- self.points.append(pt)
- return
-
- if anti:
- mult = 1
- else:
- mult = -1
-
- # calculate radius of points
- for i in range(n):
- # determine angle
- t = theta + mult * i * 1.0 / max(1, n - 1) * np.pi * 0.5
-
- x = pt[0] + r * np.cos(t)
- y = pt[1] + r * np.sin(t)
- self.points.append([x, y])
-
-[docs] def calculate_facet_length(self, facet):
- """Calculates the length of the facet.
-
- :param facet: Point index pair *(p1, p2)* defining a facet
- :vartype facets: list[int, int]
-
- :return: Facet length
- :rtype: float
- """
-
- # get facet points
- p1 = self.points[facet[0]]
- p2 = self.points[facet[1]]
-
- # calculate distance between two points
- return np.sqrt((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2)
-
-[docs] def calculate_perimeter(self):
- """Calculates the perimeter of the cross-section by summing the length of all facets in the
- ``perimeter`` class variable.
-
- :return: Cross-section perimeter, returns 0 if there is no perimeter defined
- :rtype: float
- """
-
- # check to see if there are any facets in the perimeter variable
- if len(self.perimeter) == 0:
- return 0
-
- # initialise perimeter variable
- perimeter = 0
-
- # loop through all the facets along the perimeter
- for facet_idx in self.perimeter:
- perimeter += self.calculate_facet_length(self.facets[facet_idx])
-
- return perimeter
-
-
-[docs]class CustomSection(Geometry):
- """Constructs a cross-section from a list of points, facets, holes and a user specified control
- point.
-
- :param points: List of points *(x, y)* defining the vertices of the cross-section
- :type points: list[list[float, float]]
- :param facets: List of point index pairs *(p1, p2)* defining the edges of the cross-section
- :type facets: list[list[int, int]]
- :param holes: List of points *(x, y)* defining the locations of holes within the cross-section.
- If there are no holes, provide an empty list [].
- :type holes: list[list[float, float]]
- :param control_points: A list of points *(x, y)* that define different regions of the
- cross-section. A control point is an arbitrary point within a region enclosed by facets.
- :type control_points: list[list[float, float]]
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
- :param perimeter: List of facet indices defining the perimeter of the cross-section
- :vartype perimeter: list[int]
-
- The following example creates a hollow trapezium with a base width of 100, top width of 50,
- height of 50 and a wall thickness of 10. A mesh is generated with a maximum triangular area of
- 2.0::
-
- import sectionproperties.pre.sections as sections
-
- points = [[0, 0], [100, 0], [75, 50], [25, 50], [15, 10], [85, 10], [70, 40], [30, 40]]
- facets = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4]]
- holes = [[50, 25]]
- control_points = [[5, 5]]
- perimeter = [0, 1, 2, 3]
-
- geometry = sections.CustomSection(
- points, facets, holes, control_points, perimeter=perimeter
- )
- mesh = geometry.create_mesh(mesh_sizes=[2.0])
-
- .. figure:: ../images/sections/custom_geometry.png
- :align: center
- :scale: 75 %
-
- Custom section geometry.
-
- .. figure:: ../images/sections/custom_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, points, facets, holes, control_points, shift=[0, 0], perimeter=[]):
- """Inits the CustomSection class."""
-
- super().__init__(control_points, shift)
-
- self.points = points
- self.facets = facets
- self.holes = holes
- self.perimeter = perimeter
-
- self.shift_section()
-
-
-[docs]class RectangularSection(Geometry):
- """Constructs a rectangular section with the bottom left corner at the origin *(0, 0)*, with
- depth *d* and width *b*.
-
- :param float d: Depth (y) of the rectangle
- :param float b: Width (x) of the rectangle
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a rectangular cross-section with a depth of 100 and width of 50,
- and generates a mesh with a maximum triangular area of 5::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.RectangularSection(d=100, b=50)
- mesh = geometry.create_mesh(mesh_sizes=[5])
-
- .. figure:: ../images/sections/rectangle_geometry.png
- :align: center
- :scale: 75 %
-
- Rectangular section geometry.
-
- .. figure:: ../images/sections/rectangle_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, shift=[0, 0]):
- """Inits the RectangularSection class."""
-
- # assign control point
- control_points = [[0.5 * b, 0.5 * d]]
-
- super().__init__(control_points, shift)
-
- # construct the points and facets
- self.points = [[0, 0], [b, 0], [b, d], [0, d]]
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 0]]
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class CircularSection(Geometry):
- """Constructs a solid circle centered at the origin *(0, 0)* with diameter *d* and using *n*
- points to construct the circle.
-
- :param float d: Diameter of the circle
- :param int n: Number of points discretising the circle
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a circular cross-section with a diameter of 50 with 64 points,
- and generates a mesh with a maximum triangular area of 2.5::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.CircularSection(d=50, n=64)
- mesh = geometry.create_mesh(mesh_sizes=[2.5])
-
- .. figure:: ../images/sections/circle_geometry.png
- :align: center
- :scale: 75 %
-
- Circular section geometry.
-
- .. figure:: ../images/sections/circle_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, n, shift=[0, 0]):
- """Inits the CircularSection class."""
-
- # assign control point
- control_points = [[0, 0]]
-
- super().__init__(control_points, shift)
-
- # loop through each point on the circle
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of the point
- x = 0.5 * d * np.cos(theta)
- y = 0.5 * d * np.sin(theta)
-
- # append the current point to the points list
- self.points.append([x, y])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class Chs(Geometry):
- """Constructs a circular hollow section centered at the origin *(0, 0)*, with diameter *d* and
- thickness *t*, using *n* points to construct the inner and outer circles.
-
- :param float d: Outer diameter of the CHS
- :param float t: Thickness of the CHS
- :param int n: Number of points discretising the inner and outer circles
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a CHS discretised with 64 points, with a diameter of 48 and
- thickness of 3.2, and generates a mesh with a maximum triangular area of 1.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.Chs(d=48, t=3.2, n=64)
- mesh = geometry.create_mesh(mesh_sizes=[1.0])
-
- .. figure:: ../images/sections/chs_geometry.png
- :align: center
- :scale: 75 %
-
- CHS geometry.
-
- .. figure:: ../images/sections/chs_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, t, n, shift=[0, 0]):
- """Inits the Chs class."""
-
- # assign control point
- control_points = [[d * 0.5 - t * 0.5, 0]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the CHS
- self.holes = [[0, 0]]
-
- # loop through each point of the CHS
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of outer and inner points
- x_outer = 0.5 * d * np.cos(theta)
- y_outer = 0.5 * d * np.sin(theta)
- x_inner = (0.5 * d - t) * np.cos(theta)
- y_inner = (0.5 * d - t) * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x_outer, y_outer])
- self.points.append([x_inner, y_inner])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i * 2, i * 2 + 2])
- self.facets.append([i * 2 + 1, i * 2 + 3])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i * 2, 0])
- self.facets.append([i * 2 + 1, 1])
-
- self.perimeter = list(range(0, len(self.facets), 2))
-
- self.shift_section()
-
-
-[docs]class EllipticalSection(Geometry):
- """Constructs a solid ellipse centered at the origin *(0, 0)* with vertical diameter *d_y* and
- horizontal diameter *d_x*, using *n* points to construct the ellipse.
-
- :param float d_y: Diameter of the ellipse in the y-dimension
- :param float d_x: Diameter of the ellipse in the x-dimension
- :param int n: Number of points discretising the ellipse
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates an elliptical cross-section with a vertical diameter of 25 and
- horizontal diameter of 50, with 40 points, and generates a mesh with a maximum triangular area
- of 1.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.EllipticalSection(d_y=25, d_x=50, n=40)
- mesh = geometry.create_mesh(mesh_sizes=[1.0])
-
- .. figure:: ../images/sections/ellipse_geometry.png
- :align: center
- :scale: 75 %
-
- Elliptical section geometry.
-
- .. figure:: ../images/sections/ellipse_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d_y, d_x, n, shift=[0, 0]):
- """Inits the EllipticalSection class."""
-
- # assign control point centered at zero
- control_points = [[0, 0]]
-
- super().__init__(control_points, shift)
-
- # loop through each point on the ellipse
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of the point
- x = 0.5 * d_x * np.cos(theta)
- y = 0.5 * d_y * np.sin(theta)
-
- # append the current point to the points list
- self.points.append([x, y])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the ellipse
- else:
- self.facets.append([i, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class Ehs(Geometry):
- """Constructs an elliptical hollow section centered at the origin *(0, 0)*, with outer vertical
- diameter *d_y*, outer horizontal diameter *d_x*, and thickness *t*, using *n* points to
- construct the inner and outer ellipses.
-
- :param float d_y: Diameter of the ellipse in the y-dimension
- :param float d_x: Diameter of the ellipse in the x-dimension
- :param float t: Thickness of the EHS
- :param int n: Number of points discretising the inner and outer ellipses
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a EHS discretised with 30 points, with a outer vertical diameter
- of 25, outer horizontal diameter of 50, and thickness of 2.0, and generates a mesh with a
- maximum triangular area of 0.5::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.Ehs(d_y=25, d_x=50, t=2.0, n=64)
- mesh = geometry.create_mesh(mesh_sizes=[0.5])
-
- .. figure:: ../images/sections/ehs_geometry.png
- :align: center
- :scale: 75 %
-
- EHS geometry.
-
- .. figure:: ../images/sections/ehs_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d_y, d_x, t, n, shift=[0, 0]):
- """Inits the Ehs class."""
-
- # assign control point
- control_points = [[(d_x * 0.5) - (t * 0.5), 0]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the EHS
- self.holes = [[0, 0]]
-
- # loop through each point of the EHS
- for i in range(n):
- # determine polar angle
- theta = i * 2 * np.pi * 1.0 / n
-
- # calculate location of outer and inner points
- x_outer = 0.5 * d_x * np.cos(theta)
- y_outer = 0.5 * d_y * np.sin(theta)
- x_inner = ((0.5 * d_x) - t) * np.cos(theta)
- y_inner = ((0.5 * d_y) - t) * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x_outer, y_outer])
- self.points.append([x_inner, y_inner])
-
- # if we are not at the last point
- if i != n - 1:
- self.facets.append([i * 2, i * 2 + 2])
- self.facets.append([i * 2 + 1, i * 2 + 3])
- # if we are at the last point, complete the circle
- else:
- self.facets.append([i * 2, 0])
- self.facets.append([i * 2 + 1, 1])
-
- self.perimeter = list(range(0, len(self.facets), 2))
-
- self.shift_section()
-
-
-[docs]class Rhs(Geometry):
- """Constructs a rectangular hollow section centered at *(b/2, d/2)*, with depth *d*, width *b*,
- thickness *t* and outer radius *r_out*, using *n_r* points to construct the inner and outer
- radii. If the outer radius is less than the thickness of the RHS, the inner radius is set to
- zero.
-
- :param float d: Depth of the RHS
- :param float b: Width of the RHS
- :param float t: Thickness of the RHS
- :param float r_out: Outer radius of the RHS
- :param int n_r: Number of points discretising the inner and outer radii
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates an RHS with a depth of 100, a width of 50, a thickness of 6 and
- an outer radius of 9, using 8 points to discretise the inner and outer radii. A mesh is
- generated with a maximum triangular area of 2.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.Rhs(d=100, b=50, t=6, r_out=9, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[2.0])
-
- .. figure:: ../images/sections/rhs_geometry.png
- :align: center
- :scale: 75 %
-
- RHS geometry.
-
- .. figure:: ../images/sections/rhs_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t, r_out, n_r, shift=[0, 0]):
- """Inits the Rhs class."""
-
- # assign control point
- control_points = [[b - t * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # specify a hole in the centre of the RHS
- self.holes = [[b * 0.5, d * 0.5]]
-
- # calculate internal radius
- r_in = max(r_out - t, 0)
-
- # construct the outer radius points
- self.draw_radius([r_out, r_out], r_out, np.pi, n_r)
- self.draw_radius([b - r_out, r_out], r_out, 1.5 * np.pi, n_r)
- self.draw_radius([b - r_out, d - r_out], r_out, 0, n_r)
- self.draw_radius([r_out, d - r_out], r_out, 0.5 * np.pi, n_r)
-
- # construct the outer radius facet list
- n_outer = len(self.points)
- for i in range(n_outer):
- # if we are not at the last point
- if i != n_outer - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([i, 0])
-
- # construct the inner radius points
- self.draw_radius([t + r_in, t + r_in], r_in, np.pi, n_r)
- self.draw_radius([b - t - r_in, t + r_in], r_in, 1.5 * np.pi, n_r)
- self.draw_radius([b - t - r_in, d - t - r_in], r_in, 0, n_r)
- self.draw_radius([t + r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r)
-
- # construct the inner radius facet list
- n_inner = len(self.points) - n_outer
- for i in range(n_inner):
- # if we are not at the last point
- if i != n_inner - 1:
- self.facets.append([i + n_outer, i + n_outer + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([i + n_outer, n_outer])
-
- self.perimeter = list(range(int(len(self.facets) / 2)))
-
- self.shift_section()
-
-
-[docs]class ISection(Geometry):
- """Constructs an I-section centered at *(b/2, d/2)*, with depth *d*, width *b*, flange
- thickness *t_f*, web thickness *t_w*, and root radius *r*, using *n_r* points to construct the
- root radius.
-
- :param float d: Depth of the I-section
- :param float b: Width of the I-section
- :param float t_f: Flange thickness of the I-section
- :param float t_w: Web thickness of the I-section
- :param float r: Root radius of the I-section
- :param int n_r: Number of points discretising the root radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates an I-section with a depth of 203, a width of 133, a flange
- thickness of 7.8, a web thickness of 5.8 and a root radius of 8.9, using 16 points to
- discretise the root radius. A mesh is generated with a maximum triangular area of 3.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.ISection(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=16)
- mesh = geometry.create_mesh(mesh_sizes=[3.0])
-
- .. figure:: ../images/sections/isection_geometry.png
- :align: center
- :scale: 75 %
-
- I-section geometry.
-
- .. figure:: ../images/sections/isection_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
- """Inits the ISection class."""
-
- # assign control point
- control_points = [[b * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # add first three points
- self.points.append([0, 0])
- self.points.append([b, 0])
- self.points.append([b, t_f])
-
- # construct the bottom right radius
- pt = [b * 0.5 + t_w * 0.5 + r, t_f + r]
- self.draw_radius(pt, r, 1.5 * np.pi, n_r, False)
-
- # construct the top right radius
- pt = [b * 0.5 + t_w * 0.5 + r, d - t_f - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add the next four points
- self.points.append([b, d - t_f])
- self.points.append([b, d])
- self.points.append([0, d])
- self.points.append([0, d - t_f])
-
- # construct the top left radius
- pt = [b * 0.5 - t_w * 0.5 - r, d - t_f - r]
- self.draw_radius(pt, r, 0.5 * np.pi, n_r, False)
-
- # construct the bottom left radius
- pt = [b * 0.5 - t_w * 0.5 - r, t_f + r]
- self.draw_radius(pt, r, 0, n_r, False)
-
- # add the last point
- self.points.append([0, t_f])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class MonoISection(Geometry):
- """Constructs a monosymmetric I-section centered at *(max(b_t, b_b)/2, d/2)*, with depth *d*,
- top flange width *b_t*, bottom flange width *b_b*, top flange thickness *t_ft*, top flange
- thickness *t_fb*, web thickness *t_w*, and root radius *r*, using *n_r* points to construct the
- root radius.
-
- :param float d: Depth of the I-section
- :param float b_t: Top flange width
- :param float b_b: Bottom flange width
- :param float t_ft: Top flange thickness of the I-section
- :param float t_fb: Bottom flange thickness of the I-section
- :param float t_w: Web thickness of the I-section
- :param float r: Root radius of the I-section
- :param int n_r: Number of points discretising the root radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a monosymmetric I-section with a depth of 200, a top flange width
- of 50, a top flange thickness of 12, a bottom flange width of 130, a bottom flange thickness of
- 8, a web thickness of 6 and a root radius of 8, using 16 points to discretise the root radius.
- A mesh is generated with a maximum triangular area of 3.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.MonoISection(
- d=200, b_t=50, b_b=130, t_ft=12, t_fb=8, t_w=6, r=8, n_r=16
- )
- mesh = geometry.create_mesh(mesh_sizes=[3.0])
-
- .. figure:: ../images/sections/monoisection_geometry.png
- :align: center
- :scale: 75 %
-
- I-section geometry.
-
- .. figure:: ../images/sections/monoisection_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b_t, b_b, t_fb, t_ft, t_w, r, n_r, shift=[0, 0]):
- """Inits the ISection class."""
-
- # assign control point
- control_points = [[max(b_t, b_b) * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate central axis
- x_central = max(b_t, b_b) * 0.5
-
- # add first three points
- self.points.append([x_central - b_b * 0.5, 0])
- self.points.append([x_central + b_b * 0.5, 0])
- self.points.append([x_central + b_b * 0.5, t_fb])
-
- # construct the bottom right radius
- pt = [x_central + t_w * 0.5 + r, t_fb + r]
- self.draw_radius(pt, r, 1.5 * np.pi, n_r, False)
-
- # construct the top right radius
- pt = [x_central + t_w * 0.5 + r, d - t_ft - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add the next four points
- self.points.append([x_central + b_t * 0.5, d - t_ft])
- self.points.append([x_central + b_t * 0.5, d])
- self.points.append([x_central - b_t * 0.5, d])
- self.points.append([x_central - b_t * 0.5, d - t_ft])
-
- # construct the top left radius
- pt = [x_central - t_w * 0.5 - r, d - t_ft - r]
- self.draw_radius(pt, r, 0.5 * np.pi, n_r, False)
-
- # construct the bottom left radius
- pt = [x_central - t_w * 0.5 - r, t_fb + r]
- self.draw_radius(pt, r, 0, n_r, False)
-
- # add the last point
- self.points.append([x_central - b_b * 0.5, t_fb])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class TaperedFlangeISection(Geometry):
- """Constructs a Tapered Flange I-section centered at *(b/2, d/2)*, with depth *d*, width *b*,
- mid-flange thickness *t_f*, web thickness *t_w*, root radius *r_r*, flange radius *r_f* and
- flange angle *alpha*, using *n_r* points to construct the radii.
-
- :param float d: Depth of the Tapered Flange I-section
- :param float b: Width of the Tapered Flange I-section
- :param float t_f: Mid-flange thickness of the Tapered Flange I-section (measured at the point
- equidistant from the face of the web to the edge of the flange)
- :param float t_w: Web thickness of the Tapered Flange I-section
- :param float r_r: Root radius of the Tapered Flange I-section
- :param float r_f: Flange radius of the Tapered Flange I-section
- :param float alpha: Flange angle of the Tapered Flange I-section (degrees)
- :param int n_r: Number of points discretising the radii
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a Tapered Flange I-section with a depth of 588, a width of 191, a
- mid-flange thickness of 27.2, a web thickness of 15.2, a root radius of 17.8, a flange radius
- of 8.9 and a flange angle of 8°, using 16 points to discretise the radii. A mesh is generated
- with a maximum triangular area of 20.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.TaperedFlangeISection(
- d=588, b=191, t_f=27.2, t_w=15.2, r_r=17.8, r_f=8.9, alpha=8, n_r=16
- )
- mesh = geometry.create_mesh(mesh_sizes=[20.0])
-
- .. figure:: ../images/sections/taperedisection_geometry.png
- :align: center
- :scale: 75 %
-
- I-section geometry.
-
- .. figure:: ../images/sections/taperedisection_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t_f, t_w, r_r, r_f, alpha, n_r, shift=[0, 0]):
- """Inits the ISection class."""
-
- # assign control point
- control_points = [[b * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate alpha in radians
- alpha_rad = np.pi * alpha / 180
-
- # calculate the height of the flange toe and dimensions of the straight
- x1 = b * 0.25 - t_w * 0.25 - r_f * (1 - np.sin(alpha_rad))
- y1 = x1 * np.tan(alpha_rad)
- x2 = b * 0.25 - t_w * 0.25 - r_r * (1 - np.sin(alpha_rad))
- y2 = x2 * np.tan(alpha_rad)
- y_t = t_f - y1 - r_f * np.cos(alpha_rad)
-
- # add first two points
- self.points.append([0, 0])
- self.points.append([b, 0])
-
- # construct the bottom right flange toe radius
- if r_f == 0:
- self.points.append([b, y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad)
-
- # calculate the locations of the radius points
- x = b - r_f + r_f * np.cos(theta)
- y = y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the bottom right root radius
- if r_r == 0:
- self.points.append([b * 0.5 + t_w * 0.5, t_f + y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- 3.0 / 2 * np.pi - alpha_rad) - (i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad)
- )
-
- # calculate the locations of the radius points
- x = b * 0.5 + t_w * 0.5 + r_r + r_r * np.cos(theta)
- y = t_f + y2 + r_r * np.cos(alpha_rad) + r_r * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the top right root radius
- if r_r == 0:
- self.points.append([b * 0.5 + t_w * 0.5, d - t_f - y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = np.pi - i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad)
-
- # calculate the locations of the radius points
- x = b * 0.5 + t_w * 0.5 + r_r + r_r * np.cos(theta)
- y = d - t_f - y2 - r_r * np.cos(alpha_rad) + r_r * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the top right flange toe radius
- if r_f == 0:
- self.points.append([b, d - y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- 3.0 * np.pi / 2 + alpha_rad) + i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad
- )
-
- # calculate the locations of the radius points
- x = b - r_f + r_f * np.cos(theta)
- y = d - y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # add the next two points
- self.points.append([b, d])
- self.points.append([0, d])
-
- # construct the top left flange toe radius
- if r_f == 0:
- self.points.append([0, d - y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = np.pi + (i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad))
-
- # calculate the locations of the radius points
- x = r_f + r_f * np.cos(theta)
- y = d - y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the top left root radius
- if r_r == 0:
- self.points.append([b * 0.5 - t_w * 0.5, d - t_f - y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- np.pi * 0.5 - alpha_rad) - (i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad)
- )
-
- # calculate the locations of the radius points
- x = b * 0.5 - t_w * 0.5 - r_r + r_r * np.cos(theta)
- y = d - t_f - y2 - r_r * np.cos(alpha_rad) + r_r * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the bottom left root radius
- if r_r == 0:
- self.points.append([b * 0.5 - t_w * 0.5, t_f + y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = -i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad)
-
- # calculate the locations of the radius points
- x = b * 0.5 - t_w * 0.5 - r_r + r_r * np.cos(theta)
- y = t_f + y2 + r_r * np.cos(alpha_rad) + r_r * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the bottom left flange toe radius
- if r_f == 0:
- self.points.append([0, y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- np.pi * 0.5 + alpha_rad) + (i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad)
- )
-
- # calculate the locations of the radius points
- x = r_f + r_f * np.cos(theta)
- y = y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class PfcSection(Geometry):
- """Constructs a PFC section with the bottom left corner at the origin *(0, 0)*, with depth *d*,
- width *b*, flange thickness *t_f*, web thickness *t_w* and root radius *r*, using *n_r* points
- to construct the root radius.
-
- :param float d: Depth of the PFC section
- :param float b: Width of the PFC section
- :param float t_f: Flange thickness of the PFC section
- :param float t_w: Web thickness of the PFC section
- :param float r: Root radius of the PFC section
- :param int n_r: Number of points discretising the root radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a PFC section with a depth of 250, a width of 90, a flange
- thickness of 15, a web thickness of 8 and a root radius of 12, using 8 points to discretise the
- root radius. A mesh is generated with a maximum triangular area of 5.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.PfcSection(d=250, b=90, t_f=15, t_w=8, r=12, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[5.0])
-
- .. figure:: ../images/sections/pfc_geometry.png
- :align: center
- :scale: 75 %
-
- PFC geometry.
-
- .. figure:: ../images/sections/pfc_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
- """Inits the PfcSection class."""
-
- # assign control point
- control_points = [[t_w * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # add first three points
- self.points.append([0, 0])
- self.points.append([b, 0])
- self.points.append([b, t_f])
-
- # construct the bottom right radius
- pt = [t_w + r, t_f + r]
- self.draw_radius(pt, r, 1.5 * np.pi, n_r, False)
-
- # construct the top right radius
- pt = [t_w + r, d - t_f - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add last three points
- self.points.append([b, d - t_f])
- self.points.append([b, d])
- self.points.append([0, d])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class TaperedFlangeChannel(Geometry):
- """Constructs a Tapered Flange Channel section with the bottom left corner at the origin
- *(0, 0)*, with depth *d*, width *b*, mid-flange thickness *t_f*, web thickness *t_w*, root
- radius *r_r*, flange radius *r_f* and flange angle *alpha*, using *n_r* points to construct the
- radii.
-
- :param float d: Depth of the Tapered Flange Channel section
- :param float b: Width of the Tapered Flange Channel section
- :param float t_f: Mid-flange thickness of the Tapered Flange Channel section (measured at the
- point equidistant from the face of the web to the edge of the flange)
- :param float t_w: Web thickness of the Tapered Flange Channel section
- :param float r_r: Root radius of the Tapered Flange Channel section
- :param float r_f: Flange radius of the Tapered Flange Channel section
- :param float alpha: Flange angle of the Tapered Flange Channel section (degrees)
- :param int n_r: Number of points discretising the radii
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a Tapered Flange Channel section with a depth of 10, a width of
- 3.5, a mid-flange thickness of 0.575, a web thickness of 0.475, a root radius of 0.575, a
- flange radius of 0.4 and a flange angle of 8°, using 16 points to discretise the radii. A mesh
- is generated with a maximum triangular area of 0.02::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.TaperedFlangeChannel(
- d=10, b=3.5, t_f=0.575, t_w=0.475, r_r=0.575, r_f=0.4, alpha=8, n_r=16
- )
- mesh = geometry.create_mesh(mesh_sizes=[0.02])
-
- .. figure:: ../images/sections/taperedchannel_geometry.png
- :align: center
- :scale: 75 %
-
- I-section geometry.
-
- .. figure:: ../images/sections/taperedchannel_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t_f, t_w, r_r, r_f, alpha, n_r, shift=[0, 0]):
- """Inits the ISection class."""
-
- # assign control point
- control_points = [[t_w * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate alpha in radians
- alpha_rad = np.pi * alpha / 180
-
- # calculate the height of the flange toe and dimensions of the straight
- x1 = b * 0.5 - t_w * 0.5 - r_f * (1 - np.sin(alpha_rad))
- y1 = x1 * np.tan(alpha_rad)
- x2 = b * 0.5 - t_w * 0.5 - r_r * (1 - np.sin(alpha_rad))
- y2 = x2 * np.tan(alpha_rad)
- y_t = t_f - y1 - r_f * np.cos(alpha_rad)
-
- # add first two points
- self.points.append([0, 0])
- self.points.append([b, 0])
-
- # construct the bottom right flange toe radius
- if r_f == 0:
- self.points.append([b, y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad)
-
- # calculate the locations of the radius points
- x = b - r_f + r_f * np.cos(theta)
- y = y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the bottom right root radius
- if r_r == 0:
- self.points.append([t_w, t_f + y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- 3.0 / 2 * np.pi - alpha_rad) - (i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad)
- )
-
- # calculate the locations of the radius points
- x = t_w + r_r + r_r * np.cos(theta)
- y = t_f + y2 + r_r * np.cos(alpha_rad) + r_r * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the top right root radius
- if r_r == 0:
- self.points.append([t_w, d - t_f - y2])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = np.pi - i * 1.0 / max(1, n_r - 1) * (np.pi * 0.5 - alpha_rad)
-
- # calculate the locations of the radius points
- x = t_w + r_r + r_r * np.cos(theta)
- y = d - t_f - y2 - r_r * np.cos(alpha_rad) + r_r * np.sin(
- theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # construct the top right flange toe radius
- if r_f == 0:
- self.points.append([b, d - y_t])
- else:
- for i in range(n_r):
- # determine polar angle
- theta = (
- 3.0 * np.pi / 2 + alpha_rad) + (i * 1.0 / max(1, n_r - 1) * (
- np.pi * 0.5 - alpha_rad)
- )
-
- # calculate the locations of the radius points
- x = b - r_f + r_f * np.cos(theta)
- y = d - y_t + r_f * np.sin(theta)
-
- # append the current points to the points list
- self.points.append([x, y])
-
- # add the final two points
- self.points.append([b, d])
- self.points.append([0, d])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class TeeSection(Geometry):
- """Constructs a Tee section with the top left corner at *(0, d)*, with depth *d*, width *b*,
- flange thickness *t_f*, web thickness *t_w* and root radius *r*, using *n_r* points to
- construct the root radius.
-
- :param float d: Depth of the Tee section
- :param float b: Width of the Tee section
- :param float t_f: Flange thickness of the Tee section
- :param float t_w: Web thickness of the Tee section
- :param float r: Root radius of the Tee section
- :param int n_r: Number of points discretising the root radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a Tee section with a depth of 200, a width of 100, a flange
- thickness of 12, a web thickness of 6 and a root radius of 8, using 8 points to discretise the
- root radius. A mesh is generated with a maximum triangular area of 3.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.TeeSection(d=200, b=100, t_f=12, t_w=6, r=8, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[3.0])
-
- .. figure:: ../images/sections/tee_geometry.png
- :align: center
- :scale: 75 %
-
- Tee section geometry.
-
- .. figure:: ../images/sections/tee_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
- """Inits the TeeSection class."""
-
- # assign control point
- control_points = [[b * 0.5, d - t_f * 0.5]]
-
- super().__init__(control_points, shift)
-
- # add first two points
- self.points.append([b * 0.5 - t_w * 0.5, 0])
- self.points.append([b * 0.5 + t_w * 0.5, 0])
-
- # construct the top right radius
- pt = [b * 0.5 + t_w * 0.5 + r, d - t_f - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add next four points
- self.points.append([b, d - t_f])
- self.points.append([b, d])
- self.points.append([0, d])
- self.points.append([0, d - t_f])
-
- # construct the top left radius
- pt = [b * 0.5 - t_w * 0.5 - r, d - t_f - r]
- self.draw_radius(pt, r, 0.5 * np.pi, n_r, False)
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class AngleSection(Geometry):
- """Constructs an angle section with the bottom left corner at the origin *(0, 0)*, with depth
- *d*, width *b*, thickness *t*, root radius *r_r* and toe radius *r_t*, using *n_r* points to
- construct the radii.
-
- :param float d: Depth of the angle section
- :param float b: Width of the angle section
- :param float t: Thickness of the angle section
- :param float r_r: Root radius of the angle section
- :param float r_t: Toe radius of the angle section
- :param int n_r: Number of points discretising the radii
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates an angle section with a depth of 150, a width of 100, a thickness
- of 8, a root radius of 12 and a toe radius of 5, using 16 points to discretise the radii. A
- mesh is generated with a maximum triangular area of 2.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.AngleSection(d=150, b=100, t=8, r_r=12, r_t=5, n_r=16)
- mesh = geometry.create_mesh(mesh_sizes=[2.0])
-
- .. figure:: ../images/sections/angle_geometry.png
- :align: center
- :scale: 75 %
-
- Angle section geometry.
-
- .. figure:: ../images/sections/angle_mesh.png
- :align: center
- :scale: 75 %
- """
-
- def __init__(self, d, b, t, r_r, r_t, n_r, shift=[0, 0]):
- """Inits the AngleSection class."""
-
- # assign control point
- control_points = [[t * 0.5, t * 0.5]]
-
- super().__init__(control_points, shift)
-
- # add first two points
- self.points.append([0, 0])
- self.points.append([b, 0])
-
- # construct the bottom toe radius
- pt = [b - r_t, t - r_t]
- self.draw_radius(pt, r_t, 0, n_r)
-
- # construct the root radius
- pt = [t + r_r, t + r_r]
- self.draw_radius(pt, r_r, 1.5 * np.pi, n_r, False)
-
- # construct the top toe radius
- pt = [t - r_t, d - r_t]
- self.draw_radius(pt, r_t, 0, n_r)
-
- # add the next point
- self.points.append([0, d])
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class CeeSection(Geometry):
- """Constructs a Cee section with the bottom left corner at the origin *(0, 0)*, with depth *d*,
- width *b*, lip *l*, thickness *t* and outer radius *r_out*, using *n_r* points to construct the
- radius. If the outer radius is less than the thickness of the Cee Section, the inner radius is
- set to zero.
-
- :param float d: Depth of the Cee section
- :param float b: Width of the Cee section
- :param float l: Lip of the Cee section
- :param float t: Thickness of the Cee section
- :param float r_out: Outer radius of the Cee section
- :param int n_r: Number of points discretising the outer radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
- :raises Exception: Lip length must be greater than the outer radius
-
- The following example creates a Cee section with a depth of 125, a width of 50, a lip of 30, a
- thickness of 1.5 and an outer radius of 6, using 8 points to discretise the radius. A mesh is
- generated with a maximum triangular area of 0.25::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.CeeSection(d=125, b=50, l=30, t=1.5, r_out=6, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[0.25])
-
- .. figure:: ../images/sections/cee_geometry.png
- :align: center
- :scale: 75 %
-
- Cee section geometry.
-
- .. figure:: ../images/sections/cee_mesh.png
- :align: center
- :scale: 75 %
- """
-
- def __init__(self, d, b, l, t, r_out, n_r, shift=[0, 0]):
- """Inits the CeeSection class."""
-
- # ensure the lip length is greater than the outer radius
- if l < r_out:
- raise Exception('Lip length must be greater than the outer radius')
-
- # assign control point
- control_points = [[t * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate internal radius
- r_in = max(r_out - t, 0)
-
- # construct the outer bottom left radius
- self.draw_radius([r_out, r_out], r_out, np.pi, n_r)
-
- # construct the outer bottom right radius
- self.draw_radius([b - r_out, r_out], r_out, 1.5 * np.pi, n_r)
-
- if r_out != l:
- # add next two points
- self.points.append([b, l])
- self.points.append([b - t, l])
-
- # construct the inner bottom right radius
- self.draw_radius([b - t - r_in, t + r_in], r_in, 0, n_r, False)
-
- # construct the inner bottom left radius
- self.draw_radius([t + r_in, t + r_in], r_in, 1.5 * np.pi, n_r, False)
-
- # construct the inner top left radius
- self.draw_radius([t + r_in, d - t - r_in], r_in, np.pi, n_r, False)
-
- # construct the inner top right radius
- self.draw_radius(
- [b - t - r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r, False)
-
- if r_out != l:
- # add next two points
- self.points.append([b - t, d - l])
- self.points.append([b, d - l])
-
- # construct the outer top right radius
- self.draw_radius([b - r_out, d - r_out], r_out, 0, n_r)
-
- # construct the outer top left radius
- self.draw_radius([r_out, d - r_out], r_out, 0.5 * np.pi, n_r)
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class ZedSection(Geometry):
- """Constructs a Zed section with the bottom left corner at the origin *(0, 0)*, with depth *d*,
- left flange width *b_l*, right flange width *b_r*, lip *l*, thickness *t* and outer radius
- *r_out*, using *n_r* points to construct the radius. If the outer radius is less than the
- thickness of the Zed Section, the inner radius is set to zero.
-
- :param float d: Depth of the Zed section
- :param float b_l: Left flange width of the Zed section
- :param float b_r: Right flange width of the Zed section
- :param float l: Lip of the Zed section
- :param float t: Thickness of the Zed section
- :param float r_out: Outer radius of the Zed section
- :param int n_r: Number of points discretising the outer radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
- :raises Exception: Lip length must be greater than the outer radius
-
- The following example creates a Zed section with a depth of 100, a left flange width of 40, a
- right flange width of 50, a lip of 20, a thickness of 1.2 and an outer radius of 5, using 8
- points to discretise the radius. A mesh is generated with a maximum triangular area of 0.15::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.ZedSection(d=100, b_l=40, b_r=50, l=20, t=1.2, r_out=5, n_r=8)
- mesh = geometry.create_mesh(mesh_sizes=[0.15])
-
- .. figure:: ../images/sections/zed_geometry.png
- :align: center
- :scale: 75 %
-
- Zed section geometry.
-
- .. figure:: ../images/sections/zed_mesh.png
- :align: center
- :scale: 75 %
- """
-
- def __init__(self, d, b_l, b_r, l, t, r_out, n_r, shift=[0, 0]):
- """Inits the ZedSection class."""
-
- # ensure the lip length is greater than the outer radius
- if l < r_out:
- raise Exception('Lip length must be greater than the outer radius')
-
- # assign control point
- control_points = [[t * 0.5, d * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate internal radius
- r_in = max(r_out - t, 0)
-
- # construct the outer bottom left radius
- self.draw_radius([r_out, r_out], r_out, np.pi, n_r)
-
- # construct the outer bottom right radius
- self.draw_radius([b_r - r_out, r_out], r_out, 1.5 * np.pi, n_r)
-
- if r_out != l:
- # add next two points
- self.points.append([b_r, l])
- self.points.append([b_r - t, l])
-
- # construct the inner bottom right radius
- self.draw_radius([b_r - t - r_in, t + r_in], r_in, 0, n_r, False)
-
- # construct the inner bottom left radius
- self.draw_radius([t + r_in, t + r_in], r_in, 1.5 * np.pi, n_r, False)
-
- # construct the outer top right radius
- self.draw_radius([t - r_out, d - r_out], r_out, 0, n_r)
-
- # construct the outer top left radius
- self.draw_radius([t - b_l + r_out, d - r_out], r_out, 0.5 * np.pi, n_r)
-
- if r_out != l:
- # add the next two points
- self.points.append([t - b_l, d - l])
- self.points.append([t - b_l + t, d - l])
-
- # construct the inner top left radius
- self.draw_radius([2 * t - b_l + r_in, d - t - r_in], r_in, np.pi, n_r, False)
-
- # construct the inner top right radius
- self.draw_radius([-r_in, d - t - r_in], r_in, 0.5 * np.pi, n_r, False)
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class CruciformSection(Geometry):
- """Constructs a cruciform section centered at the origin *(0, 0)*, with depth *d*, width *b*,
- thickness *t* and root radius *r*, using *n_r* points to construct the root radius.
-
- :param float d: Depth of the cruciform section
- :param float b: Width of the cruciform section
- :param float t: Thickness of the cruciform section
- :param float r: Root radius of the cruciform section
- :param int n_r: Number of points discretising the root radius
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a cruciform section with a depth of 250, a width of 175, a
- thickness of 12 and a root radius of 16, using 16 points to discretise the radius. A mesh is
- generated with a maximum triangular area of 5.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.CruciformSection(d=250, b=175, t=12, r=16, n_r=16)
- mesh = geometry.create_mesh(mesh_sizes=[5.0])
-
- .. figure:: ../images/sections/cruciform_geometry.png
- :align: center
- :scale: 75 %
-
- Cruciform section geometry.
-
- .. figure:: ../images/sections/cruciform_mesh.png
- :align: center
- :scale: 75 %
- """
-
- def __init__(self, d, b, t, r, n_r, shift=[0, 0]):
- """Inits the CruciformSection class."""
-
- # assign control point
- control_points = [[0, 0]]
-
- super().__init__(control_points, shift)
-
- # add first two points
- self.points.append([-t * 0.5, -d * 0.5])
- self.points.append([t * 0.5, -d * 0.5])
-
- # construct the bottom right radius
- pt = [0.5 * t + r, -0.5 * t - r]
- self.draw_radius(pt, r, np.pi, n_r, False)
-
- # add the next two points
- self.points.append([0.5 * b, -t * 0.5])
- self.points.append([0.5 * b, t * 0.5])
-
- # construct the top right radius
- pt = [0.5 * t + r, 0.5 * t + r]
- self.draw_radius(pt, r, 1.5 * np.pi, n_r, False)
-
- # add the next two points
- self.points.append([t * 0.5, 0.5 * d])
- self.points.append([-t * 0.5, 0.5 * d])
-
- # construct the top left radius
- pt = [-0.5 * t - r, 0.5 * t + r]
- self.draw_radius(pt, r, 0, n_r, False)
-
- # add the next two points
- self.points.append([-0.5 * b, t * 0.5])
- self.points.append([-0.5 * b, -t * 0.5])
-
- # construct the bottom left radius
- pt = [-0.5 * t - r, -0.5 * t - r]
- self.draw_radius(pt, r, 0.5 * np.pi, n_r, False)
-
- # build the facet list
- for i in range(len(self.points)):
- # if we are not at the last point
- if i != len(self.points) - 1:
- self.facets.append([i, i + 1])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([len(self.points) - 1, 0])
-
- self.perimeter = list(range(len(self.facets)))
-
- self.shift_section()
-
-
-[docs]class PolygonSection(Geometry):
- """Constructs a regular hollow polygon section centered at *(0, 0)*, with a pitch circle
- diameter of bounding polygon *d*, thickness *t*, number of sides *n_sides* and an optional
- inner radius *r_in*, using *n_r* points to construct the inner and outer radii (if radii is
- specified).
-
- :param float d: Pitch circle diameter of the outer bounding polygon (i.e. diameter of circle
- that passes through all vertices of the outer polygon)
- :param float t: Thickness of the polygon section wall
- :param float r_in: Inner radius of the polygon corners. By default, if not specified, a polygon
- with no corner radii is generated.
- :param int n_r: Number of points discretising the inner and outer radii, ignored if no inner
- radii is specified
- :param rot: Initial counterclockwise rotation in degrees. By default bottom face is aligned
- with x axis.
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
- :raises Exception: Number of sides in polygon must be greater than or equal to 3
-
- The following example creates an Octagonal section (8 sides) with a diameter of 200, a
- thickness of 6 and an inner radius of 20, using 12 points to discretise the inner and outer
- radii. A mesh is generated with a maximum triangular area of 5::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.PolygonSection(d=200, t=6, n_sides=8, r_in=20, n_r=12)
- mesh = geometry.create_mesh(mesh_sizes=[5])
-
- .. figure:: ../images/sections/polygon_geometry.png
- :align: center
- :scale: 75 %
-
- Octagonal section geometry.
-
- .. figure:: ../images/sections/polygon_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, t, n_sides, r_in=0, n_r=1, rot=0, shift=[0, 0]):
- """Inits the PolygonSection class."""
-
- if n_sides < 3:
- msg = 'n_sides required to be greater than 3 for PolygonSection class'
- raise Exception(msg)
-
- # initial rotation
- rot = rot * np.pi / 180 # radians
-
- # determine triangular segment angle
- alpha = 2 * np.pi / n_sides # radians
-
- # determine distance from origin to point perpendicular on face of side
- a_out = d / 2 * np.cos(alpha / 2)
- a_in = a_out - t
-
- # determine side length for outer & inner faces neglecting radii
- side_length_out = d * np.sin(alpha / 2)
- side_length_in = a_in / a_out * side_length_out
-
- # check limit on internal radii, if exceeded then radii merge to circle
- if r_in > a_in:
- r_in = a_in
- circle = True
- else:
- circle = False
-
- # calculate external radius, if r_in is zero, r_out also is zero
- if r_in == 0:
- r_out = 0
- n_r = 1
- else:
- r_out = r_in + t
-
- # equivalent side length of half the corner radii triangular segment
- c_out = r_out * (side_length_out / 2) / a_out
- c_in = r_in * (side_length_in / 2) / a_in
-
- # determine straight side length between corner radii (if present)
- side_length_straight_out = side_length_out - (2 * c_out)
- side_length_straight_in = side_length_in - (2 * c_in)
-
- # assign control point central on bottom side length & rotate to initial rotation specified
- control_points = [self.rotate([0, -a_out + t / 2], rot)]
-
- super().__init__(control_points, shift)
-
- # temp list for repeating geometry
- base_points = []
-
- # specify a hole in the centre of the Polygon section
- self.holes = [[0, 0]]
-
- # start at bottom face, constructing one corner radii, then rotate by initial rotation +
- # alpha and repeat for n_side number of times to form full section perimeter
-
- # construct the first radius (bottom right)
- for i in range(n_r):
- # determine polar angle
- theta = 1 / 2 * np.pi + i * 1.0 / max(1, n_r - 1) * alpha
-
- # calculate location of inner and outer points
- x_outer = side_length_straight_out / 2 - r_out * np.cos(theta)
- y_outer = -a_out + r_out - r_out * np.sin(theta)
- x_inner = side_length_straight_in / 2 - r_in * np.cos(theta)
- y_inner = -a_in + r_in - r_in * np.sin(theta)
-
- # append the current temporary points to the temporary points list
- base_points.append([x_outer, y_outer])
- base_points.append([x_inner, y_inner])
-
- # if radii merged to circle with an outer diameter of a_out then skip last point as causes
- # overlapping end points which causes meshing issues if geometry is not cleaned by user
- if circle:
- base_points = base_points[0:-2]
-
- # iterate and add subsequent corner radii one point at a time for each side
- for i in range(n_sides):
- for point in base_points:
- point_new = self.rotate(point, alpha * i + rot)
- self.points.append(point_new)
-
- # build the facet list
- num_points = int(len(self.points) / 2)
- for i in range(num_points):
- # if we are not at the last point
- if i != num_points - 1:
- self.facets.append([i * 2, i * 2 + 2])
- self.facets.append([i * 2 + 1, i * 2 + 3])
- # if we are at the last point, complete the loop
- else:
- self.facets.append([i * 2, 0])
- self.facets.append([i * 2 + 1, 1])
-
- self.perimeter = list(range(0, len(self.facets), 2))
-
- self.shift_section()
-
- def rotate(self, point, angle):
- """
- Rotate a point counterclockwise by a given angle around origin [0, 0]
-
- :param list point: Point coordinates to be rotated
- :param float angle: Angle to rotate point coordinates
- :return: Coordinates of rotated point
- :rtype: list[float, float]
- """
-
- pt_x, pt_y = point
-
- c = np.cos(angle)
- s = np.sin(angle)
-
- new_x = c * pt_x - s * pt_y
- new_y = s * pt_x + c * pt_y
-
- return [new_x, new_y]
-
-
-[docs]class BoxGirderSection(Geometry):
- """Constructs a Box Girder section centered at at *(max(b_t, b_b)/2, d/2)*, with depth *d*, top
- width *b_t*, bottom width *b_b*, top flange thickness *t_ft*, bottom flange thickness *t_fb*
- and web thickness *t_w*.
-
- :param float d: Depth of the Box Girder section
- :param float b_t: Top width of the Box Girder section
- :param float b_b: Bottom width of the Box Girder section
- :param float t_ft: Top lange thickness of the Box Girder section
- :param float t_fb: Bottom flange thickness of the Box Girder section
- :param float t_w: Web thickness of the Box Girder section
- :param shift: Vector that shifts the cross-section by *(x, y)*
- :type shift: list[float, float]
-
- The following example creates a Box Gider section with a depth of 1200, a top width of 1200, a
- bottom width of 400, a top flange thickness of 16, a bottom flange thickness of 12 and a web
- thickness of 8. A mesh is generated with a maximum triangular area of 5.0::
-
- import sectionproperties.pre.sections as sections
-
- geometry = sections.BoxGirderSection(d=1200, b_t=1200, b_b=400, t_ft=100, t_fb=80, t_w=50)
- mesh = geometry.create_mesh(mesh_sizes=[200.0])
-
- .. figure:: ../images/sections/box_girder_geometry.png
- :align: center
- :scale: 75 %
-
- Box Girder geometry.
-
- .. figure:: ../images/sections/box_girder_mesh.png
- :align: center
- :scale: 75 %
-
- Mesh generated from the above geometry.
- """
-
- def __init__(self, d, b_t, b_b, t_ft, t_fb, t_w, shift=[0, 0]):
- """Inits the BoxGirderSection class."""
-
- # assign control point
- control_points = [[max(b_t, b_b) * 0.5, t_fb * 0.5]]
-
- super().__init__(control_points, shift)
-
- # calculate central axis
- x_c = max(b_t, b_b) * 0.5
-
- # specify a hole in the centre of the Box Girder
- self.holes = [[x_c, d * 0.5]]
-
- # determine side wall angle
- if b_t < b_b:
- phi_b = np.arctan2(d, 0.5 * (b_b - b_t))
- phi_t = np.pi - phi_b
- else:
- phi_t = np.arctan2(d, 0.5 * (b_t - b_b))
- phi_b = np.pi - phi_t
-
- # determine inner wall x-offsets
- x_bot = t_fb / np.tan(np.pi - phi_b)
- x_top = t_ft / np.tan(np.pi - phi_t)
- web_x = abs(t_w / np.sin(np.pi - phi_b))
-
- # add outer points
- self.points.append([x_c - 0.5 * b_b, 0])
- self.points.append([x_c + 0.5 * b_b, 0])
- self.points.append([x_c + 0.5 * b_t, d])
- self.points.append([x_c - 0.5 * b_t, d])
-
- # add inner points
- self.points.append([x_c - 0.5 * b_b - x_bot + web_x, t_fb])
- self.points.append([x_c + 0.5 * b_b + x_bot - web_x, t_fb])
- self.points.append([x_c + 0.5 * b_t + x_top - web_x, d - t_ft])
- self.points.append([x_c - 0.5 * b_t - x_top + web_x, d - t_ft])
-
- # build facet list
- self.facets = [[0, 1], [1, 2], [2, 3], [3, 0], [4, 5], [5, 6], [6, 7], [7, 4]]
- self.perimeter = [0, 1, 2, 3]
-
- self.shift_section()
-
-
-[docs]class MergedSection(Geometry):
- """Merges a number of section geometries into one geometry. Note that for the meshing algorithm
- to work, there needs to be connectivity between all regions of the provided geometries.
- Overlapping of geometries is permitted.
-
- :param sections: A list of geometry objects to merge into one
- :class:`~sectionproperties.pre.sections.Geometry` object
- :type sections: list[:class:`~sectionproperties.pre.sections.Geometry`]
-
- The following example creates a combined cross-section with a 150x100x6 RHS placed on its side
- on top of a 200UB25.4. A mesh is generated with a maximum triangle size of 5.0 for the
- I-section and 2.5 for the RHS::
-
- import sectionproperties.pre.sections as sections
-
- isection = sections.ISection(d=203, b=133, t_f=7.8, t_w=5.8, r=8.9, n_r=8)
- box = sections.Rhs(d=100, b=150, t=6, r_out=15, n_r=8, shift=[-8.5, 203])
-
- geometry = sections.MergedSection([isection, box])
- geometry.clean_geometry()
- mesh = geometry.create_mesh(mesh_sizes=[5.0, 2.5])
-
- .. figure:: ../images/sections/merged_geometry.png
- :align: center
- :scale: 75 %
-
- Merged section geometry.
-
- .. figure:: ../images/sections/merged_mesh.png
- :align: center
- :scale: 75 %
- """
-
- def __init__(self, sections):
- """Inits the MergedSection class."""
-
- super().__init__([], [0, 0])
-
- point_count = 0
-
- # loop through all sections
- for section in sections:
- # add facets
- for facet in section.facets:
- self.facets.append([facet[0] + point_count, facet[1] + point_count])
-
- # add points and count points
- for point in section.points:
- self.points.append([point[0], point[1]])
- point_count += 1
-
- # add holes
- for hole in section.holes:
- self.holes.append([hole[0], hole[1]])
-
- # add control points
- for control_point in section.control_points:
- self.control_points.append([control_point[0], control_point[1]])
-' + _('Hide Search Matches') + '
') - .appendTo($('#searchbox')); - } - }, - - /** - * init the domain index toggle buttons - */ - initIndexTable : function() { - var togglers = $('img.toggler').click(function() { - var src = $(this).attr('src'); - var idnum = $(this).attr('id').substr(7); - $('tr.cg-' + idnum).toggle(); - if (src.substr(-9) === 'minus.png') - $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); - else - $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); - }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { - togglers.click(); - } - }, - - /** - * helper function to hide the search marks again - */ - hideSearchWords : function() { - $('#searchbox .highlight-link').fadeOut(300); - $('span.highlighted').removeClass('highlighted'); - }, - - /** - * make the url absolute - */ - makeURL : function(relativeURL) { - return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; - }, - - /** - * get the current relative url - */ - getCurrentURL : function() { - var path = document.location.pathname; - var parts = path.split(/\//); - $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { - if (this === '..') - parts.pop(); - }); - var url = parts.join('/'); - return path.substring(url.lastIndexOf('/') + 1, path.length - 1); - }, - - initOnKeyListeners: function() { - $(document).keydown(function(event) { - var activeElementType = document.activeElement.tagName; - // don't navigate when in search box or textarea - if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT' - && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { - switch (event.keyCode) { - case 37: // left - var prevHref = $('link[rel="prev"]').prop('href'); - if (prevHref) { - window.location.href = prevHref; - return false; - } - case 39: // right - var nextHref = $('link[rel="next"]').prop('href'); - if (nextHref) { - window.location.href = nextHref; - return false; - } - } - } - }); - } -}; - -// quick alias for translations -_ = Documentation.gettext; - -$(document).ready(function() { - Documentation.init(); -}); diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js deleted file mode 100644 index 285a1ecc..00000000 --- a/docs/build/html/_static/documentation_options.js +++ /dev/null @@ -1,12 +0,0 @@ -var DOCUMENTATION_OPTIONS = { - URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '1.0.6', - LANGUAGE: 'en', - COLLAPSE_INDEX: false, - BUILDER: 'html', - FILE_SUFFIX: '.html', - LINK_SUFFIX: '.html', - HAS_SOURCE: true, - SOURCELINK_SUFFIX: '.txt', - NAVIGATION_WITH_KEYS: false -}; \ No newline at end of file diff --git a/docs/build/html/_static/file.png b/docs/build/html/_static/file.png deleted file mode 100644 index a858a410..00000000 Binary files a/docs/build/html/_static/file.png and /dev/null differ diff --git a/docs/build/html/_static/fonts/Inconsolata-Bold.ttf b/docs/build/html/_static/fonts/Inconsolata-Bold.ttf deleted file mode 100644 index 809c1f58..00000000 Binary files a/docs/build/html/_static/fonts/Inconsolata-Bold.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Inconsolata-Regular.ttf b/docs/build/html/_static/fonts/Inconsolata-Regular.ttf deleted file mode 100644 index fc981ce7..00000000 Binary files a/docs/build/html/_static/fonts/Inconsolata-Regular.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Inconsolata.ttf b/docs/build/html/_static/fonts/Inconsolata.ttf deleted file mode 100644 index 4b8a36d2..00000000 Binary files a/docs/build/html/_static/fonts/Inconsolata.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato-Bold.ttf b/docs/build/html/_static/fonts/Lato-Bold.ttf deleted file mode 100644 index 1d23c706..00000000 Binary files a/docs/build/html/_static/fonts/Lato-Bold.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato-Regular.ttf b/docs/build/html/_static/fonts/Lato-Regular.ttf deleted file mode 100644 index 0f3d0f83..00000000 Binary files a/docs/build/html/_static/fonts/Lato-Regular.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bold.eot b/docs/build/html/_static/fonts/Lato/lato-bold.eot deleted file mode 100644 index 3361183a..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bold.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bold.ttf b/docs/build/html/_static/fonts/Lato/lato-bold.ttf deleted file mode 100644 index 29f691d5..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bold.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bold.woff b/docs/build/html/_static/fonts/Lato/lato-bold.woff deleted file mode 100644 index c6dff51f..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bold.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bold.woff2 b/docs/build/html/_static/fonts/Lato/lato-bold.woff2 deleted file mode 100644 index bb195043..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bold.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot b/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot deleted file mode 100644 index 3d415493..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf b/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf deleted file mode 100644 index f402040b..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff b/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff deleted file mode 100644 index 88ad05b9..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2 b/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2 deleted file mode 100644 index c4e3d804..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-italic.eot b/docs/build/html/_static/fonts/Lato/lato-italic.eot deleted file mode 100644 index 3f826421..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-italic.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-italic.ttf b/docs/build/html/_static/fonts/Lato/lato-italic.ttf deleted file mode 100644 index b4bfc9b2..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-italic.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-italic.woff b/docs/build/html/_static/fonts/Lato/lato-italic.woff deleted file mode 100644 index 76114bc0..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-italic.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-italic.woff2 b/docs/build/html/_static/fonts/Lato/lato-italic.woff2 deleted file mode 100644 index 3404f37e..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-italic.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-regular.eot b/docs/build/html/_static/fonts/Lato/lato-regular.eot deleted file mode 100644 index 11e3f2a5..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-regular.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-regular.ttf b/docs/build/html/_static/fonts/Lato/lato-regular.ttf deleted file mode 100644 index 74decd9e..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-regular.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-regular.woff b/docs/build/html/_static/fonts/Lato/lato-regular.woff deleted file mode 100644 index ae1307ff..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-regular.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/Lato/lato-regular.woff2 b/docs/build/html/_static/fonts/Lato/lato-regular.woff2 deleted file mode 100644 index 3bf98433..00000000 Binary files a/docs/build/html/_static/fonts/Lato/lato-regular.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf b/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf deleted file mode 100644 index df5d1df2..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab-Bold.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf b/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf deleted file mode 100644 index eb52a790..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab-Regular.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot deleted file mode 100644 index 79dc8efe..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf deleted file mode 100644 index df5d1df2..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff deleted file mode 100644 index 6cb60000..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 deleted file mode 100644 index 7059e231..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot deleted file mode 100644 index 2f7ca78a..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf deleted file mode 100644 index eb52a790..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff deleted file mode 100644 index f815f63f..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 b/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 deleted file mode 100644 index f2c76e5b..00000000 Binary files a/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 and /dev/null differ diff --git a/docs/build/html/_static/fonts/fontawesome-webfont.eot b/docs/build/html/_static/fonts/fontawesome-webfont.eot deleted file mode 100644 index e9f60ca9..00000000 Binary files a/docs/build/html/_static/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/docs/build/html/_static/fonts/fontawesome-webfont.svg b/docs/build/html/_static/fonts/fontawesome-webfont.svg deleted file mode 100644 index 855c845e..00000000 --- a/docs/build/html/_static/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,2671 +0,0 @@ - - - diff --git a/docs/build/html/_static/fonts/fontawesome-webfont.ttf b/docs/build/html/_static/fonts/fontawesome-webfont.ttf deleted file mode 100644 index 35acda2f..00000000 Binary files a/docs/build/html/_static/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/docs/build/html/_static/fonts/fontawesome-webfont.woff b/docs/build/html/_static/fonts/fontawesome-webfont.woff deleted file mode 100644 index 400014a4..00000000 Binary files a/docs/build/html/_static/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/docs/build/html/_static/fonts/fontawesome-webfont.woff2 b/docs/build/html/_static/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 4d13fc60..00000000 Binary files a/docs/build/html/_static/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/docs/build/html/_static/jquery-3.2.1.js b/docs/build/html/_static/jquery-3.2.1.js deleted file mode 100644 index d2d8ca47..00000000 --- a/docs/build/html/_static/jquery-3.2.1.js +++ /dev/null @@ -1,10253 +0,0 @@ -/*! - * jQuery JavaScript Library v3.2.1 - * https://jquery.com/ - * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://jquery.org/license - * - * Date: 2017-03-20T18:59Z - */ -( function( global, factory ) { - - "use strict"; - - if ( typeof module === "object" && typeof module.exports === "object" ) { - - // For CommonJS and CommonJS-like environments where a proper `window` - // is present, execute the factory and get jQuery. - // For environments that do not have a `window` with a `document` - // (such as Node.js), expose a factory as module.exports. - // This accentuates the need for the creation of a real `window`. - // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. - module.exports = global.document ? - factory( global, true ) : - function( w ) { - if ( !w.document ) { - throw new Error( "jQuery requires a window with a document" ); - } - return factory( w ); - }; - } else { - factory( global ); - } - -// Pass this if window is not defined yet -} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { - -// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 -// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode -// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common -// enough that all such attempts are guarded in a try block. -"use strict"; - -var arr = []; - -var document = window.document; - -var getProto = Object.getPrototypeOf; - -var slice = arr.slice; - -var concat = arr.concat; - -var push = arr.push; - -var indexOf = arr.indexOf; - -var class2type = {}; - -var toString = class2type.toString; - -var hasOwn = class2type.hasOwnProperty; - -var fnToString = hasOwn.toString; - -var ObjectFunctionString = fnToString.call( Object ); - -var support = {}; - - - - function DOMEval( code, doc ) { - doc = doc || document; - - var script = doc.createElement( "script" ); - - script.text = code; - doc.head.appendChild( script ).parentNode.removeChild( script ); - } -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.2.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - - if ( copyIsArray ) { - copyIsArray = false; - clone = src && Array.isArray( src ) ? src : []; - - } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isFunction: function( obj ) { - return jQuery.type( obj ) === "function"; - }, - - isWindow: function( obj ) { - return obj != null && obj === obj.window; - }, - - isNumeric: function( obj ) { - - // As of jQuery 3.0, isNumeric is limited to - // strings and numbers (primitives or objects) - // that can be coerced to finite numbers (gh-2662) - var type = jQuery.type( obj ); - return ( type === "number" || type === "string" ) && - - // parseFloat NaNs numeric-cast false positives ("") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - !isNaN( obj - parseFloat( obj ) ); - }, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - - /* eslint-disable no-unused-vars */ - // See https://github.com/eslint/eslint/issues/6125 - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - type: function( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; - }, - - // Evaluates a script in a global context - globalEval: function( code ) { - DOMEval( code ); - }, - - // Convert dashed to camelCase; used by the css and data modules - // Support: IE <=9 - 11, Edge 12 - 13 - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // Support: Android <=4.0 only - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - now: Date.now, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = jQuery.type( obj ); - - if ( type === "function" || jQuery.isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.3 - * https://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2016-08-08 - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - disabledAncestor = addCombinator( - function( elem ) { - return elem.disabled === true && ("form" in elem || "label" in elem); - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - - // ID selector - if ( (m = match[1]) ) { - - // Document context - if ( nodeType === 9 ) { - if ( (elem = context.getElementById( m )) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && (elem = newContext.getElementById( m )) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( (m = match[3]) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; - - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 - // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { - - // Capture the context ID, setting it first if necessary - if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", (nid = expando) ); - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[i] = "#" + nid + " " + toSelector( groups[i] ); - } - newSelector = groups.join( "," ); - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement("fieldset"); - - try { - return !!fn( el ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - disabledAncestor( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9-11, Edge - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( preferredDoc !== document && - (subWindow = document.defaultView) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert(function( el ) { - el.className = "i"; - return !el.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( el ) { - el.appendChild( document.createComment("") ); - return !el.getElementsByTagName("*").length; - }); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - }); - - // ID filter and find - if ( support.getById ) { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( (elem = elems[i++]) ) { - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( el ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll("[msallowcapture^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push("~="); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push(".#.+[+~]"); - } - }); - - assert(function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement("input"); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll(":enabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll(":disabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( el ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === document ? -1 : - b === document ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - !compilerCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch (e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return (sel + "").replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - // Use previously-cached element index if available - if ( useCache ) { - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - // Don't keep the element (issue #299) - input[0] = null; - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( (oldCache = uniqueCache[ key ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context === document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: