Beispiel #1
0
def cqcglConvertReq(N2, inputFile, outputFile, indices,
                    MaxIter=300, tol=1e-12, doesPrint=False):
    """
    convert the relative equilibria found for some truncation number N to
    a finer resolution N2 = 2*N.

    parameters:
    N2          the dimension of the finer system
    inputFile   file storing reqs with N
    outputFile  file is about to create to store reqs with 2*N
    indices     the indices of reqs needed to be converted
    """
    # N = 512
    d = 50
    h = 0.005                   # time step is not used acturally
    cgl = pyCqcgl1d(N2, d, h, True, 0,
                    -0.1, 1.0, 0.8, 0.125, 0.5, -0.1, -0.6,
                    4)

    for i in indices:
        a0, wth0, wphi0, err0 = cqcglReadReq(inputFile, str(i))
        a0unpad = 2 * cgl.generalPadding(a0)
        a, wth, wphi, err = cgl.findReq(a0unpad, wth0, wphi0,
                                        MaxIter, tol, True, doesPrint)
        print err
        cqcglSaveReq(outputFile, str(i), a, wth, wphi, err)
Beispiel #2
0
def cqcglFindReq(fileName, frac=0.3, MaxIter=300, Ntrial=1000):
    N = 512
    d = 50
    h = 0.005
    cgl = pyCqcgl1d(N, d, h, -0.1, 1.0, 0.8, 0.125, 0.5, -0.1, -0.6)

    ReqNum = 1
    for i in range(Ntrial):
        A0 = 3*centerRand(2*N, frac)
        a0 = cgl.Config2Fourier(A0).squeeze()
        wth0 = rand()
        wphi0 = rand()
        a, wth, wphi, err = cgl.findReq(a0, wth0, wphi0, MaxIter,
                                        1e-12, True, False)
        if err < 1e-12:
            print "found : " + str(ReqNum)
            cqcglSaveReq(fileName, str(ReqNum), a, wth, wphi, err)
            ReqNum += 1
Beispiel #3
0
        a, wth, wphi, err = cgl.findReq(a0unpad, wth0, wphi0,
                                        MaxIter, tol, True, doesPrint)
        print err
        cqcglSaveReq(outputFile, str(i), a, wth, wphi, err)


case = 9

if case == 1:
    """
    find the relative equlibria after changing dimension
    """
    N = 512
    d = 50
    h = 0.005
    cgl = pyCqcgl1d(N, d, h, -0.1, 1.0, 0.8, 0.125, 0.5, -0.1, -0.6)
    Ndim = cgl.Ndim

    a0, wth0, wphi0, err0 = cqcglReadReq('../../data/cgl/req.h5', '10')

    a0unpad = 2*cgl.generalPadding(a0)
    a, wth, wphi, err = cgl.findReq(a0unpad, 0, wphi0,
                                    100, 1e-12, True, True)
    # cqcglSaveReq("req.hdf5", '1', a, wth, wphi, err)
    nstp = 10000
    aa = cgl.intg(a, nstp, 1)
    plotConfigSpace(cgl.Fourier2Config(aa), [0, d, 0, nstp*h])

if case == 2:
    """
    try different guesses to find relative equilibria