[MOAB-dev] r4122 - MOAB/trunk/tools/mbcoupler

smithrm at mcs.anl.gov smithrm at mcs.anl.gov
Fri Sep 3 12:04:57 CDT 2010


Author: smithrm
Date: 2010-09-03 12:04:57 -0500 (Fri, 03 Sep 2010)
New Revision: 4122

Modified:
   MOAB/trunk/tools/mbcoupler/ElemUtil.cpp
   MOAB/trunk/tools/mbcoupler/ElemUtil.hpp
Log:
o Added function to integrate a field over a trilinear hex using the Gaussian quadrature method.


Modified: MOAB/trunk/tools/mbcoupler/ElemUtil.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/ElemUtil.cpp	2010-09-03 14:56:51 UTC (rev 4121)
+++ MOAB/trunk/tools/mbcoupler/ElemUtil.cpp	2010-09-03 17:04:57 UTC (rev 4122)
@@ -9,6 +9,8 @@
 namespace moab { 
 namespace ElemUtil {
 
+  bool debug = false;
+
 /**\brief Class representing a 3-D mapping function (e.g. shape function for volume element) */
 class VolMap {
   public:
@@ -294,6 +296,114 @@
   free(od_work);
 }
 
+
+// Gaussian quadrature points.  Five 2d arrays are defined.
+// One for the single gaussian point solution, 2 point solution, 
+// 3 point solution, 4 point solution and 5 point solution.
+// There are 2 columns, one for Weights and the other for Locations
+//                                Weight         Location
+
+const double gauss_1[1][2] = { {  2.0,           0.0          } };
+
+const double gauss_2[2][2] = { {  1.0,          -0.5773502691 },
+                               {  1.0         ,  0.5773502691 } };
+
+const double gauss_3[3][2] = { {  0.5555555555, -0.7745966692 },
+                               {  0.8888888888,  0.0          },
+                               {  0.5555555555,  0.7745966692 } };
+
+const double gauss_4[4][2] = { {  0.3478548451, -0.8611363116 },
+                               {  0.6521451549, -0.3399810436 },
+                               {  0.6521451549,  0.3399810436 },
+                               {  0.3478548451,  0.8611363116 } };
+
+const double gauss_5[5][2] = { {  0.2369268851,  -0.9061798459 },
+                               {  0.4786286705,  -0.5384693101 },
+                               {  0.5688888889,   0.0          },
+                               {  0.4786286705,   0.5384693101 },
+                               {  0.2369268851,   0.9061798459 } };
+
+// Function to integrate the field defined by field_fn function
+// over the volume of the trilinear hex defined by the hex_corners
+
+bool integrate_trilinear_hex(const CartVect* hex_corners,
+                             double (*field_fn)(double, double, double),
+                             double& field_val,
+                             int num_pts)


More information about the moab-dev mailing list