Two-dimensional elastic skeleton geometric nonlinear analysis with Python

Program overview

Boundary conditions that can be handled
Item Description
Nodal external force increment Specify the number of loading nodes, loading node number, and load increment value
Displacement constraint Displacement constraint Specify the number of nodes and the number of the constraint node (complete constraint: only displacement = 0 can be handled)

FEM analysis program

Program nameDescription
py_fem_gfrmAL.py Planar skeleton geometry Non-linear structural analysis program

Script for executing FEM analysis

python3 py_fem_gfrmAL.py inp.txt out.txt nnmax
inp.txt : Input data file (blank delimited data)
out.txt : Output data file (blank separated data)
nnmax : Number of loading steps

Input data format

npoin  nele  nsec  npfix  nlod  # Basic values for analysis
E  A  I                         # Material properties
    ..... (1 to nsec) .....     # 
node_1  node_2  isec            # Element connectivity, material set number
    ..... (1 to nele) .....     # 
x  y                            # Node coordinate of node
    ..... (1 to npoin) .....    # 
lp  fix_x  fix_y  fix_r         # Restricted node number
    ..... (1 to npfix) .....    # 
lp  df_x  df_y  df_r            # Loaded node and loading conditions (load increment)
    ..... (1 to nlod) .....     #     (omit data input if nlod=0)
npoin, nele, nsec : Number of nodes, number of elements, number of cross-sectional characteristics
npfix, nlod : Number of constrained nodes, number of loaded nodes
E, A, I : Elastic modulus, cross-sectional area, moment of inertia of area
node_1, node_2, isec : Node 1, Node 2, Sectional characteristic number
x, y : x coordinate, y coordinate
lp, fix_x, fix_y, fix_r : Node number, x / y / rotation direction constraint (0: free, 1: complete constraint)
lp, df_x, df_y, df_r : Node number, x · y · rotational load

Output data format

npoin  nele  nsec npfix  nlod  nnmax
    (Each value of above)
sec  E  A  I
    sec   : Material number
    E     : Elastic modulus
    A     : Section area
    I     : Moment of inertia
    ..... (1 to nsec) .....
node  x  y  fx  fy  fr  kox  koy  kor
    node   : Node number
    x      : x-coordinate
    y      : y-coordinate
    fx     : Load in x-direction
    fy     : Load in y-direction
    fr     : Moment load
    kox    : Index of restriction in x-direction (0: free, 1: fixed)
    koy    : Index of restriction in y-direction (0: free, 1: fixed)
    kor    : Index of restriction in rotation    (0: free, 1: fixed)
    ..... (1 to npoin) .....
elem  i  j  sec
    elem : Element number
    i    : Node number of start point
    j    : Node number of end point
    sec  : Material number
    ..... (1 to nele) .....
* nnn=0 iii=0 lam=0.0
node  fp-x  fp-y  fp-r  dis-x  dis-y  dis-r  dr-x  dr-y dr-r
    node  : Node number
    fp-x  : Total load in x-direction
    fp-y  : Total load in y-direction
    fp-r  : Total load in rotation
    dis-x : Displacement in x-direction
    dis-y : Displacement in y-direction
    dis-r : Displacement in rotation
    dr-x  : Un-balanced force in x-direction
    dr-y  : Un-balanced force in y-direction
    dr-r  : Un-balanced force in rotation
    ..... (1 to npoin) .....
elem  N_i  S_i  M_i  N_j  S_j  M_j
    elem : Element number
    N_i  : Axial force of node-i
    S_i  : Shear force of node-i
    M_i  : Moment of node-i
    N_j  : Axial force of node-j
    S_j  : Shear force of node-j
    M_j  : Moment of node-j
    ..... (1 to nele) .....
* nnn=1 iii=xx lam=xxx
node  fp-x  fp-y  fp-r  dis-x  dis-y  dis-r  dr-x  dr-y dr-r
    node  : Node number
    fp-x  : Total load in x-direction
    fp-y  : Total load in y-direction
    fp-r  : Total load in rotation
    dis-x : Displacement in x-direction
    dis-y : Displacement in y-direction
    dis-r : Displacement in rotation
    dr-x  : Un-balanced force in x-direction
    dr-y  : Un-balanced force in y-direction
    dr-r  : Un-balanced force in rotation
    ..... (1 to npoin) .....
elem  N_i  S_i  M_i  N_j  S_j  M_j
    elem : Element number
    N_i  : Axial force of node-i
    S_i  : Shear force of node-i
    M_i  : Moment of node-i
    N_j  : Axial force of node-j
    S_j  : Shear force of node-j
    M_j  : Moment of node-j
    ..... (1 to nele) .....

.... .... ....

