def VAWT_Power(x_v, y_v, x_h, y_h, params):
	"""
	inputs:
		x_v: numpy array with VAWT x locations as follows [x1, x2, ..., xn]
		y_v: numpy array with VAWT y locations as follows [y1, y2, ..., yn]
		x_h: numpy array with HAWT x locations as follows [x1, x2, ..., xm]
		norm_vel_func: function handle that calculates the normalized velocity at each location 
		velf: free stream velocity
		dia: turbine diameter
		tsr: tip speed ratio
		solidity: 
	returns:
		loss: numpy array with loss of each turbine as follows [L1, L2, ..., Ln]
	"""
	velf, r_tower, r_VAWT = params
	dia = 2*r_VAWT  # turbine diameter (m)
	tsr = 4.0  # tip speed ratio
	B = 3. # number of blades
	chord = 0.25 # chord lenth (m)
	solidity = (chord*B)/(dia/2.)
	n = np.size(x_v) #number of turbines
	loss_VT = np.zeros(n) #total loss on each turbine
	tot_loss = np.zeros(n)
	power = np.zeros(n)
	cp = 0.3
	rho = 1.1716
	h = 2.*dia
	# ----------------new stuff------------------------
	cfd_data = 'velo' #use this for simple wake model
	men = np.array( [-0.0006344223751663201, 0.01055675755786011, -0.004073212523707764] )
	spr = np.array( [-0.005187125854670714, 0.06397918461247416, 0.543874357807372] )
	scl = np.array( [6.667328694868336, 5.617498827673229, 21.520026361522778] )
	rat = np.array( [-2.129054494312758, 45.17191461412915] )
	tns = np.array( [-1.5569348878268718, 31.913143231782648] )
	param = np.array([men,spr,scl,rat,tns])
	#----------------------------------------------------
	
	#loss on a turbine from all the other turbines [Lj1, Lj2, Lj3, Lj4, ..., Lji] where Ljn = loss on turbine j from turbine n
	ind_loss = np.zeros(n)
	for i in range(0, n):
		for j in range(0, n):
			if i == j:
				ind_loss[j] = 0 #i.e. L11 = L22 = L33 = 0... turbine loss from itself is zero
			else:
				ind_loss[j] = 1. - velocity_field(x_v[j], y_v[j], x_v[i] - x_v[j], y_v[i] - y_v[j], velf, dia, tsr, solidity, cfd_data, param)
		loss_VT[i] = np.linalg.norm(ind_loss,2) #calculate the sum of the squares (the 2 norm)
		ind_loss = np.zeros(n)
	loss_HT = loss_cylinder(x_h, y_h, x_v, y_v, r_tower, r_VAWT) #loss from HAWT towers
	for z in range(0, n):
		tot_loss[z] = (loss_HT[z]**2. + loss_VT[z]**2.)**0.5
		if tot_loss[z] > 1.:
			tot_loss[z] = 1.
		vel = (1-tot_loss[z])*velf
		power[z] = 0.5*rho*cp*dia*h*vel**3
	return power
Exemplo n.º 2
0
elif cfd_data == 'vort2':
    loc1,loc2,loc3,spr1,spr2,skw1,skw2,scl1,scl2,scl3 = vorticity2(tsr,solidity)
    param = np.array([loc1,loc2,loc3,spr1,spr2,skw1,skw2,scl1,scl2,scl3])

    # print param
    # import time
    #
    # time.sleep(10)

elif cfd_data == 'velo2':
    spr1,pow1,pow2,spr2,skw,scl1,scl2,scl3 = velocity2(tsr,solidity)
    param = np.array([spr1,pow1,pow2,spr2,skw,scl1,scl2,scl3])



vel = velocity_field(xt,yt,xt + x0,yt + y0,velf,dia,tsr,solidity,cfd_data,param)

print '\nNormalized velocity at (',x0,',',y0,') from the turbine =',vel,'\n' # output velocity (normalized by free stream wind speed)

## Plotting
fs = 25 # 18# font size for plots

# Option to plot velocity profiles
vel_slice = True
vel_slice = False # comment this out if desired on

# Option to plot a full velocity domain
plot_dist = True
plot_dist = False # comment this out if desired on

