# Writing a fourth order Runga Kutta solver for a vibrations problem in Python (Part 2)

## April 13, 2017

This post continues where part 1 ended. In order to increase the accuracy of our function solver we are going to use a 4th order Runga Kutta algorithm. The basics are the same as with the Euler method. However the dy part of the 4th order method is more accurately computed. Definition The incremental values of this method are defined as: $y_{n+1} = y_{n} + \frac{h}{6}(k_{1} + 2k_{2} +2k_{3} + k_{4})$ $t_{n+1} = t_{n} + h$ With the factors k1 - k4 being:

# Writing a fourth order Runga Kutta solver for a vibrations problem in Python (Part 3)

## April 13, 2017

This post continues where part 2 ended. The Runga Kutta algorithm described in last post is only able to solve first order differential equations. The differential equation (de) for a single mass spring vibrations problem is a second order de. $mu'' + cu' + ku = F$ Note that in this equation: u'' = acceleration a u' = velocity v u = displacement Before we can solve it with a Runga Kutta algorithm we must rewrite the base equation to a system of two first order ode’s.

# Python 1D FEM Example 3

## March 12, 2017

Python 1D FEM Example 3. Simple code example for anaStruct. # if using ipython notebook %matplotlib inline from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements(EA=15000, EI=5000) # Add beams to the system. ss.add_element(location=[[0, 0], [0, 5]]) ss.add_element(location=[[0, 5], [5, 5]]) ss.add_element(location=[[5, 5], [5, 0]]) # Add a fixed support at node 1. ss.add_support_fixed(node_id=1) # Add a rotational spring at node 4. ss.add_support_spring(node_id=4, translation=3, k=4000) # Add loads.

# Python 1D FEM Example 2

## February 12, 2017

Example 2: Truss framework Simple code example for anaStruct. # if using ipython notebook %matplotlib inline import math from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements(EA=5000) # Add beams to the system. ss.add_truss_element(location=[[0, 0], [0, 5]]) ss.add_truss_element(location=[[0, 5], [5, 5]]) ss.add_truss_element(location=[[5, 5], [5, 0]]) ss.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * math.sqrt(2)) # get a visual of the element ID's and the node ID's ss.show_structure() # add hinged supports at node ID 1 and node ID 2 ss.

# Python 1D FEM Example 1

## January 12, 2017

Example 1: Framework Simple code example for anaStruct. # if using ipython notebook %matplotlib inline from anastruct.fem.system import SystemElements # Create a new system object. ss = SystemElements() # Add beams to the system. ss.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000) ss.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000) # get a visual of the element IDs and the node IDs ss.show_structure() # add loads to the element ID 2 ss.q_load(element_id=2, q=-10) # add hinged support to node ID 1 ss.

(c) 2020 Ritchie Vink.