* nnn=nnmax-1 iii=xx lam=xxx
node  fp-x  fp-y  fp-r  dis-x  dis-y  dis-r  dr-x  dr-y dr-r
    ..... (1 to npoin) .....
elem  N_i  S_i  M_i  N_j  S_j  M_j
    ..... (1 to nele) .....
n=(total degrees of freedom)  time=(calculation time)
fp-x, fp-y, fp-r : x-direction load, y-direction load, rotational direction load
dis-x, dis-y, dis-r : x-direction displacement, y-direction displacement, rotational displacement
dr-x, dr-y, dr-r : x-direction unbalanced force, y-direction unbalanced force, rotational direction unbalanced force
N, S, M : Axial force, shear force, moment
n : Total degrees of freedom (source of simultaneous equations)
time : Calculation time

Output example

Program nameDescription
inp_gfrm_canti.txt Cantilever FEM Analysis input data
inp_gfrm_cable.txt Cantilever with cable Beam FEM analysis input data
inp_gfrm_arch.txt Arch FEM analysis input Data
inp_gfrm_lee.txt Frame FEM analysis input Data
py_fig_gfrm.py Load-displacement curve Drawing program (matplotlib)
py_fig_gfrm_mode.py Program (matplotlib)

Load-Displacement curve drawing program py_fig_gfrm.py

In the load-displacement curve creation program py_fig_gfrm.py, as a result of trying to make it versatile, the input from the command line became quite confusing.

Displacement mode diagram creation program py_fig_gfrm_mode.py

With the displacement mode diagram creation program py_fig_gfrm_mode.py, it is relatively easy to realize a versatile one only with the displacement mode, but it becomes quite complicated when trying to put boundary conditions. Therefore, since I want to create only 4 graphs, I specify the input file in the program and process each file individually.

(Arrow indicating load)

The arrow indicating the load is written as an arrow. with arrow ``` ax.arrow(x,y,u,v,head_length=hl, ....) ``` Write an instruction like

. For example, when drawing a vertical arrow, it should be noted that the length from the tail to the tip of the arrow is (v + head_length). The actual correspondence is as follows. ``` uu=0.0 vv=(ymax-ymin)*0.1 x1=xx[lnod-1] y1=yy[lnod-1]+vv hl=vv*0.4 hw=hl*0.5 ax.arrow(x1,y1,uu,-(vv-hl), lw=2.0,head_width=hw, head_length=hl, fc='#555555', ec='#555555') ```

(Symbol indicating fixed end)

The symbol indicating the fixed end drawn at the base of the vertical one-way beam is drawn using fill (... hatch ='///'). Here, the rectangular area is specified in fill, but since the border is unnecessary, linewidth = 0.0 is specified in fill to prevent the border from being drawn. The actual correspondence is as follows. ``` lp=1; x1=x[lp-1]; y1=y[lp-1] px=[x1-2*scl,x1+2*scl,x1+2*scl,x1-2*scl] py=[y1,y1,y1-1*scl,y1-1*scl] ax.fill(px,py,fill=False,linewidth=0.0,hatch='///') ax.plot([x1-2*scl,x1+2*scl],[y1,y1],color='#000000',linestyle='-',linewidth=1.5) ```

Script for FEM calculation execution / load displacement curve drawing program execution

# FEM calculation by Arc-Length method
python py_fem_gfrmAL.py inp_gfrm_canti.txt out_gfrm_canti.txt 70
python py_fem_gfrmAL.py inp_gfrm_cable.txt out_gfrm_cable.txt 290
python py_fem_gfrmAL.py inp_gfrm_arch.txt out_gfrm_arch.txt 310
python py_fem_gfrmAL.py inp_gfrm_lee.txt out_gfrm_lee.txt 160

# Drawing of Load-displacement curve
python py_fig_gfrm.py out_gfrm_canti.txt 11 11 -411.07 1000 1000 \$u/L\$ $\v/L\$ \$u/L\$\,$\v/L\$ \$P/P_{cr}\$ LL
python py_fig_gfrm.py out_gfrm_cable.txt 12 11 -1644.3 1000 1000 \$u/L\$ \$v/L\$ \$u/L\$\,\$v/L\$ \$P/P_{cr}\$ LL
python py_fig_gfrm.py out_gfrm_arch.txt 21 21 -666.4 -500 -500 \$u/R\$ \$v/R\$ \$u/R\$\,\$v/R\$ \$P\\cdot\(R^2/EI\)\$ UL
python py_fig_gfrm.py out_gfrm_lee.txt 13 13 -166.6 1000 -1000 \$u/L\$ \$v/L\$ \$u/L\$\,\$v/L\$ \$P\\cdot\(L^2/EI\)\$ LL

