Exemplo n.º 1
0
def RHS(X, t=0.0):
    x1, x2 = X
    gs.wedge(theta=x1, thetaDot=x2)
    [Fx, Fy, Mz] = aero.calcLoad()
    x1dot = x2
    x2dot = -100*x1 + Mz
    return [x1dot, x2dot]
def RHS(X, t=0.0):
    x1, x2 = X
    gs.wedge(theta=x1, thetaDot=x2)
    [Fx, Fy, Mz] = aero.calcLoad()
    x1dot = x2
    x2dot = -100 * x1 + Mz
    return [x1dot, x2dot]
def residual(x):
    T = x[-1]
    x = x[:-1]
    omega0 = 2*np.pi / T
    Omega = omega0 * n
    t = np.linspace(0, T, N+1)
    t = t[0:-1]

    # # Check derivatives
    a = 0.1
    x_ = np.sin(a*t)
    dxdt_ = a*np.cos(a*t)

    X_ = np.fft.fft(x_)
    DxDt_ = np.fft.ifft(1j * np.multiply(Omega, X_))

    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3:
            np.disp('You have a problem with imaginary numbers!')
            np.disp([np.imag(x[ix]), np.imag(dx[ix])])
        gs.wedge(theta=np.real(x[ix]), thetaDot=np.real(dx[ix]))
        [Fx, Fy, Mz] = aero.calcLoad()
        f[ix] = Mz
    Residual = ddx + 100 * x - Mz
    Residual = Residual

    Residual = np.sum(np.abs((Residual**2)))
    # Residual = np.sum(np.abs((Residual**1)))
    # return Residual + np.max(np.abs(np.real(DxDt_ - dxdt_)))
    return Residual
def residual(x):
    T = x[-1]
    x = x[:-1]
    omega0 = 2 * np.pi / T
    Omega = omega0 * n
    t = np.linspace(0, T, N + 1)
    t = t[0:-1]

    # # Check derivatives
    a = 0.1
    x_ = np.sin(a * t)
    dxdt_ = a * np.cos(a * t)

    X_ = np.fft.fft(x_)
    DxDt_ = np.fft.ifft(1j * np.multiply(Omega, X_))

    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3:
            np.disp('You have a problem with imaginary numbers!')
            np.disp([np.imag(x[ix]), np.imag(dx[ix])])
        gs.wedge(theta=np.real(x[ix]), thetaDot=np.real(dx[ix]))
        [Fx, Fy, Mz] = aero.calcLoad()
        f[ix] = Mz
    Residual = ddx + 100 * x - Mz
    Residual = Residual

    Residual = np.sum(np.abs((Residual**2)))
    # Residual = np.sum(np.abs((Residual**1)))
    # return Residual + np.max(np.abs(np.real(DxDt_ - dxdt_)))
    return Residual
Exemplo n.º 5
0
def residual(x):
    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3:
            np.disp('You have a problem with imaginary numbers!')
            np.disp([np.imag(x[ix]), np.imag(dx[ix])])
        gs.wedge(theta=np.real(x[ix]), thetaDot=np.real(dx[ix]))
        [Fx, Fy, Mz] = aero.calcLoad()
        f[ix] = Mz
    Residual = ddx + 100 * x - Mz
    Residual = np.sum(np.abs((Residual**2)))
    return Residual
def residual(x):
    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3:
            np.disp('You have a problem with imaginary numbers!')
            np.disp([np.imag(x[ix]), np.imag(dx[ix])])
        gs.wedge(theta=np.real(x[ix]), thetaDot=np.real(dx[ix]))
        [Fx, Fy, Mz] = aero.calcLoad()
        f[ix] = Mz
    Residual = ddx + 100 * x - Mz
    Residual = np.sum(np.abs((Residual**2)))
    return Residual
Exemplo n.º 7
0
# Author: Koorosh Gobal
# Python code for 3.5
# Main file for flutter analysis
# -----------------------------------
import getShape as gs
import aerodynamic as aero
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.integrate import odeint
# -----------------------------------
gs.wedge(theta = 0, thetaDot = 5)
[Fx, Fy, Mz] = aero.calcLoad()

N = 9
T = 1*2*np.pi
t = np.linspace(0, T, N+1)
t = t[0:-1]
Omega = np.fft.fftfreq(N, T/(2*np.pi*N))
x0 = np.zeros(N)

def residual(x):
    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3:
            np.disp('You have a problem with imaginary numbers!')
            np.disp([np.imag(x[ix]), np.imag(dx[ix])])
        gs.wedge(theta=np.real(x[ix]), thetaDot=np.real(dx[ix]))
# Author: Koorosh Gobal
# Python code for 3.5
# Main file for flutter analysis
# This file calls 'aerodynamics' and 'getShape' functions. Please make sure that
# you have them is the same directory.
# -----------------------------------
import getShape as gs
import aerodynamic as aero
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.integrate import odeint
# -----------------------------------
gs.wedge(theta=0, thetaDot=5)
[Fx, Fy, Mz] = aero.calcLoad()

N = 9
T = 1 * 2 * np.pi
t = np.linspace(0, T, N + 1)
t = t[0:-1]
Omega = np.fft.fftfreq(N, T / (2 * np.pi * N))
x0 = np.zeros(N)


def residual(x):
    X = np.fft.fft(x)
    dx = np.fft.ifft(np.multiply(1j * Omega, X))
    ddx = np.fft.ifft(np.multiply(-Omega**2, X))
    f = np.zeros(N)
    for ix in range(0, len(x)):
        if np.imag(x[ix]) > 1e-3 or np.imag(dx[ix]) > 1e-3: