From da49f30a57efe4aa66dbef2db50a91a58ec37067 Mon Sep 17 00:00:00 2001 From: pibo Date: Thu, 9 Nov 2023 15:10:46 -0700 Subject: [PATCH 1/5] support iea22 --- SONATA/utl/converter_WT.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/SONATA/utl/converter_WT.py b/SONATA/utl/converter_WT.py index 1960f73..df440f5 100644 --- a/SONATA/utl/converter_WT.py +++ b/SONATA/utl/converter_WT.py @@ -287,9 +287,9 @@ def converter_WT(blade, cs_pos, byml, materials, mesh_resolution): # set_interp = PchipInterpolator(sec['thickness']['grid'],sec['thickness']['values']) thick_web[i, int(id_seg / 2 - 1)] = thick_web[i, int(id_seg / 2 - 1)] + thick_i - if thick_web[i, int(id_seg / 2 - 1)] < 0.02: - thick_web[i, int(id_seg / 2 - 1)] = 0.02 - print('WARNING: web filler cannot be thinner than 20mm. This is adjusted here, but please check the input yaml.') + if thick_web[i, int(id_seg / 2 - 1)] < 0.01: + thick_web[i, int(id_seg / 2 - 1)] = 0.01 + print('WARNING: web filler cannot be thinner than 10mm. This is adjusted here, but please check the input yaml.') web_filler_index = True # changes to true as web has now already been filled with material # Orthotropic at trailing edge (_te) @@ -396,6 +396,17 @@ def converter_WT(blade, cs_pos, byml, materials, mesh_resolution): if np.mean(profile[0:id_le, 1]) < 0: profile = np.flip(profile,0) + # checks for flatback airfoils + # profile[0,0] = 1. + # profile[0,1] = 1.e-4 + # profile[-1,0] = 1. + # profile[-1,1] = -1.e-4 + if len(np.where(profile[:,0] == 1.)[0]) > 2: + profile = profile[:np.where(profile[:,0]==1.)[0][2] , :] + + # if len(profile[:,0]) != len(np.unique(profile[:,0])): + # raise Exception('Airfoil at station {:d} does not have unique x points'.format(id_profile)) + profile_curve = arc_length(profile[:,0], profile[:,1]) / arc_length(profile[:,0], profile[:,1])[-1] set_interp = PchipInterpolator(profile_curve, profile[:,0]) From 8e2e46667ea6613545ae2f129659082c918f691c Mon Sep 17 00:00:00 2001 From: pibo Date: Thu, 7 Dec 2023 22:18:08 -0700 Subject: [PATCH 2/5] fix output folder generation bug --- SONATA/cbm/display/display_mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SONATA/cbm/display/display_mesh.py b/SONATA/cbm/display/display_mesh.py index 7411dc9..4305b5e 100755 --- a/SONATA/cbm/display/display_mesh.py +++ b/SONATA/cbm/display/display_mesh.py @@ -294,7 +294,7 @@ def plot_cells(cells,nodes, attr1, materials, VABSProperties=None, title='None', if 'savepath' in kw: if not os.path.exists(kw['savepath']+'figures'): # create 'figures' Folder if not already existing - os.mkdir(kw['savepath']+'figures') + os.makedirs(os.path.join(kw['savepath'],'figures')) # datestr = datetime.datetime.now().strftime("%Y%m%d_%H%M") # fname = kw['savepath'].split('.')[0]+'_'+datestr+'.'+kw['savepath'].split('.')[1] From eaa796dac96766dca977ddff0ef6784a75c8d938 Mon Sep 17 00:00:00 2001 From: pibo Date: Thu, 7 Dec 2023 22:25:33 -0700 Subject: [PATCH 3/5] again --- SONATA/cbm/display/display_mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SONATA/cbm/display/display_mesh.py b/SONATA/cbm/display/display_mesh.py index 4305b5e..05e96f3 100755 --- a/SONATA/cbm/display/display_mesh.py +++ b/SONATA/cbm/display/display_mesh.py @@ -293,7 +293,7 @@ def plot_cells(cells,nodes, attr1, materials, VABSProperties=None, title='None', if 'savepath' in kw: - if not os.path.exists(kw['savepath']+'figures'): # create 'figures' Folder if not already existing + if not os.path.exists(os.path.join(kw['savepath'],'figures')): # create 'figures' Folder if not already existing os.makedirs(os.path.join(kw['savepath'],'figures')) # datestr = datetime.datetime.now().strftime("%Y%m%d_%H%M") From ef9a474064b66e4a248da28cb77910528b2ca3fa Mon Sep 17 00:00:00 2001 From: pibo Date: Tue, 5 Mar 2024 05:46:38 -0700 Subject: [PATCH 4/5] compute along ref axis, not mid chord --- SONATA/utl_openfast/utl_sonata2beamdyn.py | 4 ++-- examples/1_IEA15MW/1_sonata_IEA15.py | 8 +++----- examples/1_IEA15MW/IEA-15-240-RWT.yaml | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/SONATA/utl_openfast/utl_sonata2beamdyn.py b/SONATA/utl_openfast/utl_sonata2beamdyn.py index 2a0d1b7..97fd548 100644 --- a/SONATA/utl_openfast/utl_sonata2beamdyn.py +++ b/SONATA/utl_openfast/utl_sonata2beamdyn.py @@ -130,7 +130,7 @@ def write_beamdyn_axis(folder, flags_dict, wt_name, ra, twist): data = np.vstack((kp_xr, kp_yr, kp_zr, twist_interp)).T # file = open(folder + '00_analysis/analysis/' + wt_name + '_BeamDyn.dat', 'w') - file = open(folder + wt_name + '_BeamDyn.dat', 'w') + file = open(os.path.join(folder , wt_name + '_BeamDyn.dat'), 'w') file.write('--------- BEAMDYN with OpenFAST INPUT FILE -------------------------------------------\n') file.write('%s blade\n' % (wt_name)) file.write('---------------------- SIMULATION CONTROL --------------------------------------\n') @@ -198,7 +198,7 @@ def write_beamdyn_prop(folder, flags_dict, wt_name, radial_stations, beam_stiff, n_pts = len(radial_stations) # file = open(folder + '00_analysis/analysis/' + wt_name + '_BeamDyn_Blade.dat', 'w') - file = open(folder + wt_name + '_BeamDyn_Blade.dat', 'w') + file = open(os.path.join(folder , wt_name + '_BeamDyn_Blade.dat'), 'w') file.write(' ------- BEAMDYN V1.00.* INDIVIDUAL BLADE INPUT FILE --------------------------\n') file.write(' Test Format 1\n') file.write(' ---------------------- BLADE PARAMETERS --------------------------------------\n') diff --git a/examples/1_IEA15MW/1_sonata_IEA15.py b/examples/1_IEA15MW/1_sonata_IEA15.py index dc3cba7..af50518 100644 --- a/examples/1_IEA15MW/1_sonata_IEA15.py +++ b/examples/1_IEA15MW/1_sonata_IEA15.py @@ -35,8 +35,7 @@ flag_wf = True # plot wire-frame flag_lft = True # plot lofted shape of blade surface (flag_wf=True obligatory); Note: create loft with grid refinement without too many radial_stations; can also export step file of lofted shape flag_topo = True # plot mesh topology -c2_axis = True -rm_vabfiles = False # Remove or keep VABS input files once generated. It is possible to set the flag to True even without a valid installation of VABS +c2_axis = False # create flag dictionary @@ -44,13 +43,12 @@ "attribute_str": attribute_str, "flag_plotDisplacement": flag_plotDisplacement, "flag_plotTheta11": flag_plotTheta11, "flag_wf": flag_wf, "flag_lft": flag_lft, "flag_topo": flag_topo, "mesh_resolution": mesh_resolution, - "flag_recovery": flag_recovery, "c2_axis": c2_axis, "rm_vabfiles": rm_vabfiles} + "flag_recovery": flag_recovery, "c2_axis": c2_axis} # ===== User defined radial stations ===== # # Define the radial stations for cross sectional analysis (only used for flag_wt_ontology = True -> otherwise, sections from yaml file are used!) -radial_stations = [0. , 0.05, 0.1 , 0.15, 0.2 , 0.25, 0.3 , 0.35, 0.4, 0.45, 0.5 , 0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.9 , 0.95, 1.] -# radial_stations = [0.3] +radial_stations = [0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.075, 0.1 , 0.15, 0.2 , 0.25, 0.3 , 0.35, 0.4, 0.45, 0.5 , 0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.9 , 0.95, 1.] # ===== Execute SONATA Blade Component Object ===== # # name - job name of current task diff --git a/examples/1_IEA15MW/IEA-15-240-RWT.yaml b/examples/1_IEA15MW/IEA-15-240-RWT.yaml index 96775ae..7314be6 100644 --- a/examples/1_IEA15MW/IEA-15-240-RWT.yaml +++ b/examples/1_IEA15MW/IEA-15-240-RWT.yaml @@ -80,10 +80,10 @@ components: grid: [0.0, 0.02040816326530612, 0.04081632653061224, 0.061224489795918366, 0.08163265306122448, 0.1020408163265306, 0.12244897959183673, 0.14285714285714285, 0.16326530612244897, 0.18367346938775508, 0.2040816326530612, 0.22448979591836732, 0.24489795918367346, 0.26530612244897955, 0.2857142857142857, 0.3061224489795918, 0.32653061224489793, 0.3469387755102041, 0.36734693877551017, 0.3877551020408163, 0.4081632653061224, 0.42857142857142855, 0.44897959183673464, 0.4693877551020408, 0.4897959183673469, 0.5102040816326531, 0.5306122448979591, 0.5510204081632653, 0.5714285714285714, 0.5918367346938775, 0.6122448979591836, 0.6326530612244897, 0.6530612244897959, 0.673469387755102, 0.6938775510204082, 0.7142857142857142, 0.7346938775510203, 0.7551020408163265, 0.7755102040816326, 0.7959183673469387, 0.8163265306122448, 0.836734693877551, 0.8571428571428571, 0.8775510204081632, 0.8979591836734693, 0.9183673469387754, 0.9387755102040816, 0.9591836734693877, 0.9795918367346939, 1.0] values: [0.05, 0.044485585534082064, 0.03920631246744508, 0.03412448386439088, 0.02929392619207671, 0.024489505325564213, 0.019384558581206295, 0.014595881643786201, 0.010343166429891729, 0.007150009588491233, 0.005006698932577704, 0.003764433062961093, 0.0030198265169068604, 0.0024784377045354734, 0.0021584738459249457, 0.00204953240924978, 0.0020060989392585928, 0.0020006011392945207, 0.002000115115065172, 0.002000012940486307, 0.0020000009096608237, 0.00200000000005121, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.002, 0.0019033104254005903, 0.0016891430845399399, 0.0013784275518661877, 0.0011538262554083136, 0.00103989912672171, 0.0010063268946716168, 0.0010007931283301417, 0.001, 0.001, 0.001] start_nd_arc: - grid: [0.0, 0.25, 0.3, 1.0] + grid: [0.0, 0.3, 0.35, 1.0] values: [0.0, 0.0, 0.01, 0.01] end_nd_arc: - grid: [0.0, 0.25, 0.3, 1.0] + grid: [0.0, 0.3, 0.35, 1.0] values: [1.0, 1.0, 0.99, 0.99] - name: Spar_Cap_SS material: CarbonUD From 64ecf7e5ef683fb131a1913f2ce6cb23d6cecd40 Mon Sep 17 00:00:00 2001 From: ptrbortolotti Date: Mon, 10 Jun 2024 14:10:51 -0600 Subject: [PATCH 5/5] Polygon has new keyword argument --- SONATA/cbm/display/display_mesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SONATA/cbm/display/display_mesh.py b/SONATA/cbm/display/display_mesh.py index 05e96f3..0579dc6 100755 --- a/SONATA/cbm/display/display_mesh.py +++ b/SONATA/cbm/display/display_mesh.py @@ -110,7 +110,7 @@ def plot_mesh(nodes, elements, theta_11, data, data_name, materials, title=None, else: array = np.vstack((nodes[ele[0] - 1], nodes[ele[1] - 1], nodes[ele[2] - 1], nodes[ele[3] - 1])) centroids.append(centroid(array)) - polygon = Polygon(array, True, edgecolor="k") + polygon = Polygon(array, closed=True, edgecolor="k") patches.append(polygon) # p = PatchCollection(patches, alpha=alpha, cmap=cmap, edgecolors = 'k')