Line data Source code
1 : // The libMesh Finite Element Library.
2 : // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 :
4 : // This library is free software; you can redistribute it and/or
5 : // modify it under the terms of the GNU Lesser General Public
6 : // License as published by the Free Software Foundation; either
7 : // version 2.1 of the License, or (at your option) any later version.
8 :
9 : // This library is distributed in the hope that it will be useful,
10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : // Lesser General Public License for more details.
13 :
14 : // You should have received a copy of the GNU Lesser General Public
15 : // License along with this library; if not, write to the Free Software
16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 :
18 :
19 :
20 : // Local includes
21 : #include "libmesh/quadrature_gauss.h"
22 : #include "libmesh/quadrature_conical.h"
23 : #include "libmesh/enum_to_string.h"
24 :
25 : #include "libmesh/face_c0polygon.h"
26 :
27 : namespace libMesh
28 : {
29 :
30 :
31 261888 : void QGauss::init_2D()
32 : {
33 : #if LIBMESH_DIM > 1
34 :
35 : //-----------------------------------------------------------------------
36 : // 2D quadrature rules
37 261888 : switch (_type)
38 : {
39 :
40 :
41 : //---------------------------------------------
42 : // Quadrilateral quadrature rules
43 131540 : case QUAD4:
44 : case QUADSHELL4:
45 : case QUAD8:
46 : case QUADSHELL8:
47 : case QUAD9:
48 : case QUADSHELL9:
49 : case QUAD16:
50 : {
51 : // We compute the 2D quadrature rule as a tensor
52 : // product of the 1D quadrature rule.
53 : //
54 : // For QUADs, a quadrature rule of order 'p' must be able to integrate
55 : // bilinear (p=1), biquadratic (p=2), bicubic (p=3), etc. polynomials of the form
56 : //
57 : // (x^p + x^{p-1} + ... + 1) * (y^p + y^{p-1} + ... + 1)
58 : //
59 : // These polynomials have terms *up to* degree 2p but they are *not* complete
60 : // polynomials of degree 2p. For example, when p=2 we have
61 : // 1
62 : // x y
63 : // x^2 xy y^2
64 : // yx^2 xy^2
65 : // x^2y^2
66 208995 : QGauss q1D(1,get_order());
67 131540 : tensor_product_quad( q1D );
68 38853 : return;
69 : }
70 :
71 :
72 : //---------------------------------------------
73 : // Triangle quadrature rules
74 130088 : case TRI3:
75 : case TRISHELL3:
76 : case TRI3SUBDIVISION:
77 : case TRI6:
78 : case TRI7:
79 : {
80 164681 : switch(get_order())
81 : {
82 2859 : case CONSTANT:
83 : case FIRST:
84 : {
85 : // Exact for linears
86 2859 : _points.resize(1);
87 2859 : _weights.resize(1);
88 :
89 2859 : _points[0](0) = Real(1)/3;
90 2859 : _points[0](1) = Real(1)/3;
91 :
92 2859 : _weights[0] = 0.5;
93 :
94 2859 : return;
95 : }
96 2276 : case SECOND:
97 : {
98 : // Exact for quadratics
99 2276 : _points.resize(3);
100 2276 : _weights.resize(3);
101 :
102 : // Alternate rule with points on ref. elt. boundaries.
103 : // Not ideal for problems with material coefficient discontinuities
104 : // aligned along element boundaries.
105 : // _points[0](0) = .5;
106 : // _points[0](1) = .5;
107 : // _points[1](0) = 0.;
108 : // _points[1](1) = .5;
109 : // _points[2](0) = .5;
110 : // _points[2](1) = .0;
111 :
112 2276 : _points[0](0) = Real(2)/3;
113 2276 : _points[0](1) = Real(1)/6;
114 :
115 2276 : _points[1](0) = Real(1)/6;
116 2276 : _points[1](1) = Real(2)/3;
117 :
118 2276 : _points[2](0) = Real(1)/6;
119 2276 : _points[2](1) = Real(1)/6;
120 :
121 :
122 2276 : _weights[0] = Real(1)/6;
123 2276 : _weights[1] = Real(1)/6;
124 2276 : _weights[2] = Real(1)/6;
125 :
126 2276 : return;
127 : }
128 55526 : case THIRD:
129 : {
130 : // Exact for cubics
131 55526 : _points.resize(4);
132 55526 : _weights.resize(4);
133 :
134 : // This rule is formed from a tensor product of
135 : // appropriately-scaled Gauss and Jacobi rules. (See
136 : // also the QConical quadrature class, this is a
137 : // hard-coded version of one of those rules.) For high
138 : // orders these rules generally have too many points,
139 : // but at extremely low order they are competitive and
140 : // have the additional benefit of having all positive
141 : // weights.
142 55526 : _points[0](0) = 1.5505102572168219018027159252941e-01_R;
143 55526 : _points[0](1) = 1.7855872826361642311703513337422e-01_R;
144 55526 : _points[1](0) = 6.4494897427831780981972840747059e-01_R;
145 55526 : _points[1](1) = 7.5031110222608118177475598324603e-02_R;
146 55526 : _points[2](0) = 1.5505102572168219018027159252941e-01_R;
147 55526 : _points[2](1) = 6.6639024601470138670269327409637e-01_R;
148 55526 : _points[3](0) = 6.4494897427831780981972840747059e-01_R;
149 55526 : _points[3](1) = 2.8001991549907407200279599420481e-01_R;
150 :
151 55526 : _weights[0] = 1.5902069087198858469718450103758e-01_R;
152 55526 : _weights[1] = 9.0979309128011415302815498962418e-02_R;
153 55526 : _weights[2] = 1.5902069087198858469718450103758e-01_R;
154 55526 : _weights[3] = 9.0979309128011415302815498962418e-02_R;
155 :
156 55526 : return;
157 :
158 :
159 : // The following third-order rule is quite commonly cited
160 : // in the literature and most likely works fine. However,
161 : // we generally prefer a rule with all positive weights
162 : // and an equal number of points, when available.
163 : //
164 : // (allow_rules_with_negative_weights)
165 : // {
166 : // // Exact for cubics
167 : // _points.resize(4);
168 : // _weights.resize(4);
169 : //
170 : // _points[0](0) = .33333333333333333333333333333333;
171 : // _points[0](1) = .33333333333333333333333333333333;
172 : //
173 : // _points[1](0) = .2;
174 : // _points[1](1) = .6;
175 : //
176 : // _points[2](0) = .2;
177 : // _points[2](1) = .2;
178 : //
179 : // _points[3](0) = .6;
180 : // _points[3](1) = .2;
181 : //
182 : //
183 : // _weights[0] = -27./96.;
184 : // _weights[1] = 25./96.;
185 : // _weights[2] = 25./96.;
186 : // _weights[3] = 25./96.;
187 : //
188 : // return;
189 : // } // end if (allow_rules_with_negative_weights)
190 : // Note: if !allow_rules_with_negative_weights, fall through to next case.
191 : }
192 :
193 :
194 :
195 : // A degree 4 rule with six points. This rule can be found in many places
196 : // including:
197 : //
198 : // J.N. Lyness and D. Jespersen, Moderate degree symmetric
199 : // quadrature rules for the triangle, J. Inst. Math. Appl. 15 (1975),
200 : // 19--32.
201 : //
202 : // We used the code in:
203 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
204 : // on triangles and tetrahedra" Journal of Computational Mathematics,
205 : // v. 27, no. 1, 2009, pp. 89-96.
206 : // to generate additional precision.
207 33186 : case FOURTH:
208 : {
209 8310 : const unsigned int n_wts = 2;
210 33186 : const Real wts[n_wts] =
211 : {
212 : 1.1169079483900573284750350421656140e-01_R,
213 : 5.4975871827660933819163162450105264e-02_R
214 : };
215 :
216 33186 : const Real a[n_wts] =
217 : {
218 : 4.4594849091596488631832925388305199e-01_R,
219 : 9.1576213509770743459571463402201508e-02_R
220 : };
221 :
222 33186 : const Real b[n_wts] = {0., 0.}; // not used
223 33186 : const unsigned int permutation_ids[n_wts] = {3, 3};
224 :
225 33186 : dunavant_rule2(wts, a, b, permutation_ids, n_wts); // 6 total points
226 :
227 8310 : return;
228 : }
229 :
230 :
231 :
232 : // Exact for quintics
233 : // Can be found in "Quadrature on Simplices of Arbitrary
234 : // Dimension" by Walkington.
235 11737 : case FIFTH:
236 : {
237 3321 : const unsigned int n_wts = 3;
238 11737 : const Real wts[n_wts] =
239 : {
240 : Real(9)/80, // ~0.1125
241 : Real(31)/480 + std::sqrt(Real(15))/2400, // ~0.06619707639
242 : Real(31)/480 - std::sqrt(Real(15))/2400 // ~0.06296959027
243 : };
244 :
245 11737 : const Real a[n_wts] =
246 : {
247 : 0., // 'a' parameter not used for origin permutation
248 : Real(2)/7 + std::sqrt(Real(15))/21, // ~0.4701420641
249 : Real(2)/7 - std::sqrt(Real(15))/21 // ~0.1012865073
250 : };
251 :
252 11737 : const Real b[n_wts] = {0., 0., 0.}; // not used
253 11737 : const unsigned int permutation_ids[n_wts] = {1, 3, 3};
254 :
255 11737 : dunavant_rule2(wts, a, b, permutation_ids, n_wts); // 7 total points
256 :
257 3321 : return;
258 : }
259 :
260 :
261 :
262 : // A degree 6 rule with 12 points. This rule can be found in many places
263 : // including:
264 : //
265 : // J.N. Lyness and D. Jespersen, Moderate degree symmetric
266 : // quadrature rules for the triangle, J. Inst. Math. Appl. 15 (1975),
267 : // 19--32.
268 : //
269 : // We used the code in:
270 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
271 : // on triangles and tetrahedra" Journal of Computational Mathematics,
272 : // v. 27, no. 1, 2009, pp. 89-96.
273 : // to generate additional precision.
274 : //
275 : // Note that the following 7th-order Ro3-invariant rule also has only 12 points,
276 : // which technically makes it the superior rule. This one is here for completeness.
277 140 : case SIXTH:
278 : {
279 40 : const unsigned int n_wts = 3;
280 140 : const Real wts[n_wts] =
281 : {
282 : 5.8393137863189683012644805692789721e-02_R,
283 : 2.5422453185103408460468404553434492e-02_R,
284 : 4.1425537809186787596776728210221227e-02_R
285 : };
286 :
287 140 : const Real a[n_wts] =
288 : {
289 : 2.4928674517091042129163855310701908e-01_R,
290 : 6.3089014491502228340331602870819157e-02_R,
291 : 3.1035245103378440541660773395655215e-01_R
292 : };
293 :
294 140 : const Real b[n_wts] =
295 : {
296 : 0.,
297 : 0.,
298 : 6.3650249912139864723014259441204970e-01_R
299 : };
300 :
301 140 : const unsigned int permutation_ids[n_wts] = {3, 3, 6}; // 12 total points
302 :
303 140 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
304 :
305 40 : return;
306 : }
307 :
308 :
309 : // A degree 7 rule with 12 points. This rule can be found in:
310 : //
311 : // K. Gatermann, The construction of symmetric cubature
312 : // formulas for the square and the triangle, Computing 40
313 : // (1988), 229--240.
314 : //
315 : // This rule, which is provably minimal in the number of
316 : // integration points, is said to be 'Ro3 invariant' which
317 : // means that a given set of barycentric coordinates
318 : // (z1,z2,z3) implies the quadrature points (z1,z2),
319 : // (z3,z1), (z2,z3) which are formed by taking the first
320 : // two entries in cyclic permutations of the barycentric
321 : // point. Barycentric coordinates are related in the
322 : // sense that: z3 = 1 - z1 - z2.
323 : //
324 : // The 12-point sixth-order rule for triangles given in
325 : // Flaherty's (http://www.cs.rpi.edu/~flaherje/FEM/fem6.ps)
326 : // lecture notes has been removed in favor of this rule
327 : // which is higher-order (for the same number of
328 : // quadrature points) and has a few more digits of
329 : // precision in the points and weights. Some 10-point
330 : // degree 6 rules exist for the triangle but they have
331 : // quadrature points outside the region of integration.
332 17909 : case SEVENTH:
333 : {
334 17909 : _points.resize (12);
335 17909 : _weights.resize(12);
336 :
337 5518 : const unsigned int nrows=4;
338 :
339 : // In each of the rows below, the first two entries are (z1, z2) which imply
340 : // z3. The third entry is the weight for each of the points in the cyclic permutation.
341 : // The original publication tabulated about 16 decimal digits for each point and weight
342 : // parameter. The additional digits shown here were obtained using a code in the
343 : // mp-quadrature library, https://github.com/jwpeterson/mp-quadrature
344 17909 : const Real rule_data[nrows][3] = {
345 : {6.2382265094402118173683000996350e-02_R, 6.7517867073916085442557131050869e-02_R, 2.6517028157436251428754180460739e-02_R}, // group A
346 : {5.5225456656926611737479190275645e-02_R, 3.2150249385198182266630784919920e-01_R, 4.3881408714446055036769903139288e-02_R}, // group B
347 : {3.4324302945097146469630642483938e-02_R, 6.6094919618673565761198031019780e-01_R, 2.8775042784981585738445496900219e-02_R}, // group C
348 : {5.1584233435359177925746338682643e-01_R, 2.7771616697639178256958187139372e-01_R, 6.7493187009802774462697086166421e-02_R} // group D
349 : };
350 :
351 89545 : for (unsigned int i=0, offset=0; i<nrows; ++i)
352 : {
353 71636 : _points[offset + 0] = Point(rule_data[i][0], rule_data[i][1]); // (z1,z2)
354 71636 : _points[offset + 1] = Point(1.-rule_data[i][0]-rule_data[i][1], rule_data[i][0]); // (z3,z1)
355 71636 : _points[offset + 2] = Point(rule_data[i][1], 1.-rule_data[i][0]-rule_data[i][1]); // (z2,z3)
356 :
357 : // All these points get the same weight
358 93368 : _weights[offset + 0] = rule_data[i][2];
359 71636 : _weights[offset + 1] = rule_data[i][2];
360 71636 : _weights[offset + 2] = rule_data[i][2];
361 :
362 : // Increment offset
363 71636 : offset += 3;
364 : }
365 :
366 5518 : return;
367 :
368 :
369 : // // The following is an inferior 7th-order Lyness-style rule with 15 points.
370 : // // It's here only for completeness and the Ro3-invariant rule above should
371 : // // be used instead!
372 : // const unsigned int n_wts = 3;
373 : // const Real wts[n_wts] =
374 : // {
375 : // 2.6538900895116205835977487499847719e-02_R,
376 : // 3.5426541846066783659206291623201826e-02_R,
377 : // 3.4637341039708446756138297960207647e-02_R
378 : // };
379 : //
380 : // const Real a[n_wts] =
381 : // {
382 : // 6.4930513159164863078379776030396538e-02_R,
383 : // 2.8457558424917033519741605734978046e-01_R,
384 : // 3.1355918438493150795585190219862865e-01_R
385 : // };
386 : //
387 : // const Real b[n_wts] =
388 : // {
389 : // 0.,
390 : // 1.9838447668150671917987659863332941e-01_R,
391 : // 4.3863471792372471511798695971295936e-02_R
392 : // };
393 : //
394 : // const unsigned int permutation_ids[n_wts] = {3, 6, 6}; // 15 total points
395 : //
396 : // dunavant_rule2(wts, a, b, permutation_ids, n_wts);
397 : //
398 : // return;
399 : }
400 :
401 :
402 :
403 :
404 : // Another Dunavant rule. This one has all positive weights. This rule has
405 : // 16 points while a comparable conical product rule would have 5*5=25.
406 : //
407 : // It was copied 23rd June 2008 from:
408 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
409 : //
410 : // Additional precision obtained from the code in:
411 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
412 : // on triangles and tetrahedra" Journal of Computational Mathematics,
413 : // v. 27, no. 1, 2009, pp. 89-96.
414 651 : case EIGHTH:
415 : {
416 204 : const unsigned int n_wts = 5;
417 651 : const Real wts[n_wts] =
418 : {
419 : 7.2157803838893584125545555244532310e-02_R,
420 : 4.7545817133642312396948052194292159e-02_R,
421 : 5.1608685267359125140895775146064515e-02_R,
422 : 1.6229248811599040155462964170890299e-02_R,
423 : 1.3615157087217497132422345036954462e-02_R
424 : };
425 :
426 651 : const Real a[n_wts] =
427 : {
428 : 0.0, // 'a' parameter not used for origin permutation
429 : 4.5929258829272315602881551449416932e-01_R,
430 : 1.7056930775176020662229350149146450e-01_R,
431 : 5.0547228317030975458423550596598947e-02_R,
432 : 2.6311282963463811342178578628464359e-01_R,
433 : };
434 :
435 651 : const Real b[n_wts] =
436 : {
437 : 0.,
438 : 0.,
439 : 0.,
440 : 0.,
441 : 7.2849239295540428124100037917606196e-01_R
442 : };
443 :
444 651 : const unsigned int permutation_ids[n_wts] = {1, 3, 3, 3, 6}; // 16 total points
445 :
446 651 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
447 :
448 204 : return;
449 : }
450 :
451 :
452 :
453 : // Another Dunavant rule. This one has all positive weights. This rule has 19
454 : // points. The comparable conical product rule would have 25.
455 : // It was copied 23rd June 2008 from:
456 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
457 : //
458 : // Additional precision obtained from the code in:
459 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
460 : // on triangles and tetrahedra" Journal of Computational Mathematics,
461 : // v. 27, no. 1, 2009, pp. 89-96.
462 4908 : case NINTH:
463 : {
464 1342 : const unsigned int n_wts = 6;
465 4908 : const Real wts[n_wts] =
466 : {
467 : 4.8567898141399416909620991253644315e-02_R,
468 : 1.5667350113569535268427415643604658e-02_R,
469 : 1.2788837829349015630839399279499912e-02_R,
470 : 3.8913770502387139658369678149701978e-02_R,
471 : 3.9823869463605126516445887132022637e-02_R,
472 : 2.1641769688644688644688644688644689e-02_R
473 : };
474 :
475 4908 : const Real a[n_wts] =
476 : {
477 : 0.0, // 'a' parameter not used for origin permutation
478 : 4.8968251919873762778370692483619280e-01_R,
479 : 4.4729513394452709865106589966276365e-02_R,
480 : 4.3708959149293663726993036443535497e-01_R,
481 : 1.8820353561903273024096128046733557e-01_R,
482 : 2.2196298916076569567510252769319107e-01_R
483 : };
484 :
485 4908 : const Real b[n_wts] =
486 : {
487 : 0.,
488 : 0.,
489 : 0.,
490 : 0.,
491 : 0.,
492 : 7.4119859878449802069007987352342383e-01_R
493 : };
494 :
495 4908 : const unsigned int permutation_ids[n_wts] = {1, 3, 3, 3, 3, 6}; // 19 total points
496 :
497 4908 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
498 :
499 1342 : return;
500 : }
501 :
502 :
503 : // Another Dunavant rule with all positive weights. This rule has 25
504 : // points. The comparable conical product rule would have 36.
505 : // It was copied 23rd June 2008 from:
506 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
507 : //
508 : // Additional precision obtained from the code in:
509 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
510 : // on triangles and tetrahedra" Journal of Computational Mathematics,
511 : // v. 27, no. 1, 2009, pp. 89-96.
512 42 : case TENTH:
513 : {
514 12 : const unsigned int n_wts = 6;
515 42 : const Real wts[n_wts] =
516 : {
517 : 4.5408995191376790047643297550014267e-02_R,
518 : 1.8362978878233352358503035945683300e-02_R,
519 : 2.2660529717763967391302822369298659e-02_R,
520 : 3.6378958422710054302157588309680344e-02_R,
521 : 1.4163621265528742418368530791049552e-02_R,
522 : 4.7108334818664117299637354834434138e-03_R
523 : };
524 :
525 42 : const Real a[n_wts] =
526 : {
527 : 0.0, // 'a' parameter not used for origin permutation
528 : 4.8557763338365737736750753220812615e-01_R,
529 : 1.0948157548503705479545863134052284e-01_R,
530 : 3.0793983876412095016515502293063162e-01_R,
531 : 2.4667256063990269391727646541117681e-01_R,
532 : 6.6803251012200265773540212762024737e-02_R
533 : };
534 :
535 42 : const Real b[n_wts] =
536 : {
537 : 0.,
538 : 0.,
539 : 0.,
540 : 5.5035294182099909507816172659300821e-01_R,
541 : 7.2832390459741092000873505358107866e-01_R,
542 : 9.2365593358750027664630697761508843e-01_R
543 : };
544 :
545 42 : const unsigned int permutation_ids[n_wts] = {1, 3, 3, 6, 6, 6}; // 25 total points
546 :
547 42 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
548 :
549 12 : return;
550 : }
551 :
552 :
553 : // Dunavant's 11th-order rule contains points outside the region of
554 : // integration, and is thus unacceptable for our FEM calculations.
555 : //
556 : // This 30-point, 11th-order rule was obtained by me [JWP] using the code in
557 : //
558 : // Additional precision obtained from the code in:
559 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
560 : // on triangles and tetrahedra" Journal of Computational Mathematics,
561 : // v. 27, no. 1, 2009, pp. 89-96.
562 : //
563 : // Note: the 28-point 11th-order rule obtained by Zhang in the paper above
564 : // does not appear to be unique. It is a solution in the sense that it
565 : // minimizes the error in the least-squares minimization problem, but
566 : // it involves too many unknowns and the Jacobian is therefore singular
567 : // when attempting to improve the solution via Newton's method.
568 658 : case ELEVENTH:
569 : {
570 188 : const unsigned int n_wts = 6;
571 658 : const Real wts[n_wts] =
572 : {
573 : 3.6089021198604635216985338480426484e-02_R,
574 : 2.1607717807680420303346736867931050e-02_R,
575 : 3.1144524293927978774861144478241807e-03_R,
576 : 2.9086855161081509446654185084988077e-02_R,
577 : 8.4879241614917017182977532679947624e-03_R,
578 : 1.3795732078224796530729242858347546e-02_R
579 : };
580 :
581 658 : const Real a[n_wts] =
582 : {
583 : 3.9355079629947969884346551941969960e-01_R,
584 : 4.7979065808897448654107733982929214e-01_R,
585 : 5.1003445645828061436081405648347852e-03_R,
586 : 2.6597620190330158952732822450744488e-01_R,
587 : 2.8536418538696461608233522814483715e-01_R,
588 : 1.3723536747817085036455583801851025e-01_R
589 : };
590 :
591 658 : const Real b[n_wts] =
592 : {
593 : 0.,
594 : 0.,
595 : 5.6817155788572446538150614865768991e-02_R,
596 : 1.2539956353662088473247489775203396e-01_R,
597 : 1.2409970153698532116262152247041742e-02_R,
598 : 5.2792057988217708934207928630851643e-02_R
599 : };
600 :
601 658 : const unsigned int permutation_ids[n_wts] = {3, 3, 6, 6, 6, 6}; // 30 total points
602 :
603 658 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
604 :
605 188 : return;
606 : }
607 :
608 :
609 :
610 :
611 : // Another Dunavant rule with all positive weights. This rule has 33
612 : // points. The comparable conical product rule would have 36 (ELEVENTH) or 49 (TWELFTH).
613 : //
614 : // It was copied 23rd June 2008 from:
615 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
616 : //
617 : // Additional precision obtained from the code in:
618 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
619 : // on triangles and tetrahedra" Journal of Computational Mathematics,
620 : // v. 27, no. 1, 2009, pp. 89-96.
621 28 : case TWELFTH:
622 : {
623 8 : const unsigned int n_wts = 8;
624 28 : const Real wts[n_wts] =
625 : {
626 : 3.0831305257795086169332418926151771e-03_R,
627 : 3.1429112108942550177135256546441273e-02_R,
628 : 1.7398056465354471494664198647499687e-02_R,
629 : 2.1846272269019201067728631278737487e-02_R,
630 : 1.2865533220227667708895461535782215e-02_R,
631 : 1.1178386601151722855919538351159995e-02_R,
632 : 8.6581155543294461858210504055170332e-03_R,
633 : 2.0185778883190464758914349626118386e-02_R
634 : };
635 :
636 28 : const Real a[n_wts] =
637 : {
638 : 2.1317350453210370246856975515728246e-02_R,
639 : 2.7121038501211592234595134039689474e-01_R,
640 : 1.2757614554158592467389632515428357e-01_R,
641 : 4.3972439229446027297973662348436108e-01_R,
642 : 4.8821738977380488256466206525881104e-01_R,
643 : 2.8132558098993954824813069297455275e-01_R,
644 : 1.1625191590759714124135414784260182e-01_R,
645 : 2.7571326968551419397479634607976398e-01_R
646 : };
647 :
648 28 : const Real b[n_wts] =
649 : {
650 : 0.,
651 : 0.,
652 : 0.,
653 : 0.,
654 : 0.,
655 : 6.9583608678780342214163552323607254e-01_R,
656 : 8.5801403354407263059053661662617818e-01_R,
657 : 6.0894323577978780685619243776371007e-01_R
658 : };
659 :
660 28 : const unsigned int permutation_ids[n_wts] = {3, 3, 3, 3, 3, 6, 6, 6}; // 33 total points
661 :
662 28 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
663 :
664 8 : return;
665 : }
666 :
667 :
668 : // Another Dunavant rule with all positive weights. This rule has 37
669 : // points. The comparable conical product rule would have 49 points.
670 : //
671 : // It was copied 23rd June 2008 from:
672 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
673 : //
674 : // A second rule with additional precision obtained from the code in:
675 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
676 : // on triangles and tetrahedra" Journal of Computational Mathematics,
677 : // v. 27, no. 1, 2009, pp. 89-96.
678 28 : case THIRTEENTH:
679 : {
680 8 : const unsigned int n_wts = 9;
681 28 : const Real wts[n_wts] =
682 : {
683 : 3.3980018293415822140887212340442440e-02_R,
684 : 2.7800983765226664353628733005230734e-02_R,
685 : 2.9139242559599990702383541756669905e-02_R,
686 : 3.0261685517695859208964000161454122e-03_R,
687 : 1.1997200964447365386855399725479827e-02_R,
688 : 1.7320638070424185232993414255459110e-02_R,
689 : 7.4827005525828336316229285664517190e-03_R,
690 : 1.2089519905796909568722872786530380e-02_R,
691 : 4.7953405017716313612975450830554457e-03_R
692 : };
693 :
694 28 : const Real a[n_wts] =
695 : {
696 : 0., // 'a' parameter not used for origin permutation
697 : 4.2694141425980040602081253503137421e-01_R,
698 : 2.2137228629183290065481255470507908e-01_R,
699 : 2.1509681108843183869291313534052083e-02_R,
700 : 4.8907694645253934990068971909020439e-01_R,
701 : 3.0844176089211777465847185254124531e-01_R,
702 : 1.1092204280346339541286954522167452e-01_R,
703 : 1.6359740106785048023388790171095725e-01_R,
704 : 2.7251581777342966618005046435408685e-01_R
705 : };
706 :
707 28 : const Real b[n_wts] =
708 : {
709 : 0.,
710 : 0.,
711 : 0.,
712 : 0.,
713 : 0.,
714 : 6.2354599555367557081585435318623659e-01_R,
715 : 8.6470777029544277530254595089569318e-01_R,
716 : 7.4850711589995219517301859578870965e-01_R,
717 : 7.2235779312418796526062013230478405e-01_R
718 : };
719 :
720 28 : const unsigned int permutation_ids[n_wts] = {1, 3, 3, 3, 3, 6, 6, 6, 6}; // 37 total points
721 :
722 28 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
723 :
724 8 : return;
725 : }
726 :
727 :
728 : // Another Dunavant rule. This rule has 42 points, while
729 : // a comparable conical product rule would have 64.
730 : //
731 : // It was copied 23rd June 2008 from:
732 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
733 : //
734 : // Additional precision obtained from the code in:
735 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
736 : // on triangles and tetrahedra" Journal of Computational Mathematics,
737 : // v. 27, no. 1, 2009, pp. 89-96.
738 28 : case FOURTEENTH:
739 : {
740 8 : const unsigned int n_wts = 10;
741 28 : const Real wts[n_wts] =
742 : {
743 : 1.0941790684714445320422472981662986e-02_R,
744 : 1.6394176772062675320655489369312672e-02_R,
745 : 2.5887052253645793157392455083198201e-02_R,
746 : 2.1081294368496508769115218662093065e-02_R,
747 : 7.2168498348883338008549607403266583e-03_R,
748 : 2.4617018012000408409130117545210774e-03_R,
749 : 1.2332876606281836981437622591818114e-02_R,
750 : 1.9285755393530341614244513905205430e-02_R,
751 : 7.2181540567669202480443459995079017e-03_R,
752 : 2.5051144192503358849300465412445582e-03_R
753 : };
754 :
755 28 : const Real a[n_wts] =
756 : {
757 : 4.8896391036217863867737602045239024e-01_R,
758 : 4.1764471934045392250944082218564344e-01_R,
759 : 2.7347752830883865975494428326269856e-01_R,
760 : 1.7720553241254343695661069046505908e-01_R,
761 : 6.1799883090872601267478828436935788e-02_R,
762 : 1.9390961248701048178250095054529511e-02_R,
763 : 1.7226668782135557837528960161365733e-01_R,
764 : 3.3686145979634500174405519708892539e-01_R,
765 : 2.9837288213625775297083151805961273e-01_R,
766 : 1.1897449769695684539818196192990548e-01_R
767 : };
768 :
769 28 : const Real b[n_wts] =
770 : {
771 : 0.,
772 : 0.,
773 : 0.,
774 : 0.,
775 : 0.,
776 : 0.,
777 : 7.7060855477499648258903327416742796e-01_R,
778 : 5.7022229084668317349769621336235426e-01_R,
779 : 6.8698016780808783735862715402031306e-01_R,
780 : 8.7975717137017112951457163697460183e-01_R
781 : };
782 :
783 28 : const unsigned int permutation_ids[n_wts]
784 : = {3, 3, 3, 3, 3, 3, 6, 6, 6, 6}; // 42 total points
785 :
786 28 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
787 :
788 8 : return;
789 : }
790 :
791 :
792 : // This 49-point rule was found by me [JWP] using the code in:
793 : //
794 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
795 : // on triangles and tetrahedra" Journal of Computational Mathematics,
796 : // v. 27, no. 1, 2009, pp. 89-96.
797 : //
798 : // A 54-point, 15th-order rule is reported by
799 : //
800 : // Stephen Wandzura, Hong Xiao,
801 : // Symmetric Quadrature Rules on a Triangle,
802 : // Computers and Mathematics with Applications,
803 : // Volume 45, Number 12, June 2003, pages 1829-1840.
804 : //
805 : // can be found here:
806 : // http://people.scs.fsu.edu/~burkardt/f_src/wandzura/wandzura.f90
807 : //
808 : // but this 49-point rule is superior.
809 28 : case FIFTEENTH:
810 : {
811 8 : const unsigned int n_wts = 11;
812 28 : const Real wts[n_wts] =
813 : {
814 : 2.4777380743035579804788826970198951e-02_R,
815 : 9.2433943023307730591540642828347660e-03_R,
816 : 2.2485768962175402793245929133296627e-03_R,
817 : 6.7052581900064143760518398833360903e-03_R,
818 : 1.9011381726930579256700190357527956e-02_R,
819 : 1.4605445387471889398286155981802858e-02_R,
820 : 1.5087322572773133722829435011138258e-02_R,
821 : 1.5630213780078803020711746273129099e-02_R,
822 : 6.1808086085778203192616856133701233e-03_R,
823 : 3.2209366452594664857296985751120513e-03_R,
824 : 5.8747373242569702667677969985668817e-03_R
825 : };
826 :
827 28 : const Real a[n_wts] =
828 : {
829 : 0.0, // 'a' parameter not used for origin
830 : 7.9031013655541635005816956762252155e-02_R,
831 : 1.8789501810770077611247984432284226e-02_R,
832 : 4.9250168823249670532514526605352905e-01_R,
833 : 4.0886316907744105975059040108092775e-01_R,
834 : 5.3877851064220142445952549348423733e-01_R,
835 : 2.0250549804829997692885033941362673e-01_R,
836 : 5.5349674918711643207148086558288110e-01_R,
837 : 7.8345022567320812359258882143250181e-01_R,
838 : 8.9514624528794883409864566727625002e-01_R,
839 : 3.2515745241110782862789881780746490e-01_R
840 : };
841 :
842 28 : const Real b[n_wts] =
843 : {
844 : 0.,
845 : 0.,
846 : 0.,
847 : 0.,
848 : 0.,
849 : 1.9412620368774630292701241080996842e-01_R,
850 : 9.8765911355712115933807754318089099e-02_R,
851 : 7.7663767064308164090246588765178087e-02_R,
852 : 2.1594628433980258573654682690950798e-02_R,
853 : 1.2563596287784997705599005477153617e-02_R,
854 : 1.5082654870922784345283124845552190e-02_R
855 : };
856 :
857 28 : const unsigned int permutation_ids[n_wts]
858 : = {1, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6}; // 49 total points
859 :
860 28 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
861 :
862 8 : return;
863 : }
864 :
865 :
866 :
867 :
868 : // Dunavant's 16th-order rule contains points outside the region of
869 : // integration, and is thus unacceptable for our FEM calculations.
870 : //
871 : // This 55-point, 16th-order rule was obtained by me [JWP] using the code in
872 : //
873 : // Additional precision obtained from the code in:
874 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
875 : // on triangles and tetrahedra" Journal of Computational Mathematics,
876 : // v. 27, no. 1, 2009, pp. 89-96.
877 : //
878 : // Note: the 55-point 16th-order rule obtained by Zhang in the paper above
879 : // does not appear to be unique. It is a solution in the sense that it
880 : // minimizes the error in the least-squares minimization problem, but
881 : // it involves too many unknowns and the Jacobian is therefore singular
882 : // when attempting to improve the solution via Newton's method.
883 28 : case SIXTEENTH:
884 : {
885 8 : const unsigned int n_wts = 12;
886 28 : const Real wts[n_wts] =
887 : {
888 : 2.2668082505910087151996321171534230e-02_R,
889 : 8.4043060714818596159798961899306135e-03_R,
890 : 1.0850949634049747713966288634484161e-03_R,
891 : 7.2252773375423638869298219383808751e-03_R,
892 : 1.2997715227338366024036316182572871e-02_R,
893 : 2.0054466616677715883228810959112227e-02_R,
894 : 9.7299841600417010281624372720122710e-03_R,
895 : 1.1651974438298104227427176444311766e-02_R,
896 : 9.1291185550484450744725847363097389e-03_R,
897 : 3.5568614040947150231712567900113671e-03_R,
898 : 5.8355861686234326181790822005304303e-03_R,
899 : 4.7411314396804228041879331486234396e-03_R
900 : };
901 :
902 28 : const Real a[n_wts] =
903 : {
904 : 0.0, // 'a' parameter not used for centroid weight
905 : 8.5402539407933203673769900926355911e-02_R,
906 : 1.2425572001444092841183633409631260e-02_R,
907 : 4.9174838341891594024701017768490960e-01_R,
908 : 4.5669426695387464162068900231444462e-01_R,
909 : 4.8506759880447437974189793537259677e-01_R,
910 : 2.0622099278664205707909858461264083e-01_R,
911 : 3.2374950270039093446805340265853956e-01_R,
912 : 7.3834330556606586255186213302750029e-01_R,
913 : 9.1210673061680792565673823935174611e-01_R,
914 : 6.6129919222598721544966837350891531e-01_R,
915 : 1.7807138906021476039088828811346122e-01_R
916 : };
917 :
918 28 : const Real b[n_wts] =
919 : {
920 : 0.0,
921 : 0.0,
922 : 0.0,
923 : 0.0,
924 : 0.0,
925 : 3.2315912848634384647700266402091638e-01_R,
926 : 1.5341553679414688425981898952416987e-01_R,
927 : 7.4295478991330687632977899141707872e-02_R,
928 : 7.1278762832147862035977841733532020e-02_R,
929 : 1.6623223223705792825395256602140459e-02_R,
930 : 1.4160772533794791868984026749196156e-02_R,
931 : 1.4539694958941854654807449467759690e-02_R
932 : };
933 :
934 28 : const unsigned int permutation_ids[n_wts]
935 : = {1, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6}; // 55 total points
936 :
937 28 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
938 :
939 8 : return;
940 : }
941 :
942 :
943 : // Dunavant's 17th-order rule has 61 points, while a
944 : // comparable conical product rule would have 81 (16th and 17th orders).
945 : //
946 : // It can be found here:
947 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
948 : //
949 : // Zhang reports an identical rule in:
950 : // L. Zhang, T. Cui, and H. Liu. "A set of symmetric quadrature rules
951 : // on triangles and tetrahedra" Journal of Computational Mathematics,
952 : // v. 27, no. 1, 2009, pp. 89-96.
953 : //
954 : // Note: the 61-point 17th-order rule obtained by Dunavant and Zhang
955 : // does not appear to be unique. It is a solution in the sense that it
956 : // minimizes the error in the least-squares minimization problem, but
957 : // it involves too many unknowns and the Jacobian is therefore singular
958 : // when attempting to improve the solution via Newton's method.
959 : //
960 : // Therefore, we prefer the following 63-point rule which
961 : // I [JWP] found. It appears to be more accurate than the
962 : // rule reported by Dunavant and Zhang, even though it has
963 : // a few more points.
964 14 : case SEVENTEENTH:
965 : {
966 4 : const unsigned int n_wts = 12;
967 14 : const Real wts[n_wts] =
968 : {
969 : 1.7464603792572004485690588092246146e-02_R,
970 : 5.9429003555801725246549713984660076e-03_R,
971 : 1.2490753345169579649319736639588729e-02_R,
972 : 1.5386987188875607593083456905596468e-02_R,
973 : 1.1185807311917706362674684312990270e-02_R,
974 : 1.0301845740670206831327304917180007e-02_R,
975 : 1.1767783072977049696840016810370464e-02_R,
976 : 3.8045312849431209558329128678945240e-03_R,
977 : 4.5139302178876351271037137230354382e-03_R,
978 : 2.2178812517580586419412547665472893e-03_R,
979 : 5.2216271537483672304731416553063103e-03_R,
980 : 9.8381136389470256422419930926212114e-04_R
981 : };
982 :
983 14 : const Real a[n_wts] =
984 : {
985 : 2.8796825754667362165337965123570514e-01_R,
986 : 4.9216175986208465345536805750663939e-01_R,
987 : 4.6252866763171173685916780827044612e-01_R,
988 : 1.6730292951631792248498303276090273e-01_R,
989 : 1.5816335500814652972296428532213019e-01_R,
990 : 1.6352252138387564873002458959679529e-01_R,
991 : 6.2447680488959768233910286168417367e-01_R,
992 : 8.7317249935244454285263604347964179e-01_R,
993 : 3.4428164322282694677972239461699271e-01_R,
994 : 9.1584484467813674010523309855340209e-02_R,
995 : 2.0172088013378989086826623852040632e-01_R,
996 : 9.6538762758254643474731509845084691e-01_R
997 : };
998 :
999 14 : const Real b[n_wts] =
1000 : {
1001 : 0.0,
1002 : 0.0,
1003 : 0.0,
1004 : 3.4429160695501713926320695771253348e-01_R,
1005 : 2.2541623431550639817203145525444726e-01_R,
1006 : 8.0670083153531811694942222940484991e-02_R,
1007 : 6.5967451375050925655738829747288190e-02_R,
1008 : 4.5677879890996762665044366994439565e-02_R,
1009 : 1.1528411723154215812386518751976084e-02_R,
1010 : 9.3057714323900610398389176844165892e-03_R,
1011 : 1.5916814107619812717966560404970160e-02_R,
1012 : 1.0734733163764032541125434215228937e-02_R
1013 : };
1014 :
1015 14 : const unsigned int permutation_ids[n_wts]
1016 : = {3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6}; // 63 total points
1017 :
1018 14 : dunavant_rule2(wts, a, b, permutation_ids, n_wts);
1019 :
1020 4 : return;
1021 :
1022 : // _points.resize (61);
1023 : // _weights.resize(61);
1024 :
1025 : // // The raw data for the quadrature rule.
1026 : // const Real p[15][4] = {
1027 : // { 1./3., 0., 0., 0.033437199290803e+00 / 2.0}, // 1-perm
1028 : // {0.005658918886452e+00, 0.497170540556774e+00, 0., 0.005093415440507e+00 / 2.0}, // 3-perm
1029 : // {0.035647354750751e+00, 0.482176322624625e+00, 0., 0.014670864527638e+00 / 2.0}, // 3-perm
1030 : // {0.099520061958437e+00, 0.450239969020782e+00, 0., 0.024350878353672e+00 / 2.0}, // 3-perm
1031 : // {0.199467521245206e+00, 0.400266239377397e+00, 0., 0.031107550868969e+00 / 2.0}, // 3-perm
1032 : // {0.495717464058095e+00, 0.252141267970953e+00, 0., 0.031257111218620e+00 / 2.0}, // 3-perm
1033 : // {0.675905990683077e+00, 0.162047004658461e+00, 0., 0.024815654339665e+00 / 2.0}, // 3-perm
1034 : // {0.848248235478508e+00, 0.075875882260746e+00, 0., 0.014056073070557e+00 / 2.0}, // 3-perm
1035 : // {0.968690546064356e+00, 0.015654726967822e+00, 0., 0.003194676173779e+00 / 2.0}, // 3-perm
1036 : // {0.010186928826919e+00, 0.334319867363658e+00, 0.655493203809423e+00, 0.008119655318993e+00 / 2.0}, // 6-perm
1037 : // {0.135440871671036e+00, 0.292221537796944e+00, 0.572337590532020e+00, 0.026805742283163e+00 / 2.0}, // 6-perm
1038 : // {0.054423924290583e+00, 0.319574885423190e+00, 0.626001190286228e+00, 0.018459993210822e+00 / 2.0}, // 6-perm
1039 : // {0.012868560833637e+00, 0.190704224192292e+00, 0.796427214974071e+00, 0.008476868534328e+00 / 2.0}, // 6-perm
1040 : // {0.067165782413524e+00, 0.180483211648746e+00, 0.752351005937729e+00, 0.018292796770025e+00 / 2.0}, // 6-perm
1041 : // {0.014663182224828e+00, 0.080711313679564e+00, 0.904625504095608e+00, 0.006665632004165e+00 / 2.0} // 6-perm
1042 : // };
1043 :
1044 :
1045 : // // Now call the dunavant routine to generate _points and _weights
1046 : // dunavant_rule(p, 15);
1047 :
1048 : // return;
1049 : }
1050 :
1051 :
1052 :
1053 : // Dunavant's 18th-order rule contains points outside the region and is therefore unsuitable
1054 : // for our FEM calculations. His 19th-order rule has 73 points, compared with 100 points for
1055 : // a comparable-order conical product rule.
1056 : //
1057 : // It was copied 23rd June 2008 from:
1058 : // http://people.scs.fsu.edu/~burkardt/f_src/dunavant/dunavant.f90
1059 28 : case EIGHTTEENTH:
1060 : case NINETEENTH:
1061 : {
1062 28 : _points.resize (73);
1063 28 : _weights.resize(73);
1064 :
1065 : // The raw data for the quadrature rule.
1066 28 : const Real rule_data[17][4] = {
1067 : { 1./3., 0., 0., 0.032906331388919e+00 / 2.0}, // 1-perm
1068 : {0.020780025853987e+00, 0.489609987073006e+00, 0., 0.010330731891272e+00 / 2.0}, // 3-perm
1069 : {0.090926214604215e+00, 0.454536892697893e+00, 0., 0.022387247263016e+00 / 2.0}, // 3-perm
1070 : {0.197166638701138e+00, 0.401416680649431e+00, 0., 0.030266125869468e+00 / 2.0}, // 3-perm
1071 : {0.488896691193805e+00, 0.255551654403098e+00, 0., 0.030490967802198e+00 / 2.0}, // 3-perm
1072 : {0.645844115695741e+00, 0.177077942152130e+00, 0., 0.024159212741641e+00 / 2.0}, // 3-perm
1073 : {0.779877893544096e+00, 0.110061053227952e+00, 0., 0.016050803586801e+00 / 2.0}, // 3-perm
1074 : {0.888942751496321e+00, 0.055528624251840e+00, 0., 0.008084580261784e+00 / 2.0}, // 3-perm
1075 : {0.974756272445543e+00, 0.012621863777229e+00, 0., 0.002079362027485e+00 / 2.0}, // 3-perm
1076 : {0.003611417848412e+00, 0.395754787356943e+00, 0.600633794794645e+00, 0.003884876904981e+00 / 2.0}, // 6-perm
1077 : {0.134466754530780e+00, 0.307929983880436e+00, 0.557603261588784e+00, 0.025574160612022e+00 / 2.0}, // 6-perm
1078 : {0.014446025776115e+00, 0.264566948406520e+00, 0.720987025817365e+00, 0.008880903573338e+00 / 2.0}, // 6-perm
1079 : {0.046933578838178e+00, 0.358539352205951e+00, 0.594527068955871e+00, 0.016124546761731e+00 / 2.0}, // 6-perm
1080 : {0.002861120350567e+00, 0.157807405968595e+00, 0.839331473680839e+00, 0.002491941817491e+00 / 2.0}, // 6-perm
1081 : {0.223861424097916e+00, 0.075050596975911e+00, 0.701087978926173e+00, 0.018242840118951e+00 / 2.0}, // 6-perm
1082 : {0.034647074816760e+00, 0.142421601113383e+00, 0.822931324069857e+00, 0.010258563736199e+00 / 2.0}, // 6-perm
1083 : {0.010161119296278e+00, 0.065494628082938e+00, 0.924344252620784e+00, 0.003799928855302e+00 / 2.0} // 6-perm
1084 : };
1085 :
1086 :
1087 : // Now call the dunavant routine to generate _points and _weights
1088 28 : dunavant_rule(rule_data, 17);
1089 :
1090 8 : return;
1091 : }
1092 :
1093 :
1094 : // 20th-order rule by Wandzura.
1095 : //
1096 : // Stephen Wandzura, Hong Xiao,
1097 : // Symmetric Quadrature Rules on a Triangle,
1098 : // Computers and Mathematics with Applications,
1099 : // Volume 45, Number 12, June 2003, pages 1829-1840.
1100 : //
1101 : // Wandzura's work extends the work of Dunavant by providing degree
1102 : // 5,10,15,20,25, and 30 rules with positive weights for the triangle.
1103 : //
1104 : // Copied on 3rd July 2008 from:
1105 : // http://people.scs.fsu.edu/~burkardt/f_src/wandzura/wandzura.f90
1106 14 : case TWENTIETH:
1107 : {
1108 : // The equivalent conical product rule would have 121 points
1109 14 : _points.resize (85);
1110 14 : _weights.resize(85);
1111 :
1112 : // The raw data for the quadrature rule.
1113 14 : const Real rule_data[19][4] = {
1114 : {0.33333333333333e+00, 0.0, 0.0, 0.2761042699769952e-01 / 2.0}, // 1-perm
1115 : {0.00150064932443e+00, 0.49924967533779e+00, 0.0, 0.1779029547326740e-02 / 2.0}, // 3-perm
1116 : {0.09413975193895e+00, 0.45293012403052e+00, 0.0, 0.2011239811396117e-01 / 2.0}, // 3-perm
1117 : {0.20447212408953e+00, 0.39776393795524e+00, 0.0, 0.2681784725933157e-01 / 2.0}, // 3-perm
1118 : {0.47099959493443e+00, 0.26450020253279e+00, 0.0, 0.2452313380150201e-01 / 2.0}, // 3-perm
1119 : {0.57796207181585e+00, 0.21101896409208e+00, 0.0, 0.1639457841069539e-01 / 2.0}, // 3-perm
1120 : {0.78452878565746e+00, 0.10773560717127e+00, 0.0, 0.1479590739864960e-01 / 2.0}, // 3-perm
1121 : {0.92186182432439e+00, 0.03906908783780e+00, 0.0, 0.4579282277704251e-02 / 2.0}, // 3-perm
1122 : {0.97765124054134e+00, 0.01117437972933e+00, 0.0, 0.1651826515576217e-02 / 2.0}, // 3-perm
1123 : {0.00534961818734e+00, 0.06354966590835e+00, 0.93110071590431e+00, 0.2349170908575584e-02 / 2.0}, // 6-perm
1124 : {0.00795481706620e+00, 0.15710691894071e+00, 0.83493826399309e+00, 0.4465925754181793e-02 / 2.0}, // 6-perm
1125 : {0.01042239828126e+00, 0.39564211436437e+00, 0.59393548735436e+00, 0.6099566807907972e-02 / 2.0}, // 6-perm
1126 : {0.01096441479612e+00, 0.27316757071291e+00, 0.71586801449097e+00, 0.6891081327188203e-02 / 2.0}, // 6-perm
1127 : {0.03856671208546e+00, 0.10178538248502e+00, 0.85964790542952e+00, 0.7997475072478163e-02 / 2.0}, // 6-perm
1128 : {0.03558050781722e+00, 0.44665854917641e+00, 0.51776094300637e+00, 0.7386134285336024e-02 / 2.0}, // 6-perm
1129 : {0.04967081636276e+00, 0.19901079414950e+00, 0.75131838948773e+00, 0.1279933187864826e-01 / 2.0}, // 6-perm
1130 : {0.05851972508433e+00, 0.32426118369228e+00, 0.61721909122339e+00, 0.1725807117569655e-01 / 2.0}, // 6-perm
1131 : {0.12149778700439e+00, 0.20853136321013e+00, 0.66997084978547e+00, 0.1867294590293547e-01 / 2.0}, // 6-perm
1132 : {0.14071084494394e+00, 0.32317056653626e+00, 0.53611858851980e+00, 0.2281822405839526e-01 / 2.0} // 6-perm
1133 : };
1134 :
1135 :
1136 : // Now call the dunavant routine to generate _points and _weights
1137 14 : dunavant_rule(rule_data, 19);
1138 :
1139 4 : return;
1140 : }
1141 :
1142 :
1143 :
1144 : // 25th-order rule by Wandzura.
1145 : //
1146 : // Stephen Wandzura, Hong Xiao,
1147 : // Symmetric Quadrature Rules on a Triangle,
1148 : // Computers and Mathematics with Applications,
1149 : // Volume 45, Number 12, June 2003, pages 1829-1840.
1150 : //
1151 : // Wandzura's work extends the work of Dunavant by providing degree
1152 : // 5,10,15,20,25, and 30 rules with positive weights for the triangle.
1153 : //
1154 : // Copied on 3rd July 2008 from:
1155 : // http://people.scs.fsu.edu/~burkardt/f_src/wandzura/wandzura.f90
1156 : // case TWENTYFIRST: // fall through to 121 point conical product rule below
1157 0 : case TWENTYSECOND:
1158 : case TWENTYTHIRD:
1159 : case TWENTYFOURTH:
1160 : case TWENTYFIFTH:
1161 : {
1162 : // The equivalent conical product rule would have 169 points
1163 0 : _points.resize (126);
1164 0 : _weights.resize(126);
1165 :
1166 : // The raw data for the quadrature rule.
1167 0 : const Real rule_data[26][4] = {
1168 : {0.02794648307317e+00, 0.48602675846341e+00, 0.0, 0.8005581880020417e-02 / 2.0}, // 3-perm
1169 : {0.13117860132765e+00, 0.43441069933617e+00, 0.0, 0.1594707683239050e-01 / 2.0}, // 3-perm
1170 : {0.22022172951207e+00, 0.38988913524396e+00, 0.0, 0.1310914123079553e-01 / 2.0}, // 3-perm
1171 : {0.40311353196039e+00, 0.29844323401980e+00, 0.0, 0.1958300096563562e-01 / 2.0}, // 3-perm
1172 : {0.53191165532526e+00, 0.23404417233737e+00, 0.0, 0.1647088544153727e-01 / 2.0}, // 3-perm
1173 : {0.69706333078196e+00, 0.15146833460902e+00, 0.0, 0.8547279074092100e-02 / 2.0}, // 3-perm
1174 : {0.77453221290801e+00, 0.11273389354599e+00, 0.0, 0.8161885857226492e-02 / 2.0}, // 3-perm
1175 : {0.84456861581695e+00, 0.07771569209153e+00, 0.0, 0.6121146539983779e-02 / 2.0}, // 3-perm
1176 : {0.93021381277141e+00, 0.03489309361430e+00, 0.0, 0.2908498264936665e-02 / 2.0}, // 3-perm
1177 : {0.98548363075813e+00, 0.00725818462093e+00, 0.0, 0.6922752456619963e-03 / 2.0}, // 3-perm
1178 : {0.00129235270444e+00, 0.22721445215336e+00, 0.77149319514219e+00, 0.1248289199277397e-02 / 2.0}, // 6-perm
1179 : {0.00539970127212e+00, 0.43501055485357e+00, 0.55958974387431e+00, 0.3404752908803022e-02 / 2.0}, // 6-perm
1180 : {0.00638400303398e+00, 0.32030959927220e+00, 0.67330639769382e+00, 0.3359654326064051e-02 / 2.0}, // 6-perm
1181 : {0.00502821150199e+00, 0.09175032228001e+00, 0.90322146621800e+00, 0.1716156539496754e-02 / 2.0}, // 6-perm
1182 : {0.00682675862178e+00, 0.03801083585872e+00, 0.95516240551949e+00, 0.1480856316715606e-02 / 2.0}, // 6-perm
1183 : {0.01001619963993e+00, 0.15742521848531e+00, 0.83255858187476e+00, 0.3511312610728685e-02 / 2.0}, // 6-perm
1184 : {0.02575781317339e+00, 0.23988965977853e+00, 0.73435252704808e+00, 0.7393550149706484e-02 / 2.0}, // 6-perm
1185 : {0.03022789811992e+00, 0.36194311812606e+00, 0.60782898375402e+00, 0.7983087477376558e-02 / 2.0}, // 6-perm
1186 : {0.03050499010716e+00, 0.08355196095483e+00, 0.88594304893801e+00, 0.4355962613158041e-02 / 2.0}, // 6-perm
1187 : {0.04595654736257e+00, 0.14844322073242e+00, 0.80560023190501e+00, 0.7365056701417832e-02 / 2.0}, // 6-perm
1188 : {0.06744280054028e+00, 0.28373970872753e+00, 0.64881749073219e+00, 0.1096357284641955e-01 / 2.0}, // 6-perm
1189 : {0.07004509141591e+00, 0.40689937511879e+00, 0.52305553346530e+00, 0.1174996174354112e-01 / 2.0}, // 6-perm
1190 : {0.08391152464012e+00, 0.19411398702489e+00, 0.72197448833499e+00, 0.1001560071379857e-01 / 2.0}, // 6-perm
1191 : {0.12037553567715e+00, 0.32413434700070e+00, 0.55549011732214e+00, 0.1330964078762868e-01 / 2.0}, // 6-perm
1192 : {0.14806689915737e+00, 0.22927748355598e+00, 0.62265561728665e+00, 0.1415444650522614e-01 / 2.0}, // 6-perm
1193 : {0.19177186586733e+00, 0.32561812259598e+00, 0.48261001153669e+00, 0.1488137956116801e-01 / 2.0} // 6-perm
1194 : };
1195 :
1196 :
1197 : // Now call the dunavant routine to generate _points and _weights
1198 0 : dunavant_rule(rule_data, 26);
1199 :
1200 0 : return;
1201 : }
1202 :
1203 :
1204 :
1205 : // 30th-order rule by Wandzura.
1206 : //
1207 : // Stephen Wandzura, Hong Xiao,
1208 : // Symmetric Quadrature Rules on a Triangle,
1209 : // Computers and Mathematics with Applications,
1210 : // Volume 45, Number 12, June 2003, pages 1829-1840.
1211 : //
1212 : // Wandzura's work extends the work of Dunavant by providing degree
1213 : // 5,10,15,20,25, and 30 rules with positive weights for the triangle.
1214 : //
1215 : // Copied on 3rd July 2008 from:
1216 : // http://people.scs.fsu.edu/~burkardt/f_src/wandzura/wandzura.f90
1217 0 : case TWENTYSIXTH:
1218 : case TWENTYSEVENTH:
1219 : case TWENTYEIGHTH:
1220 : case TWENTYNINTH:
1221 : case THIRTIETH:
1222 : {
1223 : // The equivalent conical product rule would have 256 points
1224 0 : _points.resize (175);
1225 0 : _weights.resize(175);
1226 :
1227 : // The raw data for the quadrature rule.
1228 0 : const Real rule_data[36][4] = {
1229 : {0.33333333333333e+00, 0.0, 0.0, 0.1557996020289920e-01 / 2.0}, // 1-perm
1230 : {0.00733011643277e+00, 0.49633494178362e+00, 0.0, 0.3177233700534134e-02 / 2.0}, // 3-perm
1231 : {0.08299567580296e+00, 0.45850216209852e+00, 0.0, 0.1048342663573077e-01 / 2.0}, // 3-perm
1232 : {0.15098095612541e+00, 0.42450952193729e+00, 0.0, 0.1320945957774363e-01 / 2.0}, // 3-perm
1233 : {0.23590585989217e+00, 0.38204707005392e+00, 0.0, 0.1497500696627150e-01 / 2.0}, // 3-perm
1234 : {0.43802430840785e+00, 0.28098784579608e+00, 0.0, 0.1498790444338419e-01 / 2.0}, // 3-perm
1235 : {0.54530204829193e+00, 0.22734897585403e+00, 0.0, 0.1333886474102166e-01 / 2.0}, // 3-perm
1236 : {0.65088177698254e+00, 0.17455911150873e+00, 0.0, 0.1088917111390201e-01 / 2.0}, // 3-perm
1237 : {0.75348314559713e+00, 0.12325842720144e+00, 0.0, 0.8189440660893461e-02 / 2.0}, // 3-perm
1238 : {0.83983154221561e+00, 0.08008422889220e+00, 0.0, 0.5575387588607785e-02 / 2.0}, // 3-perm
1239 : {0.90445106518420e+00, 0.04777446740790e+00, 0.0, 0.3191216473411976e-02 / 2.0}, // 3-perm
1240 : {0.95655897063972e+00, 0.02172051468014e+00, 0.0, 0.1296715144327045e-02 / 2.0}, // 3-perm
1241 : {0.99047064476913e+00, 0.00476467761544e+00, 0.0, 0.2982628261349172e-03 / 2.0}, // 3-perm
1242 : {0.00092537119335e+00, 0.41529527091331e+00, 0.58377935789334e+00, 0.9989056850788964e-03 / 2.0}, // 6-perm
1243 : {0.00138592585556e+00, 0.06118990978535e+00, 0.93742416435909e+00, 0.4628508491732533e-03 / 2.0}, // 6-perm
1244 : {0.00368241545591e+00, 0.16490869013691e+00, 0.83140889440718e+00, 0.1234451336382413e-02 / 2.0}, // 6-perm
1245 : {0.00390322342416e+00, 0.02503506223200e+00, 0.97106171434384e+00, 0.5707198522432062e-03 / 2.0}, // 6-perm
1246 : {0.00323324815501e+00, 0.30606446515110e+00, 0.69070228669389e+00, 0.1126946125877624e-02 / 2.0}, // 6-perm
1247 : {0.00646743211224e+00, 0.10707328373022e+00, 0.88645928415754e+00, 0.1747866949407337e-02 / 2.0}, // 6-perm
1248 : {0.00324747549133e+00, 0.22995754934558e+00, 0.76679497516308e+00, 0.1182818815031657e-02 / 2.0}, // 6-perm
1249 : {0.00867509080675e+00, 0.33703663330578e+00, 0.65428827588746e+00, 0.1990839294675034e-02 / 2.0}, // 6-perm
1250 : {0.01559702646731e+00, 0.05625657618206e+00, 0.92814639735063e+00, 0.1900412795035980e-02 / 2.0}, // 6-perm
1251 : {0.01797672125369e+00, 0.40245137521240e+00, 0.57957190353391e+00, 0.4498365808817451e-02 / 2.0}, // 6-perm
1252 : {0.01712424535389e+00, 0.24365470201083e+00, 0.73922105263528e+00, 0.3478719460274719e-02 / 2.0}, // 6-perm
1253 : {0.02288340534658e+00, 0.16538958561453e+00, 0.81172700903888e+00, 0.4102399036723953e-02 / 2.0}, // 6-perm
1254 : {0.03273759728777e+00, 0.09930187449585e+00, 0.86796052821639e+00, 0.4021761549744162e-02 / 2.0}, // 6-perm
1255 : {0.03382101234234e+00, 0.30847833306905e+00, 0.65770065458860e+00, 0.6033164660795066e-02 / 2.0}, // 6-perm
1256 : {0.03554761446002e+00, 0.46066831859211e+00, 0.50378406694787e+00, 0.3946290302129598e-02 / 2.0}, // 6-perm
1257 : {0.05053979030687e+00, 0.21881529945393e+00, 0.73064491023920e+00, 0.6644044537680268e-02 / 2.0}, // 6-perm
1258 : {0.05701471491573e+00, 0.37920955156027e+00, 0.56377573352399e+00, 0.8254305856078458e-02 / 2.0}, // 6-perm
1259 : {0.06415280642120e+00, 0.14296081941819e+00, 0.79288637416061e+00, 0.6496056633406411e-02 / 2.0}, // 6-perm
1260 : {0.08050114828763e+00, 0.28373128210592e+00, 0.63576756960645e+00, 0.9252778144146602e-02 / 2.0}, // 6-perm
1261 : {0.10436706813453e+00, 0.19673744100444e+00, 0.69889549086103e+00, 0.9164920726294280e-02 / 2.0}, // 6-perm
1262 : {0.11384489442875e+00, 0.35588914121166e+00, 0.53026596435959e+00, 0.1156952462809767e-01 / 2.0}, // 6-perm
1263 : {0.14536348771552e+00, 0.25981868535191e+00, 0.59481782693256e+00, 0.1176111646760917e-01 / 2.0}, // 6-perm
1264 : {0.18994565282198e+00, 0.32192318123130e+00, 0.48813116594672e+00, 0.1382470218216540e-01 / 2.0} // 6-perm
1265 : };
1266 :
1267 :
1268 : // Now call the dunavant routine to generate _points and _weights
1269 0 : dunavant_rule(rule_data, 36);
1270 :
1271 0 : return;
1272 : }
1273 :
1274 :
1275 : // By default, we fall back on the conical product rules. If the user
1276 : // requests an order higher than what is currently available in the 1D
1277 : // rules, an error will be thrown from the respective 1D code.
1278 0 : default:
1279 : {
1280 : // The following quadrature rules are generated as
1281 : // conical products. These tend to be non-optimal
1282 : // (use too many points, cluster points in certain
1283 : // regions of the domain) but they are quite easy to
1284 : // automatically generate using a 1D Gauss rule on
1285 : // [0,1] and two 1D Jacobi-Gauss rules on [0,1].
1286 0 : QConical conical_rule(2, _order);
1287 0 : conical_rule.init(*this);
1288 :
1289 : // Swap points and weights with the about-to-be destroyed rule.
1290 0 : _points.swap (conical_rule.get_points() );
1291 0 : _weights.swap(conical_rule.get_weights());
1292 :
1293 0 : return;
1294 : }
1295 : }
1296 : }
1297 :
1298 :
1299 : //---------------------------------------------
1300 : // Arbitrary polygon quadrature rules
1301 260 : case C0POLYGON:
1302 : {
1303 326 : QGauss tri_rule(2, _order);
1304 260 : tri_rule.init(TRI3, _p_level, true);
1305 :
1306 66 : std::vector<Point> & tripoints = tri_rule.get_points();
1307 66 : std::vector<Real> & triweights = tri_rule.get_weights();
1308 :
1309 132 : std::size_t numtripts = tripoints.size();
1310 :
1311 : // C0Polygon requires the newer Quadrature API
1312 260 : if (!_elem)
1313 0 : libmesh_error();
1314 :
1315 66 : libmesh_assert(_elem->type() == C0POLYGON);
1316 :
1317 66 : const C0Polygon & poly = *cast_ptr<const C0Polygon *>(_elem);
1318 :
1319 260 : std::size_t numtris = poly.n_subtriangles();
1320 260 : _points.resize(numtripts*numtris);
1321 260 : _weights.resize(numtripts*numtris);
1322 1033 : for (std::size_t t = 0; t != numtris; ++t)
1323 : {
1324 773 : auto master_points = poly.master_subtriangle(t);
1325 :
1326 : // The factor of one half from the triweights cancels out
1327 : // the factor of two here, so we don't need to do so
1328 : // ourselves.
1329 : const Real twice_master_tri_area =
1330 773 : (- master_points[1](1) * master_points[2](0)
1331 773 : - master_points[0](1) * master_points[1](0)
1332 773 : + master_points[0](1) * master_points[2](0)
1333 773 : + master_points[0](0) * master_points[1](1)
1334 773 : - master_points[0](0) * master_points[2](1)
1335 773 : + master_points[1](0) * master_points[2](1));
1336 :
1337 196 : const Point v01 = master_points[1] - master_points[0];
1338 196 : const Point v02 = master_points[2] - master_points[0];
1339 :
1340 4513 : for (std::size_t i = 0; i != numtripts; ++i)
1341 : {
1342 3740 : _points[numtripts*t+i] =
1343 946 : master_points[0] +
1344 2838 : v01 * tripoints[i](0) +
1345 3784 : v02 * tripoints[i](1);
1346 5632 : _weights[numtripts*t+i] = triweights[i] *
1347 : twice_master_tri_area;
1348 : }
1349 : }
1350 66 : return;
1351 : }
1352 :
1353 : //---------------------------------------------
1354 : // Unsupported type
1355 0 : default:
1356 0 : libmesh_error_msg("Element type not supported:" << Utility::enum_to_string(_type));
1357 : }
1358 : #endif
1359 : }
1360 :
1361 : } // namespace libMesh
|