ParMooN
 All Classes Functions Variables Friends Pages
BF_N_Q_BDM2_2D.h
1 // ***********************************************************************
2 // P2 BDM vector element, nonconforming , 2D
3 // History: 23.09.2013 implementation (Markus Wolff)
4 // ***********************************************************************
5 
6 // base function values
7 // vector function, orthonormal to edges,
8 // functions 1,2, and 3 are orthogonal to edge 1
9 // functions 4,5, and 6 are orthogonal to edge 2
10 // functions 7,8, and 9 are orthogonal to edge 3
11 // functions 10,11, and 12 are orthogonal to edge 4
12 // functions 13-14 correspond to inner degrees of freedom
13 
14 // NOTE: If you want to use other evaluation points for degress of freedom on
15 // the edges of a cell, you also have to change basis functions in
16 // NF_N_Q_BDM2_2D.h
17 
18 // coefficient matrix for different choices of the degrees of freedom
19 // There seems to be no difference in using integral or point evaluation for
20 // inner dofs.
21 // The dofs on the edges determine the boundary conditions as well. Using
22 // Tschebyscheff-points might improve the boundary approximation.
23 
24 /*
25 // using equidistant points on edges and point evaluations for inner dofs
26 static double N_Q_BDM2_2D_CM[196] = {
27 0,0,0,0,0,0,0,-0,0,0,0,0,1,0,
28 0,0,0,0,0,-0,0,0,0,0,0,0,0,1,
29 0.16666667,-0.33333333,0.16666667,0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0.25,0,0,0,
30 0.25,0,-0.25,0,0,0,0.25,0,-0.25,0,0,0,0,0,
31 0,0,0,0,0.25,0,0,0,0,0,-0.25,0,-1,0,
32 -0.5,1,-0.5,0,0,0,0.5,-1,0.5,0,0,0,0,0,
33 0,0,0,-0.25,0,0.25,0,-0,0,-0.25,0,0.25,0,0,
34 0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0,
35 0,0,0,0.5,-1,0.5,0,0,0,-0.5,1,-0.5,0,0,
36 0,-0.25,0,0,0,0,0,0.25,0,0,0,0,0,-1,
37 0,0,0,-0.25,0,0.25,0,0,0,0.25,0,-0.25,0,0,
38 -0.25,0,0.25,0,0,0,0.25,0,-0.25,0,0,0,0,0,
39 -0.16666667,0.33333333,-0.16666667,0,-0,0,-0.16666667,0.33333333,-0.16666667,0,0,0,0,0,
40 0,0,0,0.16666667,-0.33333333,0.16666667,0,0,0,0.16666667,-0.33333333,0.16666667,0,0
41 };
42 */
43 /*
44 // using equidistant points on edges and integral evaluation for inner dofs
45 static double N_Q_BDM2_2D_CM[196] = {
46 -0,0,-0,-0.25,0.375,-0.25,-0,0,-0,0.25,-0.375,0.25,0.375,-0,
47 0.25,-0.375,0.25,0,0,0,-0.25,0.375,-0.25,0,0,0,0,0.375,
48 0.16666667,-0.33333333,0.16666667,0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0.25,0,0,0,
49 0.25,-0,-0.25,0,0,0,0.25,-0,-0.25,0,0,0,0,-0,
50 0,-0,0,0.25,-0.125,0.25,0,0,0,-0.25,0.125,-0.25,-0.375,0,
51 -0.5,1,-0.5,0,-0,0,0.5,-1,0.5,0,-0,0,0,0,
52 0,-0,0,-0.25,0,0.25,0,0,0,-0.25,0,0.25,0,0,
53 0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0.25,0,0.16666667,-0.33333333,0.16666667,0,0,
54 0,-0,0,0.5,-1,0.5,0,0,0,-0.5,1,-0.5,0,0,
55 -0.25,0.125,-0.25,0,0,0,0.25,-0.125,0.25,0,0,0,0,-0.375,
56 0,0,0,-0.25,0,0.25,-0,0,0,0.25,0,-0.25,0,0,
57 -0.25,-0,0.25,0,0,0,0.25,-0,-0.25,0,0,0,0,-0,
58 -0.16666667,0.33333333,-0.16666667,0,0,0,-0.16666667,0.33333333,-0.16666667,0,0,0,0,-0,
59 0,0,0,0.16666667,-0.33333333,0.16666667,0,0,0,0.16666667,-0.33333333,0.16666667,0,0
60 };
61 */
62 /*
63 // using Gauss-Points on edges and point evaluation for inner dofs
64 static double N_Q_BDM2_2D_CM[196] = {
65 0,0,0,0,0,0,0,-0,0,0,0,0,1,0,
66 0,0,0,0,0,-0,0,0,0,0,0,0,0,1,
67 0.069444444,-0.13888889,0.069444444,0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0.25,0,0,0,
68 0.16137431,0,-0.16137431,0,0,0,0.16137431,-0,-0.16137431,0,0,0,0,0,
69 0,0,0,0,0.25,0,0,0,0,0,-0.25,0,-1,0,
70 -0.20833333,0.41666667,-0.20833333,0,0,0,0.20833333,-0.41666667,0.20833333,0,0,0,0,0,
71 0,0,0,-0.16137431,0,0.16137431,0,-0,0,-0.16137431,0,0.16137431,0,0,
72 0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0,
73 0,0,0,0.20833333,-0.41666667,0.20833333,0,0,0,-0.20833333,0.41666667,-0.20833333,0,0,
74 0,-0.25,0,0,0,0,0,0.25,0,0,0,0,0,-1,
75 0,0,0,-0.16137431,0,0.16137431,0,0,0,0.16137431,0,-0.16137431,0,0,
76 -0.16137431,-0,0.16137431,0,0,0,0.16137431,-0,-0.16137431,0,0,0,0,0,
77 -0.069444444,0.13888889,-0.069444444,0,-0,0,-0.069444444,0.13888889,-0.069444444,0,0,0,0,0,
78 0,0,0,0.069444444,-0.13888889,0.069444444,0,0,0,0.069444444,-0.13888889,0.069444444,0,0
79 };
80 */
81 /*
82 // using Gauss-Points on edges and integral evaluation for inner dofs
83 static double N_Q_BDM2_2D_CM[196] = {
84 -0,0,-0,-0.10416667,0.083333333,-0.10416667,-0,0,-0,0.10416667,-0.083333333,0.10416667,0.375,0,
85 0.10416667,-0.083333333,0.10416667,-0,0,-0,-0.10416667,0.083333333,-0.10416667,-0,0,-0,0,0.375,
86 0.069444444,-0.13888889,0.069444444,0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0.25,0,0,0,
87 0.16137431,-0,-0.16137431,0,0,0,0.16137431,-0,-0.16137431,0,0,0,0,-0,
88 0,0,0,0.10416667,0.16666667,0.10416667,0,0,0,-0.10416667,-0.16666667,-0.10416667,-0.375,0,
89 -0.20833333,0.41666667,-0.20833333,0,0,0,0.20833333,-0.41666667,0.20833333,0,0,0,0,0,
90 0,-0,0,-0.16137431,0,0.16137431,0,-0,0,-0.16137431,0,0.16137431,0,0,
91 0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0.25,0,0.069444444,-0.13888889,0.069444444,0,0,
92 0,-0,0,0.20833333,-0.41666667,0.20833333,0,0,0,-0.20833333,0.41666667,-0.20833333,0,0,
93 -0.10416667,-0.16666667,-0.10416667,0,0,0,0.10416667,0.16666667,0.10416667,0,0,0,0,-0.375,
94 0,-0,0,-0.16137431,0,0.16137431,0,0,0,0.16137431,0,-0.16137431,0,0,
95 -0.16137431,0,0.16137431,0,0,0,0.16137431,0,-0.16137431,0,0,0,0,0,
96 -0.069444444,0.13888889,-0.069444444,0,0,0,-0.069444444,0.13888889,-0.069444444,0,0,0,0,0,
97 0,0,0,0.069444444,-0.13888889,0.069444444,0,0,0,0.069444444,-0.13888889,0.069444444,0,0
98 };
99 */
100 /*
101 // using Tschebyscheff-points on edges and point evaluations for inner dofs
102 static double N_Q_BDM2_2D_CM[196] = {
103 0,0,0,0,0,0,0,-0,0,0,0,0,1,0,
104 0,0,0,0,0,-0,0,0,0,0,0,0,0,1,
105 0.055555556,-0.11111111,0.055555556,0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0.25,0,0,0,
106 0.14433757,-0,-0.14433757,0,0,0,0.14433757,0,-0.14433757,0,0,0,0,0,
107 0,0,0,0,0.25,0,0,0,0,0,-0.25,0,-1,0,
108 -0.16666667,0.33333333,-0.16666667,0,0,0,0.16666667,-0.33333333,0.16666667,0,0,0,0,0,
109 0,0,0,-0.14433757,0,0.14433757,0,-0,0,-0.14433757,0,0.14433757,0,0,
110 0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0,
111 0,0,0,0.16666667,-0.33333333,0.16666667,0,0,0,-0.16666667,0.33333333,-0.16666667,0,0,
112 0,-0.25,0,0,0,0,0,0.25,0,0,0,0,0,-1,
113 0,0,0,-0.14433757,0,0.14433757,0,0,0,0.14433757,0,-0.14433757,0,0,
114 -0.14433757,0,0.14433757,0,0,0,0.14433757,0,-0.14433757,0,0,0,0,0,
115 -0.055555556,0.11111111,-0.055555556,0,-0,0,-0.055555556,0.11111111,-0.055555556,0,0,0,0,0,
116 0,0,0,0.055555556,-0.11111111,0.055555556,0,0,0,0.055555556,-0.11111111,0.055555556,0,0
117 };
118 */
119 
120 // using Tschebyscheff-points on edges and integral evaluations for inner dofs
121 static double N_Q_BDM2_2D_CM[196] = {
122 -0,0,-0,-0.083333333,0.041666667,-0.083333333,-0,0,-0,0.083333333,-0.041666667,0.083333333,0.375,-0,
123 0.083333333,-0.041666667,0.083333333,-0,0,-0,-0.083333333,0.041666667,-0.083333333,-0,0,-0,0,0.375,
124 0.055555556,-0.11111111,0.055555556,0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0.25,0,0,-0,
125 0.14433757,0,-0.14433757,0,0,0,0.14433757,-0,-0.14433757,0,0,0,0,-0,
126 0,0,0,0.083333333,0.20833333,0.083333333,0,0,0,-0.083333333,-0.20833333,-0.083333333,-0.375,0,
127 -0.16666667,0.33333333,-0.16666667,0,0,0,0.16666667,-0.33333333,0.16666667,0,0,0,0,-0,
128 0,-0,0,-0.14433757,0,0.14433757,0,0,0,-0.14433757,0,0.14433757,0,0,
129 0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0.25,0,0.055555556,-0.11111111,0.055555556,0,0,
130 0,-0,0,0.16666667,-0.33333333,0.16666667,0,0,0,-0.16666667,0.33333333,-0.16666667,0,0,
131 -0.083333333,-0.20833333,-0.083333333,0,0,0,0.083333333,0.20833333,0.083333333,0,0,0,0,-0.375,
132 0,-0,0,-0.14433757,0,0.14433757,0,0,0,0.14433757,0,-0.14433757,0,0,
133 -0.14433757,0,0.14433757,0,0,0,0.14433757,-0,-0.14433757,0,0,0,0,0,
134 -0.055555556,0.11111111,-0.055555556,0,0,0,-0.055555556,0.11111111,-0.055555556,0,0,0,0,0,
135 0,0,0,0.055555556,-0.11111111,0.055555556,0,0,0,0.055555556,-0.11111111,0.055555556,0,0
136 };
137 
138 
139 
140 static void N_Q_BDM2_2D_Funct(double xi, double eta, double *values)
141 {
142  int nBF = 14; // number of basis functions
143  // monomials x-component and y-component
144  double mon_x[14]={1,0,xi, 0,xi*xi, 0,eta, 0,eta*eta, 0,xi*eta, 0, xi*xi*xi,3*xi*eta*eta};
145  double mon_y[14]={0,1, 0,xi, 0,xi*xi, 0,eta, 0,eta*eta, 0,xi*eta,-3*xi*xi*eta,-eta*eta*eta};
146 
147  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
148  for(int i=0; i<nBF; i++)
149  {
150  for(int j=0; j<nBF; j++)
151  {
152  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
153  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
154  }
155  }
156 }
157 
158 // values of the derivatives in xi direction
159 static void N_Q_BDM2_2D_DeriveXi(double xi, double eta, double *values)
160 {
161  int nBF = 14; // number of basis functions
162  // monomials x-component and y-component
163  double mon_x[14]={0,0,1,0,2*xi, 0,0,0,0,0,eta, 0, 3*xi*xi,3*eta*eta};
164  double mon_y[14]={0,0,0,1, 0,2*xi,0,0,0,0, 0,eta,-6*xi*eta,0 };
165 
166  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
167  for(int i=0; i<nBF; i++)
168  {
169  for(int j=0; j<nBF; j++)
170  {
171  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
172  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
173  }
174  }
175 }
176 
177 // values of the derivatives in eta direction
178 static void N_Q_BDM2_2D_DeriveEta(double xi, double eta, double *values)
179 {
180  int nBF = 14; // number of basis functions
181  // monomials x-component and y-component
182  double mon_x[14]={0,0,0,0,0,0,1,0,2*eta, 0,xi, 0, 0,6*xi*eta};
183  double mon_y[14]={0,0,0,0,0,0,0,1, 0,2*eta, 0,xi,-3*xi*xi,-3*eta*eta};
184 
185  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
186  for(int i=0; i<nBF; i++)
187  {
188  for(int j=0; j<nBF; j++)
189  {
190  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
191  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
192  }
193  }
194 }
195 
196 // values of derivatives in xi-xi direction
197 static void N_Q_BDM2_2D_DeriveXiXi(double xi, double eta, double *values)
198 {
199  int nBF = 14; // number of basis functions
200  // monomials x-component and y-component
201  double mon_x[14]={0,0,0,0,2,0,0,0,0,0,0,0, 6*xi,0};
202  double mon_y[14]={0,0,0,0,0,2,0,0,0,0,0,0-6*eta,0};
203 
204  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
205  for(int i=0; i<nBF; i++)
206  {
207  for(int j=0; j<nBF; j++)
208  {
209  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
210  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
211  }
212  }
213 }
214 
215 // values of derivatives in eta-eta direction
216 static void N_Q_BDM2_2D_DeriveEtaEta(double xi, double eta, double *values)
217 {
218  int nBF = 14; // number of basis functions
219  // monomials x-component and y-component
220  double mon_x[14]={0,0,0,0,0,0,0,0,2,0,0,0,0,6*xi};
221  double mon_y[14]={0,0,0,0,0,0,0,0,0,2,0,0,0,-6*eta};
222 
223  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
224  for(int i=0; i<nBF; i++)
225  {
226  for(int j=0; j<nBF; j++)
227  {
228  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
229  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
230  }
231  }
232 }
233 
234 // values of derivatives in xi-eta direction
235 static void N_Q_BDM2_2D_DeriveXiEta(double xi, double eta, double *values)
236 {
237  int nBF = 14; // number of basis functions
238  // monomials x-component and y-component
239  double mon_x[14]={0,0,0,0,0,0,0,0,0,0,1,0, 0,6*eta};
240  double mon_y[14]={0,0,0,0,0,0,0,0,0,0,0,1,-6*xi, 0};
241 
242  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
243  for(int i=0; i<nBF; i++)
244  {
245  for(int j=0; j<nBF; j++)
246  {
247  values[i ] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_x[j];
248  values[i+nBF] += N_Q_BDM2_2D_CM[i+j*nBF]*mon_y[j];
249  }
250  }
251 }
252 
253 
254 // ***********************************************************************
255 
256 TBaseFunct2D *BF_N_Q_BDM2_2D_Obj = new TBaseFunct2D
257  (14, BF_N_Q_BDM2_2D, BFUnitSquare,
258  N_Q_BDM2_2D_Funct, N_Q_BDM2_2D_DeriveXi,
259  N_Q_BDM2_2D_DeriveEta, N_Q_BDM2_2D_DeriveXiXi,
260  N_Q_BDM2_2D_DeriveXiEta, N_Q_BDM2_2D_DeriveEtaEta, 3, 3,
261  0, NULL, 2);
Definition: BaseFunct2D.h:27