Skip to content

Commit

Permalink
Merge pull request #7 from ptrbortolotti/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ptrbortolotti authored Jun 10, 2024
2 parents 031fcc4 + 64ecf7e commit 2e3af49
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions SONATA/cbm/display/display_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -293,8 +293,8 @@ 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')
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")
# fname = kw['savepath'].split('.')[0]+'_'+datestr+'.'+kw['savepath'].split('.')[1]
Expand Down
17 changes: 14 additions & 3 deletions SONATA/utl/converter_WT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions SONATA/utl_openfast/utl_sonata2beamdyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
8 changes: 3 additions & 5 deletions examples/1_IEA15MW/1_sonata_IEA15.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,20 @@
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
flags_dict = {"flag_wt_ontology": flag_wt_ontology, "flag_ref_axes_wt": flag_ref_axes_wt,
"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
Expand Down
4 changes: 2 additions & 2 deletions examples/1_IEA15MW/IEA-15-240-RWT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e3af49

Please sign in to comment.