ParMooN
 All Classes Functions Variables Friends Pages
BF_N_Q_RT1_2D.h
1 // ***********************************************************************
2 // Q0 Raviart-Thomas vector element, nonconforming , 2D
3 // History: 17.11.2011 implementation (Ulrich)
4 // ***********************************************************************
5 
6 // base function values
7 // vector function, orthogonal to edges,
8 // functions 1 and 2 are orthogonal to edge 1
9 // functions 3 and 4 are orthogonal to edge 2
10 // functions 5 and 6 are orthogonal to edge 3
11 // functions 7 and 8 are orthogonal to edge 4
12 // functions 9-12 correspond to inner degrees of freedom
13 
14 // coefficient matrix for different choices of the degrees of freedom
15 // There seems to be no difference in using integral or point evaluation for
16 // inner dofs.
17 // The dofs on the edges determine the boundary conditions as well. Using
18 // Tschebyscheff-points might improve the boundary approximation.
19 
20 // using equidistant points on edges and integral evaluation for inner dofs
21 /*static double N_Q_RT1_2D_CM[144] = {
22  0,0,-0.0625,-0.0625,0,0,0.0625,0.0625,0.375,0,0,0,
23  0.0625,0.0625,0,0,-0.0625,-0.0625,0,0,0,0.375,0,0,
24  0,0,0.125,0.125,-0,0,0.125,0.125,0,0,0,0,
25  -0.1875,0.1875,0,0,-0.1875,0.1875,0,0,0,0,1.125,0,
26  0,0,0.1875,-0.1875,-0,0,0.1875,-0.1875,0,0,0,1.125,
27  0.125,0.125,0,-0,0.125,0.125,0,0,0,0,0,0,
28  0,0,-0.375,0.375,-0,0,0.375,-0.375,0,0,0,0,
29  -0.375,0.375,0,0,0.375,-0.375,0,0,0,0,0,0,
30  0,0,0.1875,0.1875,-0,0,-0.1875,-0.1875,-0.375,0,0,0,
31  -0.1875,-0.1875,0,0,0.1875,0.1875,0,0,0,-0.375,0,0,
32  0,0,-0.5625,0.5625,-0,0,-0.5625,0.5625,0,0,0,-1.125,
33  0.5625,-0.5625,0,0,0.5625,-0.5625,0,0,0,0,-1.125,0
34 };*/
35 /*
36 // using equidistant points on edges and point evaluation for inner dofs
37 static double N_Q_RT1_2D_CM[144] = {
38 0,0,0,0,0,0,0,0,0.5,0,0.5,0,
39 0,0,0,0,0,0,0,0,0,0.5,0,0.5,
40 0,0,0.125,0.125,0,0,0.125,0.125,0,0,0,0,
41 0,0,0,0,0,0,0,0,0,1.5,0,-1.5,
42 0,0,0,0,0,0,0,0,-1.5,0,1.5,0,
43 0.125,0.125,0,0,0.125,0.125,0,0,0,0,0,0,
44 0,0,-0.375,0.375,0,0,0.375,-0.375,0,0,0,0,
45 -0.375,0.375,0,0,0.375,-0.375,0,0,0,0,0,0,
46 0,0,0.125,0.125,0,0,-0.125,-0.125,-0.5,0,-0.5,0,
47 -0.125,-0.125,0,0,0.125,0.125,0,0,0,-0.5,-0,-0.5,
48 0,0,-0.375,0.375,0,0,-0.375,0.375,1.5,0,-1.5,0,
49 0.375,-0.375,0,0,0.375,-0.375,0,0,0,-1.5,0,1.5
50 };
51 */
52 // using Gauss-Points on edges and integral evaluation for inner dofs
53 /*static double N_Q_RT1_2D_CM[144] = {
54 0,0,-0.0625,-0.0625,0,0,0.0625,0.0625,0.375,0,0,0,
55 0.0625,0.0625,0,0,-0.0625,-0.0625,0,0,0,0.375,0,0,
56 0,0,0.125,0.125,0,0,0.125,0.125,0,0,0,0,
57 -0.10825318,0.10825318,0,0,-0.10825318,0.10825318,0,0,0,0,1.125,0,
58 0,0,0.10825318,-0.10825318,0,0,0.10825318,-0.10825318,0,0,0,1.125,
59 0.125,0.125,0,-0,0.125,0.125,0,0,0,0,0,0,
60 0,0,-0.21650635,0.21650635,0,0,0.21650635,-0.21650635,0,0,0,0,
61 -0.21650635,0.21650635,0,0,0.21650635,-0.21650635,0,0,0,0,0,0,
62 0,0,0.1875,0.1875,0,0,-0.1875,-0.1875,-0.375,0,0,0,
63 -0.1875,-0.1875,0,0,0.1875,0.1875,0,0,0,-0.375,0,0,
64 0,0,-0.32475953,0.32475953,0,0,-0.32475953,0.32475953,0,0,0,-1.125,
65 0.32475953,-0.32475953,0,0,0.32475953,-0.32475953,0,0,0,0,-1.125,0
66 };*/
67 /*
68 // using Gauss-Points on edges and point evaluation for inner dofs
69 static double N_Q_RT1_2D_CM[144] = {
70 0,0,0,0,-0,0,0,0,0.5,0,0.5,-0,
71 0,0,0,0,0,0,0,0,0,0.5,0,0.5,
72 0,0,0.125,0.125,-0,0,0.125,0.125,0,0,0,-0,
73 0,0,0,0,0,0,0,0,0,0.8660254038,0,-0.8660254038,
74 0,0,0,0,0,0,0,0,-0.8660254038,0,0.8660254038,-0,
75 0.125,0.125,0,0,0.125,0.125,0,0,0,0,0,-0,
76 0,0,-0.2165063509,0.2165063509,0,0,0.2165063509,-0.2165063509,0,0,0,-0,
77 -0.2165063509,0.2165063509,0,0,0.2165063509,-0.2165063509,0,0,0,0,0,-0,
78 0,0,0.125,0.125,0,0,-0.125,-0.125,-0.5,0,-0.5,-0,
79 -0.125,-0.125,0,0,0.125,0.125,0,0,0,-0.5,-0,-0.5,
80 0,0,-0.2165063509,0.2165063509,0,0,-0.2165063509,0.2165063509,0.8660254038,0,-0.8660254038,0,
81 0.2165063509,-0.2165063509,0,0,0.2165063509,-0.2165063509,0,0,0,-0.8660254038,0,0.8660254038
82 };*/
83 /*
84 // using Tschebyscheff-points on edges and integral evaluation for inner dofs
85 static double N_Q_RT1_2D_CM[144] = {
86 0,0,-0.0625,-0.0625,0,0,0.0625,0.0625,0.375,0,0,0,
87 0.0625,0.0625,0,0,-0.0625,-0.0625,0,0,0,0.375,-0,0,
88 0,0,0.125,0.125,0,0,0.125,0.125,0,0,0,0,
89 -0.08838835,0.08838835,0,0,-0.08838835,0.08838835,0,0,0,0,1.125,0,
90 0,0,0.08838835,-0.08838835,0,0,0.08838835,-0.08838835,0,0,0,1.125,
91 0.125,0.125,0,0,0.125,0.125,0,0,0,0,0,0,
92 0,0,-0.1767767,0.1767767,0,0,0.1767767,-0.1767767,0,0,0,0,
93 -0.1767767,0.1767767,0,0,0.1767767,-0.1767767,0,0,0,0,0,0,
94 0,-0,0.1875,0.1875,0,0,-0.1875,-0.1875,-0.375,0,0,0,
95 -0.1875,-0.1875,0,0,0.1875,0.1875,0,0,0,-0.375,0,0,
96 0,0,-0.26516504,0.26516504,0,0,-0.26516504,0.26516504,0,0,0,-1.125,
97 0.26516504,-0.26516504,0,0,0.26516504,-0.26516504,0,0,0,0,-1.125,0
98 };*/
99 
100 // using Tschebyscheff-points on edges and point evaluation for inner dofs
101 static double N_Q_RT1_2D_CM[144] = {
102 0,0,0,0,-0,0,0,0,0.5,0,0.5,0,
103 0,0,0,0,0,0,0,0,0,0.5,0,0.5,
104 0,0,0.125,0.125,-0,0,0.125,0.125,0,0,0,0,
105 0,0,0,0,0,0,0,0,0,0.7071067812,0,-0.7071067812,
106 0,0,0,0,0,0,0,0,-0.7071067812,0,0.7071067812,0,
107 0.125,0.125,0,0,0.125,0.125,0,0,0,0,0,0,
108 0,0,-0.1767766953,0.1767766953,0,0,0.1767766953,-0.1767766953,0,0,0,0,
109 -0.1767766953,0.1767766953,0,0,0.1767766953,-0.1767766953,0,0,0,0,0,0,
110 0,0,0.125,0.125,0,0,-0.125,-0.125,-0.5,0,-0.5,0,
111 -0.125,-0.125,0,0,0.125,0.125,0,0,0,-0.5,0,-0.5,
112 0,0,-0.1767766953,0.1767766953,0,0,-0.1767766953,0.1767766953,0.7071067812,0,-0.7071067812,0,
113 0.1767766953,-0.1767766953,0,0,0.1767766953,-0.1767766953,0,0,0,-0.7071067812,0,0.7071067812
114 };
115 
116 
117 static void N_Q_RT1_2D_Funct(double xi, double eta, double *values)
118 {
119  int nBF = 12; // number of basis functions
120  // monomials x-component and y-component
121  double mon_x[]={1,0,xi,0 ,eta,0 ,xi*eta,0 ,xi*xi,0 ,xi*xi*eta,0};
122  double mon_y[]={0,1,0 ,xi,0 ,eta,0 ,xi*eta,0 ,eta*eta,0,xi*eta*eta};
123 
124  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
125  for(int i=0; i<nBF; i++)
126  {
127  for(int j=0; j<nBF; j++)
128  {
129  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
130  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
131  }
132  }
133 }
134 
135 // values of the derivatives in xi direction
136 static void N_Q_RT1_2D_DeriveXi(double xi, double eta, double *values)
137 {
138  int nBF = 12; // number of basis functions
139  // xi-derivative of monomials x-component and y-component
140  double mon_x[]={0,0,1,0,0,0,eta,0 ,2*xi,0,2*xi*eta,0};
141  double mon_y[]={0,0,0,1,0,0,0 ,eta,0 ,0,0 ,eta*eta};
142 
143  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
144  for(int i=0; i<nBF; i++)
145  {
146  for(int j=0; j<nBF; j++)
147  {
148  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
149  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
150  }
151  }
152 }
153 
154 // values of the derivatives in eta direction
155 static void N_Q_RT1_2D_DeriveEta(double xi, double eta, double *values)
156 {
157  int nBF = 12; // number of basis functions
158  // eta-derivative of monomials x-component and y-component
159  double mon_x[]={0,0,0,0,1,0,xi,0 ,0,0 ,xi*xi,0};
160  double mon_y[]={0,0,0,0,0,1,0 ,xi,0,2*eta,0 ,2*xi*eta};
161 
162  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
163  for(int i=0; i<nBF; i++)
164  {
165  for(int j=0; j<nBF; j++)
166  {
167  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
168  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
169  }
170  }
171 }
172 
173 // values of derivatives in xi-xi direction
174 static void N_Q_RT1_2D_DeriveXiXi(double xi, double eta, double *values)
175 {
176  int nBF = 12; // number of basis functions
177  // xi-derivative of monomials x-component and y-component
178  double mon_x[]={0,0,0,0,0,0,0,0,2,0,2*eta,0};
179  double mon_y[]={0,0,0,0,0,0,0,0,0,0,0 ,0};
180 
181  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
182  for(int i=0; i<nBF; i++)
183  {
184  for(int j=0; j<nBF; j++)
185  {
186  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
187  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
188  }
189  }
190 }
191 
192 // values of derivatives in eta-eta direction
193 static void N_Q_RT1_2D_DeriveEtaEta(double xi, double eta, double *values)
194 {
195  int nBF = 12; // number of basis functions
196  // eta-derivative of monomials x-component and y-component
197  double mon_x[]={0,0,0,0,0,0,0,0,0,0,0,0};
198  double mon_y[]={0,0,0,0,0,0,0,0,0,2,0,2*xi};
199 
200  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
201  for(int i=0; i<nBF; i++)
202  {
203  for(int j=0; j<nBF; j++)
204  {
205  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
206  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
207  }
208  }
209 }
210 
211 // values of derivatives in xi-eta direction
212 static void N_Q_RT1_2D_DeriveXiEta(double xi, double eta, double *values)
213 {
214  int nBF = 12; // number of basis functions
215  // eta-derivative of monomials x-component and y-component
216  double mon_x[]={0,0,0,0,0,0,1,0,0,0,2*xi,0};
217  double mon_y[]={0,0,0,0,0,0,0,1,0,0,0 ,2*eta};
218 
219  memset(values, 0.0, 2*nBF*SizeOfDouble); // 2 is the space dimension
220  for(int i=0; i<nBF; i++)
221  {
222  for(int j=0; j<nBF; j++)
223  {
224  values[i ] += N_Q_RT1_2D_CM[i+j*nBF]*mon_x[j];
225  values[i+nBF] += N_Q_RT1_2D_CM[i+j*nBF]*mon_y[j];
226  }
227  }
228 }
229 
230 // ***********************************************************************
231 
232 TBaseFunct2D *BF_N_Q_RT1_2D_Obj = new TBaseFunct2D
233  (12, BF_N_Q_RT1_2D, BFUnitSquare,
234  N_Q_RT1_2D_Funct, N_Q_RT1_2D_DeriveXi,
235  N_Q_RT1_2D_DeriveEta, N_Q_RT1_2D_DeriveXiXi,
236  N_Q_RT1_2D_DeriveXiEta, N_Q_RT1_2D_DeriveEtaEta, 3, 2,
237  0, NULL, 2);
Definition: BaseFunct2D.h:27