OGS
ShapePrism15-impl.h
Go to the documentation of this file.
1
11namespace NumLib
12{
13template <class T_X, class T_N>
14void ShapePrism15::computeShapeFunction(const T_X& x, T_N& N)
15{
16 const double L1 = x[0];
17 const double L2 = x[1];
18 const double L0 = 1.0 - L1 - L2;
19 const double t = x[2];
20 const double tt1 = 1.0 - t * t;
21
22 double v1 = 2.0 * L0 - 1;
23 double v2 = 2.0 * L1 - 1;
24 double v3 = 2.0 * L2 - 1;
25 // Vertex, bottom
26 N[0] = 0.5 * L0 * (v1 * (1.0 - t) - tt1);
27 N[1] = 0.5 * L1 * (v2 * (1.0 - t) - tt1);
28 N[2] = 0.5 * L2 * (v3 * (1.0 - t) - tt1);
29 // Vertex, top
30 N[3] = 0.5 * L0 * (v1 * (1.0 + t) - tt1);
31 N[4] = 0.5 * L1 * (v2 * (1.0 + t) - tt1);
32 N[5] = 0.5 * L2 * (v3 * (1.0 + t) - tt1);
33
34 v1 = 2.0 * L0 * L1;
35 v2 = 2.0 * L1 * L2;
36 v3 = 2.0 * L2 * L0;
37 // Middle point, bottom
38 N[6] = v1 * (1.0 - t);
39 N[7] = v2 * (1.0 - t);
40 N[8] = v3 * (1.0 - t);
41 // Middle point, top
42 N[9] = v1 * (1.0 + t);
43 N[10] = v2 * (1.0 + t);
44 N[11] = v3 * (1.0 + t);
45 // Middle point, center
46 N[12] = L0 * tt1;
47 N[13] = L1 * tt1;
48 N[14] = L2 * tt1;
49}
50
51template <class T_X, class T_N>
52void ShapePrism15::computeGradShapeFunction(const T_X& x, T_N& dN)
53{
54 const double L1 = x[0];
55 const double L2 = x[1];
56 const double L0 = 1.0 - L1 - L2;
57 const double t = x[2];
58 const double tt1 = 1.0 - t * t;
59
60 //---dN/dL1
61 double v1 = (4.0 * L0 - 1);
62 double v2 = (4.0 * L1 - 1);
63 // Vertex, bottom
64 dN[0] = -0.5 * (v1 * (1.0 - t) - tt1);
65 dN[1] = 0.5 * (v2 * (1.0 - t) - tt1);
66 dN[2] = 0.0;
67 // Vertex, top
68 dN[3] = -0.5 * (v1 * (1.0 + t) - tt1);
69 dN[4] = 0.5 * (v2 * (1.0 + t) - tt1);
70 dN[5] = 0.0;
71 // Middle point, bottom
72 dN[6] = 2.0 * (L0 - L1) * (1.0 - t);
73 dN[7] = 2.0 * L2 * (1.0 - t);
74 dN[8] = -dN[7];
75 // Middle point, top
76 dN[9] = 2.0 * (L0 - L1) * (1.0 + t);
77 dN[10] = 2.0 * L2 * (1.0 + t);
78 dN[11] = -dN[10];
79 // Middle point, center
80 dN[12] = -tt1;
81 dN[13] = tt1;
82 dN[14] = 0.0;
83
84 //---dN/dL2
85 v1 = (4.0 * L2 - 1);
86 // Vertex, bottom
87 dN[15] = dN[0];
88 dN[16] = 0.0;
89 dN[17] = 0.5 * (v1 * (1.0 - t) - tt1);
90 // Vertex, top
91 dN[18] = dN[3];
92 dN[19] = 0.0;
93 dN[20] = 0.5 * (v1 * (1.0 + t) - tt1);
94 // Middle point, bottom
95 dN[21] = -2.0 * L1 * (1.0 - t);
96 dN[22] = -dN[21];
97 v1 = 2.0 * (L0 - L2);
98 dN[23] = v1 * (1.0 - t);
99 // Middle point, top
100 dN[24] = -2.0 * L1 * (1.0 + t);
101 dN[25] = -dN[24];
102 dN[26] = v1 * (1.0 + t);
103 // Middle point, center
104 dN[27] = -tt1;
105 dN[28] = 0.0;
106 dN[29] = tt1;
107
108 //---dN/dt
109 v1 = 2.0 * L0 - 1;
110 v2 = 2.0 * L1 - 1;
111 double v3 = 2.0 * L2 - 1;
112 // Vertex, bottom
113 dN[30] = 0.5 * L0 * (-v1 + 2.0 * t);
114 dN[31] = 0.5 * L1 * (-v2 + 2.0 * t);
115 dN[32] = 0.5 * L2 * (-v3 + 2.0 * t);
116 // Vertex, top
117 dN[33] = 0.5 * L0 * (v1 + 2.0 * t);
118 dN[34] = 0.5 * L1 * (v2 + 2.0 * t);
119 dN[35] = 0.5 * L2 * (v3 + 2.0 * t);
120 // Middle point, bottom
121 dN[36] = -2.0 * L0 * L1;
122 dN[37] = -2.0 * L1 * L2;
123 dN[38] = -2.0 * L2 * L0;
124 // Middle point, top
125 dN[39] = -dN[36];
126 dN[40] = -dN[37];
127 dN[41] = -dN[38];
128 // Middle point, center
129 dN[42] = -2.0 * L0 * t;
130 dN[43] = -2.0 * L1 * t;
131 dN[44] = -2.0 * L2 * t;
132}
133
134} // namespace NumLib
static void computeGradShapeFunction(const T_X &x, T_N &dN)
static void computeShapeFunction(const T_X &x, T_N &N)