def setParams():
    basename = 'zquarterradius_farfield_BConaxis_hairrad05'
    if os.path.exists('/Volumes/PATRIOT32G'):
        basedir = '/Volumes/PATRIOT32G/CricketProject/ChooseEpsilon/'
    else:
        basedir = os.path.expanduser('~/CricketProject/ChooseEpsilon/')
    fname = os.path.join(basedir,basename)
    pdict ={}
    circrad = 0.005 #millimeters
    pdict['circrad'] = circrad
    zh = circrad/4
    halfzpts = np.round(200*circrad/zh)
    pdict['N'] = 400
    th = 2*np.pi/pdict['N']
    ch = circrad*th
    pdict['circh'] = ch
    theta = np.arange(th/2.,2*np.pi,th)
    pdict['theta'] = theta
    xcirc = circrad*np.cos(theta)
    ycirc = circrad*np.sin(theta)
    Xcirc = np.column_stack([xcirc,ycirc])
    pdict['obsptscirc'] = np.column_stack([Xcirc,np.zeros(Xcirc[:,0].shape)])
    #spatial parameters
    hl = 20*circrad
    hextent = hl - hl/2
    Npts = 5
    Mpts = 4*Npts
    pdict['h'] = hextent/size[0]
    X1 = mygrids.makeGridCenter(Npts,Mpts,pdict['h'],(-hl,-hl))
    X1 = np.reshape(X1,(Npts*Mpts,2))
    X1 = np.column_stack([X1,np.zeros(X1[:,0].shape)])
    X2 = mygrids.makeGridCenter(Npts,Mpts,pdict['h'],(hl/2,-hl))
    X2 = np.reshape(X2,(Npts*Mpts,2))
    X2 = np.column_stack([X2,np.zeros(X2[:,0].shape)])
    newN = 2*Npts
    newM = Npts
    X3 = mygrids.makeGridCenter(newN,newM,pdict['h'],(-hl/2,-hl))
    X3 = np.reshape(X3,(newN*newM,2))
    X3 = np.column_stack([X3,np.zeros(X3[:,0].shape)])
    X4 = mygrids.makeGridCenter(newN,newM,pdict['h'],(-hl/2,hl/2))
    X4 = np.reshape(X4,(newN*newM,2))
    X4 = np.column_stack([X4,np.zeros(X4[:,0].shape)])
    pdict['obspts'] = np.rod.w_stack([X1,X2,X3,X4])
    nodes = np.zeros((2*halfzpts+1,3))
    nodes[:,2] = np.arange(-halfzpts*zh,(halfzpts+1)*zh,zh)
    pdict['nodes'] = nodes
    Nz = (halfzpts*2)*10
    zline = np.zeros((Nz,3))
    zline[:,2] = np.linspace(-halfzpts*zh,halfzpts*zh,Nz)
    pdict['obsptszline'] = zline
    pdict['vh']=1.0 #mm/s
    pdict['mu']=1.85e-8 #kg/(mm s)
    pdict['nu']=15.7 #mm^2/s
    return pdict, fname
Beispiel #2
0
def setParams():
    basename = 'zquarterradius_farfield_BConaxis_hairrad05'
    if os.path.exists('/Volumes/PATRIOT32G'):
        basedir = '/Volumes/PATRIOT32G/CricketProject/ChooseEpsilon/'
    else:
        basedir = os.path.expanduser('~/CricketProject/ChooseEpsilon/')
    fname = os.path.join(basedir, basename)
    pdict = {}
    circrad = 0.005  #millimeters
    pdict['circrad'] = circrad
    zh = circrad / 4
    halfzpts = np.round(200 * circrad / zh)
    pdict['N'] = 400
    th = 2 * np.pi / pdict['N']
    ch = circrad * th
    pdict['circh'] = ch
    theta = np.arange(th / 2., 2 * np.pi, th)
    pdict['theta'] = theta
    xcirc = circrad * np.cos(theta)
    ycirc = circrad * np.sin(theta)
    Xcirc = np.column_stack([xcirc, ycirc])
    pdict['obsptscirc'] = np.column_stack([Xcirc, np.zeros(Xcirc[:, 0].shape)])
    #spatial parameters
    hl = 20 * circrad
    hextent = hl - hl / 2
    Npts = 5
    Mpts = 4 * Npts
    pdict['h'] = hextent / size[0]
    X1 = mygrids.makeGridCenter(Npts, Mpts, pdict['h'], (-hl, -hl))
    X1 = np.reshape(X1, (Npts * Mpts, 2))
    X1 = np.column_stack([X1, np.zeros(X1[:, 0].shape)])
    X2 = mygrids.makeGridCenter(Npts, Mpts, pdict['h'], (hl / 2, -hl))
    X2 = np.reshape(X2, (Npts * Mpts, 2))
    X2 = np.column_stack([X2, np.zeros(X2[:, 0].shape)])
    newN = 2 * Npts
    newM = Npts
    X3 = mygrids.makeGridCenter(newN, newM, pdict['h'], (-hl / 2, -hl))
    X3 = np.reshape(X3, (newN * newM, 2))
    X3 = np.column_stack([X3, np.zeros(X3[:, 0].shape)])
    X4 = mygrids.makeGridCenter(newN, newM, pdict['h'], (-hl / 2, hl / 2))
    X4 = np.reshape(X4, (newN * newM, 2))
    X4 = np.column_stack([X4, np.zeros(X4[:, 0].shape)])
    pdict['obspts'] = np.rod.w_stack([X1, X2, X3, X4])
    nodes = np.zeros((2 * halfzpts + 1, 3))
    nodes[:, 2] = np.arange(-halfzpts * zh, (halfzpts + 1) * zh, zh)
    pdict['nodes'] = nodes
    Nz = (halfzpts * 2) * 10
    zline = np.zeros((Nz, 3))
    zline[:, 2] = np.linspace(-halfzpts * zh, halfzpts * zh, Nz)
    pdict['obsptszline'] = zline
    pdict['vh'] = 1.0  #mm/s
    pdict['mu'] = 1.85e-8  #kg/(mm s)
    pdict['nu'] = 15.7  #mm^2/s
    return pdict, fname