# Drawing of displacement mode
python py_fig_gfrm_mode.py
python py_fig_gfrm.py out.txt node-L node-D nd-L nd-u nd-v leg-u leg-v x-Label y-Label loc
out.txt : FEM output data file (blank delimited data)
node-L : Loading node number for drawing load displacement curve
node-D : Displacement drawing node number for drawing load displacement curve
nd-L : Numerical value (including sign) for load dimensionless
nd-u : Numerical value (including sign) for dimensionless displacement in x direction
nd-v : Numerical value (including sign) for dimensionless displacement in the y direction
leg-u : x-direction displacement label (for legend)
leg-v : y-direction displacement label (for legend)
x-Label : x-axis label (Displacement)
y-Label : y-axis label (Load)
loc : Legend drawing position

Displacement mode and load-Displacement curve output example

Cantilever beam receiving axial compressive force (inp_gfrm_canti.txt)
L=1,000mm, E=200,000MPa, A=100m$^2$, I=833m$^4$
Initial deflection $v_0$=1mm
Buckling load $P_{cr}=\pi^2 EI / 4 L^2$=411.07N

fig_mode_gfrm_canti.png

fig_gfrm_canti.png

Cantilever (inp_gfrm_cable.txt) whose tip is pulled by a cable
Column: L=1,000mm, E=200,000MPa, A=100m$^2$, I=833m$^4$
Cable: L=1,000mm, E=200,000MPa, A=28.3$^2$
Initial deflection $v_0$=5mm
Buckling load $P_{cr}=\pi^2 EI / L^2$=1644.3NN

fig_mode_gfrm_cable.png

fig_gfrm_cable.png

Asymmetrically supported arch under vertical concentrated load (inp_gfrm_arch.txt)
R=500mm, Center angle=215$^\circ$, E=200,000MPa, A=100m$^2$, I=833m$^4$

fig_mode_gfrm_arch.png

fig_gfrm_arch.png

Frame receiving vertical concentrated load (inp_gfrm_lee.txt)
L=1000mm, E=200,000MPa, A=100m$^2$, I=833m$^4$

fig_mode_gfrm_lee.png

fig_gfrm_lee.png

that's all

Recommended Posts

Two-dimensional elastic skeleton geometric nonlinear analysis with Python
Planar skeleton analysis with Python
3D skeleton structure analysis with Python
Two-dimensional saturated-unsaturated osmotic flow analysis with Python
Two-dimensional unsteady heat conduction analysis with Python
Data analysis with python 2
Voice analysis with python
Data analysis with Python
Planar skeleton analysis with Python (4) Handling of forced displacement
[Python] Morphological analysis with MeCab
[Co-occurrence analysis] Easy co-occurrence analysis with Python! [Python]
Sentiment analysis with Python (word2vec)
Muscle jerk analysis with Python
Plane skeleton analysis with Python (3) Creation of section force diagram
Impedance analysis (EIS) with python [impedance.py]
Text mining with Python ① Morphological analysis
Planar skeleton analysis in Python (2) Hotfix
Data analysis starting with python (data visualization 1)
Logistic regression analysis Self-made with python
Data analysis starting with python (data visualization 2)
[In-Database Python Analysis Tutorial with SQL Server 2017]
Marketing analysis with Python ① Customer analysis (decyl analysis, RFM analysis)
Machine learning with python (2) Simple regression analysis
2D FEM stress analysis program with Python
Example of 3D skeleton analysis by Python
Tweet analysis with Python, Mecab and CaboCha
Principal component analysis with Power BI + Python
Data analysis starting with python (data preprocessing-machine learning)
You can do it with Python! Structural analysis of two-dimensional colloidal crystals
Python: Simplified morphological analysis with regular expressions
[Various image analysis with plotly] Dynamic visualization with plotly [python, image]
Medical image analysis with Python 1 (Read MRI image with SimpleITK)
Static analysis of Python code with GitLab CI
FizzBuzz with Python3
Scraping with Python
python script skeleton
Scraping with Python
Python with Go
Data analysis python
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
Tested with Python
python starts with ()
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
Excel with Python
Microcomputer with Python
Cast with python
Collecting information from Twitter with Python (morphological analysis with MeCab)
[OpenCV / Python] I tried image analysis of cells with OpenCV
Reading Note: An Introduction to Data Analysis with Python
Python Scikit-learn Linear Regression Analysis Nonlinear Simple Regression Analysis Machine Learning
Data analysis environment construction with Python (IPython notebook + Pandas)
Calculate the regression coefficient of simple regression analysis with python
3. Natural language processing with Python 4-1. Analysis for words with KWIC
[Python] Added DB instance of RDS with Elastic Beanstalk