# Plotting velocity profiles
Exemplo n.º 3
0
    error20 = np.zeros_like(pos20)

    tot2 = np.size(pos2)
    tot4 = np.size(pos4)
    tot6 = np.size(pos6)
    tot8 = np.size(pos8)
    tot10 = np.size(pos10)
    tot15 = np.size(pos15)
    tot20 = np.size(pos20)

    veltype_in = 'x'
    rot = tsr*velf/(dia/2.)
    chord = solidity*(dia/2.)/B

    for i in range(np.size(pos2)):
        velp = velocity_field(xt,yt,2*dia,pos2[i],velf,dia,rot,chord,B,veltype=veltype_in)
        error2[i] = ((1.-velp)-(1.-velo2[i]))**2
        print '2D',i+1,'of',tot2,'TSR:',tsr,'Solidity:',solidity,'Error:',error2[i],'Velp:',velp,'Velo:',velo2[i],'Pos:',pos2[i]
    for i in range(np.size(pos4)):
        velp = velocity_field(xt,yt,4*dia,pos4[i],velf,dia,rot,chord,B,veltype=veltype_in)
        error4[i] = ((1.-velp)-(1.-velo4[i]))**2
        print '4D',i+1,'of',tot4,'TSR:',tsr,'Solidity:',solidity,'Error:',error4[i],'Velp:',velp,'Velo:',velo4[i],'Pos:',pos4[i]
    for i in range(np.size(pos6)):
        velp = velocity_field(xt,yt,6*dia,pos6[i],velf,dia,rot,chord,B,veltype=veltype_in)
        error6[i] = ((1.-velp)-(1.-velo6[i]))**2
        print '6D',i+1,'of',tot6,'TSR:',tsr,'Solidity:',solidity,'Error:',error6[i],'Velp:',velp,'Velo:',velo6[i],'Pos:',pos6[i]
    for i in range(np.size(pos8)):
        velp = velocity_field(xt,yt,8*dia,pos8[i],velf,dia,rot,chord,B,veltype=veltype_in)
        error8[i] = ((1.-velp)-(1.-velo8[i]))**2
        print '8D',i+1,'of',tot8,'TSR:',tsr,'Solidity:',solidity,'Error:',error8[i],'Velp:',velp,'Velo:',velo8[i],'Pos:',pos8[i]
    for i in range(np.size(pos10)):
