diff --git a/WISDEM/generateTables.py b/WISDEM/generateTables.py index e3a79951..999c3a72 100644 --- a/WISDEM/generateTables.py +++ b/WISDEM/generateTables.py @@ -125,7 +125,7 @@ def write_overview(self): irow = 2 for k,v in self.overview.items(): - myv = float(v) if type(v)==type(np.array([])) else v + myv = v[0] if type(v)==type(np.array([])) else v ws.cell(row=irow, column=1, value=k) ws.cell(row=irow, column=2, value=myv) irow += 1 @@ -456,7 +456,7 @@ def myinterp(xgrid, val): ax.set_ylabel('Thickness [mm]', size=14, weight='bold') vy = ax.get_ylim() xtick = 0.5 + 0.1*np.arange(len(self.airfoil_list)) + 0.05 - labs = [self.airfoil_list[m]+' '+str(int(np.round(1e2*self.airfoil_span[m])))+'%' for m in range(naf)] + labs = [self.airfoil_list[m]+' '+str(int(round(1e2*self.airfoil_span[m])))+'%' for m in range(naf)] #ax.set_xticks( np.r_[xtick, xtick+1, xtick+2] ) ax.set_xticks( np.r_[xtick, xtick+1.1] ) #ax.set_xticklabels( labs+labs+labs, rotation='vertical' ) @@ -509,13 +509,11 @@ def myinterp(xgrid, val): ax.set_xlabel('Airfoil s-coordinate [-]', size=14, weight='bold') ax.set_ylabel('Thickness [mm]', size=14, weight='bold') vy = ax.get_ylim() - ax.text(0.6, 0.95*np.diff(vy), self.airfoil_list[iaf]+' airfoil, '+str(int(np.round(1e2*self.airfoil_span[iaf])))+'% span', - size=12, weight='bold') + ax.text(0.6, 0.95*np.diff(vy), self.airfoil_list[iaf]+' airfoil, '+str(int(round(1e2*self.airfoil_span[iaf])))+'% span', size=12, weight='bold') ax.set_xticks([0.0, 0.25, 0.5, 0.75, 1.0]) ax.set_xticklabels(['TE','Suction Side', 'LE','Pressure Side','TE']) fig.subplots_adjust(bottom = 0.15, left = 0.15) - fig.savefig('outputs' + os.sep + 'layers_'+self.airfoil_list[iaf]+'_'+str(int(np.round(1e2*self.airfoil_span[iaf])))+'.pdf', - pad_inches=0.1, bbox_inches='tight') + #fig.savefig('outputs' + os.sep + 'layers_'+self.airfoil_list[iaf]+'_'+str(int(round(1e2*self.airfoil_span[iaf])))+'.pdf', pad_inches=0.1, bbox_inches='tight') plt.close() # Cross section over-view sheet diff --git a/tests/test_blade_mass.py b/tests/test_blade_mass.py index 18a380d2..512a3e78 100644 --- a/tests/test_blade_mass.py +++ b/tests/test_blade_mass.py @@ -26,7 +26,7 @@ def test_blade_mass_BDtw(self): readBD1.fst_vt['Fst']['BDBldFile(1)'] = base_name1 + '_BeamDyn.dat' bd_file = os.path.join(BDtw_path, readBD1.fst_vt['Fst']['BDBldFile(1)']) readBD1.read_BeamDyn(bd_file) - BDtw = np.trapz(readBD1.fst_vt['BeamDynBlade'][0]['beam_inertia'][:,0,0], readBD1.fst_vt['BeamDynBlade'][0]['radial_stations']*blade_length) + BDtw = np.trapezoid(readBD1.fst_vt['BeamDynBlade'][0]['beam_inertia'][:,0,0], readBD1.fst_vt['BeamDynBlade'][0]['radial_stations']*blade_length) print('\nBlade mass in BD along twist centers ', BDtw) self.assertAlmostEqual(BDtw/ref_blade_mass,1., places=3) @@ -44,7 +44,7 @@ def test_blade_mass_BDtw(self): # readBD2.fst_vt['Fst']['BDBldFile(1)'] = base_name1 + '_BeamDyn_c2.dat' # bd_file2 = os.path.join(BDc2_path, readBD2.fst_vt['Fst']['BDBldFile(1)']) # readBD2.read_BeamDyn(bd_file2) - # BDc2 = np.trapz(readBD2.fst_vt['BeamDynBlade']['beam_inertia'][:,0,0], readBD2.fst_vt['BeamDynBlade']['radial_stations']*blade_length) + # BDc2 = np.trapezoid(readBD2.fst_vt['BeamDynBlade']['beam_inertia'][:,0,0], readBD2.fst_vt['BeamDynBlade']['radial_stations']*blade_length) # print('\nBlade mass in BD along mid chord ', BDc2) # self.assertAlmostEqual(BDc2/ref_blade_mass,1., places=3) @@ -55,7 +55,7 @@ def test_blade_mass_ED(self): readED.fst_vt['ElastoDyn']['BldFile1'] = base_name1 + '_ElastoDyn_blade.dat' ed_file = os.path.join(BDtw_path, readED.fst_vt['ElastoDyn']['BldFile1']) readED.read_ElastoDynBlade(ed_file) - ED = np.trapz(readED.fst_vt['ElastoDynBlade'][0]['BMassDen'], np.array(readED.fst_vt['ElastoDynBlade'][0]['BlFract'])*blade_length) + ED = np.trapezoid(readED.fst_vt['ElastoDynBlade'][0]['BMassDen'], np.array(readED.fst_vt['ElastoDynBlade'][0]['BlFract'])*blade_length) print('\nBlade mass in ED ', ED) self.assertAlmostEqual(ED/ref_blade_mass_ED,1., places=3) @@ -82,9 +82,9 @@ def test_blade_mass_H2(self): f.close() - blade_mass_H2FPM = np.trapz(h2FPM[:,1], h2FPM[:,0]) - blade_mass_H2noFPM = np.trapz(h2noFPM[:,1], h2noFPM[:,0]) - blade_mass_H2noFPMrigid = np.trapz(h2noFPM_rigid[:,1], h2noFPM_rigid[:,0]) + blade_mass_H2FPM = np.trapezoid(h2FPM[:,1], h2FPM[:,0]) + blade_mass_H2noFPM = np.trapezoid(h2noFPM[:,1], h2noFPM[:,0]) + blade_mass_H2noFPMrigid = np.trapezoid(h2noFPM_rigid[:,1], h2noFPM_rigid[:,0]) print('\nBlade mass in H2 with fully populated matrices ', blade_mass_H2FPM) print('\nBlade mass in H2 without fully populated matrices ', blade_mass_H2noFPM) print('\nBlade mass in H2 without fully populated matrices and rigid ', blade_mass_H2noFPMrigid) diff --git a/tests/test_monopile.py b/tests/test_monopile.py index f94e7e96..fd09215a 100644 --- a/tests/test_monopile.py +++ b/tests/test_monopile.py @@ -92,7 +92,7 @@ def test_monopile_mass(self): # yamldata = tstf.load_yaml(yaml_path) # twr_stn_yaml, out_diam_yaml, thick_yaml, E, G, rho, outfit = tstf.load_body_properties('monopile', yamldata) # mpl_yaml = tstf.calculate_mpl(out_diam_yaml, thick_yaml, rho, outfitting_factor=outfit) - # mass_yaml = np.trapz(mpl_yaml, twr_stn_yaml) + 100e3 + # mass_yaml = np.trapezoid(mpl_yaml, twr_stn_yaml) + 100e3 mass_yaml = 1309947.640745313 # from -75 m to +15 m [kg] # load the hawc2 embedded-monopile tower properties @@ -106,8 +106,8 @@ def test_monopile_mass(self): mpl_h2_mon = h2_mon[:, 1] # calculate hawc2 mass - mass_embmon = np.trapz(mpl_h2_embmon, twr_stn_embdmon) - mass_mon = np.trapz(mpl_h2_mon, twr_stn_mon) + mass_embmon = np.trapezoid(mpl_h2_embmon, twr_stn_embdmon) + mass_mon = np.trapezoid(mpl_h2_mon, twr_stn_mon) mass_h2 = mass_embmon + mass_mon + 100e3 assert abs((mass_h2 - mass_yaml) / mass_yaml) < 0.01