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

141{
142 const Real & x = p(0);
143 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
144 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
145
146 return x*(1-x)*(1-x) + x*x*(1-y) + x*(1-y)*(1-z) + y*(1-y)*z + z*(1-z)*(1-z);
147}
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 150 of file fe_test.h.

154{
155 const Real & x = p(0);
156 const Real & y = (LIBMESH_DIM > 1) ? p(1) : 0;
157 const Real & z = (LIBMESH_DIM > 2) ? p(2) : 0;
158
159 Gradient grad = 3*x*x-4*x+1 + 2*x*(1-y) + (1-y)*(1-z);
160 if (LIBMESH_DIM > 1)
161 grad(1) = -x*x - x*(1-z) + (1-2*y)*z;
162 if (LIBMESH_DIM > 2)
163 grad(2) = -x*(1-y) + y*(1-y) + 3*z*z-4*z+1;
164
165 return grad;
166}
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 170 of file fe_test.h.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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