Exemplo n.º 4
0
    def test_PIV(self):

        x15 = np.array([
            -0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5,
            -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081,
            -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391,
            0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        x20 = np.array([
            -0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5,
            -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081,
            -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391,
            0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        x25 = np.array([
            -0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5,
            -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081,
            -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391,
            0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        x30 = np.array([
            -0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5,
            -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081,
            -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391,
            0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        x35 = np.array([
            -0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5,
            -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081,
            -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391,
            0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        x40 = np.array([
            -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133,
            -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339,
            0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811
        ])
        y15 = np.array([
            0.994109059733553, 0.9963677091332376, 1.0005562115755295,
            1.0129863984422722, 1.0507201982582595, 0.9041429426683261,
            0.6716433705834841, 0.5201309340176287, 0.508144821028986,
            0.45366206008875143, 0.4120816289764176, 0.3841500969704306,
            0.36762989356268116, 0.34878204855733175, 0.3239136841769655,
            0.30087738601863206, 0.2879935890797586, 0.26790770257593155,
            0.2625797365850182, 0.292431451988392, 0.32394314025359344,
            0.3491215866639411, 0.3443858871235991, 0.3482695942305222,
            0.3129449223429124, 0.36582747813800515, 0.4154704750687794,
            0.49039503797192485, 0.6038500532436828, 0.7927363063069286,
            0.9055264980137487, 0.9492042298526092, 0.9678480377419288
        ])
        y20 = np.array([
            0.9920370542708112, 0.9937027721069257, 0.9957821547724749,
            1.0042398848773346, 0.9749571783229305, 0.8545201774180555,
            0.565802548086458, 0.5143332054399019, 0.489198302575,
            0.44408180130876845, 0.3816702901351002, 0.35005844980465,
            0.33679345047454295, 0.3230305737612392, 0.3146901353633469,
            0.29915244503218225, 0.2790206166599524, 0.2464443364444221,
            0.2475139147846546, 0.25357920856345817, 0.27126299099141044,
            0.2987673093397647, 0.3182385501649433, 0.3243813328675722,
            0.30742297967502097, 0.32253464736566645, 0.3693305499571722,
            0.4191276334361715, 0.5015171898966418, 0.6228502433753057,
            0.8230607176338183, 0.9264600739810046, 0.9616530515736079
        ])
        y25 = np.array([
            0.9879572983671737, 0.9905509911272896, 0.9933676654604374,
            0.9923430478507566, 0.9160865587232668, 0.727774179726256,
            0.5833627736796199, 0.4815735966162955, 0.4258818988364446,
            0.40697818686203785, 0.3645090556659908, 0.33624432950148214,
            0.3254855613810157, 0.3103304514855841, 0.3045151031176352,
            0.28401646740896264, 0.2593430020697244, 0.23659060256721978,
            0.22300420317944888, 0.2244438460371643, 0.23642978330838485,
            0.2568650503421204, 0.28114157843083193, 0.294601202395863,
            0.3006303134268269, 0.3118773622351477, 0.3203024532857655,
            0.3747931924965308, 0.41075281837916877, 0.5033971635645369,
            0.6381178175981282, 0.8832861499445961, 0.9780827152012185
        ])
        y30 = np.array([
            0.9807919873645041, 0.9799943204500705, 0.9756659438025117,
            0.9597111733105987, 0.8640379300795783, 0.6756090098761603,
            0.5574514345456549, 0.48935854692854497, 0.428523583438216,
            0.3833992822748339, 0.3480531699708427, 0.32487761318471114,
            0.3153752965437699, 0.2971902045364618, 0.2830498661729626,
            0.2701094817124857, 0.2525140339109516, 0.22990689461698513,
            0.21388156547631884, 0.2009225725260476, 0.2109170460152375,
            0.22197598259760387, 0.24007485599064649, 0.2629099716848817,
            0.28306559237296497, 0.29465097651166405, 0.29791611270965696,
            0.320843380159032, 0.365988216767817, 0.435994478045424,
            0.5459295715799363, 0.7790196684279612, 0.9232640197764616
        ])
        y35 = np.array([
            0.9771079214279068, 0.9739267876288416, 0.9659755072544549,
            0.9409586395095753, 0.8372410989082885, 0.6761226132078453,
            0.5567979451297009, 0.46883935558555223, 0.41825105219857445,
            0.3643627166731387, 0.33608496528240905, 0.31852020274820736,
            0.3061917562496233, 0.28608694443477783, 0.273103042317234,
            0.26439124635620204, 0.2478225127262987, 0.22900647970420313,
            0.20929176925815257, 0.19435346927934738, 0.19534832002282343,
            0.19777809452729966, 0.21620168910917673, 0.23300547991382745,
            0.25288024387549046, 0.27049877766131897, 0.2804228982454348,
            0.2916868458391746, 0.3235522394271216, 0.3723078207006349,
            0.4706069281766252, 0.6090953502184843, 0.8713603615558797
        ])
        y40 = np.array([
            0.45465337175396475, 0.3980109024658175, 0.35904507111616846,
            0.32774805291916986, 0.31088720860935865, 0.29832097587839296,
            0.2821950936769575, 0.26788022954331897, 0.25719920421744913,
            0.24586751730014048, 0.2286008521345077, 0.20763836919642048,
            0.1912065524478209, 0.1952723101174681, 0.1863567864754898,
            0.19527809328409215, 0.21004969265451465, 0.22887599974659367,
            0.2507107104057936, 0.26844672767918015, 0.27999051414332765,
            0.2936850402917538, 0.33560687204407424, 0.41822453322242903,
            0.5404777347489278, 0.7985895165740945
        ])

        # Wake model calculation using PIV data specifications
        rad = 0.5
        dia = 2 * rad
        velf = 9.308422677
        tsr = 4.5
        rot = tsr * velf / rad
        chord = 0.06
        B = 2
        rom15 = np.zeros_like(x15)
        rom20 = np.zeros_like(x20)
        rom25 = np.zeros_like(x25)
        rom30 = np.zeros_like(x30)
        rom35 = np.zeros_like(x35)
        rom40 = np.zeros_like(x40)
        for i in range(np.size(x15)):
            rom15[i] = velocity_field(0.0, 0.0, 0.75, x15[i] * dia, velf, dia,
                                      rot, chord, B)
            rom20[i] = velocity_field(0.0, 0.0, 1.0, x20[i] * dia, velf, dia,
                                      rot, chord, B)
            rom25[i] = velocity_field(0.0, 0.0, 1.25, x25[i] * dia, velf, dia,
                                      rot, chord, B)
            rom30[i] = velocity_field(0.0, 0.0, 1.5, x30[i] * dia, velf, dia,
                                      rot, chord, B)
            rom35[i] = velocity_field(0.0, 0.0, 1.75, x35[i] * dia, velf, dia,
                                      rot, chord, B)
        for i in range(np.size(x40)):
            rom40[i] = velocity_field(0.0, 0.0, 2.0, x40[i] * dia, velf, dia,
                                      rot, chord, B)

        idx1 = np.array([
            4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
            22, 23, 24, 25, 26, 27, 28, 29
        ])
        idx2 = np.array([
            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
            19, 20, 21, 22, 23, 24, 25
        ])
        np.testing.assert_allclose(rom15[idx1], y15[idx1], atol=0.4)
        np.testing.assert_allclose(rom20[idx1], y20[idx1], atol=0.4)
        np.testing.assert_allclose(rom25[idx1], y25[idx1], atol=0.4)
        np.testing.assert_allclose(rom30[idx1], y30[idx1], atol=0.4)
        np.testing.assert_allclose(rom35[idx1], y35[idx1], atol=0.4)
        np.testing.assert_allclose(rom40[idx2], y40[idx2], atol=0.6)

        # Wind tunnel test data
        x15wt = np.linspace(-1.7, 1.7, 21)
        y15wt = np.array([
            0.98, 0.98, 0.985, 0.99, 0.995, 1.005, 0.96, 0.73, 0.5, 0.44, 0.54,
            0.51, 0.66, 0.9, 1.01, 1.0, 0.99, 0.985, 0.98, 0.98, 0.97
        ])

        # Wake model calculation using wind tunnel data specifications
        rad = 0.515
        dia = 2 * rad
        velf = 16.0
        sol = 0.5
        tsr = 1.6
        rot = tsr * velf / rad
        B = 3
        chord = sol * rad / B
        rom15wt = np.zeros_like(x15wt)
        for i in range(np.size(rom15wt)):
            rom15wt[i] = velocity_field(0.0, 0.0, 1.5 * dia, x15wt[i] * dia,
                                        velf, dia, rot, chord, B)

        np.testing.assert_allclose(rom15wt, y15wt, atol=0.4)
Exemplo n.º 5
0
n = 200  # number of divisions in the lateral direction (for Simpson's Rule)
# integration = 'gskr'  # use 21 Point Gauss-Kronrod Rule Quadrature integration

########################################################################################################################
########################################################################################################################
########################################################################################################################
########################################################################################################################

# CALCULATING VELOCITY AT GIVEN POINT (x0,y0)
vel = velocity_field(xt,
                     yt,
                     x0,
                     y0,
                     Vinf,
                     dia,
                     rot,
                     chord,
                     B,
                     param=None,
                     veltype=veltype,
                     integration=integration,
                     m=m,
                     n=n)
print '\nNormalized velocity at (', x0, ',', y0, ') =', vel, '\n'  # output velocity (normalized by free stream wind speed)
pointval1 = 1.
pointval2 = 0.
pointval3 = 0.

fs = 25  # font size for plots

# PLOTTING VELOCITY PROFILES
if vel_slice == True:
Exemplo n.º 6
0
 error6 = np.zeros_like(pos6)
 error8 = np.zeros_like(pos8)
 error10 = np.zeros_like(pos10)
 error15 = np.zeros_like(pos15)
 error20 = np.zeros_like(pos20)
 
 tot2 = np.size(pos2)
 tot4 = np.size(pos4)
 tot6 = np.size(pos6)
 tot8 = np.size(pos8)
 tot10 = np.size(pos10)
 tot15 = np.size(pos15)
 tot20 = np.size(pos20)
 
 for i in range(np.size(pos2)):
     velp = velocity_field(xt,yt,2*dia,pos2[i],velf,dia,tsr,solidity,cfd_data,param)
     error2[i] = (velp-velo2[i])/velo2[i]
     print '2D',i,'of',tot2,'TSR:',tsr,'Solidity:',solidity
 for i in range(np.size(pos4)):
     velp = velocity_field(xt,yt,4*dia,pos4[i],velf,dia,tsr,solidity,cfd_data,param)
     error4[i] = (velp-velo4[i])/velo4[i]
     print '4D',i,'of',tot4,'TSR:',tsr,'Solidity:',solidity
 for i in range(np.size(pos6)):
     velp = velocity_field(xt,yt,6*dia,pos6[i],velf,dia,tsr,solidity,cfd_data,param)
     error6[i] = (velp-velo6[i])/velo6[i]
     print '6D',i,'of',tot6,'TSR:',tsr,'Solidity:',solidity
 for i in range(np.size(pos8)):
     velp = velocity_field(xt,yt,8*dia,pos8[i],velf,dia,tsr,solidity,cfd_data,param)
     error8[i] = (velp-velo8[i])/velo8[i]
     print '8D',i,'of',tot8,'TSR:',tsr,'Solidity:',solidity
 for i in range(np.size(pos10)):
n = 100
x = np.linspace(0,120.,n)
y = np.linspace(-2*6.,2*6.,n)


fs = 15
fig = plt.figure(1,figsize=(10,6))
fig.subplots_adjust(bottom=0,left=0,right=1,top=1)
ax = fig.gca(projection='3d')
X, Y = np.meshgrid(x, y)
G = np.zeros((n,n))

for i in range(n):
    for j in range(n):
        G[i,j] = velocity_field(0.,0.,X[i,j],Y[i,j],15.,6.,tsr,solidity,'velo',param)



pnt = ax.scatter(posdn,poslt,velod,'b.',label='CFD Data')

surf = ax.plot_surface(X/6., Y/6., G, rstride=1, cstride=1, color='g', linewidth=0, antialiased=True, alpha=0.5, label='SMG Surface')#cmap=cm.parula
ax.azim = -160
ax.elev = 35
ax.set_xlabel('$x/D$',fontsize=fs)
ax.set_ylabel('$y/D$',fontsize=fs)
ax.set_zlabel(r'$u/U_\infty$',fontsize=fs)
ax.set_xlim(0,20)
ax.set_ylim(-2,2)
ax.set_zlim(0,1.2)
ax.set_xticklabels(np.array([0,5,10,15,20]),fontsize=fs)
def overlap(xt,yt,diat,tsr,solidity,x0,y0,dia,velf,hub,out):
    """
    Calculating an effective velocity based on overlapping of wakes
    
    Parameters
    ----------
    xt : array
        downstream locations of turbines producing wakes (m)
    yt : array
        lateral locations of turbines producing wakes (m)
    diat : array
        diameters of each of the turbines producing wakes (m)
    tsr : array
        tip-speed ratio of each turbine
    solidity : array
        solidities of each turbine
    x0 : float
        downstream location of turbine being analyzed (m)
    y0 : float
        lateral location of turbine being analyzed (m)
    dia : float
        diameter of turbine being analyzed (m)
    velf : float
        free stream velocity (m/s)
    hub : bool
        option of using the hub velocity (True) or an average of
        velocities across the turbine's rotation (False)
    out : bool
        option of outputting the the information of turbines completed
        in the overlap calculation (True)
    
    Returns
    ----------
    veleff : float
        effective velocity in front of turbine (m/s)
    """
    
    N = np.size(xt) # number of turbines that overlap given turbine
    inte = 0. # initializing integration value
    r1 = y0 - dia/2. # lower bound of integration
    r2 = y0 + dia/2. # upper bound of integration
    n = 3
    if hub == True:
        y = np.array([y0]) # using hub velocity for effective velocity
    else:
        y = np.linspace(r1,r2,n) # using n velocity values for effective velocity
    
    vel = np.zeros_like(y)
    
    for i in range(N):
        for j in range(np.size(y)):
            vel[j] = 1. - velocity_field(xt[i],yt[i],x0,y[j],velf,diat[i],tsr[i],solidity[i])
        
        inte_n = np.average(vel)
        
        inte = inte + (inte_n)**2
        if out == True:
            print 'Turbine '+str(i+1)+' of '+str(N)+' completed'
    
    veleff = velf*(1. - sqrt(inte))
    
    return veleff
Exemplo n.º 9
0
def ydiff(y,x,xt,yt,Vinf,dia,rot,c,B):
    return velocity_field(xt,yt,x,y,Vinf,dia,rot,c,B,param=None,veltype='vort')*rot
Exemplo n.º 10
0
        # print tsrn1,tsrn2
        # print soln1,soln2
        # print p,q
        # time.sleep(10)
        param = np.array([men1,sdv1,rat1,wdt1,spr1,scl1,men2,sdv2,rat2,wdt2,spr2,scl2,men3,sdv3,rat3,wdt3,spr3,scl3,men4,sdv4,rat4,wdt4,spr4,scl4,p,q])

    elif cfd_data == 'velo2':
        spr1,pow1,pow2,spr2,skw,scl1,scl2,scl3 = velocity2(tsr,sol)
        param = np.array([spr1,pow1,pow2,spr2,skw,scl1,scl2,scl3])
        # print param
        # import time
        #
        # time.sleep(10)

    for i in range(np.size(x15)):
        rom15t[i] = velocity_field(0.,0.,1.5*dia,x15[i]*dia,velf,dia,tsr,sol,cfd_data,param)
        error_test[i] = (rom15t[i]-y15o[i])/y15o[i]
    error = np.average(fabs(error_test))
    errorstd = np.std(fabs(error_test))
    for i in range(np.size(rom15)):
        rom15[i] = velocity_field(0.,0.,1.5*dia,x15r[i]*dia,velf,dia,tsr,sol,cfd_data,param)
        print i
    
    fs = 15
    
    plt.figure(1)
    # plt.subplot(2,3,1)
    # plt.plot(x15,y15c,'r.',label='Experimental (closed)')
    # plt.plot(x15,y15o,'b.',label='Experimental (open)')
    if k == 0:
        plt.plot(x15,y15o,'b.',label='Experimental')
Exemplo n.º 11
0
N = 50
rom_y = np.linspace(-1.5, 1.5, N)
vel_a = np.zeros_like(rom_y)
vel_b = np.zeros_like(rom_y)
vel_c = np.zeros_like(rom_y)
vel_d = np.zeros_like(rom_y)
vel_e = np.zeros_like(rom_y)

for i in range(N):
    vel_a[i] = velocity_field(xt,
                              yt,
                              xr_a * r,
                              rom_y[i] * dia,
                              velf,
                              dia,
                              rot,
                              chord,
                              B,
                              param=None,
                              veltype=veltype)
    vel_b[i] = velocity_field(xt,
                              yt,
                              xr_b * r,
                              rom_y[i] * dia,
                              velf,
                              dia,
                              rot,
                              chord,
                              B,
                              param=None,
Exemplo n.º 12
0
 rom15 = np.zeros(33)
 rom20 = np.zeros(33)
 rom25 = np.zeros(33)
 rom30 = np.zeros(33)
 rom35 = np.zeros(33)
 rom40 = np.zeros(26)
 rom40f = np.zeros(33)
 
 rom15t = np.zeros(33)
 rom20t = np.zeros(33)
 rom25t = np.zeros(33)
 rom30t = np.zeros(33)
 rom35t = np.zeros(33)
 rom40t = np.zeros(26)
 for i in range(33):
     rom15[i] = velocity_field(xt,yt,0.75,x15[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     rom15t[i] = (rom15[i]-y15[i])/y15[i]
     rom20[i] = velocity_field(xt,yt,1.0,x20[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     rom20t[i] = (rom20[i]-y20[i])/y20[i]
     rom25[i] = velocity_field(xt,yt,1.25,x25[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     rom25t[i] = (rom25[i]-y25[i])/y25[i]
     rom30[i] = velocity_field(xt,yt,1.5,x30[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     rom30t[i] = (rom30[i]-y30[i])/y30[i]
     rom35[i] = velocity_field(xt,yt,1.75,x35[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     rom35t[i] = (rom35[i]-y35[i])/y35[i]
     rom40f[i] = velocity_field(xt,yt,2.0,x35[i]*dia,velf,dia,tsr,sol,cfd_data,param)
     print i
 for i in range(26):
     rom40[i] = velocity_field(xt,yt,4.0*3.,x40[i]*3.,9.308422677,6.,4.5,0.24,cfd_data,param)
     rom40t[i] = (rom40[i]-y40[i])/y40[i]
     print i
Exemplo n.º 13
0
    rom20 = np.zeros(33)
    rom25 = np.zeros(33)
    rom30 = np.zeros(33)
    rom35 = np.zeros(33)
    rom40 = np.zeros(26)
    rom40f = np.zeros(33)

    rom15t = np.zeros(33)
    rom20t = np.zeros(33)
    rom25t = np.zeros(33)
    rom30t = np.zeros(33)
    rom35t = np.zeros(33)
    rom40t = np.zeros(26)

    for i in range(33):
        rom15[i] = velocity_field(xt,yt,0.75*dia,x15[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        rom20[i] = velocity_field(xt,yt,1.0*dia,x20[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        rom25[i] = velocity_field(xt,yt,1.25*dia,x25[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        rom30[i] = velocity_field(xt,yt,1.5*dia,x30[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        rom35[i] = velocity_field(xt,yt,1.75*dia,x35[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        rom40f[i] = velocity_field(xt,yt,2.0*dia,x35[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        print i
    for i in range(26):
        rom40[i] = velocity_field(xt,yt,2.0*dia,x40[i]*dia,velf,dia,rot,chord,B,param=None,veltype=veltype)
        print i

    for i in range(33):
        if errortype == 'abs':
            rom15t[i] = fabs((1. - rom15[i])-(1. - y15[i]))
        elif errortype == 'rel':
            if fabs(1. - y15[i]) >= epsilon:
Exemplo n.º 14
0
    def test_PIV(self):

        x15 = np.array( [-0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        x20 = np.array( [-0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        x25 = np.array( [-0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        x30 = np.array( [-0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        x35 = np.array( [-0.867, -0.815, -0.763, -0.71, -0.658, -0.605, -0.553, -0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        x40 = np.array( [-0.5, -0.448, -0.395, -0.343, -0.291, -0.238, -0.186, -0.133, -0.081, -0.028, 0.024, 0.077, 0.129, 0.182, 0.234, 0.286, 0.339, 0.391, 0.444, 0.496, 0.549, 0.601, 0.654, 0.706, 0.759, 0.811] )
        y15 = np.array( [0.994109059733553, 0.9963677091332376, 1.0005562115755295, 1.0129863984422722, 1.0507201982582595, 0.9041429426683261, 0.6716433705834841, 0.5201309340176287, 0.508144821028986, 0.45366206008875143, 0.4120816289764176, 0.3841500969704306, 0.36762989356268116, 0.34878204855733175, 0.3239136841769655, 0.30087738601863206, 0.2879935890797586, 0.26790770257593155, 0.2625797365850182, 0.292431451988392, 0.32394314025359344, 0.3491215866639411, 0.3443858871235991, 0.3482695942305222, 0.3129449223429124, 0.36582747813800515, 0.4154704750687794, 0.49039503797192485, 0.6038500532436828, 0.7927363063069286, 0.9055264980137487, 0.9492042298526092, 0.9678480377419288] )
        y20 = np.array( [0.9920370542708112, 0.9937027721069257, 0.9957821547724749, 1.0042398848773346, 0.9749571783229305, 0.8545201774180555, 0.565802548086458, 0.5143332054399019, 0.489198302575, 0.44408180130876845, 0.3816702901351002, 0.35005844980465, 0.33679345047454295, 0.3230305737612392, 0.3146901353633469, 0.29915244503218225, 0.2790206166599524, 0.2464443364444221, 0.2475139147846546, 0.25357920856345817, 0.27126299099141044, 0.2987673093397647, 0.3182385501649433, 0.3243813328675722, 0.30742297967502097, 0.32253464736566645, 0.3693305499571722, 0.4191276334361715, 0.5015171898966418, 0.6228502433753057, 0.8230607176338183, 0.9264600739810046, 0.9616530515736079] )
        y25 = np.array( [0.9879572983671737, 0.9905509911272896, 0.9933676654604374, 0.9923430478507566, 0.9160865587232668, 0.727774179726256, 0.5833627736796199, 0.4815735966162955, 0.4258818988364446, 0.40697818686203785, 0.3645090556659908, 0.33624432950148214, 0.3254855613810157, 0.3103304514855841, 0.3045151031176352, 0.28401646740896264, 0.2593430020697244, 0.23659060256721978, 0.22300420317944888, 0.2244438460371643, 0.23642978330838485, 0.2568650503421204, 0.28114157843083193, 0.294601202395863, 0.3006303134268269, 0.3118773622351477, 0.3203024532857655, 0.3747931924965308, 0.41075281837916877, 0.5033971635645369, 0.6381178175981282, 0.8832861499445961, 0.9780827152012185] )
        y30 = np.array( [0.9807919873645041, 0.9799943204500705, 0.9756659438025117, 0.9597111733105987, 0.8640379300795783, 0.6756090098761603, 0.5574514345456549, 0.48935854692854497, 0.428523583438216, 0.3833992822748339, 0.3480531699708427, 0.32487761318471114, 0.3153752965437699, 0.2971902045364618, 0.2830498661729626, 0.2701094817124857, 0.2525140339109516, 0.22990689461698513, 0.21388156547631884, 0.2009225725260476, 0.2109170460152375, 0.22197598259760387, 0.24007485599064649, 0.2629099716848817, 0.28306559237296497, 0.29465097651166405, 0.29791611270965696, 0.320843380159032, 0.365988216767817, 0.435994478045424, 0.5459295715799363, 0.7790196684279612, 0.9232640197764616] )
        y35 = np.array( [0.9771079214279068, 0.9739267876288416, 0.9659755072544549, 0.9409586395095753, 0.8372410989082885, 0.6761226132078453, 0.5567979451297009, 0.46883935558555223, 0.41825105219857445, 0.3643627166731387, 0.33608496528240905, 0.31852020274820736, 0.3061917562496233, 0.28608694443477783, 0.273103042317234, 0.26439124635620204, 0.2478225127262987, 0.22900647970420313, 0.20929176925815257, 0.19435346927934738, 0.19534832002282343, 0.19777809452729966, 0.21620168910917673, 0.23300547991382745, 0.25288024387549046, 0.27049877766131897, 0.2804228982454348, 0.2916868458391746, 0.3235522394271216, 0.3723078207006349, 0.4706069281766252, 0.6090953502184843, 0.8713603615558797] )
        y40 = np.array( [0.45465337175396475, 0.3980109024658175, 0.35904507111616846, 0.32774805291916986, 0.31088720860935865, 0.29832097587839296, 0.2821950936769575, 0.26788022954331897, 0.25719920421744913, 0.24586751730014048, 0.2286008521345077, 0.20763836919642048, 0.1912065524478209, 0.1952723101174681, 0.1863567864754898, 0.19527809328409215, 0.21004969265451465, 0.22887599974659367, 0.2507107104057936, 0.26844672767918015, 0.27999051414332765, 0.2936850402917538, 0.33560687204407424, 0.41822453322242903, 0.5404777347489278, 0.7985895165740945] )
        
        # Wake model calculation using PIV data specifications
        rad = 0.5
        dia = 2*rad
        velf = 9.308422677
        sol = 0.24
        tsr = 4.5
        rom15 = np.zeros_like(x15)
        rom20 = np.zeros_like(x20)
        rom25 = np.zeros_like(x25)
        rom30 = np.zeros_like(x30)
        rom35 = np.zeros_like(x35)
        rom40 = np.zeros_like(x40)
        for i in range(np.size(x15)):
            rom15[i] = velocity_field(0.0,0.0,0.75,x15[i]*dia,velf,dia,tsr,sol)
            rom20[i] = velocity_field(0.0,0.0,1.0,x20[i]*dia,velf,dia,tsr,sol)
            rom25[i] = velocity_field(0.0,0.0,1.25,x25[i]*dia,velf,dia,tsr,sol)
            rom30[i] = velocity_field(0.0,0.0,1.5,x30[i]*dia,velf,dia,tsr,sol)
            rom35[i] = velocity_field(0.0,0.0,1.75,x35[i]*dia,velf,dia,tsr,sol)
        for i in range(np.size(x40)):
            rom40[i] = velocity_field(0.0,0.0,2.0,x40[i]*dia,velf,dia,tsr,sol)
            
            
        idx1 = np.array([4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29])
        idx2 = np.array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])
        np.testing.assert_allclose(rom15[idx1],y15[idx1],atol=0.4)
        np.testing.assert_allclose(rom20[idx1],y20[idx1],atol=0.4)
        np.testing.assert_allclose(rom25[idx1],y25[idx1],atol=0.4)
        np.testing.assert_allclose(rom30[idx1],y30[idx1],atol=0.4)
        np.testing.assert_allclose(rom35[idx1],y35[idx1],atol=0.4)
        np.testing.assert_allclose(rom40[idx2],y40[idx2],atol=0.6)
        
        
        
        # Wind tunnel test data
        x15wt = np.linspace(-1.7,1.7,21)
        y15wt = np.array([0.98,0.98,0.985,0.99,0.995,1.005,0.96,0.73,0.5,0.44,0.54,0.51,0.66,0.9,1.01,1.0,0.99,0.985,0.98,0.98,0.97])
        
        # Wake model calculation using wind tunnel data specifications
        rad = 0.515
        dia = 2*rad
        velf = 16.0
        sol = 0.5
        tsr = 1.6
        rom15wt = np.zeros_like(x15wt)
        for i in range(np.size(rom15wt)):
            rom15wt[i] = velocity_field(0.0,0.0,1.5*dia,x15wt[i]*dia,velf,dia,tsr,sol)
        
        np.testing.assert_allclose(rom15wt,y15wt,atol=0.4)