Exemplo n.º 1
0
    'angle_max_pred': 90,
    'it_cont_max': 1e6,
    'adaptive_stepsize': True
}

# run full continuation
hb = HB(M, C, K, nl, **par_hb)
omega, z, stab, lamb = hb.periodic(f0, vrms, fdof)
hb.continuation(**par_cont)

if savedata:
    with open('data/hb' + '.pkl', 'wb') as f:
        pickle.dump(hb, f)
    print('data saved as {}'.format(filename))

ffrf, ax = nfrc(dof=0, hb=hb, interactive=False, xscale=1, xunit='(rad/s)')

plt.show()
"""
One-sided:
    'NH': 12,
    'npow2': 8,
    'step_max': 0.01,
vrms = 0.01
b = 0.08
beta = 1
slope = np.array([0, -beta])
x = np.array([b])
y = np.array([0])

"""
Exemplo n.º 2
0
## Plot NFRC and sweep
plt.figure(1)
plt.clf()
plt.plot(sweep1.finst * 2 * np.pi, sweep1.y[dof])

x = np.asarray(hb.omega_vec) / hb.scale_t
y = np.asarray(hb.xamp_vec).T[dof]
stab_vec = np.asarray(hb.stab_vec)
idx1 = ~stab_vec
idx2 = stab_vec
plt.plot(np.ma.masked_where(idx1, x), np.ma.masked_where(idx1, y), '-k',
         np.ma.masked_where(idx2, x), np.ma.masked_where(idx2, y), '--k')

fig = plt.gcf()
ax = plt.gca()
nfrc(nnm=nnm1, interactive=False, xscale=1, xunit='(rad/s)', fig=fig, ax=ax)
nfrc(nnm=nnm2, interactive=False, xscale=1, xunit='(rad/s)', fig=fig, ax=ax)

plt.ylabel('Amplitude (m)')
plt.xlabel('Frequency (rad/s)')

plt.xlim([0, 5])
plt.ylim([-5, 5])

## Plot harmonic components
# get harmonic components
NH = hb.NH
n = hb.n
cvec = []
for z in hb.z_vec:
    c, phi, cnorm = hb_components(z, n, NH)
Exemplo n.º 3
0
from scipy.linalg import eigvals
from pyvib.helper.plotting import (phase, periodic, stability, configuration,
                                 nfrc)

plot = False

path = 'data/'
nnm = pickle.load(open(path + 'nnm1' + '.pkl', 'rb'))

def plots(t, x, xd, xxd, lamb, T, dof, inl, ptype='displ', idx='', savefig=False):
    fper, ax = periodic(t, x, dof=0, ls='-', c='k')
    fper, ax = periodic(t, x, dof=1, fig=fper, ax=ax, ls='--', c='k')
    fphase, ax = phase(x, xd, dof, c='k')
    fconf, ax = configuration(x, c='k')


    dof = 0
# get full periodic solution for last entry
T = 2*np.pi/nnm.omega_vec[-1]
x, xd, xdd, PhiT, dt = nnm.numsim(nnm.X0_vec[-1], T)
lamb = eigvals(PhiT)
ns = x.shape[1]
t = np.arange(ns)*dt
if plot:
    plots(t, x, xd, xdd, lamb, T, dof, inl, ptype='displ', idx='', savefig=savefig)


ffrf, ax = nfrc(nnm=nnm, interactive=False, xscale=1/2/np.pi, xunit='(Hz)')
ffep, ax = nfrc(nnm=nnm, interactive=False, xscale=1/2/np.pi,
                      xunit='(Hz)', energy_plot=True)
Exemplo n.º 4
0
import pickle
import os
import sys
import numpy as np
import matplotlib.pyplot as plt

from scipy.linalg import eigvals
from pyvib.helper.plotting import (phase, periodic, stability, configuration,
                                   nfrc)

filename = 'data/nnm'
nnm1 = pickle.load(open(filename + '1' + '.pkl', 'rb'))
nnm2 = pickle.load(open(filename + '2' + '.pkl', 'rb'))

fig1, ax1 = plt.subplots()
nfrc(nnm=nnm1, interactive=False, xscale=1, xunit='(rad/s)', fig=fig1, ax=ax1)
nfrc(nnm=nnm2, interactive=False, xscale=1, xunit='(rad/s)', fig=fig1, ax=ax1)

fig2, ax2 = plt.subplots()
nfrc(nnm=nnm1,
     interactive=False,
     xscale=1,
     xunit='(rad/s)',
     energy_plot=True,
     fig=fig2,
     ax=ax2)
nfrc(nnm=nnm2,
     interactive=False,
     xscale=1,
     xunit='(rad/s)',
     energy_plot=True,