Size Function Smoothing Using an Element Area Gradient John Howlett and Alan Zundel Department of Civil and Environmental Engineering Brigham Young University
[email protected],
[email protected]
Abstract. This paper presents a method to improve element size transitions when using a size function to govern the mesh generation. The method modifies the size function to meet a user specified adjacent element area change limit. The method can be used to either refine or coarsen the resulting mesh. Two sample meshes generated using the method are presented.
1 Introduction Size functions consist of spatially distributed points with an associated value used to specify the desired spacing of finite element nodes. Size functions should contain only positive, nonzero values. In addition, size functions should contain values for the entire domain. Sources of size functions vary based on what numerical model the finite element mesh being generated will be used with. They may come from manual specification by the user, analysis performed on a previous calculation [6], or from geometric data such as depth. For example, the size function may be specified based on the wavelength when using CGWAVE a wave prediction model for simulating the propagation and transformation of ocean waves in coastal regions and harbors [5]. In any case, the size function specifies how far apart nodes should be in the finite element mesh. Figure 2 shows a wave shape represented by a different number of elements. The quality of the representation varies as the number of nodes changes. To include more nodes, the size of each element must be a smaller fraction of the wavelength. Since wavelength is related to the depth of the water, which varies spatially over the domain, a size function can be created based on the wavelength in the area being modeled. Shallow areas, with short wavelengths, require closer node spacing than deeper areas, with long wavelengths [2].
2
J. Howlett and A. Zundel
Fig. 1. CGWAVE Model Results
Fig. 2. Wave Shape as Represented by Different Number of Elements
2 Size Function Smoothing Using an Element Area Gradient If the size function changes too quickly, it will be impossible to space the mesh nodes at a distance close to the distance specified by the size function. Size functions that change too quickly are said to be poorly conditioned. Size functions that change at an acceptable rate are said to be well conditioned [3][7][8]. Size function smoothing using an element area gradient significantly improves the quality of meshes produced by size function based mesh generators. By creating high quality initial meshes, the amount of manual mesh editing required is greatly reduced or eliminated. To understand why size function smoothing is needed, consider the case of a one dimensional grid between x = 0 and x = 20 with a desired node spacing varying from one unit at x = 0 to five units at x = 20. The creation of intermediate nodes to match the desired spacing could proceed, starting at x = 0, as shown in Figure 3. The first node is located at x = 0.0 and has a size value of 1.0. The next node is offset one unit to x = 1.0 and has a size function value of 1.2. The third node is offset 1.2 units to x = 2.2 and has a size function value of 1.44. This process continues until the entire one dimensional grid is filled in. The creation of intermediate nodes to match the desired spacing could also proceed, starting at x = 20, as shown in Figure 4.
Size Function Smoothing Using an Element Area Gradient
3
5.5 5.16
Size Function Value
5.0 4.5
4.30
4.0 3.5
3.58
3.0 2.5 2.0 1.5 1.0 0.5
2.99 2.49 2.07 1.73 1.44 1.20 1.00 0
2
4
6
8
10
12
14
16
18
20
22
X-Location One Dimensional Grid
Size Function Value
Size Function Value
Fig. 3. One Dimensional Grid Node Distribution – Case 1A
5.5 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5
5.00 4.00 3.20 2.56 2.05 1.64
1.05 1.31 1.0 0.5 1.00 0 2 4
6
8
10
12
14
16
18
20
X-Location One Dimensional Grid
Size Function Value
Fig. 4. One Dimensional Grid Node Distribution – Case 1B
22
4
J. Howlett and A. Zundel
If the generation of nodes begins x = 0, the resulting grid contains nine elements. However, if the generation of nodes begins at x = 20, eight elements are created. Since there is a fixed length to fill, numeric integration of the desired node spacing can be used to compute the number of nodes to insert along the fixed length and the resulting number of elements. This will lead to a node insertion that more accurately matches the desired node spacing. Consider the case of two nodes shown in Figure 5. If a linear variation in the size function is assumed along the length, L, the size function at any point along the line can be calculated using Equation 1.
S1
L
S2
Fig. 5. Linear Variation in Size
Taking small steps along L, each segment, dx, has an associated size S. The number of elements, n, to fill the length L can be calculated using Equation 2. Combining Equation 1 and 2 and computing the integral yields the number of elements required to fill the length L as shown in Equation 3. Since the number of nodes to be inserted will be not be an integer value in most cases, the desired node spacing values are scaled using the scale calculated with Equation 4. The scaled node spacing values produce an integer value for the number of nodes to insert.
⎛x⎞ ⎛L − x⎞ S (x ) = ⎜ ⎟ • S 2 + ⎜ ⎟ • S1 ⎝L⎠ ⎝ L ⎠
(1)
n
(2)
n=∑ i =0
L
n=∫
dx Si
(3)
dx
1 • ( x • (S 2 − S1 ) + L • S1 ) L L L n= • ln x • (S 2 − S1 ) + S1 • L 0 S 2 − S1 0
n=
⎛S ⎞ L • ln⎜⎜ 2 ⎟⎟ S 2 − S1 ⎝ S1 ⎠ Scale =
7n n
(4)
Size Function Smoothing Using an Element Area Gradient
5
This method is able to place points in an acceptable manner unless the fixed length is not long enough to match the desired node spacing values. Consider the same one dimensional grid presented earlier, but this time with a desired node spacing varying from one unit at x = 0 to one hundred units at x = 20 as shown in Figure 6.
Size Function Value
100
100.00
80 60 40
35.40
20 5.95 0
1.00 0 2
4
6
8
10
12
14
16
18
20
22
X-Location One Dimensional Grid
Size Function Value
Fig. 6. One Dimensional Grid Node Distribution – Case 2A
Using this desired node spacing, if the generation of nodes begins x = 0, and the same offset method as described earlier is used, the resulting grid contains three elements. However, if the generation of nodes begins at x = 20, one element is created. So the question becomes, what is a reasonable variation of the desired node spacing? The desired node spacing should be a function of the fixed length to fill. We will present an algorithm capable of determining the minimum, Smin, and maximum, Smax, size values for a node located a distance, L, from the starting node, whose desired node spacing is known. To simplify the algorithm, we eliminate the need to compute Smin by always computing Smax for the smaller of the two desired node spacings and adjusting the larger desired node spacing value to be less than or equal to Smax. To compute Smax, we must define how fast the desired node spacing is allowed to change. One guideline for the RMA2 model from the USACE-ERDC states that the area of an element should fall between 50 and 200 percent of its neighbor’s area [4]. For example, if an element has an area of ten square meters, the adjacent elements should have an area between five and twenty square meters. ADCIRC
6
J. Howlett and A. Zundel
Eadj
E1
For any element Eadj, having area Aadj, adjacent to element E1, having area A1: RMA2 area change ratio = 0.5 0.5 A1 < Aadj < 2.0 A1
ADCIRC area change ratio = 0.8 0.8 A1 < Aadj < 1.25 A1
Fig. 7. Element Area Change Guidelines
model developers recommend even more restrictive guidelines that limit area change to between 80 and 125 percent [9].
1 r Pg = Maximum percent growth Pg =
(5)
r = area change ratio Le ' = Le • Pg The area change ratio, r, is specified as a value between zero and one. The minimum area of an adjacent element is the current element’s area times the area change ratio. The maximum area of an adjacent element is the current element’s area times one over the area change ratio. Since the area of a triangle is proportional to the nodal spacing squared, the allowable change in the desired node spacing is the square root of the user specified area change ratio.
S
Pg S1
1
Le
L e’ Fig. 8. Maximum Nodal Spacing Growth Rate
Size Function Smoothing Using an Element Area Gradient
7
Given a segment with a target size of S1 at one end and a length of L, we want to compute the maximum size of a segment, Smax. We begin by determining how far down the segment one element extends. Since S1 is the minimum size, it will extend farther than S1. This distance can be computed by finding the length to get one element using Equation 6.
⎛S ⎞ Le • ln⎜⎜ 2 ⎟⎟ where S 2 = Pg • S1 S 2 − S1 ⎝ S1 ⎠ ⎛ Pg • S1 ⎞ Le ⎟ 1= • ln⎜⎜ (Pg • S1 ) − S1 ⎝ S1 ⎟⎠ Le ( ) 1= (Pg − 1)• S1 • ln Pg 1=
(6)
Solving for Le gives : Le = Sf ≡
(P
g
− 1) • S1
ln (Pg )
Pg − 1
ln (Pg )
Le = S1 • S f The next segment length can be computed in the same fashion with Equation 7.
S1 = Pg • S1
(7)
S 2 = (Pg ) • S1 2
⎛ (Pg )2 • S1 ⎞ ⎟ 1= • ln⎜ (Pg )2 − Pg • S1 ⎜⎝ Pg • S1 ⎟⎠ Le2 1= (Pg − 1)• Pg • S1 • ln(Pg ) Le2
Solving for Le2 gives : Le2 =
(P
g
− 1) • Pg • S1 ln (Pg )
Le2 = Pg • S1 • S f Le3 = (Pg ) • S 1 • S f 2
(8)
8
J. Howlett and A. Zundel
Similarly, the third segment length can be computed with Equation 8. The resulting nodal size values and segment lengths are shown in Figure 9.
S
Pg 2 S1
Pg S1
1
Pg2 Sf S1
Pg Sf S1
Sf S1
Fig. 9. Segment Lengths and Associated Nodal Size Values
Therefore, the total length of n segments can be computed using Equation 9 and the nodal size value using Equation 10.
Le n = S1 • S f •
n −1
∑P
i
(9)
g
i=0
S n = Pg • S1 n
(10)
The number of terms to complete length Le can be found using Equation 11.
Le = S 1 • S f + Pg • S 1 • S f + (Pg ) • S 1 • S f + ... + (Pg )
n −1
2
(
Le = S 1 • S f • 1 + Pg + Pg + ... + Pg 2
n +1
1 − Pg Le = S1 • S f 1 − Pg
n +1
1 − Pg L Let S n = = S1 • S f 1 − Pg P ≡ Pg − 1 Pg = P + 1 Sn =
1 − Pg
n +1
−P n +1 − PS n = 1 − Pg PS n = −1 + Pg PS n + 1 = Pg
n +1
n +1
Log Pg (PS n + 1) = n + 1
n = Log Pg (PS n + 1) − 1
n −1
)
• S1 • S f
(11)
Size Function Smoothing Using an Element Area Gradient
9
The number of terms, n, from Equation 11 can be used in Equation 10 to determine the maximum size value for a node located a distance, L, from the node with size value S1, given the maximum percent growth, Pg.
3 Size Function Smoothing Tools in SMS The Surface-water Modeling System (SMS) [1] contains a size function smoothing tool based on the method presented in this paper. The smoothing tool modifies size function values to honor the user specified maximum area change limit (see Figure 7). The tool allows the user to control whether size function values are increased (maximum value anchored) or decreased (minimum value anchored). Increasing size function values results in a less refined mesh, while decreasing them results in a more refined mesh. A minimum size function value can also be specified.
Fig. 10. SMS Smoothing Tool Dialog
The smoothing tool operates on a size function stored as a triangulated irregular network (TIN) by performing the following steps for the minimum value anchored example: 1. Sort TIN nodes from smallest to largest size function value 2. Set the size function value to the larger of the current size function value or the specified minimum size function value
10
J. Howlett and A. Zundel
3. 4. 5. 6. 7. 8.
For each sorted TIN node, Ti: For each TIN node adjacent to Ti: Calculate the distance, L, from the adjacent TIN node to Ti Compute n using Equation 11 Compute Smax using Equation 10 Set the size function value at Ti to the smaller of the current size function value or Smax 9. If the size function value at Ti was changed, resort Ti in the list of TIN nodes
4 Examples Consider a two dimensional grid, similar to the one dimensional grid presented earlier, with a desired node spacing varying from one unit at x = 0 to one hundred units at x = 20 with no variation in the y direction. The resulting mesh is shown in Figure 11.
Fig. 11. Poor Element Size Transitions
Fig. 12. Good Element Size Transitions
Fig. 13. Beaufort, North Carolina Mesh Generated Using Original Size Function
Size Function Smoothing Using an Element Area Gradient
11
By applying the smoothing algorithm with an area change limit of 0.8, the revised size function has a desired node spacing varying from one unit at x = 0 to 3.23 units at x = 20 with no variation in the y direction. The resulting mesh is shown in Figure 12. Figure 13 shows a mesh generated using a size function of 10 elements per 12 hour period (semi-diurnal tidal constituents) wave. The size function varies from 4 to 827,685. Applying the smoothing algorithm with an area change limit of 0.8 results in a new size function varying from 4 to 38,283. The resulting mesh from this new size function is shown in Figure 14.
Fig. 14. Beaufort, North Carolina Mesh Generated Using Smoothed Size Function
5 Conclusion Size function smoothing using an element area gradient has been proposed as a new method for improving element size transitions when using a size function to govern the mesh generation. The method can be applied as a pre-process to a sizing function generated from any criteria regardless of the mesh generator used. Future work will involve application to three dimensions.
References 1. Aquaveo LLC. Reference manual: The Surface water Modeling System (2009) 2. Aquaveo LLC. Tutorial document: CGWAVE Analysis (2009) 3. Borouchaki, H., Hecht, F., Frey, P.J.: Mesh Gradation Control. In: Proceedings, 6th International Meshing Roundtable, pp. 131–141. Sandia National Laboratories (1997)
12
J. Howlett and A. Zundel
4. Donnel, B.P., Letter, J.V., McAnally, W.H.: Users Guide for RMA2 Version 4.5. U.S. Army Engineer Research and development Center, Vicksburg MS (2001) 5. Demirbilek, Z., Panchang, V.: CGWAVE: A Coastal Surface Water Wave Model of the Mild Slope Equation, USACE Technical Report CHL-98-xx, U.S. Army Engineer Research and Development Center, Vicksburg MS (1998) 6. Hagen, S.C., Michael Parrish, D.: Unstructured Mesh Generation for the Western North Atlantic Tidal Model Domain. In: Proceedings, 11th International Meshing Roundtable, pp. 87–98. Sandia National Laboratories (2002) 7. Howlett, J.D.: Size Function Based Mesh Relaxation. Depatment of Civil and Environmental Engineering, Brigham Young University (2005) 8. Li, X., Remacle, J.-F., Chevaugeon, N., Shephard, M.S.: Anisotropic Mesh Gradation Control. In: Proceedings, 13th International Meshing Roundtable, pp. 401–412. Sandia National Laboratories (2004) 9. Luettich Jr., R.A., Westerink, J.J.: Reference manual: ADCIRC, University of North Carolina at Chapel Hill (2004)