> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ntop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parametric Flying Wing Demo

export const YouTubeVideo = ({src, title, caption}) => {
  return <Frame caption={caption}>
      <iframe className="w-full aspect-video rounded-xl" src={`https://www.youtube.com/embed/${src}`} title={title} allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>
    </Frame>;
};

<YouTubeVideo src="h0-VtWs-B-c" />

This demo walks through one approach to creating a two panel flying wing geometry from scratch in nTop using some custom blocks.

<Accordion title="Transcript">
  Hello. This is a quick example of how you might go about making a simple shape for a flying wing. I'll start by adding some variables for my key parameters. We'll start with **root chord** and set it to one meter. I'll rename my section “Key Parameters.” Then, I'll duplicate this for the **span**. I'll specify the span as a ratio to my root chord, so I'm going to remove the units here; everything will be a ratio.

  Next, we'll define a **panel break**. We'll do a simple two-panel flying wing and start with half of the span. Then, we'll set the **panel one leading edge angle** to 30° and the **panel two leading edge angle** to 15°. We'll do the same for the trailing edge: **panel one trailing edge angle** and **panel two trailing edge angle**.

  All right, let's start there. We'll add a new section labeled **Point Calcs** and create a bunch of points to define the planform shape. It will be pointed in the negative Z direction. This first one will be **panel zero**, representing the root chord leading edge. Then, we'll create the **panel zero trailing edge**, where the X-coordinate will be the root chord distance. Zooming out, we can see our leading and trailing edges.

  Now, we'll create our **P1 leading edge** with a little math. To find our actual span, we'll multiply our root chord by the span percentage. I'll make this a variable called **half span** (dividing the span percentage by two), as that's what we'll actually need for our point calculations. For the P1 leading edge point, the Y-coordinate will be the half span multiplied by our panel break percentage. For the X-coordinate, we'll use trigonometry: multiplying that Y value by the tangent of our panel one leading edge angle. If I change my angle, it looks like it's working.

  Let's duplicate this to create our **trailing edge**. The Y-coordinate will be the same, but we'll start from the root chord, so we need to subtract the root chord distance from the X-coordinate and update the angle to the **P1 trailing edge angle**.

  Now, let's create our final **panel two points**. For the **P2 leading edge**, the Y-coordinate will just be the half span. For the X-coordinate, we'll take the X-coordinate from P1 and add some math. Let's clean this up: we'll take the P1 leading edge X and add the result of the half span minus the panel break, multiplied by the tangent of the **panel two leading edge angle**. If I set that angle to zero, it should be totally straight—and it is.

  We'll do the same for the **trailing edge**. The Y-coordinate is the same, but we'll subtract the P2 trailing edge X-coordinate using the **P2 trailing edge angle**. For cleanliness, I'll label this **P2 trailing edge Y**, even though it's the same as P1.

  Now that we have our points, I'll collapse these sections. We have full parametric control. The next step is to create the **splines** for our planform. First, I'll create a point list for the **leading edge** with five points total. I'll go left to right for my sanity. I'll use a point block to mirror the leading edge points, using the same X value but a negative Y value. I'll make this a variable called **leading edge points** and repeat the process for the **trailing edge**.

  To keep it simple, we'll start by making a couple of lines: **P0 to P1** and **P1 to P2** for both the leading and trailing edges. While there are many ways to create splines, I'm going with **spline by tangents** for ease and control. We'll need a tangent vector for all five points along the leading edge. I'll take the tangents from my lines and add a “tension multiplier” variable (**P2 tension** and **P1 tension**). For the center point, I'll add a **center leading edge tension**.

  Once the leading edge spline is set, I'll do the same for the **trailing edge spline**. We'll use the trailing edge point list and create corresponding tension variables. We can change our root chord or span, and everything updates accordingly.

  The next step is to create our **airfoils**. For this demo, we'll use two different profiles. For the center, a **NACA 5-digit (2312)** with the root chord as the length. For the outer airfoil, a **NACA 4-digit (0010)** symmetrical profile.

  Now, we'll create a **lofted section** that blends these two. I'll use a **mix block**, which works well for airfoils with zero camber at the tip and tail. I'll use a **ramp block** to control the transition, using the absolute value of Y as the input. We'll define an **airfoil transition length** variable to smooth the blend between the two profiles. By setting a bounding box, we can see the transition.

  Now that we have our mixed airfoils, we'll **loft** them into our planform. In nTop, we use a **remap field block** to map the coordinate space of one signed distance field to another. For the leading edge, we want to translate the field by the distance to the leading edge. I'll use the **distance to curve from axis** block for the leading edge spline.

  We also need to scale it appropriately. I'll create a field for the **trailing edge distance to curve**. By subtracting the leading edge distance from the trailing edge distance, we get a **chord field** representing the chord length across the wing. I'll normalize this by the root chord to create a **taper ratio field**.

  Finally, I'll take our X and Z coordinates and divide them by this taper ratio field. This remaps the airfoil so it fits perfectly between the leading and trailing edges while scaling the height uniformly.

  The last step is to **add twist** to the wing. I'll use a **twist wing** block. I'll specify a **twist chord ratio** and create a **twist field** using a ramp block. Typically, a flying wing needs a little downwash on the outer panels, so I'll set a **wing tip downwash angle** (e.g., 3 degrees). Applying a bounding box allows us to see the wing tip deflect appropriately.

  This gives us the basic parametric shape of a flying wing in nTop. From here, you could package this into a custom block for detailed design. While simplistic, I hope this shows how easy it is to model real aircraft geometry.
</Accordion>

**Downloadable Files:**

[2 Panel Flying Wing.ntop](https://storage.googleapis.com/files-learn/Courses/Aircraft%20Modeling/2%20Panel%20Flying%20Wing.ntop)

\*This file was last updated in nTop 5.44.\*2
