quadrature_simpson_2D.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 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
22 
23 namespace libMesh
24 {
25 
26 
27 
28 void QSimpson::init_2D(const ElemType type_in,
29  unsigned int)
30 {
31 #if LIBMESH_DIM > 1
32 
33  //-----------------------------------------------------------------------
34  // 2D quadrature rules
35  switch (type_in)
36  {
37 
38 
39  //---------------------------------------------
40  // Quadrilateral quadrature rules
41  case QUAD4:
42  case QUAD8:
43  case QUAD9:
44  {
45  // We compute the 2D quadrature rule as a tensor
46  // product of the 1D quadrature rule.
47  QSimpson q1D(1);
48  q1D.init(EDGE2);
49  tensor_product_quad( q1D );
50  return;
51  }
52 
53 
54  //---------------------------------------------
55  // Triangle quadrature rules
56  case TRI3:
57  case TRI6:
58  {
59  // I'm not sure if you would call this Simpson's
60  // rule for triangles. What it *Really* is is
61  // four trapezoidal rules combined to give a six
62  // point rule. The points lie at the nodal locations
63  // of the TRI6, so you can get diagonal element
64  // stiffness matrix entries for quadratic elements.
65  // This rule should be able to integrate a little
66  // better than linears exactly.
67 
68  _points.resize(6);
69  _weights.resize(6);
70 
71  _points[0](0) = 0.;
72  _points[0](1) = 0.;
73 
74  _points[1](0) = 1.;
75  _points[1](1) = 0.;
76 
77  _points[2](0) = 0.;
78  _points[2](1) = 1.;
79 
80  _points[3](0) = 0.5;
81  _points[3](1) = 0.;
82 
83  _points[4](0) = 0.;
84  _points[4](1) = 0.5;
85 
86  _points[5](0) = 0.5;
87  _points[5](1) = 0.5;
88 
89  _weights[0] = 0.041666666666666666666666666667; // 1./24.
90  _weights[1] = 0.041666666666666666666666666667; // 1./24.
91  _weights[2] = 0.041666666666666666666666666667; // 1./24.
92  _weights[3] = 0.125; // 1./8.
93  _weights[4] = 0.125; // 1./8.
94  _weights[5] = 0.125; // 1./8.
95 
96  return;
97  }
98 
99 
100  //---------------------------------------------
101  // Unsupported type
102  default:
103  {
104  libMesh::err << "Element type not supported!:" << type_in << std::endl;
105  libmesh_error();
106  }
107  }
108 
109  libmesh_error();
110 
111  return;
112 
113 #endif
114 }
115 
116 } // namespace libMesh

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:07 UTC

Hosted By:
SourceForge.net Logo