libMesh
Classes | Functions | Variables
fe_test.h File Reference

Go to the source code of this file.

Classes

class  FETest< order, family, elem_type >
 

Functions

Number linear_test (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient linear_test_grad (const Point &, const Parameters &, const std::string &, const std::string &)
 
Number rational_test (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient rational_test_grad (const Point &p, const Parameters &, const std::string &, const std::string &)
 

Variables

static const Real rational_w = 0.75
 

Function Documentation

◆ linear_test()

Number linear_test ( const Point p,
const Parameters ,
const std::string &  ,
const std::string &   
)
inline

Definition at line 28 of file fe_test.h.

32 {
33  const Real & x = p(0);
34  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
35  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
36 
37  return x + 0.25*y + 0.0625*z;
38 }

References libMesh::Real.

Referenced by FETest< order, family, elem_type >::setUp().

◆ linear_test_grad()

Gradient linear_test_grad ( const Point ,
const Parameters ,
const std::string &  ,
const std::string &   
)
inline

Definition at line 41 of file fe_test.h.

45 {
46  Gradient grad = 1;
47  if (LIBMESH_DIM > 1)
48  grad(1) = 0.25;
49  if (LIBMESH_DIM > 2)
50  grad(2) = 0.0625;
51 
52  return grad;
53 }

Referenced by FETest< order, family, elem_type >::setUp().

◆ rational_test()

Number rational_test ( const Point p,
const Parameters ,
const std::string &  ,
const std::string &   
)
inline

Definition at line 62 of file fe_test.h.

66 {
67  const Real & x = p(0);
68  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
69  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
70 
71  const Real denom = ((1-x)*(1-x)+x*x+2*rational_w*x*(1-x))*
72  ((1-y)*(1-y)+y*y+2*rational_w*y*(1-y))*
73  ((1-z)*(1-z)+z*z+2*rational_w*z*(1-z));
74 
75  return (x + 0.25*y + 0.0625*z)/denom;
76 }

References rational_w, and libMesh::Real.

Referenced by FETest< order, family, elem_type >::setUp(), and FETest< order, family, elem_type >::testU().

◆ rational_test_grad()

Gradient rational_test_grad ( const Point p,
const Parameters ,
const std::string &  ,
const std::string &   
)
inline

Definition at line 79 of file fe_test.h.

83 {
84  const Real & x = p(0);
85  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
86  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
87 
88  const Real xpoly = (1-x)*(1-x)+x*x+2*rational_w*x*(1-x);
89  const Real xderiv = -2*(1-x)+2*x+2*rational_w*(1-2*x);
90  const Real ypoly = (1-y)*(1-y)+y*y+2*rational_w*y*(1-y);
91  const Real yderiv = -2*(1-y)+2*y+2*rational_w*(1-2*y);
92  const Real zpoly = (1-z)*(1-z)+z*z+2*rational_w*z*(1-z);
93  const Real zderiv = -2*(1-z)+2*z+2*rational_w*(1-2*z);
94 
95  const Real denom = xpoly * ypoly * zpoly;
96 
97  const Real numer = (x + 0.25*y + 0.0625*z);
98 
99  Gradient grad_n = 1, grad_d = xderiv * ypoly * zpoly;
100  if (LIBMESH_DIM > 1)
101  {
102  grad_n(1) = 0.25;
103  grad_d(1) = xpoly * yderiv * zpoly;
104  }
105  if (LIBMESH_DIM > 2)
106  {
107  grad_n(2) = 0.0625;
108  grad_d(2) = xpoly * ypoly * zderiv;
109  }
110 
111  Gradient grad = (grad_n - numer * grad_d / denom) / denom;
112 
113  return grad;
114 }

References rational_w, and libMesh::Real.

Referenced by FETest< order, family, elem_type >::setUp(), FETest< order, family, elem_type >::testGradU(), and FETest< order, family, elem_type >::testGradUComp().

Variable Documentation

◆ rational_w

const Real rational_w = 0.75
static
libMesh::VectorValue< Number >
rational_w
static const Real rational_w
Definition: fe_test.h:59
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121