Effect of damping in a single dof system under harmonic excitation

As we saw in previous posts, all real systems have some damping. The damping forces affect the response also on forced vibrations, especially around resonance. It is essential in practice to be able to incorporate them in the theoretical models and investigate the effect of damping in forced vibration.

Following the theory given in the post for Harmonic forced vibration of single dof oscillator we will consider plotting the response amplitude and phase using Gaea for several values of damping ratio. The code for doing this is given below:

(require :plotting)

(defun my-make-vector (dim init-fn)
  (let ((vec (make-array dim :initial-element 0.0 :element-type 'float)))
    (dotimes (i dim)
      (setf (aref vec i) (funcall init-fn i)))
    vec))

(defun ss-amplitude (X z f)
  (/ X
     (sqrt (+ (expt (- 1. (expt f 2.)) 2.)
              (expt (* (* 2. z) f ) 2.)))))

(defun ss-phase (z f)
  (/ (* 180 (atan (* 2. (* z f ))
            (- 1. (expt f 2.)))) pi))

(defun damped-forced-vibration ()
  (let ((xm  1.)
        (z (list 0.000001
                 0.1
                 0.2
                 0.3
                 0.4
                 0.5
                 1.0))
        (styles (list :--
                      :-.
                      :.
                      :--
                      :-.
                      :.
                      :--))
        (colors (list :brown
                      :black
                      :red
                      :cyan
                      :green
                      :blue
                      :magenta))
        (llabels (list "0% Damping"
                      "10% Damping"
                      "20% Damping"
                      "30% Damping"
                      "40% Damping"
                      "50% Damping"
                      "100% Damping"))
        (dr 0.001) ; frequency ratio increment
        (n 2010)) ;change the number of points of plot
        (dolist (i (mapcar #'list z styles colors llabels))
          (plotting:plot (my-make-vector n
                                      #'(lambda(x) (* dr x)))
                      (my-make-vector n
                                      #'(lambda(x) (/ xm
                                                      (sqrt (+ (expt (- 1. (expt (* dr x) 2.)) 2.)
                                                               (expt (* (* 2. (first i)) (* dr x) ) 2.))))))
                      :line-width 2.
                      :line-style (second i)
                      :color (third i)
                      :label (fourth i)))
        (plotting:ylim :ymin 0. :ymax 5.5)
        (plotting:xlim :xmin 0. :xmax 2.)
        (plotting:set-title "Amplitude")
        (plotting:xlabel "Frequency Ratio (f/fc)")
        (plotting:ylabel "Amplification Ratio (X)")
        (plotting:legend)
        (plotting:savefig "Forced_vibration_Amplitude.svg")
        (plotting:show)
        (dolist (i (mapcar #'list z styles colors llabels))
          (plotting:plot (my-make-vector n
                                      #'(lambda(x) (* dr x)))
                      (my-make-vector n
                                      #'(lambda(x) (/ (* 180 (atan (* 2. (* (first i) (* dr x) ))
                                                             (- 1. (expt (* dr x) 2.)))) pi)))
                      :line-width 2.
                      :line-style (second i)
                      :color (third i)
                      :label (fourth i)))
        (plotting:ylim :ymin 0. :ymax 180.)
        (plotting:xlim :xmin 0. :xmax 2.)
        (plotting:set-title "Phase")
        (plotting:xlabel "Frequency Ratio (f/fc)")
        (plotting:ylabel "Phase Angle [degrees]")
        (plotting:legend :loc :subpage :anchor '(0.05 0.55))
        (plotting:savefig "Forced_vibration_Phase.svg")
        (plotting:show)))
(damped-forced-vibration)

The resulting plots for amplitude and phase using Gaea plotting are given below:

Want to know more about Gaea ? Please contact us!