0% found this document useful (0 votes)
3 views1 page

GRASP Python (58)

The document outlines a procedure for matrix multiplication involving stiffness matrices in a finite element analysis context. It details the calculation of local and global stiffness matrices, as well as the assignment of degrees of freedom indices for nodes. Additionally, it addresses the application of boundary conditions to the system by fixing degrees of freedom based on support types.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

GRASP Python (58)

The document outlines a procedure for matrix multiplication involving stiffness matrices in a finite element analysis context. It details the calculation of local and global stiffness matrices, as well as the assignment of degrees of freedom indices for nodes. Additionally, it addresses the application of boundary conditions to the system by fixing degrees of freedom based on support types.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

' First multiply k_local * T

Dim i As Integer, j As Integer, k As Integer


For i = 1 To 6
For j = 1 To 6
temp(i, j) = 0
For k = 1 To 6
temp(i, j) = temp(i, j) + k_local(i, k) * T(k, j)
Next k
Next j
Next i

' Then multiply T' * (k_local * T)


For i = 1 To 6
For j = 1 To 6
k_global_elem(i, j) = 0
For k = 1 To 6
k_global_elem(i, j) = k_global_elem(i, j) + T(k, i) *
temp(k, j)
Next k
Next j
Next i

' Get global DOF indices


Dim dof_indices(1 To 6) As Integer
dof_indices(1) = 3 * (e.node1 - 1) + 1 ' ux1
dof_indices(2) = 3 * (e.node1 - 1) + 2 ' uy1
dof_indices(3) = 3 * (e.node1 - 1) + 3 ' θz1
dof_indices(4) = 3 * (e.node2 - 1) + 1 ' ux2
dof_indices(5) = 3 * (e.node2 - 1) + 2 ' uy2
dof_indices(6) = 3 * (e.node2 - 1) + 3 ' θz2

' Add to global stiffness matrix


For i = 1 To 6
For j = 1 To 6
K_global(dof_indices(i), dof_indices(j)) =
K_global(dof_indices(i), dof_indices(j)) + k_global_elem(i, j)
Next j
Next i
Next elemId

' Apply boundary conditions


Dim fixed_dofs() As Integer
ReDim fixed_dofs(1 To totalDof) ' Will be resized later
Dim num_fixed As Integer
num_fixed = 0

Dim nodeId As Integer


For nodeId = 1 To nodes.Count
On Error Resume Next
Dim s As Support
Set s = supports("S" & nodeId)
If Not s Is Nothing Then
Select Case s.supportType
Case "fixed"
' Fix all DOFs
fixed_dofs(num_fixed + 1) = 3 * (nodeId - 1) + 1 ' ux

P a g e 44 | 62

You might also like