libMesh
Classes | Functions | Variables
fe_test.h File Reference

Go to the source code of this file.

Classes

class  SkewFunc
 
class  FETestBase< order, family, elem_type, build_nx >
 
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 quadratic_test (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient quadratic_test_grad (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Number fe_cubic_test (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient fe_cubic_test_grad (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Number fe_quartic_test (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient fe_quartic_test_grad (const Point &p, 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

◆ fe_cubic_test()

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

Definition at line 128 of file fe_test.h.

References libMesh::Real.

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

132 {
133  const Real & x = p(0);
134  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
135  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
136 
137  return x*(1-x)*(1-x) + x*x*(1-y) + x*(1-y)*(1-z) + y*(1-y)*z + z*(1-z)*(1-z);
138 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ fe_cubic_test_grad()

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

Definition at line 141 of file fe_test.h.

References libMesh::Real.

Referenced by FETestBase< order, family, elem_type, 1 >::setUp(), and FETestBase< order, family, elem_type, 1 >::true_gradient().

145 {
146  const Real & x = p(0);
147  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
148  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
149 
150  Gradient grad = 3*x*x-4*x+1 + 2*x*(1-y) + (1-y)*(1-z);
151  if (LIBMESH_DIM > 1)
152  grad(1) = -x*x - x*(1-z) + (1-2*y)*z;
153  if (LIBMESH_DIM > 2)
154  grad(2) = -x*(1-y) + y*(1-y) + 3*z*z-4*z+1;
155 
156  return grad;
157 }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ fe_quartic_test()

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

Definition at line 161 of file fe_test.h.

References libMesh::Real.

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

165 {
166  const Real & x = p(0);
167  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
168  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
169 
170  return x*x*(1-x)*(1-x) + x*x*z*(1-y) + x*(1-x)*(1-y)*(1-z) + (1-x)*y*(1-y)*z + z*z*(1-z)*(1-z);
171 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ fe_quartic_test_grad()

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

Definition at line 174 of file fe_test.h.

References libMesh::Real.

Referenced by FETestBase< order, family, elem_type, 1 >::setUp(), and FETestBase< order, family, elem_type, 1 >::true_gradient().

178 {
179  const Real & x = p(0);
180  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
181  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
182 
183  Gradient grad = 4*x*x*x-6*x*x+2*x + 2*x*z*(1-y) + (1-2*x)*(1-y)*(1-z) - y*(1-y)*z;
184  if (LIBMESH_DIM > 1)
185  grad(1) = -x*x*z - x*(1-x)*(1-z) + (1-x)*(1-2*y)*z;
186  if (LIBMESH_DIM > 2)
187  grad(2) = x*x*(1-y) - x*(1-x)*(1-y) + (1-x)*y*(1-y) + 4*z*z*z-6*z*z+2*z;
188 
189  return grad;
190 }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ linear_test()

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

Definition at line 66 of file fe_test.h.

References libMesh::Real.

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

70 {
71  const Real & x = p(0);
72  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
73  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
74 
75  return x + 0.25*y + 0.0625*z;
76 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ linear_test_grad()

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

Definition at line 79 of file fe_test.h.

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

83 {
84  Gradient grad = 1;
85  if (LIBMESH_DIM > 1)
86  grad(1) = 0.25;
87  if (LIBMESH_DIM > 2)
88  grad(2) = 0.0625;
89 
90  return grad;
91 }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.

◆ quadratic_test()

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

Definition at line 95 of file fe_test.h.

References libMesh::Real.

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

99 {
100  const Real & x = p(0);
101  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
102  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
103 
104  return x*x + 0.5*y*y + 0.25*z*z + 0.125*x*y + 0.0625*x*z + 0.03125*y*z;
105 }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ quadratic_test_grad()

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

Definition at line 108 of file fe_test.h.

References libMesh::Real.

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

112 {
113  const Real & x = p(0);
114  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
115  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
116 
117  Gradient grad = 2*x + 0.125*y + 0.0625*z;
118  if (LIBMESH_DIM > 1)
119  grad(1) = y + 0.125*x + 0.03125*z;
120  if (LIBMESH_DIM > 2)
121  grad(2) = 0.5*z + 0.0625*x + 0.03125*y;
122 
123  return grad;
124 }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ rational_test()

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

Definition at line 200 of file fe_test.h.

References rational_w, and libMesh::Real.

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

204 {
205  const Real & x = p(0);
206  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
207  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
208 
209  const Real denom = ((1-x)*(1-x)+x*x+2*rational_w*x*(1-x))*
210  ((1-y)*(1-y)+y*y+2*rational_w*y*(1-y))*
211  ((1-z)*(1-z)+z*z+2*rational_w*z*(1-z));
212 
213  return (x + 0.25*y + 0.0625*z)/denom;
214 }
static const Real rational_w
Definition: fe_test.h:197
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ rational_test_grad()

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

Definition at line 217 of file fe_test.h.

References rational_w, and libMesh::Real.

Referenced by FETestBase< order, family, elem_type, 1 >::setUp(), and FETestBase< order, family, elem_type, 1 >::true_gradient().

221 {
222  const Real & x = p(0);
223  const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
224  const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
225 
226  const Real xpoly = (1-x)*(1-x)+x*x+2*rational_w*x*(1-x);
227  const Real xderiv = -2*(1-x)+2*x+2*rational_w*(1-2*x);
228  const Real ypoly = (1-y)*(1-y)+y*y+2*rational_w*y*(1-y);
229  const Real yderiv = -2*(1-y)+2*y+2*rational_w*(1-2*y);
230  const Real zpoly = (1-z)*(1-z)+z*z+2*rational_w*z*(1-z);
231  const Real zderiv = -2*(1-z)+2*z+2*rational_w*(1-2*z);
232 
233  const Real denom = xpoly * ypoly * zpoly;
234 
235  const Real numer = (x + 0.25*y + 0.0625*z);
236 
237  Gradient grad_n = 1, grad_d = xderiv * ypoly * zpoly;
238  if (LIBMESH_DIM > 1)
239  {
240  grad_n(1) = 0.25;
241  grad_d(1) = xpoly * yderiv * zpoly;
242  }
243  if (LIBMESH_DIM > 2)
244  {
245  grad_n(2) = 0.0625;
246  grad_d(2) = xpoly * ypoly * zderiv;
247  }
248 
249  Gradient grad = (grad_n - numer * grad_d / denom) / denom;
250 
251  return grad;
252 }
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
static const Real rational_w
Definition: fe_test.h:197
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Variable Documentation

◆ rational_w

const Real rational_w = 0.75
static