def constructSolns(circrad,eps,zh,halfzpts,regfunc):
    #spatial parameters
    origin = (-0.05,-0.05) #millimeters
    N = 100
    M = 100
    h = 1.e-3
    X = mygrids.makeGridCenter(N,M,h,origin)
    X = np.reshape(X,(N*M,2))
    #get exact solution
    time = [0]
    freq=10 #Hz
    vh=1.0 #mm/s
    vinf=0.0
    mu=1.85e-8 #kg/(mm s)
    nu=15.7 #mm^2/s
    print('Calculating exact solution...')
    uexact,vexact = ES.circularCylinder2DOscillating(X[:,0],X[:,1],circrad,nu,mu,freq,vh,vinf,time)
    Vexact = np.column_stack([uexact,vexact])
    print('Calculating reg velocity...')
    #get regularized solution
    nodes = np.zeros((2*halfzpts+1,3))
    nodes[:,2] = np.arange(-halfzpts*zh,(halfzpts+1)*zh,zh)
    alph = np.sqrt(1j*2*np.pi*freq/nu)
    rb, f = regfunc(nodes,eps,mu,alph,circrad,vh)
#    print("forces")
#    print(f)
    X = np.column_stack([X,np.zeros(X[:,0].shape)])
    Vreg = rb.calcVel(X,nodes,f)
    zline = np.arange(-halfzpts*zh,(halfzpts+1/10)*zh,zh/10)
    zlinearr = np.zeros((zline.shape[0],3))
    zlinearr[:,2] = zline
    zlinearr[:,0] = circrad
    Vzline = rb.calcVel(zlinearr,nodes,f)
    return X, Vexact, Vreg, Vzline, zline
def constructSolns(circrad, eps, zh, halfzpts, regfunc):
    #spatial parameters
    origin = (-0.05, -0.05)  #millimeters
    N = 100
    M = 100
    h = 1.e-3
    X = mygrids.makeGridCenter(N, M, h, origin)
    X = np.reshape(X, (N * M, 2))
    #get exact solution
    time = [0]
    freq = 10  #Hz
    vh = 1.0  #mm/s
    vinf = 0.0
    mu = 1.85e-8  #kg/(mm s)
    nu = 15.7  #mm^2/s
    print('Calculating exact solution...')
    uexact, vexact = ES.circularCylinder2DOscillating(X[:, 0], X[:, 1],
                                                      circrad, nu, mu, freq,
                                                      vh, vinf, time)
    Vexact = np.column_stack([uexact, vexact])
    print('Calculating reg velocity...')
    #get regularized solution
    nodes = np.zeros((2 * halfzpts + 1, 3))
    nodes[:, 2] = np.arange(-halfzpts * zh, (halfzpts + 1) * zh, zh)
    alph = np.sqrt(1j * 2 * np.pi * freq / nu)
    rb, f = regfunc(nodes, eps, mu, alph, circrad, vh)
    #    print("forces")
    #    print(f)
    X = np.column_stack([X, np.zeros(X[:, 0].shape)])
    Vreg = rb.calcVel(X, nodes, f)
    zline = np.arange(-halfzpts * zh, (halfzpts + 1 / 10) * zh, zh / 10)
    zlinearr = np.zeros((zline.shape[0], 3))
    zlinearr[:, 2] = zline
    zlinearr[:, 0] = circrad
    Vzline = rb.calcVel(zlinearr, nodes, f)
    return X, Vexact, Vreg, Vzline, zline