lqg/lqg_julien1_loop.py
changeset 0 0efde00f9229
equal deleted inserted replaced
-1:000000000000 0:0efde00f9229
       
     1 #!/usr/bin/python
       
     2 
       
     3 import scipy as sp
       
     4 from lqg import lqg
       
     5 from cl import cl
       
     6 
       
     7 A, dA = sp.convolve([1, -0.7], [1, 0.9]), 2
       
     8 B, dB = sp.convolve([0.079, 0.221], [1, 0.9]), 2
       
     9 C, dC = sp.array([1, -0.7]), 1
       
    10 k = 2
       
    11 int1 = 1
       
    12 F, dF = sp.array([1, -1]), 1
       
    13 V, dV = 1, 0
       
    14 W, dW = 1, 0
       
    15 u_lqg = []
       
    16 y_lqg =[]
       
    17 uy_lqg = []
       
    18 no_points = 101
       
    19 rhovector = sp.logspace(-1.63, 1.2, no_points)
       
    20 
       
    21 for i, rho in enumerate(rhovector):
       
    22     print i, rho
       
    23     R1, dR1, Sc, dSc = lqg (A, dA, B, dB, C, dC, k, rho, V, dV, W, dW, F, dF)
       
    24     print R1, dR1, Sc, dSc
       
    25     Nu, dNu, Du, dDu, Ny, dNy, Dy, dDy, yvar, uvar = \
       
    26         cl(A, dA, B, dB, C, dC, k, Sc, dSc, R1, dR1, int1)
       
    27     uvar = sp.atleast_1d(uvar.squeeze())
       
    28     yvar = sp.atleast_1d(yvar.squeeze())
       
    29     u_lqg = sp.concatenate((u_lqg, uvar))
       
    30     y_lqg = sp.concatenate((y_lqg, yvar))
       
    31     if sp.size(uy_lqg) == 0:
       
    32         uy_lqg = sp.array([rho, uvar[0], yvar[0]])
       
    33     else:
       
    34         uy_lqg = sp.vstack((uy_lqg, sp.array([rho, uvar[0], yvar[0]])))
       
    35 
       
    36 plot(u_lqg, y_lqg)