OGS
ShapeQuad8-impl.h
Go to the documentation of this file.
1
11namespace NumLib
12{
13template <class T_X, class T_N>
14void ShapeQuad8::computeShapeFunction(const T_X& r, T_N& N)
15{
16 N[0] = 0.25 * (1.0 + r[0]) * (1.0 + r[1]) * (-1.0 + r[0] + r[1]);
17 N[1] = -0.25 * (1.0 - r[0]) * (1.0 + r[1]) * (1.0 + r[0] - r[1]);
18 N[2] = -0.25 * (1.0 - r[0]) * (1.0 - r[1]) * (1.0 + r[0] + r[1]);
19 N[3] = 0.25 * (1.0 + r[0]) * (1.0 - r[1]) * (-1.0 + r[0] - r[1]);
20 //
21 N[4] = 0.5 * (1.0 - r[0] * r[0]) * (1.0 + r[1]);
22 N[5] = 0.5 * (1.0 - r[1] * r[1]) * (1.0 - r[0]);
23 N[6] = 0.5 * (1.0 - r[0] * r[0]) * (1.0 - r[1]);
24 N[7] = 0.5 * (1.0 - r[1] * r[1]) * (1.0 + r[0]);
25}
26
27template <class T_X, class T_N>
28void ShapeQuad8::computeGradShapeFunction(const T_X& rs, T_N& dN)
29{
30 const double r = rs[0];
31 const double s = rs[1];
32
33 // dN/dr
34 dN[0] = (1 + s) * (2 * r + s) * 0.25;
35 dN[1] = (1 + s) * (2 * r - s) * 0.25;
36 dN[2] = (1 - s) * (2 * r + s) * 0.25;
37 dN[3] = (1 - s) * (2 * r - s) * 0.25;
38
39 dN[4] = -r * (1 + s);
40 dN[5] = -(1 - s * s) * 0.5;
41 dN[6] = -r * (1 - s);
42 dN[7] = (1 - s * s) * 0.5;
43
44 // dN/ds
45 dN[8] = (1 + r) * (r + 2 * s) * 0.25;
46 dN[9] = -(1 - r) * (r - 2 * s) * 0.25;
47 dN[10] = (1 - r) * (r + 2 * s) * 0.25;
48 dN[11] = -(1 + r) * (r - 2 * s) * 0.25;
49
50 dN[12] = (1 - r * r) * 0.5;
51 dN[13] = -(1 - r) * s;
52 dN[14] = -(1 - r * r) * 0.5;
53 dN[15] = -(1 + r) * s;
54}
55
56} // namespace NumLib
static void computeShapeFunction(const T_X &r, T_N &N)
static void computeGradShapeFunction(const T_X &rs, T_N &dN)