libMesh
Loading...
Searching...
No Matches
Classes | Functions | Variables
fe_test.h File Reference

Go to the source code of this file.

Classes

class  SkewFunc
 
struct  Default
 
class  FETestBase< order, family, elem_type, build_nx, CaseName >
 
class  FETest< order, family, elem_type, CaseName >
 

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 136 of file fe_test.h.

140{
141 const Real & x = p(0);
142 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
143 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
144
145 return x*(1-x)*(1-x) + x*x*(1-y) + x*(1-y)*(1-z) + y*(1-y)*z + z*(1-z)*(1-z);
146}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

References libMesh::Real.

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

◆ fe_cubic_test_grad()

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

Definition at line 149 of file fe_test.h.

153{
154 const Real & x = p(0);
155 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
156 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
157
158 Gradient grad = 3*x*x-4*x+1 + 2*x*(1-y) + (1-y)*(1-z);
159 if (LIBMESH_DIM > 1)
160 grad(1) = -x*x - x*(1-z) + (1-2*y)*z;
161 if (LIBMESH_DIM > 2)
162 grad(2) = -x*(1-y) + y*(1-y) + 3*z*z-4*z+1;
163
164 return grad;
165}
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.

References libMesh::Real.

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

◆ fe_quartic_test()

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

Definition at line 169 of file fe_test.h.

173{
174 const Real & x = p(0);
175 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
176 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
177
178 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);
179}

References libMesh::Real.

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

◆ fe_quartic_test_grad()

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

Definition at line 182 of file fe_test.h.

186{
187 const Real & x = p(0);
188 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
189 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
190
191 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;
192 if (LIBMESH_DIM > 1)
193 grad(1) = -x*x*z - x*(1-x)*(1-z) + (1-x)*(1-2*y)*z;
194 if (LIBMESH_DIM > 2)
195 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;
196
197 return grad;
198}

References libMesh::Real.

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

◆ linear_test()

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

Definition at line 74 of file fe_test.h.

78{
79 const Real & x = p(0);
80 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
81 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
82
83 return x + 0.25*y + 0.0625*z;
84}

References libMesh::Real.

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

◆ linear_test_grad()

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

Definition at line 87 of file fe_test.h.

91{
92 Gradient grad = 1;
93 if (LIBMESH_DIM > 1)
94 grad(1) = 0.25;
95 if (LIBMESH_DIM > 2)
96 grad(2) = 0.0625;
97
98 return grad;
99}

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

◆ quadratic_test()

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

Definition at line 103 of file fe_test.h.

107{
108 const Real & x = p(0);
109 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
110 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
111
112 return x*x + 0.5*y*y + 0.25*z*z + 0.125*x*y + 0.0625*x*z + 0.03125*y*z;
113}

References libMesh::Real.

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

◆ quadratic_test_grad()

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

Definition at line 116 of file fe_test.h.

120{
121 const Real & x = p(0);
122 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
123 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
124
125 Gradient grad = 2*x + 0.125*y + 0.0625*z;
126 if (LIBMESH_DIM > 1)
127 grad(1) = y + 0.125*x + 0.03125*z;
128 if (LIBMESH_DIM > 2)
129 grad(2) = 0.5*z + 0.0625*x + 0.03125*y;
130
131 return grad;
132}

References libMesh::Real.

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

◆ rational_test()

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

Definition at line 208 of file fe_test.h.

212{
213 const Real & x = p(0);
214 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
215 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
216
217 const Real denom = ((1-x)*(1-x)+x*x+2*rational_w*x*(1-x))*
218 ((1-y)*(1-y)+y*y+2*rational_w*y*(1-y))*
219 ((1-z)*(1-z)+z*z+2*rational_w*z*(1-z));
220
221 return (x + 0.25*y + 0.0625*z)/denom;
222}
static const Real rational_w
Definition fe_test.h:205

References rational_w, and libMesh::Real.

Referenced by FETest< order, family, elem_type, CaseName >::checkU(), FETestBase< order, family, elem_type, build_nx, CaseName >::setUp(), and FESideTest< 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 225 of file fe_test.h.

229{
230 const Real & x = p(0);
231 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
232 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
233
234 const Real xpoly = (1-x)*(1-x)+x*x+2*rational_w*x*(1-x);
235 const Real xderiv = -2*(1-x)+2*x+2*rational_w*(1-2*x);
236 const Real ypoly = (1-y)*(1-y)+y*y+2*rational_w*y*(1-y);
237 const Real yderiv = -2*(1-y)+2*y+2*rational_w*(1-2*y);
238 const Real zpoly = (1-z)*(1-z)+z*z+2*rational_w*z*(1-z);
239 const Real zderiv = -2*(1-z)+2*z+2*rational_w*(1-2*z);
240
241 const Real denom = xpoly * ypoly * zpoly;
242
243 const Real numer = (x + 0.25*y + 0.0625*z);
244
245 Gradient grad_n = 1, grad_d = xderiv * ypoly * zpoly;
246 if (LIBMESH_DIM > 1)
247 {
248 grad_n(1) = 0.25;
249 grad_d(1) = xpoly * yderiv * zpoly;
250 }
251 if (LIBMESH_DIM > 2)
252 {
253 grad_n(2) = 0.0625;
254 grad_d(2) = xpoly * ypoly * zderiv;
255 }
256
257 Gradient grad = (grad_n - numer * grad_d / denom) / denom;
258
259 return grad;
260}

References rational_w, and libMesh::Real.

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

Variable Documentation

◆ rational_w

const Real rational_w = 0.75
static