def test_TotalLoads(inputs_str, inputs_aeroloads):
    npts = np.size(inputs_str['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', TotalLoads(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, inputs_str)
    prob = init_IndepVar_add(prob, inputs_aeroloads)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, inputs_str)
    prob = init_IndepVar_set(prob, inputs_aeroloads)

    check_gradient_unit_test(prob, tol=.01, display=False)
def test_TestRootMoment():

    data_aero = inputs_aeroloads_operating()
    data_str = inputs_str()

    data = {}
    data['aeroloads_r'] = np.array([1.5375, 1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697, 2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267, 8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998, 18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509, 28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998, 42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998, 56.20419994, 58.9374998, 61.67080026, 63.03135, 63.0375])
    data['aeroloads_Px'] = np.array([0., 610.90043568, 469.20341791, 529.97827499, 580.02866009, 625.05962708, 661.78185992, 694.27930979, 830.93330879, 856.02758285, 872.85385017, 1155.30591175, 1278.65677079, 1394.84126103, 1598.03834945, 1726.35834871, 1933.87963881, 2271.78104859, 2748.8320438, 3083.27106663, 3677.62201087, 4343.75465079, 5051.54596049, 5731.9904625, 7004.11264534, 7364.31723123, 8093.26478732, 8599.46800605, 9000.96202336, 9390.16142378, 9555.38019573, 9708.33654591, 9964.10107999, 10160.41657631, 10284.8330047, 10072.19130201, 9644.34268454, 8877.83504026, 7799.39529499, 0.])
    data['aeroloads_Py'] = np.array([-0., -144.78495637, -124.72748876, -141.81359748, -155.88095732, -168.54159208, -178.87593197, -188.03239815, -226.67105832, -233.77977156, -238.54367701, -315.58006958, -346.98243408, -376.42732276, -428.40371938, -460.55814935, -514.08253305, -608.45781344, -797.59235326, -945.37444233, -1201.2028286, -1460.69809022, -1699.93141114, -1895.13844916, -2173.05749742, -2231.72002959, -2324.32717937, -2368.68132531, -2391.87757363, -2400.12541632, -2397.52018148, -2390.65909733, -2364.75629832, -2319.62320261, -2178.87813088, -2006.41143031, -1828.46265047, -1590.92929559, -887.78584275, -0.])
    data['aeroloads_Pz'] = np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
    data['r_pts'] = np.array([1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697, 2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267, 8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998, 18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509, 28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998, 42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998, 56.20419994, 58.9374998, 61.67080026, 63.03135])
    data['totalCone'] = np.array([2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5])
    data['x_az'] = np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
    data['y_az'] = np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
    data['z_az'] = np.array([1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697, 2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267, 8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998, 18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509, 28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998, 42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998, 56.20419994, 58.9374998, 61.67080026, 63.03135])
    data['s'] = np.array([1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697, 2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267, 8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998, 18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509, 28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998, 42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998, 56.20419994, 58.9374998, 61.67080026, 63.03135])
    data['r_pts'] = data['r_pts'] + 0.1
    npts = np.size(data['z_az'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', RootMoment(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['form'] = 'central'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['step_calc'] = 'relative'   
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, data)

    # check_gradient_unit_test(prob, tol=5e-3)
    check_gradient_unit_test(prob, tol=0.05)
def test_TotalLoads(inputs_str, inputs_aeroloads):
    npts = np.size(inputs_str['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', TotalLoads(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, inputs_str)
    prob = init_IndepVar_add(prob, inputs_aeroloads)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative' 
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, inputs_str)
    prob = init_IndepVar_set(prob, inputs_aeroloads)

    check_gradient_unit_test(prob, tol=.01, display=False)
def test_OutputsAero():

    data = {}
    data['AEP_in'] = 23490703.70603071
    data['V_in'] = np.array([0.178275041966, 0.190296788962, 0.202568028297, 0.215071993446, 0.227791807017, 0.240710518196, 0.253811139789, 0.267076684744, 0.280490202059, 0.294034811963, 0.307693740274, 0.32145035184, 0.335288182978, 0.349190972822, 0.363142693506, 0.377127579106, 0.391130153286, 0.405135255571, 0.419128066214, 0.43309412959, 0.447019376098, 0.460890142513, 0.474693190784, 0.488415725243, 0.502045408211, 0.515570374001, 0.528979241305, 0.54226112398, 0.555405640233, 0.568402920224, 0.581243612108, 0.593918886545, 0.606420439704, 0.618740494789, 0.630871802149, 0.642807637993, 0.654541801767, 0.666068612246, 0.67738290239, 0.68848001302, 0.699355785386, 0.710006552662, 0.720429130464, 0.730620806428, 0.740579328925, 0.750302894983, 0.759790137479, 0.76904011166, 0.778052281079, 0.786826502994, 0.795363013307, 0.803662411103, 0.811725642861, 0.819553986387, 0.827149034543, 0.834512678823, 0.841647092838, 0.848554715765, 0.855238235811, 0.861700573747, 0.867944866556, 0.873974451244, 0.879792848857, 0.885403748745, 0.890810993109, 0.896018561866, 0.90103055787, 0.90585119251, 0.91048477172, 0.914935682413, 0.919208379383, 0.923307372661, 0.927237215373, 0.931002492094, 0.934607807711, 0.93805777681, 0.941357013592, 0.944510122313, 0.947521688261, 0.950396269264, 0.95313838773, 0.955752523204, 0.95824310546, 0.960614508091, 0.962871042612, 0.965016953057, 0.967056411054, 0.968993511377, 0.970832267946, 0.972576610282, 0.974230380379, 0.975797329995, 0.977281118336, 0.978685310119, 0.980013374, 0.981268681344, 0.982454505324, 0.98357402033, 0.984630301666, 0.985626325531, 0.986564969246, 0.987449011729, 0.988281134189, 0.98906392103, 0.989799860938, 0.990491348148, 0.991140683869, 0.991750077849, 0.992321650072, 0.992857432566, 0.993359371317, 0.99382932827, 0.994269083401, 0.994680336859, 0.995064711163, 0.995423753433, 0.995758937661, 0.996071667003, 0.996363276084, 0.996635033314, 0.996888143197, 0.997123748634, 0.997342933215, 0.997546723483, 0.997736091178, 0.997911955448, 0.998075185027, 0.998226600365, 0.998366975728, 0.998497041241, 0.998617484891, 0.99872895447, 0.998832059475, 0.998927372946, 0.999015433252, 0.999096745819, 0.999171784802, 0.999240994698, 0.999304791902, 0.999363566204, 0.999417682229, 0.999467480822, 0.999513280372, 0.999555378083, 0.999594051191, 0.999629558123, 0.999662139611, 0.999692019741, 0.999719406969, 0.999744495073, 0.999767464065, 0.999788481055, 0.99980770107, 0.999825267834, 0.999841314496, 0.999855964334, 0.999869331401, 0.999881521151, 0.999892631024, 0.999902750988, 0.999911964064, 0.999920346811, 0.999927969778, 0.99993489794, 0.999941191092, 0.999946904234, 0.999952087915, 0.999956788569, 0.99996104882, 0.999964907768, 0.99996840126, 0.999971562138, 0.999974420473, 0.999977003779, 0.999979337216, 0.999981443776, 0.999983344458, 0.999985058426, 0.999986603162, 0.999987994599, 0.999989247253, 0.999990374339, 0.999991387879, 0.999992298805, 0.999993117053, 0.999993851641, 0.999994510758, 0.999995101829, 0.999995631585, 0.999996106123, 0.999996530963, 0.999996911098, 0.999997251045, 0.999997554883, 0.999997826298, 0.999998068616, 0.999998284835, 0.999998477661, 0.999998649529, 0.999998802632])
    data['P_in'] = np.array([22025.3984542, 31942.1185436, 42589.4002304, 53993.2085473, 66179.5085267, 79174.2652013, 93003.4436034, 107693.008766, 123268.925721, 139757.159501, 157183.67514, 175574.437668, 194955.41212, 215352.563527, 236791.856922, 259299.257337, 282900.729806, 307622.23936, 333489.751032, 360529.229855, 388766.640862, 418227.949084, 448939.119554, 480926.117306, 514214.907371, 548831.454781, 584801.724571, 622151.681771, 660907.291415, 701094.518535, 742739.328164, 785867.685334, 830505.555078, 876678.902429, 924413.692418, 973735.890078, 1024671.46044, 1077246.36854, 1131486.57941, 1187418.05809, 1245066.76959, 1304458.67896, 1365619.75124, 1428575.95144, 1493353.24461, 1559977.59577, 1628474.96996, 1698871.33222, 1771192.64757, 1845464.88105, 1921713.99769, 1999965.96251, 2080246.74057, 2162582.29688, 2246998.59648, 2333521.6044, 2422177.28568, 2512991.60535, 2605990.52843, 2701200.01997, 2798646.04499, 2898354.56853, 3000351.55562, 3104662.97129, 3211314.78058, 3320332.94852, 3431743.44013, 3545572.22046, 3661284.29229, 3777883.06101, 3895967.17288, 4015492.83297, 4136416.74759, 4258697.48598, 4382294.05017, 4507165.36302, 4631531.67845, 4757024.71876, 4883638.63072, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0])
    data['rated_V_in'] = 11.738606532616528
    data['rated_Omega_in'] = 12.
    data['rated_pitch_in'] = 0.0
    data['rated_T_in'] = 714206.5321080858
    data['rated_Q_in'] = 3978873.5772973835
    data['hub_diameter_in'] = 3.075
    data['diameter_in'] = 125.95500453593273
    data['max_chord_in'] = 3.0459289459935825
    data['V_extreme_in'] = 70.0
    data['T_extreme_in'] = 0.0
    data['Q_extreme_in'] = 0.0
    data['Rtip_in'] = 63.0375
    data['precurveTip_in'] = 0.0
    data['precsweepTip_in'] = 0.0

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', OutputsAero(len(data['P_in'])), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative' 
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_DamageLoads():

    data = {}
    data['r'] = np.array([2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05, 28.15, 32.25, 36.35, 40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, 61.6333])  # (Array): new aerodynamic grid on unit radius
    data['rstar'] = np.array([0.000, 0.022, 0.067, 0.111, 0.167, 0.233, 0.300, 0.367, 0.433, 0.500,
        0.567, 0.633, 0.700, 0.767, 0.833, 0.889, 0.933, 0.978])  # (Array): nondimensional radial locations of damage equivalent moments
    data['Mxb'] = 1e3*np.array([2.3743E+003, 2.0834E+003, 1.8108E+003, 1.5705E+003, 1.3104E+003,
        1.0488E+003, 8.2367E+002, 6.3407E+002, 4.7727E+002, 3.4804E+002, 2.4458E+002, 1.6339E+002,
        1.0252E+002, 5.7842E+001, 2.7349E+001, 1.1262E+001, 3.8549E+000, 4.4738E-001])  # (Array, N*m): damage equivalent moments about blade c.s. x-direction
    data['Myb'] = 1e3*np.array([2.7732E+003, 2.8155E+003, 2.6004E+003, 2.3933E+003, 2.1371E+003,
        1.8459E+003, 1.5582E+003, 1.2896E+003, 1.0427E+003, 8.2015E+002, 6.2449E+002, 4.5229E+002,
        3.0658E+002, 1.8746E+002, 9.6475E+001, 4.2677E+001, 1.5409E+001, 1.8426E+000])  # (Array, N*m): damage equivalent moments about blade c.s. y-direction
    data['theta'] = np.array([13.308, 13.308, 13.308, 13.308, 11.48, 10.162, 9.011, 7.795, 6.544, 5.361, 4.188, 3.125, 2.319, 1.526, 0.863, 0.37, 0.106])
    npts = np.size(data['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', DamageLoads(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'   
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=5e-5)
def test_SetupRunVarSpeed(inputs_control):
    del inputs_control['control_ratedPower'], inputs_control['control_minOmega']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', SetupRunVarSpeed(20), promotes=['*'])
    prob = init_IndepVar_add(prob, inputs_control)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, inputs_control)

    check_gradient_unit_test(prob)
Exemple #7
0
def test_SetupRunVarSpeed(inputs_control):
    del inputs_control['control_ratedPower'], inputs_control[
        'control_minOmega']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', SetupRunVarSpeed(20), promotes=['*'])
    prob = init_IndepVar_add(prob, inputs_control)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, inputs_control)

    check_gradient_unit_test(prob)
Exemple #8
0
def test_CCBladeGeometry():
    data = {}
    data['Rtip'] = 63.0
    data['precone'] = 5.0
    data['precurveTip'] = 0.0

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', CCBladeGeometry(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_CCBladeGeometry():
    data = {}
    data['Rtip'] = 63.0
    data['precone'] = 5.0
    data['precurveTip'] = 0.0

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', CCBladeGeometry(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_ExtremeLoads():

    data = {}
    data['T'] = np.array([2414072.40260361, 188461.59444074])
    data['Q'] = np.array([10926313.24295958, -8041330.51312603])
    data['nBlades'] = 3

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', ExtremeLoads(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=1.5e-4)
def test_ExtremeLoads():

    data = {}
    data['T'] = np.array([2414072.40260361, 188461.59444074])
    data['Q']= np.array([10926313.24295958, -8041330.51312603])
    data['nBlades'] = 3

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', ExtremeLoads(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=1.5e-4)
def test_GustETM():

    data = {}
    data['V_mean'] = 10.0
    data['V_hub'] = 11.7733866478
    data['std'] = 3
    data['turbulence_class'] = TURBULENCE_CLASS['B']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', GustETM(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
Exemple #13
0
def test_CSMDrivetrain(aeroPower, ratedPower):
    data = {}
    data['aeroPower'] = aeroPower
    data['ratedPower'] = ratedPower
    data['drivetrainType'] = DRIVETRAIN_TYPE['GEARED']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', CSMDrivetrain(len(aeroPower)), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=6e-4)
def test_CSMDrivetrain(aeroPower, ratedPower):
    data = {}
    data['aeroPower'] = aeroPower
    data['ratedPower'] = ratedPower
    data['drivetrainType'] = DRIVETRAIN_TYPE['GEARED']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', CSMDrivetrain(len(aeroPower)), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'    
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=6e-4)
def test_GustETM():

    data = {}
    data['V_mean'] = 10.0
    data['V_hub'] = 11.7733866478
    data['std'] = 3
    data['turbulence_class'] = TURBULENCE_CLASS['B']

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', GustETM(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_BladeCurvature():

    data = {}
    data['r'] = np.array([1.5375, 1.84056613137, 1.93905987557, 2.03755361977, 2.14220322299, 2.24069696719, 2.33919071139, 2.90419974, 3.04095863882, 3.13945238302, 5.637500205, 7.04226699698, 8.370800055, 11.8494282928, 13.8375, 14.7182548841, 15.887499795, 18.5537233505, 19.9875, 22.0564071286, 24.087500205, 26.16236509, 28.187499795, 32.2875, 33.5678634821, 36.387500205, 38.5725768593, 40.487499795, 40.6967540173, 40.7964789782, 40.8975, 42.6919644014, 44.5875, 52.787499795, 56.204199945, 58.937499795, 61.67080026, 63.0375])
    data['precurve'] = np.array([0.0, 0.043324361025, 0.0573893371698, 0.0714469497372, 0.0863751069858, 0.100417566593, 0.114452695996, 0.194824077331, 0.214241777459, 0.228217752953, 0.580295739194, 0.776308800624, 0.960411633829, 1.4368012564, 1.7055214864, 1.823777005, 1.98003324362, 2.32762426752, 2.50856911855, 2.76432512112, 3.0113656418, 3.26199245912, 3.50723775206, 4.0150233695, 4.17901272929, 4.55356019347, 4.85962948702, 5.14086873143, 5.17214747287, 5.18708601127, 5.20223968442, 5.47491847385, 5.77007321175, 7.12818875977, 7.7314427824, 8.22913789456, 8.73985955154, 9.0])
    data['presweep'] = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
    data['precone'] = 2.5
    npts = np.size(data['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', BladeCurvature(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=5e-5)
def test_RayleighCDF():

    data = {}
    data['xbar'] = 6.0
    data['x'] = np.array([3.0, 3.08805770406, 3.17611540812, 3.26417311218, 3.35223081624, 3.4402885203, 3.52834622436, 3.61640392842, 3.70446163248, 3.79251933654, 3.8805770406, 3.96863474466, 4.05669244872, 4.14475015278, 4.23280785684, 4.3208655609, 4.40892326496, 4.49698096902, 4.58503867308, 4.67309637714, 4.7611540812, 4.84921178526, 4.93726948932, 5.02532719338, 5.11338489744, 5.2014426015, 5.28950030556, 5.37755800962, 5.46561571369, 5.55367341775, 5.64173112181, 5.72978882587, 5.81784652993, 5.90590423399, 5.99396193805, 6.08201964211, 6.17007734617, 6.25813505023, 6.34619275429, 6.43425045835, 6.52230816241, 6.61036586647, 6.69842357053, 6.78648127459, 6.87453897865, 6.96259668271, 7.05065438677, 7.13871209083, 7.22676979489, 7.31482749895, 7.40288520301, 7.49094290707, 7.57900061113, 7.66705831519, 7.75511601925, 7.84317372331, 7.93123142737, 8.01928913143, 8.10734683549, 8.19540453955, 8.28346224361, 8.37151994767, 8.45957765173, 8.54763535579, 8.63569305985, 8.72375076391, 8.81180846797, 8.89986617203, 8.98792387609, 9.07598158015, 9.16403928421, 9.25209698827, 9.34015469233, 9.42821239639, 9.51627010045, 9.60432780451, 9.69238550857, 9.78044321263, 9.86850091669, 9.95655862075, 10.0446163248, 10.1326740289, 10.2207317329, 10.308789437, 10.3968471411, 10.4849048451, 10.5729625492, 10.6610202532, 10.7490779573, 10.8371356614, 10.9251933654, 11.0132510695, 11.1013087735, 11.1893664776, 11.2774241817, 11.3654818857, 11.4535395898, 11.5415972938, 11.6296549979, 11.717712702, 11.8505355749, 11.9833584479, 12.1161813209, 12.2490041939, 12.3818270669, 12.5146499398, 12.6474728128, 12.7802956858, 12.9131185588, 13.0459414318, 13.1787643047, 13.3115871777, 13.4444100507, 13.5772329237, 13.7100557967, 13.8428786696, 13.9757015426, 14.1085244156, 14.2413472886, 14.3741701616, 14.5069930345, 14.6398159075, 14.7726387805, 14.9054616535, 15.0382845265, 15.1711073994, 15.3039302724, 15.4367531454, 15.5695760184, 15.7023988914, 15.8352217644, 15.9680446373, 16.1008675103, 16.2336903833, 16.3665132563, 16.4993361293, 16.6321590022, 16.7649818752, 16.8978047482, 17.0306276212, 17.1634504942, 17.2962733671, 17.4290962401, 17.5619191131, 17.6947419861, 17.8275648591, 17.960387732, 18.093210605, 18.226033478, 18.358856351, 18.491679224, 18.6245020969, 18.7573249699, 18.8901478429, 19.0229707159, 19.1557935889, 19.2886164618, 19.4214393348, 19.5542622078, 19.6870850808, 19.8199079538, 19.9527308267, 20.0855536997, 20.2183765727, 20.3511994457, 20.4840223187, 20.6168451916, 20.7496680646, 20.8824909376, 21.0153138106, 21.1481366836, 21.2809595565, 21.4137824295, 21.5466053025, 21.6794281755, 21.8122510485, 21.9450739215, 22.0778967944, 22.2107196674, 22.3435425404, 22.4763654134, 22.6091882864, 22.7420111593, 22.8748340323, 23.0076569053, 23.1404797783, 23.2733026513, 23.4061255242, 23.5389483972, 23.6717712702, 23.8045941432, 23.9374170162, 24.0702398891, 24.2030627621, 24.3358856351, 24.4687085081, 24.6015313811, 24.734354254, 24.867177127, 25.0])
    n = len(data['x'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', RayleighCDF(n), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative' 
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test( prob, tol=2e-6)
def test_SetupPCModVarSpeed():

    data = {}
    data['control_tsr'] = 8.0
    data['control_pitch'] = 1.0
    data['Vrated'] = 12.0
    data['R'] = 63.0
    data['Vfactor'] = 0.7

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', SetupPCModVarSpeed(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_SetupPCModVarSpeed():

    data = {}
    data['control_tsr'] = 8.0
    data['control_pitch'] = 1.0
    data['Vrated'] = 12.0
    data['R'] = 63.0
    data['Vfactor'] = 0.7

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', SetupPCModVarSpeed(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_WeibullWithMeanCDF():

    data = {}
    data['xbar'] = 8.0
    data['k'] = 2.2
    data['x'] = np.linspace(1.0, 15.0, 50)
    n = len(data['x'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', WeibullWithMeanCDF(n), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative' 
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
Exemple #21
0
def test_WeibullWithMeanCDF():

    data = {}
    data['xbar'] = 8.0
    data['k'] = 2.2
    data['x'] = np.linspace(1.0, 15.0, 50)
    n = len(data['x'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', WeibullWithMeanCDF(n), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_MassProperties():

    data = {}
    data['blade_mass'] = 17288.717087
    data['blade_moment_of_inertia'] = 11634376.0531
    data['tilt'] = 5.0
    data['nBlades'] = 3

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', MassProperties(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_MassProperties():

    data = {}
    data['blade_mass'] = 17288.717087
    data['blade_moment_of_inertia'] = 11634376.0531
    data['tilt'] = 5.0
    data['nBlades'] = 3

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', MassProperties(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_TipDeflection():
    data = {}
    data['dx'] = 4.27242809591
    data['dy'] = -0.371550675139
    data['dz'] = 0.0400553989266
    data['theta'] = -0.0878099
    data['pitch'] = 0.0
    data['azimuth'] = 180.0
    data['tilt'] = 5.0
    data['totalConeTip'] = 2.5
    data['dynamicFactor'] = 1.2

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', TipDeflection(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_TipDeflection():
    data = {}
    data['dx'] = 4.27242809591
    data['dy'] = -0.371550675139
    data['dz'] = 0.0400553989266
    data['theta'] = -0.0878099
    data['pitch'] = 0.0
    data['azimuth'] = 180.0
    data['tilt'] = 5.0
    data['totalConeTip'] = 2.5
    data['dynamicFactor'] = 1.2

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', TipDeflection(), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
def test_BladeCurvature():

    data = {}
    data['r'] = np.array([
        1.5375, 1.84056613137, 1.93905987557, 2.03755361977, 2.14220322299,
        2.24069696719, 2.33919071139, 2.90419974, 3.04095863882, 3.13945238302,
        5.637500205, 7.04226699698, 8.370800055, 11.8494282928, 13.8375,
        14.7182548841, 15.887499795, 18.5537233505, 19.9875, 22.0564071286,
        24.087500205, 26.16236509, 28.187499795, 32.2875, 33.5678634821,
        36.387500205, 38.5725768593, 40.487499795, 40.6967540173,
        40.7964789782, 40.8975, 42.6919644014, 44.5875, 52.787499795,
        56.204199945, 58.937499795, 61.67080026, 63.0375
    ])
    data['precurve'] = np.array([
        0.0, 0.043324361025, 0.0573893371698, 0.0714469497372, 0.0863751069858,
        0.100417566593, 0.114452695996, 0.194824077331, 0.214241777459,
        0.228217752953, 0.580295739194, 0.776308800624, 0.960411633829,
        1.4368012564, 1.7055214864, 1.823777005, 1.98003324362, 2.32762426752,
        2.50856911855, 2.76432512112, 3.0113656418, 3.26199245912,
        3.50723775206, 4.0150233695, 4.17901272929, 4.55356019347,
        4.85962948702, 5.14086873143, 5.17214747287, 5.18708601127,
        5.20223968442, 5.47491847385, 5.77007321175, 7.12818875977,
        7.7314427824, 8.22913789456, 8.73985955154, 9.0
    ])
    data['presweep'] = np.array([
        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
        0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
    ])
    data['precone'] = 2.5
    npts = np.size(data['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', BladeCurvature(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=5e-5)
def test_DamageLoads():

    data = {}
    data['r'] = np.array([
        2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05, 28.15, 32.25, 36.35,
        40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, 61.6333
    ])  # (Array): new aerodynamic grid on unit radius
    data['rstar'] = np.array([
        0.000, 0.022, 0.067, 0.111, 0.167, 0.233, 0.300, 0.367, 0.433, 0.500,
        0.567, 0.633, 0.700, 0.767, 0.833, 0.889, 0.933, 0.978
    ])  # (Array): nondimensional radial locations of damage equivalent moments
    data['Mxb'] = 1e3 * np.array([
        2.3743E+003, 2.0834E+003, 1.8108E+003, 1.5705E+003, 1.3104E+003,
        1.0488E+003, 8.2367E+002, 6.3407E+002, 4.7727E+002, 3.4804E+002,
        2.4458E+002, 1.6339E+002, 1.0252E+002, 5.7842E+001, 2.7349E+001,
        1.1262E+001, 3.8549E+000, 4.4738E-001
    ])  # (Array, N*m): damage equivalent moments about blade c.s. x-direction
    data['Myb'] = 1e3 * np.array([
        2.7732E+003, 2.8155E+003, 2.6004E+003, 2.3933E+003, 2.1371E+003,
        1.8459E+003, 1.5582E+003, 1.2896E+003, 1.0427E+003, 8.2015E+002,
        6.2449E+002, 4.5229E+002, 3.0658E+002, 1.8746E+002, 9.6475E+001,
        4.2677E+001, 1.5409E+001, 1.8426E+000
    ])  # (Array, N*m): damage equivalent moments about blade c.s. y-direction
    data['theta'] = np.array([
        13.308, 13.308, 13.308, 13.308, 11.48, 10.162, 9.011, 7.795, 6.544,
        5.361, 4.188, 3.125, 2.319, 1.526, 0.863, 0.37, 0.106
    ])
    npts = np.size(data['r'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', DamageLoads(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=5e-5)
def test_BladeDeflection():
    NINPUT = 5

    data = {}
    data['dx'] = np.array([0.0, 1.39292987639e-05, 2.42964362361e-05, 3.73611415086e-05, 5.41276445811e-05, 7.25773833888e-05, 9.35928069108e-05, 0.000268596883961, 0.000326596195925, 0.000372259193056, 0.00253285667923, 0.00455502505195, 0.00706548815047, 0.017530829505, 0.0272151750396, 0.0326222002275, 0.0410034329532, 0.0655343595834, 0.0818962168404, 0.109404026845, 0.140873579829, 0.177728457961, 0.218834564559, 0.318921553007, 0.354759106888, 0.442199496033, 0.51925808593, 0.593774567144, 0.602307030873, 0.606403310701, 0.610574803156, 0.688594372351, 0.779039709944, 1.2575016857, 1.49348304065, 1.69400834707, 1.90049599542, 2.00437890947])
    data['dy'] = np.array([0.0, -9.11673273998e-07, -1.59100573731e-06, -2.44958708331e-06, -3.55417484862e-06, -4.77185559999e-06, -6.16078184177e-06, -1.77741315033e-05, -2.16387627714e-05, -2.46907649535e-05, -0.000177142122562, -0.00032886393339, -0.000523351402122, -0.00136667950935, -0.00215626107629, -0.00258384925494, -0.00322230578732, -0.00497009730837, -0.00607094164543, -0.00784913963514, -0.00980572470543, -0.0120149227037, -0.0143773305481, -0.0197932419212, -0.0216584171821, -0.0260612290834, -0.0297556792352, -0.0331954636074, -0.0335827012855, -0.0337680683508, -0.0339563913295, -0.0373950218981, -0.0412189884014, -0.0597108654077, -0.0681209435104, -0.0750137913709, -0.0819682184214, -0.085450339495])
    data['dz'] = np.array([0.0, 0.000190681386865, 0.000249594803444, 0.000305808888278, 0.000363037181592, 0.000414559803159, 0.000465006717172, 0.00079021115147, 0.000878140045153, 0.000937905765842, 0.00236994444878, 0.003141201122, 0.00385188728597, 0.0059090995974, 0.00721749042255, 0.00775193614485, 0.00838246793108, 0.00965065210961, 0.010256099836, 0.0110346081014, 0.0117147556349, 0.0123373351129, 0.0128834601832, 0.0138847141125, 0.014168689932, 0.0147331399477, 0.0151335663707, 0.015450772371, 0.015480903206, 0.0154926033582, 0.0155017716157, 0.0156218668894, 0.0157089720273, 0.0159512118376, 0.0160321965202, 0.0160695719649, 0.0160814363339, 0.0160814363339])
    data['pitch'] = 0.0
    data['theta'] = np.array([13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 12.9342399734, 12.4835173655, 11.4807910924, 10.9555299481, 10.2141623046, 9.50473135323, 8.7980712345, 8.12522342051, 6.81383731475, 6.42068577363, 5.58414615907, 4.96394315694, 4.44088253161, 4.38489418276, 4.35829308634, 4.33139992746, 3.86272702658, 3.38639207628, 1.57773054352, 0.953410121155, 0.504987738102, 0.0995174088527, -0.0878099])
    data['r_in0'] = np.array([1.5375, 13.2620872, 17.35321975, 40.19535987, 63.0375])
    data['Rhub0'] = 1.5375
    data['r_pts0'] = np.array([1.5375, 1.84056613137, 1.93905987557, 2.03755361977, 2.14220322299, 2.24069696719, 2.33919071139, 2.90419974, 3.04095863882, 3.13945238302, 5.637500205, 7.04226699698, 8.370800055, 11.8494282928, 13.8375, 14.7182548841, 15.887499795, 18.5537233505, 19.9875, 22.0564071286, 24.087500205, 26.16236509, 28.187499795, 32.2875, 33.5678634821, 36.387500205, 38.5725768593, 40.487499795, 40.6967540173, 40.7964789782, 40.8975, 42.6919644014, 44.5875, 52.787499795, 56.204199945, 58.937499795, 61.67080026, 63.0375])
    data['precurve0'] = np.zeros_like(data['dx']) #np.linspace(0.0, 5.0, np.size(data['dx']))
    data['bladeLength0'] = 61.5
    npts = np.size(data['dx'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', BladeDeflection(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=1e-4)
Exemple #29
0
def test_RayleighCDF():

    data = {}
    data['xbar'] = 6.0
    data['x'] = np.array([
        3.0, 3.08805770406, 3.17611540812, 3.26417311218, 3.35223081624,
        3.4402885203, 3.52834622436, 3.61640392842, 3.70446163248,
        3.79251933654, 3.8805770406, 3.96863474466, 4.05669244872,
        4.14475015278, 4.23280785684, 4.3208655609, 4.40892326496,
        4.49698096902, 4.58503867308, 4.67309637714, 4.7611540812,
        4.84921178526, 4.93726948932, 5.02532719338, 5.11338489744,
        5.2014426015, 5.28950030556, 5.37755800962, 5.46561571369,
        5.55367341775, 5.64173112181, 5.72978882587, 5.81784652993,
        5.90590423399, 5.99396193805, 6.08201964211, 6.17007734617,
        6.25813505023, 6.34619275429, 6.43425045835, 6.52230816241,
        6.61036586647, 6.69842357053, 6.78648127459, 6.87453897865,
        6.96259668271, 7.05065438677, 7.13871209083, 7.22676979489,
        7.31482749895, 7.40288520301, 7.49094290707, 7.57900061113,
        7.66705831519, 7.75511601925, 7.84317372331, 7.93123142737,
        8.01928913143, 8.10734683549, 8.19540453955, 8.28346224361,
        8.37151994767, 8.45957765173, 8.54763535579, 8.63569305985,
        8.72375076391, 8.81180846797, 8.89986617203, 8.98792387609,
        9.07598158015, 9.16403928421, 9.25209698827, 9.34015469233,
        9.42821239639, 9.51627010045, 9.60432780451, 9.69238550857,
        9.78044321263, 9.86850091669, 9.95655862075, 10.0446163248,
        10.1326740289, 10.2207317329, 10.308789437, 10.3968471411,
        10.4849048451, 10.5729625492, 10.6610202532, 10.7490779573,
        10.8371356614, 10.9251933654, 11.0132510695, 11.1013087735,
        11.1893664776, 11.2774241817, 11.3654818857, 11.4535395898,
        11.5415972938, 11.6296549979, 11.717712702, 11.8505355749,
        11.9833584479, 12.1161813209, 12.2490041939, 12.3818270669,
        12.5146499398, 12.6474728128, 12.7802956858, 12.9131185588,
        13.0459414318, 13.1787643047, 13.3115871777, 13.4444100507,
        13.5772329237, 13.7100557967, 13.8428786696, 13.9757015426,
        14.1085244156, 14.2413472886, 14.3741701616, 14.5069930345,
        14.6398159075, 14.7726387805, 14.9054616535, 15.0382845265,
        15.1711073994, 15.3039302724, 15.4367531454, 15.5695760184,
        15.7023988914, 15.8352217644, 15.9680446373, 16.1008675103,
        16.2336903833, 16.3665132563, 16.4993361293, 16.6321590022,
        16.7649818752, 16.8978047482, 17.0306276212, 17.1634504942,
        17.2962733671, 17.4290962401, 17.5619191131, 17.6947419861,
        17.8275648591, 17.960387732, 18.093210605, 18.226033478, 18.358856351,
        18.491679224, 18.6245020969, 18.7573249699, 18.8901478429,
        19.0229707159, 19.1557935889, 19.2886164618, 19.4214393348,
        19.5542622078, 19.6870850808, 19.8199079538, 19.9527308267,
        20.0855536997, 20.2183765727, 20.3511994457, 20.4840223187,
        20.6168451916, 20.7496680646, 20.8824909376, 21.0153138106,
        21.1481366836, 21.2809595565, 21.4137824295, 21.5466053025,
        21.6794281755, 21.8122510485, 21.9450739215, 22.0778967944,
        22.2107196674, 22.3435425404, 22.4763654134, 22.6091882864,
        22.7420111593, 22.8748340323, 23.0076569053, 23.1404797783,
        23.2733026513, 23.4061255242, 23.5389483972, 23.6717712702,
        23.8045941432, 23.9374170162, 24.0702398891, 24.2030627621,
        24.3358856351, 24.4687085081, 24.6015313811, 24.734354254,
        24.867177127, 25.0
    ])
    n = len(data['x'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', RayleighCDF(n), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=2e-6)
def test_TestRootMoment():

    data_aero = inputs_aeroloads_operating()
    data_str = inputs_str()

    data = {}
    data['aeroloads_r'] = np.array([
        1.5375, 1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322,
        2.24069697, 2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021,
        7.042267, 8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998,
        18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509,
        28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998,
        42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998,
        56.20419994, 58.9374998, 61.67080026, 63.03135, 63.0375
    ])
    data['aeroloads_Px'] = np.array([
        0., 610.90043568, 469.20341791, 529.97827499, 580.02866009,
        625.05962708, 661.78185992, 694.27930979, 830.93330879, 856.02758285,
        872.85385017, 1155.30591175, 1278.65677079, 1394.84126103,
        1598.03834945, 1726.35834871, 1933.87963881, 2271.78104859,
        2748.8320438, 3083.27106663, 3677.62201087, 4343.75465079,
        5051.54596049, 5731.9904625, 7004.11264534, 7364.31723123,
        8093.26478732, 8599.46800605, 9000.96202336, 9390.16142378,
        9555.38019573, 9708.33654591, 9964.10107999, 10160.41657631,
        10284.8330047, 10072.19130201, 9644.34268454, 8877.83504026,
        7799.39529499, 0.
    ])
    data['aeroloads_Py'] = np.array([
        -0., -144.78495637, -124.72748876, -141.81359748, -155.88095732,
        -168.54159208, -178.87593197, -188.03239815, -226.67105832,
        -233.77977156, -238.54367701, -315.58006958, -346.98243408,
        -376.42732276, -428.40371938, -460.55814935, -514.08253305,
        -608.45781344, -797.59235326, -945.37444233, -1201.2028286,
        -1460.69809022, -1699.93141114, -1895.13844916, -2173.05749742,
        -2231.72002959, -2324.32717937, -2368.68132531, -2391.87757363,
        -2400.12541632, -2397.52018148, -2390.65909733, -2364.75629832,
        -2319.62320261, -2178.87813088, -2006.41143031, -1828.46265047,
        -1590.92929559, -887.78584275, -0.
    ])
    data['aeroloads_Pz'] = np.array([
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0.
    ])
    data['r_pts'] = np.array([
        1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697,
        2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267,
        8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998,
        18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509,
        28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998,
        42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998,
        56.20419994, 58.9374998, 61.67080026, 63.03135
    ])
    data['totalCone'] = np.array([
        2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,
        2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5,
        2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5
    ])
    data['x_az'] = np.array([
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0.
    ])
    data['y_az'] = np.array([
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
        0., 0.
    ])
    data['z_az'] = np.array([
        1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697,
        2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267,
        8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998,
        18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509,
        28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998,
        42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998,
        56.20419994, 58.9374998, 61.67080026, 63.03135
    ])
    data['s'] = np.array([
        1.54365, 1.84056613, 1.93905988, 2.03755362, 2.14220322, 2.24069697,
        2.33919071, 2.90419974, 3.04095864, 3.13945238, 5.63750021, 7.042267,
        8.37080006, 10.54495078, 11.7875002, 13.54900997, 15.8874998,
        18.55372335, 19.9875, 22.05640713, 24.08750021, 26.16236509,
        28.1874998, 32.2875, 33.56786348, 36.38750021, 38.57257686, 40.4874998,
        42.58004108, 43.57729024, 44.5875, 46.58134943, 48.6875002, 52.7874998,
        56.20419994, 58.9374998, 61.67080026, 63.03135
    ])
    data['r_pts'] = data['r_pts'] + 0.1
    npts = np.size(data['z_az'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', RootMoment(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['form'] = 'central'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.root.comp.deriv_options['step_calc'] = 'relative'
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)

    prob = init_IndepVar_set(prob, data)

    # check_gradient_unit_test(prob, tol=5e-3)
    check_gradient_unit_test(prob, tol=0.05)
Exemple #31
0
def test_OutputsAero():

    data = {}
    data['AEP_in'] = 23490703.70603071
    data['V_in'] = np.array([
        0.178275041966, 0.190296788962, 0.202568028297, 0.215071993446,
        0.227791807017, 0.240710518196, 0.253811139789, 0.267076684744,
        0.280490202059, 0.294034811963, 0.307693740274, 0.32145035184,
        0.335288182978, 0.349190972822, 0.363142693506, 0.377127579106,
        0.391130153286, 0.405135255571, 0.419128066214, 0.43309412959,
        0.447019376098, 0.460890142513, 0.474693190784, 0.488415725243,
        0.502045408211, 0.515570374001, 0.528979241305, 0.54226112398,
        0.555405640233, 0.568402920224, 0.581243612108, 0.593918886545,
        0.606420439704, 0.618740494789, 0.630871802149, 0.642807637993,
        0.654541801767, 0.666068612246, 0.67738290239, 0.68848001302,
        0.699355785386, 0.710006552662, 0.720429130464, 0.730620806428,
        0.740579328925, 0.750302894983, 0.759790137479, 0.76904011166,
        0.778052281079, 0.786826502994, 0.795363013307, 0.803662411103,
        0.811725642861, 0.819553986387, 0.827149034543, 0.834512678823,
        0.841647092838, 0.848554715765, 0.855238235811, 0.861700573747,
        0.867944866556, 0.873974451244, 0.879792848857, 0.885403748745,
        0.890810993109, 0.896018561866, 0.90103055787, 0.90585119251,
        0.91048477172, 0.914935682413, 0.919208379383, 0.923307372661,
        0.927237215373, 0.931002492094, 0.934607807711, 0.93805777681,
        0.941357013592, 0.944510122313, 0.947521688261, 0.950396269264,
        0.95313838773, 0.955752523204, 0.95824310546, 0.960614508091,
        0.962871042612, 0.965016953057, 0.967056411054, 0.968993511377,
        0.970832267946, 0.972576610282, 0.974230380379, 0.975797329995,
        0.977281118336, 0.978685310119, 0.980013374, 0.981268681344,
        0.982454505324, 0.98357402033, 0.984630301666, 0.985626325531,
        0.986564969246, 0.987449011729, 0.988281134189, 0.98906392103,
        0.989799860938, 0.990491348148, 0.991140683869, 0.991750077849,
        0.992321650072, 0.992857432566, 0.993359371317, 0.99382932827,
        0.994269083401, 0.994680336859, 0.995064711163, 0.995423753433,
        0.995758937661, 0.996071667003, 0.996363276084, 0.996635033314,
        0.996888143197, 0.997123748634, 0.997342933215, 0.997546723483,
        0.997736091178, 0.997911955448, 0.998075185027, 0.998226600365,
        0.998366975728, 0.998497041241, 0.998617484891, 0.99872895447,
        0.998832059475, 0.998927372946, 0.999015433252, 0.999096745819,
        0.999171784802, 0.999240994698, 0.999304791902, 0.999363566204,
        0.999417682229, 0.999467480822, 0.999513280372, 0.999555378083,
        0.999594051191, 0.999629558123, 0.999662139611, 0.999692019741,
        0.999719406969, 0.999744495073, 0.999767464065, 0.999788481055,
        0.99980770107, 0.999825267834, 0.999841314496, 0.999855964334,
        0.999869331401, 0.999881521151, 0.999892631024, 0.999902750988,
        0.999911964064, 0.999920346811, 0.999927969778, 0.99993489794,
        0.999941191092, 0.999946904234, 0.999952087915, 0.999956788569,
        0.99996104882, 0.999964907768, 0.99996840126, 0.999971562138,
        0.999974420473, 0.999977003779, 0.999979337216, 0.999981443776,
        0.999983344458, 0.999985058426, 0.999986603162, 0.999987994599,
        0.999989247253, 0.999990374339, 0.999991387879, 0.999992298805,
        0.999993117053, 0.999993851641, 0.999994510758, 0.999995101829,
        0.999995631585, 0.999996106123, 0.999996530963, 0.999996911098,
        0.999997251045, 0.999997554883, 0.999997826298, 0.999998068616,
        0.999998284835, 0.999998477661, 0.999998649529, 0.999998802632
    ])
    data['P_in'] = np.array([
        22025.3984542, 31942.1185436, 42589.4002304, 53993.2085473,
        66179.5085267, 79174.2652013, 93003.4436034, 107693.008766,
        123268.925721, 139757.159501, 157183.67514, 175574.437668,
        194955.41212, 215352.563527, 236791.856922, 259299.257337,
        282900.729806, 307622.23936, 333489.751032, 360529.229855,
        388766.640862, 418227.949084, 448939.119554, 480926.117306,
        514214.907371, 548831.454781, 584801.724571, 622151.681771,
        660907.291415, 701094.518535, 742739.328164, 785867.685334,
        830505.555078, 876678.902429, 924413.692418, 973735.890078,
        1024671.46044, 1077246.36854, 1131486.57941, 1187418.05809,
        1245066.76959, 1304458.67896, 1365619.75124, 1428575.95144,
        1493353.24461, 1559977.59577, 1628474.96996, 1698871.33222,
        1771192.64757, 1845464.88105, 1921713.99769, 1999965.96251,
        2080246.74057, 2162582.29688, 2246998.59648, 2333521.6044,
        2422177.28568, 2512991.60535, 2605990.52843, 2701200.01997,
        2798646.04499, 2898354.56853, 3000351.55562, 3104662.97129,
        3211314.78058, 3320332.94852, 3431743.44013, 3545572.22046,
        3661284.29229, 3777883.06101, 3895967.17288, 4015492.83297,
        4136416.74759, 4258697.48598, 4382294.05017, 4507165.36302,
        4631531.67845, 4757024.71876, 4883638.63072, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0,
        5000000.0, 5000000.0, 5000000.0, 5000000.0, 5000000.0
    ])
    data['rated_V_in'] = 11.738606532616528
    data['rated_Omega_in'] = 12.
    data['rated_pitch_in'] = 0.0
    data['rated_T_in'] = 714206.5321080858
    data['rated_Q_in'] = 3978873.5772973835
    data['hub_diameter_in'] = 3.075
    data['diameter_in'] = 125.95500453593273
    data['max_chord_in'] = 3.0459289459935825
    data['V_extreme_in'] = 70.0
    data['T_extreme_in'] = 0.0
    data['Q_extreme_in'] = 0.0
    data['Rtip_in'] = 63.0375
    data['precurveTip_in'] = 0.0
    data['precsweepTip_in'] = 0.0

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', OutputsAero(len(data['P_in'])), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob)
Exemple #32
0
def test_CCBlade(bem_case):

    data = {}
    data['r'] = np.array([
        2.8667, 5.6000, 8.3333, 11.7500, 15.8500, 19.9500, 24.0500, 28.1500,
        32.2500, 36.3500, 40.4500, 44.5500, 48.6500, 52.7500, 56.1667, 58.9000,
        61.6333
    ])
    data['chord'] = np.array([
        3.542, 3.854, 4.167, 4.557, 4.652, 4.458, 4.249, 4.007, 3.748, 3.502,
        3.256, 3.010, 2.764, 2.518, 2.313, 2.086, 1.419
    ])
    data['theta'] = np.array([
        13.308, 13.308, 13.308, 13.308, 11.480, 10.162, 9.011, 7.795, 6.544,
        5.361, 4.188, 3.125, 2.319, 1.526, 0.863, 0.370, 0.106
    ])
    data['Rhub'] = 1.5
    data['Rtip'] = 63.0
    data['hubHt'] = 80.0
    data['precone'] = 2.5
    data['tilt'] = -5.0
    data['yaw'] = 0.0
    data['B'] = 3
    data['rho'] = 1.225
    data['mu'] = 1.81206e-5
    data['shearExp'] = 0.2
    data['nSector'] = 4
    data['precurve'] = np.zeros(len(data['r']))
    data['precurveTip'] = 0.0

    # airfoils
    basepath = os.path.join(
        os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'),
        '5MW_AFFiles/')
    # load all airfoils
    airfoil_types = [0] * 8
    airfoil_types[0] = basepath + 'Cylinder1.dat'
    airfoil_types[1] = basepath + 'Cylinder2.dat'
    airfoil_types[2] = basepath + 'DU40_A17.dat'
    airfoil_types[3] = basepath + 'DU35_A17.dat'
    airfoil_types[4] = basepath + 'DU30_A17.dat'
    airfoil_types[5] = basepath + 'DU25_A17.dat'
    airfoil_types[6] = basepath + 'DU21_A17.dat'
    airfoil_types[7] = basepath + 'NACA64_A17.dat'
    # place at appropriate radial stations
    af_idx = [0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7]
    n = len(data['r'])
    af = [0] * n
    for i in range(n):
        af[i] = airfoil_types[af_idx[i]]
    data['airfoil_files'] = af

    prob = Problem()
    prob.root = Group()

    if bem_case == 'power':
        # run_case = 'power'
        data['Uhub'] = np.array([
            3.0, 4.15789473684, 5.31578947368, 6.47368421053, 7.63157894737,
            8.78947368421, 9.94736842105, 11.1052631579, 12.2631578947,
            13.4210526316, 14.5789473684, 15.7368421053, 16.8947368421,
            18.0526315789, 19.2105263158, 20.3684210526, 21.5263157895,
            22.6842105263, 23.8421052632, 25.0
        ])
        data['Omega'] = np.array([
            3.43647024491, 4.76282718154, 6.08918411817, 7.41554105481,
            8.74189799144, 10.0682549281, 11.3946118647, 12.0, 12.0, 12.0,
            12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0
        ])
        data['pitch'] = np.array([
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
        ])
        n2 = len(data['Uhub'])
        prob.root.add('comp', CCBladePower(n, n2), promotes=['*'])

    elif bem_case == 'loads':
        # run_case = 'loads'
        data['V_load'] = 12.0
        data['Omega_load'] = 10.0
        data['pitch_load'] = 0.0
        data['azimuth_load'] = 180.0
        n2 = 1
        prob.root.add('comp', CCBladeLoads(n, n2), promotes=['*'])

    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative'
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=1e-3, display=True)
def test_BladeDeflection():
    NINPUT = 5

    data = {}
    data['dx'] = np.array([
        0.0, 1.39292987639e-05, 2.42964362361e-05, 3.73611415086e-05,
        5.41276445811e-05, 7.25773833888e-05, 9.35928069108e-05,
        0.000268596883961, 0.000326596195925, 0.000372259193056,
        0.00253285667923, 0.00455502505195, 0.00706548815047, 0.017530829505,
        0.0272151750396, 0.0326222002275, 0.0410034329532, 0.0655343595834,
        0.0818962168404, 0.109404026845, 0.140873579829, 0.177728457961,
        0.218834564559, 0.318921553007, 0.354759106888, 0.442199496033,
        0.51925808593, 0.593774567144, 0.602307030873, 0.606403310701,
        0.610574803156, 0.688594372351, 0.779039709944, 1.2575016857,
        1.49348304065, 1.69400834707, 1.90049599542, 2.00437890947
    ])
    data['dy'] = np.array([
        0.0, -9.11673273998e-07, -1.59100573731e-06, -2.44958708331e-06,
        -3.55417484862e-06, -4.77185559999e-06, -6.16078184177e-06,
        -1.77741315033e-05, -2.16387627714e-05, -2.46907649535e-05,
        -0.000177142122562, -0.00032886393339, -0.000523351402122,
        -0.00136667950935, -0.00215626107629, -0.00258384925494,
        -0.00322230578732, -0.00497009730837, -0.00607094164543,
        -0.00784913963514, -0.00980572470543, -0.0120149227037,
        -0.0143773305481, -0.0197932419212, -0.0216584171821, -0.0260612290834,
        -0.0297556792352, -0.0331954636074, -0.0335827012855, -0.0337680683508,
        -0.0339563913295, -0.0373950218981, -0.0412189884014, -0.0597108654077,
        -0.0681209435104, -0.0750137913709, -0.0819682184214, -0.085450339495
    ])
    data['dz'] = np.array([
        0.0, 0.000190681386865, 0.000249594803444, 0.000305808888278,
        0.000363037181592, 0.000414559803159, 0.000465006717172,
        0.00079021115147, 0.000878140045153, 0.000937905765842,
        0.00236994444878, 0.003141201122, 0.00385188728597, 0.0059090995974,
        0.00721749042255, 0.00775193614485, 0.00838246793108, 0.00965065210961,
        0.010256099836, 0.0110346081014, 0.0117147556349, 0.0123373351129,
        0.0128834601832, 0.0138847141125, 0.014168689932, 0.0147331399477,
        0.0151335663707, 0.015450772371, 0.015480903206, 0.0154926033582,
        0.0155017716157, 0.0156218668894, 0.0157089720273, 0.0159512118376,
        0.0160321965202, 0.0160695719649, 0.0160814363339, 0.0160814363339
    ])
    data['pitch'] = 0.0
    data['theta'] = np.array([
        13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783,
        13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783, 13.2783,
        12.9342399734, 12.4835173655, 11.4807910924, 10.9555299481,
        10.2141623046, 9.50473135323, 8.7980712345, 8.12522342051,
        6.81383731475, 6.42068577363, 5.58414615907, 4.96394315694,
        4.44088253161, 4.38489418276, 4.35829308634, 4.33139992746,
        3.86272702658, 3.38639207628, 1.57773054352, 0.953410121155,
        0.504987738102, 0.0995174088527, -0.0878099
    ])
    data['r_in0'] = np.array(
        [1.5375, 13.2620872, 17.35321975, 40.19535987, 63.0375])
    data['Rhub0'] = 1.5375
    data['r_pts0'] = np.array([
        1.5375, 1.84056613137, 1.93905987557, 2.03755361977, 2.14220322299,
        2.24069696719, 2.33919071139, 2.90419974, 3.04095863882, 3.13945238302,
        5.637500205, 7.04226699698, 8.370800055, 11.8494282928, 13.8375,
        14.7182548841, 15.887499795, 18.5537233505, 19.9875, 22.0564071286,
        24.087500205, 26.16236509, 28.187499795, 32.2875, 33.5678634821,
        36.387500205, 38.5725768593, 40.487499795, 40.6967540173,
        40.7964789782, 40.8975, 42.6919644014, 44.5875, 52.787499795,
        56.204199945, 58.937499795, 61.67080026, 63.0375
    ])
    data['precurve0'] = np.zeros_like(
        data['dx'])  #np.linspace(0.0, 5.0, np.size(data['dx']))
    data['bladeLength0'] = 61.5
    npts = np.size(data['dx'])

    prob = Problem()
    prob.root = Group()
    prob.root.add('comp', BladeDeflection(npts), promotes=['*'])
    prob = init_IndepVar_add(prob, data)
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test(prob, tol=1e-4)
def test_CCBlade(bem_case):

    data = {}
    data['r'] = np.array([2.8667, 5.6000, 8.3333, 11.7500, 15.8500, 19.9500, 24.0500, 28.1500, 32.2500, 36.3500, 40.4500, 44.5500, 48.6500, 52.7500, 56.1667, 58.9000, 61.6333])
    data['chord'] = np.array([3.542, 3.854, 4.167, 4.557, 4.652, 4.458, 4.249, 4.007, 3.748, 3.502, 3.256, 3.010, 2.764, 2.518, 2.313, 2.086, 1.419])
    data['theta'] = np.array([13.308, 13.308, 13.308, 13.308, 11.480, 10.162, 9.011, 7.795, 6.544, 5.361, 4.188, 3.125, 2.319, 1.526, 0.863, 0.370, 0.106])
    data['Rhub'] = 1.5
    data['Rtip'] = 63.0
    data['hubHt'] = 80.0
    data['precone'] = 2.5
    data['tilt'] = -5.0
    data['yaw'] = 0.0
    data['B'] = 3
    data['rho'] = 1.225
    data['mu'] = 1.81206e-5
    data['shearExp'] = 0.2
    data['nSector'] = 4
    data['precurve'] = np.zeros(len(data['r']))
    data['precurveTip'] = 0.0

    # airfoils
    basepath = os.path.join(os.path.join(os.path.dirname(os.path.realpath(__file__)),'..'), '5MW_AFFiles/')
    # load all airfoils
    airfoil_types = [0]*8
    airfoil_types[0] = basepath + 'Cylinder1.dat'
    airfoil_types[1] = basepath + 'Cylinder2.dat'
    airfoil_types[2] = basepath + 'DU40_A17.dat'
    airfoil_types[3] = basepath + 'DU35_A17.dat'
    airfoil_types[4] = basepath + 'DU30_A17.dat'
    airfoil_types[5] = basepath + 'DU25_A17.dat'
    airfoil_types[6] = basepath + 'DU21_A17.dat'
    airfoil_types[7] = basepath + 'NACA64_A17.dat'
    # place at appropriate radial stations
    af_idx = [0, 0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7]
    n = len(data['r'])
    af = [0]*n
    for i in range(n):
        af[i] = airfoil_types[af_idx[i]]
    data['airfoil_files'] = af

    prob = Problem()
    prob.root = Group()

    if bem_case == 'power':
        # run_case = 'power'
        data['Uhub'] = np.array([3.0, 4.15789473684, 5.31578947368, 6.47368421053, 7.63157894737, 8.78947368421, 9.94736842105, 11.1052631579, 12.2631578947, 13.4210526316, 14.5789473684, 15.7368421053, 16.8947368421, 18.0526315789, 19.2105263158, 20.3684210526, 21.5263157895, 22.6842105263, 23.8421052632, 25.0])
        data['Omega'] = np.array([3.43647024491, 4.76282718154, 6.08918411817, 7.41554105481, 8.74189799144, 10.0682549281, 11.3946118647, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0, 12.0])
        data['pitch'] = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
        n2 = len(data['Uhub'])
        prob.root.add('comp', CCBladePower(n, n2), promotes=['*'])

    elif bem_case == 'loads':
        # run_case = 'loads'
        data['V_load'] = 12.0
        data['Omega_load'] = 10.0
        data['pitch_load'] = 0.0
        data['azimuth_load'] = 180.0
        n2 = 1
        prob.root.add('comp', CCBladeLoads(n, n2), promotes=['*'])

    prob = init_IndepVar_add(prob, data)
    prob.root.comp.deriv_options['check_step_calc'] = 'relative' 
    prob.root.comp.deriv_options['check_form'] = 'central'
    prob.setup(check=False)
    prob = init_IndepVar_set(prob, data)

    check_gradient_unit_test( prob, tol=1e-3, display=True)