Exemple #1
0
def simulate_forced_vibrations3():
    # Scaling with u_c based on large delta
    from vib import solver, visualize
    from math import pi
    delta = 10
    alpha = 0.05*delta**2
    u, t = solver(I=alpha, V=0, m=1, b=0, s=lambda u: delta**(-2)*u,
                  F=lambda t: cos(t),
                  dt=2*pi/160, T=2*pi*20)
    visualize(u, t)
    raw_input()
Exemple #2
0
def simulate_forced_vibrations2():
    # Scaling with u_c based on gamma=1
    from vib import solver, visualize
    from math import pi

    delta = 0.5
    delta = 0.99
    alpha = 1
    u, t = solver(I=alpha, V=0, m=1, b=0, s=lambda u: u, F=lambda t: cos(delta * t), dt=2 * pi / 160, T=2 * pi * 160)
    visualize(u, t)
    raw_input()
Exemple #3
0
def simulate_forced_vibrations1():
    # Scaling with u_c based on resonance amplitude
    from vib import solver, visualize
    from math import pi
    delta = 0.99
    alpha = 1 - delta**2
    u, t = solver(I=alpha, V=0, m=1, b=0, s=lambda u: u,
                  F=lambda t: (1-delta**2)*cos(delta*t),
                  dt=2*pi/160, T=2*pi*160)
    visualize(u, t)
    raw_input()
Exemple #4
0
def simulate_forced_vibrations3():
    # Scaling with u_c based on large delta
    from vib import solver, visualize
    from math import pi

    delta = 10
    alpha = 0.05 * delta ** 2
    u, t = solver(
        I=alpha, V=0, m=1, b=0, s=lambda u: delta ** (-2) * u, F=lambda t: cos(t), dt=2 * pi / 160, T=2 * pi * 20
    )
    visualize(u, t)
    raw_input()
Exemple #5
0
def simulate_forced_vibrations2():
    # Scaling with u_c based on gamma=1
    from vib import solver, visualize
    from math import pi
    delta = 0.5
    delta = 0.99
    alpha = 1
    u, t = solver(I=alpha, V=0, m=1, b=0, s=lambda u: u,
                  F=lambda t: cos(delta*t),
                  dt=2*pi/160, T=2*pi*160)
    visualize(u, t)
    raw_input()
Exemple #6
0
def simulate_forced_vibrations1():
    # Scaling with u_c based on resonance amplitude
    from vib import solver, visualize
    from math import pi

    delta = 0.99
    alpha = 1 - delta ** 2
    u, t = solver(
        I=alpha,
        V=0,
        m=1,
        b=0,
        s=lambda u: u,
        F=lambda t: (1 - delta ** 2) * cos(delta * t),
        dt=2 * pi / 160,
        T=2 * pi * 160,
    )
    visualize(u, t)
    raw_input()
Exemple #7
0
import sys, os

sys.path.insert(0, os.path.join(os.pardir, 'src-vib'))
from vib import solver, visualize, plt
from math import pi, sin
import numpy as np

beta_values = [0.005, 0.05, 0.2]
beta_values = [0.00005]
gamma_values = [5, 1.5, 1.1, 1]
for i, beta in enumerate(beta_values):
    for gamma in gamma_values:
        u, t = solver(I=1,
                      V=0,
                      m=1,
                      b=2 * beta,
                      s=lambda u: u,
                      F=lambda t: sin(gamma * t),
                      dt=2 * pi / 60,
                      T=2 * pi * 20,
                      damping='quadratic')
        visualize(u, t, title='gamma=%g' % gamma, filename='tmp_%s' % gamma)
        print gamma, 'max u amplitude:', np.abs(u).max()
    for ext in 'png', 'pdf':
        cmd = 'doconce combine_images '
        cmd += ' '.join(['tmp_%s.' % gamma + ext for gamma in gamma_values])
        cmd += ' resonance%d.' % (i + 1) + ext
        os.system(cmd)
raw_input()
Exemple #8
0
import sys, os
sys.path.insert(0, os.path.join(os.pardir, 'src-vib'))
from vib import solver, visualize, plt
from math import pi, sin
import numpy as np

beta_values = [0.005, 0.05, 0.2]
beta_values = [0.00005]
gamma_values = [5, 1.5, 1.1, 1]
for i, beta in enumerate(beta_values):
    for gamma in gamma_values:
        u, t = solver(I=1, V=0, m=1, b=2*beta, s=lambda u: u,
                      F=lambda t: sin(gamma*t), dt=2*pi/60,
                      T=2*pi*20, damping='quadratic')
        visualize(u, t, title='gamma=%g' %
                  gamma, filename='tmp_%s' % gamma)
        print gamma, 'max u amplitude:', np.abs(u).max()
    for ext in 'png', 'pdf':
        cmd = 'doconce combine_images '
        cmd += ' '.join(['tmp_%s.' % gamma + ext for gamma in gamma_values])
        cmd += ' resonance%d.' % (i+1) + ext
        os.system(cmd)
raw_input()