A Simple VBA Tutorial: Newmark’s dynamic solutions of a 2 dof mass spring damper system.

This code solves a two dof mass spring damper system using a Newmark’s time stepping solution. This is a direct dynamics solution in the time domain and may be extended to a systam with more then 2 degrees of freedom.

The Theory:-

Is quite involved so refer to “The Finite Element Method” by Thomas J.R. Hughes, but the implementation is fairly straight forward as follows.

1) For our example we take g=0.5 and b=0.25 which are integration parameters and a time step dt= 0.01.

2) we are going to solve (M+g*dt*C+b*dt^2*K)*an+1=-C*vbn+1-K*dbn+1 where M,C,K are the mass, damping and stiffness matrices.

3) from (M+g*dt*C+b*dt^2*K) we get our effective stiffness matrix and we invert this so we can calculate the new acceleration vector from the effective force.

4) -C*vbn+1-K*dbn+1 gives us the effective force where :-

dbn+1=dn+dt*vn+0.5*dt^2*(1-2*b)*an

vbn+1=vn+(1-g)*dt*an

we start with dn our displacement vector set to initial conditions [0.1] and vn and an set to [0,]0]

5) we calculate our effective force from 4 starting with our initial conditions (dn,vn,an) multiplying this by 3 the inverse of the effective stiffness matrix we get are new acceleration vector an+1.

6) We now calculate the new displacement and velocity vectors from  an+1 as :-

dn+1=dbn+1 + b*dt^2*an+1

vn+1=vbn+1 + g*dt^2*an+1

7) now we goto 4 where dn and vn are now the newly calculated dn+1 vn+1