示例#1
0
文件: pyHyp.py 项目: zhang9song/pyhyp
    def surfaceSmooth(self, nIter, stepSize, surfFile=None):
        """
        Run smoothing iterations on the body surface

        Parameters
        ----------
        nIter : int
            Number of iterations to run
        stepSize : float
            Size of step. Must be < 1. Usually less than 0.1 for stability
            reasons.
        """

        if surfFile is not None:
            try:
                from pygeo import pyGeo
            except:
                raise Error(
                    "pyGeo must be available to use the surface "
                    "reprojection object. Try again without specifying "
                    "the surfFile option.")

            geoSurf = pyGeo('iges', fileName=surfFile)
            self.hyp.allocatesurfaces(geoSurf.nSurf)
            for iSurf in range(geoSurf.nSurf):
                surf = geoSurf.surfs[iSurf]
                self.hyp.setsurface(iSurf + 1, surf.ku, surf.kv, surf.tu,
                                    surf.tv, surf.coef.T)

        self.hyp.smoothwrap(nIter, stepSize)
示例#2
0
def deform_iges():
    # =========================================================================
    # Set Up pyGeo Object
    # =========================================================================
    # rst IGES
    # ------------------------------ IGES File ------------------------------ #
    geo = pyGeo(fileName=input_files + "deform_geometry_wing.igs",
                initType="iges")
    geo.doConnectivity()
    # rst IGES (end)

    # Deform Geometry Object and Output
    deform_DVGeo(geo)
示例#3
0
def deform_plot3d():
    # =========================================================================
    # Set Up pyGeo Object
    # =========================================================================
    # rst plot3d
    # ----------------------------- Plot3D File ----------------------------- #
    geo = pyGeo(fileName=input_files + "deform_geometry_wing.xyz",
                initType="plot3d")
    geo.doConnectivity()
    geo.fitGlobal()
    # rst plot3d (end)

    # Deform Geometry Object and Output
    deform_DVGeo(geo)
示例#4
0
def deform_liftingsurface():
    # =========================================================================
    # Set Up pyGeo Object
    # =========================================================================
    # rst LiftingSurface
    # ---------------------  Lifting Surface Definition --------------------- #
    # Airfoil file
    naf = 10  # number of airfoils
    airfoil_list = ["./geo/rae2822.dat"] * naf

    # Airfoil leading edge positions
    x = np.linspace(0.0, 7.5, naf)
    y = np.linspace(0.0, 0.0, naf)
    z = np.linspace(0.0, 14.0, naf)

    offset = np.zeros(
        (naf, 2))  # x-y offset applied to airfoil position before scaling

    # Airfoil rotations
    rot_x = [0.0] * naf
    rot_y = [0.0] * naf
    rot_z = [0.0] * naf

    # Airfoil scaling
    chord = np.linspace(5.0, 1.5, naf)

    # Run pyGeo
    geo = pyGeo(
        "liftingSurface",
        xsections=airfoil_list,
        scale=chord,
        offset=offset,
        x=x,
        y=y,
        z=z,
        rotX=rot_x,
        rotY=rot_y,
        rotZ=rot_z,
        tip="rounded",
        bluntTe=True,
        squareTeTip=True,
        teHeight=0.25 * 0.0254,
    )
    # rst LiftingSurface (end)

    # Deform Geometry Object and Output
    deform_DVGeo(geo)
示例#5
0
    def regTest(self, handler):
        dirName = os.path.join(baseDir, "../../input_files")

        # Airfoil file
        airfoil_list = [dirName + "/rae2822.dat"] * 2
        naf = len(airfoil_list)  # number of airfoils

        # Wing definition
        # Airfoil leading edge positions
        x = [0.0, 7.5]
        y = [0.0, 0.0]
        z = [0.0, 14.0]
        offset = np.zeros(
            (naf, 2))  # x-y offset applied to airfoil position before scaling

        # Airfoil rotations
        rot_x = [0.0, 0.0]
        rot_y = [0.0, 0.0]
        rot_z = [0.0, 0.0]

        # Airfoil scaling
        chord = [5.0, 1.5]  # chord lengths

        # Run pyGeo
        wing = pyGeo(
            "liftingSurface",
            xsections=airfoil_list,
            scale=chord,
            offset=offset,
            x=x,
            y=y,
            z=z,
            rotX=rot_x,
            rotY=rot_y,
            rotZ=rot_z,
            tip="rounded",
            bluntTe=True,
            squareTeTip=True,
            teHeight=0.25 * 0.0254,
        )

        for isurf in range(wing.nSurf):
            wing.surfs[isurf].computeData()
        surf = wing.surfs[isurf].data
        handler.root_add_val("sum of surface data",
                             sum(surf.flatten()),
                             tol=1e-10)
