Algorithm 01 Class of objects used in Julia code
01
:
# Str Node
02
:
struct Node
03
:
Coords:: Coordinates
04
:
Constrs:: Constraints
05
:
NLoads:: Nodal_Loads
06
:
Displs:: Displacements
07
:
end
08
:
# Str Element
09
:
struct Element
10
:
Connect:: Connectvt
11
:
Section:: Section
12
:
DLoads:: Distributed_Loads
13
:
Discret:: Int64
14
:
end
15
:
# Str Structure Model
16
:
struct Structure_Model
17
:
NodesData:: Matrix{Node}
18
:
ElementsData:: Matrix{Element}
19
:
NumbNodes:: Int64
20
:
NumbElem:: Int64
21
:
NumbDOF:: Int64
22
:
end
23
:
# Str Results
24
:
struct Results
25
:
Id:: Identifiers
26
:
MV:: Matrix_and_Vectors
27
:
Ans:: Answers
28
:
IF:: Solicitations
29
:
BuckId:: Buckling_Id
30
:
DynamId:: Dynamic_Id
31
:
end
32
:
# Str Analysis
33
:
struct Analysis
34
:
SM:: Structure_Model
35
:
Res:: Results
36
:
end
Algorithm 02 Analysis of stability in frames by Finite Element Method in Julia
01
:
function BuckMEF(bw_b, h_b, bw_p, h_p, Nv)
02
:
#02. Automatic data generated for the template to analysis
03
:
FrameType = [5 3 5 Nv 2 3e7] #[beam_length pillar_length Number_of_Horizontal_Frames Number_of_Vertical_Frames constraints E]
04
:
GeoSec = [bw_b h_b bw_p h_p] #[bw_beam h_beam bw_pillar h_pillar]
05
:
Load_Disc = [10.0 -5.0 10 6] #[Px q discret_beam discret_pillar]
06
:
SM = GenerateFrames(FrameType,GeoSec,Load_Disc)
07
:
#03. Discretization of the tabulated structure with new nodes and elements
08
:
SM = Discretizer(SM)
09
:
#04. Numbering of degrees of freedom of the problem
10
:
Id = DOF(SM)
11
:
#05. Calculus of the stiffness matrices and equivalent nodal loads
12
:
(K,M,Peq) = (zeros(SM.NumbDOF,SM.NumbDOF),zeros(SM.NumbDOF,SM.NumbDOF),zeros(SM.NumbDOF))
13
:
MV = MatrixAssemling(SM,Id,K,M,Peq)
14
:
#06. Matricial solution of the linear system of equations
15
:
Ans = EqSolution(MV,Id)
16
:
#07. Results of nodal loads in local system of coordinates to assembly of diagrams
17
:
IF = InternalForces(MV,Ans)
18
:
#08. Solutions for the characteristic problem: λcr and the buckling mode of the structure
19
:
BuckId = CharacProblSol(Id,Ans,IF)
20
:
#09. Exportation of the deformed shape and buckling mode of the structure in PNG
21
:
PlotStructure(Analysis(SM,Res),100,4,0.20)
22
:
Res = Results(Id,MV,Ans,IF,BuckId) #concatenation of the results
23
:
return Analysis(SM,Res)
24
:
end
Algorithm 03 Local and global stiffness calculation with the assembling using degrees of freedom
01
:
function MatrixAssembling(SM:: Structure_Model, Id:: Identifiers, K:: Matrix{Float64}, M:: Matrix{Float64}, Peq:: Vector{Float64})
02
:
#Capture of the model information
03
:
NumbElem = SM.NumbElem
04
:
#Previous creation of matrices for stiffness matrices calculations
05
:
R = Array{Float64}(undef,(6,6,NumbElem))
06
:
kl = Array{Float64}(undef,(6,6,NumbElem))
07
:
pleq = Array{Float64}(undef,(6,1,NumbElem))
08
:
dof_elements = Matrix{Int16}(undef,NumbElem,6)
09
:
kgl = Array{Float64}(undef,(6,6,NumbElem))
10
:
#Sweep all the frames of structure for the [K] and [Peq] calculations
11
:
for Element in 1:NumbElem
12
:
Frame = SM.ElementsData[1,Element]
13
:
(L,cos,sen) = Orientation(Frame) #function 03.a.
14
:
(EA,EI) = SecProp(Frame) #function 03.b.
15
:
#Local stiffness matrix
16
:
kl[:,:,Element] = @SMatrix [
17
:
EA/L 0 0 -EA/L 0 0
18
:
0 12*EI/(L^3) 6*EI/(L^2) 0 -12*EI/(L^3) 6*EI/(L^2)
19
:
0 6*EI/(L^2) 4*EI/L 0 -6*EI/(L^2) 2*EI/L
20
:
-EA/L 0 0 EA/L 0 0
21
:
0 -12*EI/(L^3) -6*EI/(L^2) 0 12*EI/(L^3) -6*EI/(L^2)
22
:
0 6*EI/(L^2) 2*EI/L 0 -6*EI/(L^2) 4*EI/L
23
:
]
24
:
#Rotation matrix
25
:
R[:,:,Element] = @SMatrix [
26
:
cos sen 0 0 0 0
27
:
-sen cos 0 0 0 0
28
:
0 0 1 0 0 0
29
:
0 0 0 cos sen 0
30
:
0 0 0 -sen cos 0
31
:
0 0 0 0 0 1
32
:
]
33
:
#Global stiffness and mass matrix
34
:
kg = R[:,:,Element]'*kl[:,:,Element]*R[:,:,Element]
35
:
dof_elements[Element,:] = Int64.(DOFElement(Frame,SM,Id)) #function 03.c.
36
:
#Structure stiffness and mass matrix
37
:
K[dof_elements[Element,:],dof_elements[Element,:]] = K[dof_elements[Element,:],dof_elements[Element,:]] + kg
38
:
#Distributed loads on element
39
:
ql0 = [Frame.DLoads.Localqx;Frame.DLoads.Localqy]
40
:
qg = [Frame.DLoads.Globalqx;Frame.DLoads.Globalqy]
41
:
qp = [Frame.DLoads.Projectedqx;Frame.DLoads.Projectedqy]
42
:
#Rotation of global-local systems matrix
43
:
r = @SMatrix [cos sen;
44
:
-sen cos]
45
:
#Scale projected-local systems matrix
46
:
e = @SMatrix [sen 0;
47
:
0 cos]
48
:
#Transformations of load systems
49
:
ql1 = r*qg
50
:
ql2 = r*e*qp
51
:
#Total local distributed load
52
:
qlx = ql0[1]+ql1[1]+ql2[1]
53
:
qly = ql0[2]+ql1[2]+ql2[2]
54
:
#Equivalent nodal loads
55
:
pleq[:,1,Element] = @SMatrix [
56
:
qlx*L/2;
57
:
qly*L/2;
58
:
qly*(L^2)/12;
59
:
qlx*L/2;
60
:
qly*L/2;
61
:
-qly*(L^2)/12
62
:
]
63
:
pgeq = R[:,:,Element]'*pleq[:,:,Element]
64
:
Peq[dof_elements[Element,:]] = Peq[dof_elements[Element,:]] + pgeq
65
:
#Local geometric stiffness matrix
66
:
kgl[:,:,Element] = -@SMatrix [0 0 0 0 0 0;
67
:
0 36/(30*L) 1/10 0 -36/(30*L) 1/10;
68
:
0 1/10 4*L/30 0 -1/10 -L/30;
69
:
0 0 0 0 0 0;
70
:
0 -36/(30*L) -1/10 0 36/(30*L) -1/10;
71
:
0 1/10 -L/30 0 -1/10 4*L/30]
72
:
end
73
:
return Matrix_and_Vectors(R, kl, K, pleq, Peq, dof_elements, kgl)
74
:
end
Algorithm 04 Matrix solution of the linear equation system
01
:
function EqSolution(MV:: Matrix_and_Vectors, Id:: Identifiers)
02
:
#Capture of the model information
03
:
K = MV.K
04
:
Peq = MV.Peq
05
:
P = Id.P
06
:
D = Id.D
07
:
PF = Id.PF
08
:
DC = Id.DC
09
:
doff = Id.doff
10
:
NumbDOF = size(P,1)
11
:
#Division in submatrices for the solution Free-Constraint
12
:
KFF = K[1:doff,1:doff]
13
:
KFC = K[1:doff,doff+1:NumbDOF]
14
:
KCF = K[doff+1:NumbDOF,1:doff]
15
:
KCC = K[doff+1:NumbDOF,doff+1:NumbDOF]
16
:
PeqF = Peq[1:doff]
17
:
PeqC = Peq[doff+1:NumbDOF]
18
:
PTF = PF+PeqF
19
:
#Answer of the analysis
20
:
DF = KFF\(PTF-KFC*DC)
21
:
PTC = KCF*DF+KCC*DC
22
:
PC = PTC-PeqC
23
:
#Final vectors of loads and displacements
24
:
P[doff+1:NumbDOF,1] = PC
25
:
D[1:doff,1] = DF
26
:
PT = P+Peq
27
:
return Answers(KFF, DF, PC, P, D, PT)
28
:
end
Algorithm 05 Buckling factor and buckling modes by the eigenvalues and eigenvectors solution
01
:
function CharacProblSol(Id:: Identifiers, Ans:: Answers, IF:: Solicitations)
02
:
#Capture of the model
03
:
doff = Id.doff
04
:
KFF = Ans.KFF
05
:
Kg = IF.Kg
06
:
DC = Id.DC
07
:
#Solution using the nomeation of free and constraint dof
08
:
KgFF = Kg[1:doff,1:doff]
09
:
#Eigenvalues and eigenvectors for 2 symmetric matrices with 1 eigen value (nev) which type of eigenvalue is smallest magnitude (SM)
10
:
λcr,d = eigs(Symmetric(KFF),Symmetric(KgFF), nev=1, which=:SM)
11
:
λcr = real(λcr); d = real(d)
12
:
DBuck = [d;DC]
13
:
return Buckling_Id(λcr, DBuck)
14
:
end
Table 1
Input values used in the frame.
Table 2
Comparison of joint reactions between the Julia program and SAP2000.
Table 3
Processing time in seconds for the 3 analyzed processes.
Table 4
Variation in measures of sample dispersion after the removal of outliers.