def compute(self, inputs, outputs): z_full = inputs["z_full"] z_param = inputs["z_param"] z_section = 0.5 * (z_full[:-1] + z_full[1:]) outputs["height_constraint"] = inputs["hub_height"] - z_param[-1] outputs["rho_full"] = util.sectionalInterp(z_section, z_param, inputs["rho"]) outputs["outfitting_full"] = util.sectionalInterp(z_section, z_param, inputs["outfitting_factor"]) outputs["unit_cost_full"] = util.sectionalInterp(z_section, z_param, inputs["unit_cost"]) outputs["E_full"] = util.sectionalInterp(z_section, z_param, inputs["E"]) outputs["G_full"] = util.sectionalInterp(z_section, z_param, inputs["G"]) outputs["sigma_y_full"] = util.sectionalInterp(z_section, z_param, inputs["sigma_y"]) # Unpack for Elastodyn z = 0.5 * (z_param[:-1] + z_param[1:]) rho = inputs["rho"] E = inputs["E"] G = inputs["G"] Az = util.sectionalInterp(z, z_full, inputs["Az"]) Ixx = util.sectionalInterp(z, z_full, inputs["Ixx"]) Iyy = util.sectionalInterp(z, z_full, inputs["Iyy"]) Jz = util.sectionalInterp(z, z_full, inputs["Jz"]) outputs["sec_loc"] = (z - z[0]) / (z[-1] - z[0]) outputs["mass_den"] = rho * Az outputs["foreaft_iner"] = rho * Ixx outputs["sideside_iner"] = rho * Iyy outputs["foreaft_stff"] = E * Ixx outputs["sideside_stff"] = E * Iyy outputs["tor_stff"] = G * Jz outputs["axial_stff"] = E * Az
def compute(self, inputs, outputs): # Check to make sure we have good values if np.any(inputs["section_height"] <= 0.0): raise ValueError( "Section height values must be greater than zero, " + str(inputs["section_height"])) if np.any(inputs["wall_thickness"] <= 0.0): raise ValueError( "Wall thickness values must be greater than zero, " + str(inputs["wall_thickness"])) if np.any(inputs["diameter"] <= 0.0): raise ValueError("Diameter values must be greater than zero, " + str(inputs["diameter"])) nRefine = int(np.round(self.options["nRefine"])) z_param = float(inputs["foundation_height"]) + np.r_[ 0.0, np.cumsum(inputs["section_height"].flatten())] # Have to regine each element one at a time so that we preserve input nodes z_full = np.array([]) for k in range(z_param.size - 1): zref = np.linspace(z_param[k], z_param[k + 1], nRefine + 1) z_full = np.append(z_full, zref) z_full = np.unique(z_full) outputs["z_full"] = z_full outputs["d_full"] = np.interp(z_full, z_param, inputs["diameter"]) z_section = 0.5 * (z_full[:-1] + z_full[1:]) outputs["t_full"] = util.sectionalInterp(z_section, z_param, inputs["wall_thickness"]) outputs["z_param"] = z_param
def testSectionalInterp(self): x = np.arange(0.0, 2.1, 0.5) y = np.array([-1.0, 1.0, -2.0, 2.0]) xi = np.array([-0.1, 0.25, 0.9, 1.4, 1.5, 1.6, 2.1]) yi = util.sectionalInterp(xi, x, y) y_expect = np.array([-1.0, -1.0, 1.0, -2.0, 2.0, 2.0, 2.0]) npt.assert_array_equal(yi, y_expect)
def compute(self, inputs, outputs): nRefine = int(np.round(self.options['nRefine'])) z_param = float(inputs['foundation_height']) + np.r_[ 0.0, np.cumsum(inputs['section_height'].flatten())] # Have to regine each element one at a time so that we preserve input nodes z_full = np.array([]) for k in range(z_param.size - 1): zref = np.linspace(z_param[k], z_param[k + 1], nRefine + 1) z_full = np.append(z_full, zref) z_full = np.unique(z_full) outputs['z_full'] = z_full outputs['d_full'] = np.interp(z_full, z_param, inputs['diameter']) z_section = 0.5 * (z_full[:-1] + z_full[1:]) outputs['t_full'] = sectionalInterp(z_section, z_param, inputs['wall_thickness']) outputs['z_param'] = z_param