示例#6
0
chord = te - le
x = le
z = span * ref_span
mid_y = (up[0] + low[0]) / 2.0
y = -(up + low) / 2 + mid_y

# Scale the thicknesses
toc = -(up - low) / chord
thickness = toc / 0.12

rot_x = np.zeros(naf)
rot_y = np.zeros(naf)
rot_z = np.zeros(naf)
offset = np.zeros((naf, 2))

bwb = pyGeo(
    "liftingSurface",
    xsections=airfoil_list,
    scale=chord,
    offset=offset,
    thickness=thickness,
    bluntTe=True,
    teHeight=0.05,
    tip="rounded",
    x=x,
    y=y,
    z=z,
)

bwb.writeIGES("bwb.igs")
示例#7
0
    (naf, 2))  # x-y offset applied to airfoil position before scaling

# Airfoil rotations
rot_x = [0., 0.]
rot_y = [0., 0.]
rot_z = [0., 0.]

# Airfoil scaling
chord = [5.0, 1.5]  # chord lengths

#rst Run pyGeo
wing = pyGeo('liftingSurface',
             xsections=airfoil_list,
             scale=chord,
             offset=offset,
             x=x,
             y=y,
             z=z,
             rotX=rot_x,
             rotY=rot_y,
             rotZ=rot_z,
             tip='rounded',
             bluntTe=True,
             squareTeTip=True,
             teHeight=0.25 * .0254)

#rst Write output files
wing.writeTecplot('wing.dat')
wing.writeIGES('wing.igs')
wing.writeTin('wing.tin')
# Finally fill in chord-wise with linear edges
for i in range(ncols):
    X[i, :] = geo_utils.linearEdge(X[i, 0], X[i, -1], nrows)

# Boundary conditions
ribBC = {
    0:{'all':'123456'},
}

# ==============================================================================
#       Generate wingbox
# ==============================================================================
# Get surface definition to use for projections
surfFile = 'wing.igs'
geo = pyGeo('iges', fileName=surfFile)

# Initialize pyLayout
layout = pyLayout.Layout(geo,
    teList=[],
    nribs=ncols,
    nspars=nrows,
    elementOrder=2,
    X=X,
    ribBlank=ribBlank,
    sparBlank=sparBlank,
    topStringerBlank=topStringerBlank,
    botStringerBlank=botStringerBlank,
    ribStiffenerBlank=ribStiffenerBlank,
    minStringer_height = 0.025,
    maxStringer_height = 0.025,
示例#9
0
文件: c172.py 项目: eirikurj/pygeo
rot_x = [0, 0, 0]
rot_y = [0, 0, 0]
rot_z = [0, 0, 2]
offset = np.zeros((naf, 2))

# There are several examples that follow showing many of the different
# combinations of tip/trailing edge options that are available.

# --------- Sharp Trailing Edge / Rounded Tip -------
wing = pyGeo(
    "liftingSurface",
    xsections=airfoil_list,
    scale=chord,
    offset=offset,
    x=x,
    y=y,
    z=z,
    rotX=rot_x,
    rotY=rot_y,
    rotZ=rot_z,
    kSpan=2,
    tip="rounded",
)

wing.writeTecplot("c172_sharp_te_rounded_tip.dat")
wing.writeIGES("c172_sharp_te_rounded_tip.igs")

# --------- Sharp Trailing Edge / Pinched Tip -------
wing = pyGeo(
    "liftingSurface",
    xsections=airfoil_list,
    scale=chord,