ParMooN
 All Classes Functions Variables Friends Pages
NF_N_T_BDDF2_3D.h
1 // ***********************************************************************
2 // Brezzi-Douglas-Duran-Fortin element of second order on tetrahedra, 3D
3 // ***********************************************************************
4 
5 static double NF_N_T_BDDF2_3D_Xi[] = {
6  0.2, 0.4, 0.6, 0.2, 0.4, 0.2,
7  0.2, 0.2, 0.2, 0.4, 0.4, 0.6,
8  0.2, 0.4, 0.6, 0.2, 0.4, 0.2,
9  0,0,0,0,0,0,
10  //inner dof
11  0.333333333333333333333333333333333,
12  0.333333333333333333333333333333333,
13  0,
14  0.333333333333333333333333333333333,
15  0.25,
16  0.909090909090909090909090909090909e-1,
17  0.909090909090909090909090909090909e-1,
18  0.727272727272727272727272727272727,
19  0.909090909090909090909090909090909e-1,
20  0.665501535736642982398804642263025e-1,
21  0.433449846426335701760119535773697,
22  0.433449846426335701760119535773697,
23  0.665501535736642982398804642263025e-1,
24  0.665501535736642982398804642263025e-1,
25  0.433449846426335701760119535773697
26 };
27 static double NF_N_T_BDDF2_3D_Eta[] = {
28  0.2, 0.2, 0.2, 0.4, 0.4, 0.6,
29  0,0,0,0,0,0,
30  0.6, 0.4, 0.2, 0.4, 0.2, 0.2,
31  0.2, 0.4, 0.6, 0.2, 0.4, 0.2,
32  //inner dof
33  0.333333333333333333333333333333333,
34  0,
35  0.333333333333333333333333333333333,
36  0.333333333333333333333333333333333,
37  0.25,
38  0.909090909090909090909090909090909e-1,
39  0.727272727272727272727272727272727,
40  0.909090909090909090909090909090909e-1,
41  0.909090909090909090909090909090909e-1,
42  0.433449846426335701760119535773697,
43  0.665501535736642982398804642263025e-1,
44  0.433449846426335701760119535773697,
45  0.665501535736642982398804642263025e-1,
46  0.433449846426335701760119535773697,
47  0.665501535736642982398804642263025e-1
48 };
49 static double NF_N_T_BDDF2_3D_Zeta[]= {
50  0,0,0,0,0,0,
51  0.2, 0.4, 0.6, 0.2, 0.4, 0.2,
52  0.2, 0.2, 0.2, 0.4, 0.4, 0.6,
53  0.2, 0.2, 0.2, 0.4, 0.4, 0.6,
54  //inner dof
55  0,
56  0.333333333333333333333333333333333,
57  0.333333333333333333333333333333333,
58  0.333333333333333333333333333333333,
59  0.25,
60  0.727272727272727272727272727272727,
61  0.90909090909090909090909090909091e-1,
62  0.909090909090909090909090909090911e-1,
63  0.909090909090909090909090909090911e-1,
64  0.433449846426335701760119535773699,
65  0.433449846426335701760119535773699,
66  0.66550153573664298239880464226304e-1,
67  0.433449846426335701760119535773699,
68  0.66550153573664298239880464226304e-1,
69  0.665501535736642982398804642263035e-1
70 };
71 // points are x-x^2-2xy-xz
72 static double NF_N_T_BDDF2_3D_XiEta_Xi[]= {
73  0,
74  0.111111111111111,
75  0,
76  -0.111111111111111,
77  0,
78  0,
79  -0.057851239669421,
80  0,
81  0.057851239669421,
82  -0.024417230905476,
83  0,
84  -0.159032615520860,
85  0.024417230905476,
86  0,
87  0.159032615520860
88 };
89 // points are -y+y^2+2xy+yz
90 static double NF_N_T_BDDF2_3D_XiEta_Eta[]= {
91  0,
92  0,
93  -0.111111111111111,
94  0.111111111111111,
95  0,
96  0,
97  0,
98  0.057851239669421,
99  -0.057851239669421,
100  0,
101  0.024417230905476,
102  0.159032615520860,
103  -0.024417230905476,
104  -0.159032615520860,
105  0
106 };
107 // points are x-x^2-xy-2xz
108 static double NF_N_T_BDDF2_3D_XiZeta_Xi[]= {
109  0.111111111111111,
110  0,
111  0,
112  -0.111111111111111,
113  0,
114  -0.057851239669421,
115  0,
116  0,
117  0.057851239669421,
118  -0.024417230905476,
119  -0.159032615520860,
120  0,
121  0,
122  0.024417230905476,
123  0.159032615520860
124 };
125 // points are -z+z^2+2xz+yz
126 static double NF_N_T_BDDF2_3D_XiZeta_Zeta[]= {
127  0,
128  0,
129  -0.111111111111111,
130  0.111111111111111,
131  0,
132  0,
133  0,
134  0.057851239669421,
135  -0.057851239669421,
136  0,
137  0.159032615520860,
138  0.024417230905476,
139  -0.159032615520860,
140  -0.024417230905476,
141  0
142 };
143 // points are y-y^2-xy-2yz
144 static double NF_N_T_BDDF2_3D_EtaZeta_Eta[]= {
145  0.111111111111111,
146  0,
147  0,
148  -0.111111111111111,
149  0,
150  -0.057851239669421,
151  0,
152  0,
153  0.057851239669421,
154  -0.159032615520860,
155  -0.024417230905476,
156  -0.000000000000000,
157  0,
158  0.159032615520860,
159  0.024417230905476
160 };
161 // points are -z+z^2+xz+2yz
162 static double NF_N_T_BDDF2_3D_EtaZeta_Zeta[]= {
163  0,
164  -0.111111111111111,
165  0,
166  0.111111111111111,
167  0,
168  0,
169  0.057851239669421,
170  0,
171  -0.057851239669421,
172  0.159032615520860,
173  0,
174  0.024417230905476,
175  -0.159032615520860,
176  0,
177  -0.024417230905476
178 };
179 
180 
181 static double NF_N_T_BDDF2_3D_Weights[]= {
182  0.602678571428571428571428571428571e-2,
183  0.602678571428571428571428571428571e-2,
184  0.602678571428571428571428571428571e-2,
185  0.602678571428571428571428571428571e-2,
186  0.302836780970891758063769725577305e-1,
187  0.116452490860289694108936091443380e-1,
188  0.116452490860289694108936091443380e-1,
189  0.116452490860289694108936091443380e-1,
190  0.116452490860289694108936091443380e-1,
191  0.109491415613864593456430191124068e-1,
192  0.109491415613864593456430191124068e-1,
193  0.109491415613864593456430191124068e-1,
194  0.109491415613864593456430191124068e-1,
195  0.109491415613864593456430191124068e-1,
196  0.109491415613864593456430191124068e-1};
197 
198 /* face 0 0 */
199 static double NF_N_T_BDDF2_3D_F0_Xi[] = {0.2, 0.4, 0.6, 0.2, 0.4, 0.2};
200 static double NF_N_T_BDDF2_3D_F0_Eta[] = {0.2, 0.2, 0.2, 0.4, 0.4, 0.6};
201 static double NF_N_T_BDDF2_3D_F0_Zeta[] = { 0,0,0,0,0,0 };
202 
203 /* face 1 1 */
204 static double NF_N_T_BDDF2_3D_F1_Xi[] = {0.2, 0.2, 0.2, 0.4, 0.4, 0.6};
205 static double NF_N_T_BDDF2_3D_F1_Eta[] = { 0,0,0,0,0,0 };
206 static double NF_N_T_BDDF2_3D_F1_Zeta[] = {0.2, 0.4, 0.6, 0.2, 0.4, 0.2};
207 
208 /* face 2 2 */
209 static double NF_N_T_BDDF2_3D_F2_Xi[] = {0.2, 0.4, 0.6, 0.2, 0.4, 0.2};
210 static double NF_N_T_BDDF2_3D_F2_Eta[] = {0.6, 0.4, 0.2, 0.4, 0.2, 0.2};
211 static double NF_N_T_BDDF2_3D_F2_Zeta[] = {0.2, 0.2, 0.2, 0.4, 0.4, 0.6};
212 
213 /* face 3 3 */
214 static double NF_N_T_BDDF2_3D_F3_Xi[] = { 0,0,0,0,0,0 };
215 static double NF_N_T_BDDF2_3D_F3_Eta[] = {0.2, 0.4, 0.6, 0.2, 0.4, 0.2};
216 static double NF_N_T_BDDF2_3D_F3_Zeta[] = {0.2, 0.2, 0.2, 0.4, 0.4, 0.6};
217 
218 static double *NF_N_T_BDDF2_3D_XiArray[4] = {
219  NF_N_T_BDDF2_3D_F0_Xi,
220  NF_N_T_BDDF2_3D_F1_Xi,
221  NF_N_T_BDDF2_3D_F2_Xi,
222  NF_N_T_BDDF2_3D_F3_Xi };
223 
224 static double *NF_N_T_BDDF2_3D_EtaArray[4] = {
225  NF_N_T_BDDF2_3D_F0_Eta,
226  NF_N_T_BDDF2_3D_F1_Eta,
227  NF_N_T_BDDF2_3D_F2_Eta,
228  NF_N_T_BDDF2_3D_F3_Eta };
229 
230 static double *NF_N_T_BDDF2_3D_ZetaArray[4] = {
231  NF_N_T_BDDF2_3D_F0_Zeta,
232  NF_N_T_BDDF2_3D_F1_Zeta,
233  NF_N_T_BDDF2_3D_F2_Zeta,
234  NF_N_T_BDDF2_3D_F3_Zeta };
235 
236 static double NF_N_T_BDDF2_3D_T[] = {-100};// ???
237 static double NF_N_T_BDDF2_3D_S[] = {-100};// ???
238 
239 void NF_N_T_BDDF2_3D_EvalAll(TCollection *Coll, TBaseCell *Cell,
240  double *PointValues, double *Functionals)
241 {
242  // PointValues[4*i + j] means i-th component (i=0 for x, i=1 for y, i=2 for z)
243  // at j-th evaluation point (see NF_N_T_BDDF2_3D_Xi, ...Eta, ...Zeta)
244  //face 0
245  Functionals[0] = -PointValues[78];
246  Functionals[1] = -PointValues[79];
247  Functionals[2] = -PointValues[80];
248  Functionals[3] = -PointValues[81];
249  Functionals[4] = -PointValues[82];
250  Functionals[5] = -PointValues[83];
251  //face 1
252  Functionals[6] = -PointValues[45];
253  Functionals[7] = -PointValues[46];
254  Functionals[8] = -PointValues[47];
255  Functionals[9] = -PointValues[48];
256  Functionals[10] = -PointValues[49];
257  Functionals[11] = -PointValues[50];
258  //face 2
259  Functionals[12] = PointValues[12]+PointValues[51]+PointValues[90];
260  Functionals[13] = PointValues[13]+PointValues[52]+PointValues[91];
261  Functionals[14] = PointValues[14]+PointValues[53]+PointValues[92];
262  Functionals[15] = PointValues[15]+PointValues[54]+PointValues[93];
263  Functionals[16] = PointValues[16]+PointValues[55]+PointValues[94];
264  Functionals[17] = PointValues[17]+PointValues[56]+PointValues[95];
265  //face 3
266  Functionals[18] = -PointValues[18];
267  Functionals[19] = -PointValues[19];
268  Functionals[20] = -PointValues[20];
269  Functionals[21] = -PointValues[21];
270  Functionals[22] = -PointValues[22];
271  Functionals[23] = -PointValues[23];
272 
273  //inner dofs
274  int i;
275  double s;
276 
277  //int_T u \cdot \grad p
278  //x-component
279  s = 0;
280  for(i=0;i<15;i++)
281  s += PointValues[i+24] * NF_N_T_BDDF2_3D_Weights[i];
282  Functionals[24] = s;
283  //y-component
284  s = 0;
285  for(i=0;i<15;i++)
286  s += PointValues[i+63] * NF_N_T_BDDF2_3D_Weights[i];
287  Functionals[25] = s;
288  //z-component
289  s = 0;
290  for(i=0;i<15;i++)
291  s += PointValues[i+102] * NF_N_T_BDDF2_3D_Weights[i];
292  Functionals[26] = s;
293 
294  //int_T uv and v a subspace of P_2(T)
295  s = 0;
296  for(i=0;i<15;i++){
297  //x-component
298  s += PointValues[i+24] * NF_N_T_BDDF2_3D_XiEta_Xi[i] * NF_N_T_BDDF2_3D_Weights[i];
299  //y-component
300  s += PointValues[i+63] * NF_N_T_BDDF2_3D_XiEta_Eta[i] * NF_N_T_BDDF2_3D_Weights[i];
301  }
302  Functionals[27] = s;
303 
304  s = 0;
305  for(i=0;i<15;i++){
306  //x-component
307  s += PointValues[i+24] * NF_N_T_BDDF2_3D_XiZeta_Xi[i] * NF_N_T_BDDF2_3D_Weights[i];
308  //z-component
309  s += PointValues[i+102] * NF_N_T_BDDF2_3D_XiZeta_Zeta[i] * NF_N_T_BDDF2_3D_Weights[i];
310  }
311  Functionals[28] = s;
312 
313  s = 0;
314  for(i=0;i<15;i++){
315  //y-component
316  s += PointValues[i+63] * NF_N_T_BDDF2_3D_EtaZeta_Eta[i] * NF_N_T_BDDF2_3D_Weights[i];
317  //z-component
318  s += PointValues[i+102] * NF_N_T_BDDF2_3D_EtaZeta_Zeta[i] * NF_N_T_BDDF2_3D_Weights[i];
319  }
320  Functionals[29] = s;
321 
322 }
323 
324 void NF_N_T_BDDF2_3D_EvalFace(TCollection *Coll, TBaseCell *Cell, int face,
325  double *PointValues, double *Functionals)
326 {
327  double s; // size of face
328  double x0,x1,x2,y0,y1,y2,z0,z1,z2;
329  #ifdef __3D__
330  // find vertices of this face, then their coordinates
331  const int *faceVertex, *length;
332  int MaxLen;
333  Cell->GetShapeDesc()->GetFaceVertex(faceVertex, length, MaxLen);
334  // now MaxLen == 3, length == {3,3,3,3}
335  Cell->GetVertex(faceVertex[3*face ])->GetCoords(x0,y0,z0);
336  Cell->GetVertex(faceVertex[3*face + 1])->GetCoords(x1,y1,z1);
337  Cell->GetVertex(faceVertex[3*face + 2])->GetCoords(x2,y2,z2);
338  #endif
339  // compute measure of this face
340  s = sqrt( POW((y1-y0)*(z2-z0) - (z1-z0)*(y2-y0),2)
341  + POW((z1-z0)*(x2-x0) - (x1-x0)*(z2-z0),2)
342  + POW((x1-x0)*(y2-y0) - (x2-x0)*(y1-y0),2) );
343  for(int i=0; i<6; i++)
344  Functionals[i] = PointValues[i]*s;
345 }
346 
347 static int NF_N_T_BDDF2_3D_N_AllFunctionals = 30;
348 static int NF_N_T_BDDF2_3D_N_PointsAll = 39;
349 static int NF_N_T_BDDF2_3D_N_FaceFunctionals[] = { 6, 6, 6, 6 };
350 static int NF_N_T_BDDF2_3D_N_PointsFace[] = { 6, 6, 6, 6 };
351 
352 TNodalFunctional3D *NF_N_T_BDDF2_3D_Obj = new TNodalFunctional3D
353  (NF_N_T_BDDF2_3D, NF_N_T_BDDF2_3D_N_AllFunctionals,
354  NF_N_T_BDDF2_3D_N_FaceFunctionals, NF_N_T_BDDF2_3D_N_PointsAll,
355  NF_N_T_BDDF2_3D_N_PointsFace,
356  NF_N_T_BDDF2_3D_Xi, NF_N_T_BDDF2_3D_Eta, NF_N_T_BDDF2_3D_Zeta,
357  NF_N_T_BDDF2_3D_XiArray, NF_N_T_BDDF2_3D_EtaArray,
358  NF_N_T_BDDF2_3D_ZetaArray,
359  NF_N_T_BDDF2_3D_T, NF_N_T_BDDF2_3D_S,
360  NF_N_T_BDDF2_3D_EvalAll, NF_N_T_BDDF2_3D_EvalFace);
int GetFaceVertex(const int *&TmpFV, const int *&TmpLen, int &MaxLen)
Definition: ShapeDesc.h:124
TShapeDesc * GetShapeDesc() const
return shape descriptor of refinement descriptor
Definition: BaseCell.h:134
Definition: NodalFunctional3D.h:21
store cells in an array, used by cell iterators
Definition: Collection.h:18
virtual TVertex * GetVertex(int Vert_i)=0
return the pointer to vertex with number i
void GetCoords(double &x, double &y, double &z) const
Definition: Vertex.h:106
information for finite element data structure
Definition: BaseCell.h:25