def solve_nonlinear(self, params, unknowns, resids): # we need to dig into the _ByObjWrapper val to get the array # values out # pf_in = {name: val['val'].val for name, val in params.iteritems()} pf_in = {} pf_in['s'] = params['s'] pf_in['x'] = params['x'] pf_in['y'] = params['y'] pf_in['z'] = params['z'] pf_in['rot_x'] = params['rot_x'] pf_in['rot_y'] = params['rot_y'] pf_in['rot_z'] = params['rot_z'] pf_in['chord'] = params['chord'] pf_in['rthick'] = params['rthick'] pf_in['p_le'] = params['p_le'] if _PGL_installed: pf = redistribute_planform(pf_in, s=self.s_new, spline_type=self.spline_type) else: pf = {} for k, v in pf_in.iteritems(): spl = pchip(pf_in['s'], v) pf[k] = spl(self.s_new) for k, v in pf.iteritems(): unknowns[k+self._suffix] = v unknowns['athick'+self._suffix] = pf['chord'] * pf['rthick']
def solve_nonlinear(self, params, unknowns, resids): # we need to dig into the _ByObjWrapper val to get the array # values out # pf_in = {name: val['val'].val for name, val in params.iteritems()} pf_in = {} pf_in["s"] = params["s"] pf_in["x"] = params["x"] pf_in["y"] = params["y"] pf_in["z"] = params["z"] pf_in["rot_x"] = params["rot_x"] pf_in["rot_y"] = params["rot_y"] pf_in["rot_z"] = params["rot_z"] pf_in["chord"] = params["chord"] pf_in["rthick"] = params["rthick"] pf_in["p_le"] = params["p_le"] if _PGL_installed: pf = redistribute_planform(pf_in, s=self.s_new, spline_type=self.spline_type) else: pf = {} for k, v in pf_in.iteritems(): spl = pchip(pf_in["s"], v) pf[k] = spl(self.s_new) for k, v in pf.iteritems(): unknowns[k + self._suffix] = v unknowns["athick" + self._suffix] = pf["chord"] * pf["rthick"]
def solve_nonlinear(self, params, unknowns, resids): # we need to dig into the _ByObjWrapper val to get the array # values out # pf_in = {name: val['val'].val for name, val in params.iteritems()} pf_in = {} pf_in['s'] = params['s'] pf_in['x'] = params['x'] pf_in['y'] = params['y'] pf_in['z'] = params['z'] pf_in['rot_x'] = params['rot_x'] pf_in['rot_y'] = params['rot_y'] pf_in['rot_z'] = params['rot_z'] pf_in['chord'] = params['chord'] pf_in['rthick'] = params['rthick'] pf_in['p_le'] = params['p_le'] if _PGL_installed: pf = redistribute_planform(pf_in, s=self.s_new, spline_type=self.spline_type) else: pf = {} for k, v in pf_in.iteritems(): spl = pchip(pf_in['s'], v) pf[k] = spl(self.s_new) for k, v in pf.iteritems(): unknowns[k + self._suffix] = v unknowns['athick' + self._suffix] = pf['chord'] * pf['rthick']
def redistribute_planform(pf, dist=[], s=None, spline_type="akima"): """ redistribute a blade planform calls PGL.main.planform.read_blade_planform parameters ---------- pf: dict optional dictionary containing planform. If not supplied, planform_filename is required. Keys: | s: normalized running length of blade | x: x-coordinates of blade axis | y: y-coordinates of blade axis | z: z-coordinates of blade axis | rot_x: x-rotation of blade axis | rot_y: y-rotation of blade axis | rot_z: z-rotation of blade axis | chord: chord distribution | rthick: relative thickness distribution | p_le: pitch axis aft leading edge distribution dist: list list of control points with the form | [[s0, ds0, n0], [s1, ds1, n1], ... [s<n>, ds<n>, n<n>]] | where | s<n> is the curve fraction at each control point, | ds<n> is the cell size at each control point, | n<n> is the cell count at each control point. s: array optional normalized distribution of cells. """ from PGL.main.planform import redistribute_planform return redistribute_planform(pf, dist, s, spline_type)
def redistribute_planform(pf, dist=[], s=None, spline_type='akima'): """ redistribute a blade planform calls PGL.main.planform.read_blade_planform parameters ---------- pf: dict optional dictionary containing planform. If not supplied, planform_filename is required. Keys: | s: normalized running length of blade | x: x-coordinates of blade axis | y: y-coordinates of blade axis | z: z-coordinates of blade axis | rot_x: x-rotation of blade axis | rot_y: y-rotation of blade axis | rot_z: z-rotation of blade axis | chord: chord distribution | rthick: relative thickness distribution | p_le: pitch axis aft leading edge distribution | dy: vertical offset of cross-section dist: list list of control points with the form | [[s0, ds0, n0], [s1, ds1, n1], ... [s<n>, ds<n>, n<n>]] | where | s<n> is the curve fraction at each control point, | ds<n> is the cell size at each control point, | n<n> is the cell count at each control point. s: array optional normalized distribution of cells. """ from PGL.main.planform import redistribute_planform return redistribute_planform(pf, dist, s, spline_type)
from fusedwind.turbine.structure import ComputeDPsParam2, \ read_bladestructure, \ write_bladestructure PATH = pkg_resources.resource_filename('fusedwind', 'turbine/test') # --- 2 --- # generate a lofted blade surface using PGL pf = read_blade_planform(os.path.join(PATH, 'data/DTU_10MW_RWT_blade_axis_prebend.dat')) s_st = np.linspace(0, 1, 20) pf = redistribute_planform(pf, s=s_st) d = LoftedBladeSurface() d.pf = pf # redistribute in the chordwise direction # with 200 nodes, open TE (chord_nte=0) # and open TE of cross sections with TE # thickness less 2 cm d.redistribute_flag = True d.chord_ni = 200 d.chord_nte = 0 d.minTE = 0.000232 # privide base airfoils as function of relative thickess d.blend_var = [0.241, 0.301, 0.36, 0.48, 1.0]