# Generating Anisotropic Triangles Using 2D T-Rex

When creating unstructured domains on surfaces with significant curvature, resolving the regions of high curvature can be difficult. One solution to this problem is to generate a 2D T-Rex domain on these surfaces. A T-Rex mesh allows you to grow anisotropic triangles off edges of a domain for a certain number of layers then fill in the remainder of the domain with isotropic triangles. The end result is a mesh that resolves the spacing and curvature near the domain edge while using isotropic triangles to reduce cell count in the roughly planar regions of the domain. Not only does T-Rex provide viscous resolution for 2D grids, but can also be used to generate match domains for full 3D anisotropic grids.

To learn how to use T-Rex on an unstructured domain with high curvature, begin with a geometry like the example shown below of a wing. Unstructured domains have already been created on the existing database. The goal is to resolve the curvature on the leading edge of the wing to reduce the faceting caused by the isotropic triangles.

Refer to the example and apply the steps to your own geometry. Note that the numbers in the following steps apply to the example; you will need to determine which settings work best for your own grid.

The first step is to select the desired domains and set the T-Rex attributes for the grids.

1. Click on Unstructured on the toolbar.
2. Select the two domains.
3. Grid, T-Rex
4. In the Layers frame, enter 10 for Max. Layers.
5. Enter 5 for Full Layers.
6. Keep the default Growth Rate for this example.

Max. Layers sets the maximum number of anisotropic layers you wish to have on the domains. This number does not guarantee the total number of anisotropic layers, but sets the limit on the total number of layers generated. Full Layers tells the T-Rex solver to generate this number of layers without removing triangles from or adding triangles to the layer front. In other words, this is the number of complete anisotropic triangle layers generated. Growth Rate is set to 1.3 by default, which is a 30% growth rate. To change the default, uncheck Use Default and enter your own value.

Now that the T-Rex attributes have been set, boundary conditions need to be applied to the domains' edges so the solver will know how they should be handled. For example, you may have some edges grow anisotropic triangles, but keep some edges isotropic.

1. Click on the Solve, Boundary Conditions tab.
2. Notice that all domain edges are set to the Unspecified BC for which the Type is Off. This means that, by default, isotropic triangles will be generated off all edges.

3. Click New.
4. Double-click the Name field of the new BC.
5. Enter LE.
6. Double-click the Type field of the LE BC.
7. Select Wall.
8. Edges with this BC Type applied to them will grow anisotropic triangles.

9. Double-click the Δs field of the LE BC.
10. Enter 0.2.
11. This value will be the initial height for the first layer of anisotropic cells.

12. Select the two Leading Edge Connectors.
13. Check the LE BC.
14. The BC has been applied to the selected connectors. Notice that the Unspecified BC has been decreased by two.

15. Click New.
16. Double-click the Name field of the new BC.
17. Enter Chord.
18. Double-click the Type field of the Chord BC.
19. Select Match.
20. Edges with this BC Type will act as guides for the anisotropic triangles grown off the Wall BC edges.

21. Select the Chordwise Connectors, the root and tip of the wing and the Same and Opposite sides of the middle chordwise connector.
22. Two different BCs can be set to the shared edge of two domains, one for each side of the edge. For this example, we will set both sides of the edge to the same BC.

23. Check the Chord BC.
24. The BC has been applied to the selected connectors. Notice that the Unspecified BC has been decreased by four.

There are two connectors, the trailing edges, which still remain in the Unspecified BC. We want isotropic triangles generated off these edges, so we will leave them in this BC which is set to Off.

The boundary conditions are set, so now we are ready to initialize the domains.

1. Click on the Solve, Solve tab.
2. Initialize
3. Use Initialize when initializing your domain for the first time. But if you make changes in the Attributes, T-Rex, or Boundary Conditions tabs, use Refine to modify the domains.

4. OK (T-Rex domains are saved.)

But notice that the Chordwise Connectors near the leading edge do not have the same initial spacing or growth rate as the T-Rex grids. This can easily be fixed by applying a growth distribution function to the connectors. For more information on this technique, please go to Applying the Growth Distribution Function to Connectors (2D T-Rex).

Following this example, you can see how a T-Rex mesh can help you create an unstructured mesh, while also resolving areas of high curvature.

Back to the main DIY training page.