proteus  1.8.1
C/C++/Fortran libraries
CompKernel.h
Go to the documentation of this file.
1 #ifndef COMPKERNEL_H
2 #define COMPKERNEL_H
3 #include <cmath>
4 //#include "xtensor-python/pyarray.hpp"
5 //#include "xtensor-python/pyvectorize.hpp"
9 template<int NSPACE>
10 class EIndex
11 {
12 };
13 
14 template<>
15 class EIndex<3>
16 {
17 public:
18  const int X,Y,Z,
19  XX,XY,XZ,
20  YX,YY,YZ,
21  ZX,ZY,ZZ,
22  sXX,sXY,sXZ,
23  sYX,sYY,sYZ,
24  sZX,sZY,sZZ,
26  XHX,XHY,
27  YHX,YHY,
28  ZHX,ZHY,
29  HXHX,HXHY,
30  HYHX,HYHY;
31  EIndex():
32  X(0),
33  Y(1),
34  Z(2),
35  XX(0),XY(1),XZ(2),
36  YX(3),YY(4),YZ(5),
37  ZX(6),ZY(7),ZZ(8),
38  sXX(0),sXY(5),sXZ(4),
39  sYX(5),sYY(1),sYZ(3),
40  sZX(4),sZY(3),sZZ(2),
41  nSymTen(6),
42  XHX(0),XHY(1),
43  YHX(2),YHY(3),
44  ZHX(4),ZHY(5),
45  HXHX(0),HXHY(1),
46  HYHX(2),HYHY(3)
47  {}
48 };
49 
50 template<>
51 class EIndex<2>
52 {
53 public:
54  const int X,Y,
55  XX,XY,
56  YX,YY,
57  sXX,sXY,
58  sYX,sYY,
60  XHX,XHY,
61  YHX,YHY,
63  EIndex():
64  X(0),
65  Y(1),
66  XX(0),XY(1),
67  YX(2),YY(3),
68  sXX(0),sXY(2),
69  sYX(2),sYY(1),
70  nSymTen(3),
71  XHX(0),XHY(1),
72  YHX(2),YHY(3),
73  HXHX(0)
74  {}
75 };
76 //I separated the space mapping part of the kernel so I could partially specialize the template on NSPACE
77 template<int NSPACE, int NDOF_MESH_TRIAL_ELEMENT>
79 {
80 public:
81  inline void calculateMapping_element(const int eN,
82  const int k,
83  double* mesh_dof,
84  int* mesh_l2g,
85  //xt::pyarray<double>& mesh_trial_ref,
86  double* mesh_trial_ref,
87  double* mesh_grad_trial_ref,
88  double* jac,
89  double& jacDet,
90  double* jacInv,
91  double& x,
92  double& y,
93  double& z);
94  inline void calculateH_element(const int eN,
95  const int k,
96  double* h_dof,
97  int* mesh_l2g,
98  //xt::pyarray<double>& mesh_trial_ref,
99  double* mesh_trial_ref,
100  double& h);
101  inline void calculateMappingVelocity_element(const int eN,
102  const int k,
103  double* mesh_velocity_dof,
104  int* mesh_l2g,
105  //xt::pyarray<double>& mesh_trial_ref,
106  double* mesh_trial_ref,
107  double& xt,
108  double& yt,
109  double& zt);
110  inline void calculateMapping_elementBoundary(const int eN,
111  const int ebN_local,
112  const int kb,
113  const int ebN_local_kb,
114  double* mesh_dof,
115  int* mesh_l2g,
116  double* mesh_trial_trace_ref,
117  double* mesh_grad_trial_trace_ref,
118  double* boundaryJac_ref,
119  double* jac,
120  double& jacDet,
121  double* jacInv,
122  double* boundaryJac,
123  double* metricTensor,
124  double& metricTensorDetSqrt,
125  double* normal_ref,
126  double* normal,
127  double& x,
128  double& y,
129  double& z);
131  const int ebN_local,
132  const int kb,
133  const int ebN_local_kb,
134  double* mesh_velocity_dof,
135  int* mesh_l2g,
136  double* mesh_trial_trace_ref,
137  double& xt,
138  double& yt,
139  double& zt,
140  double* normal,
141  double* boundaryJac,
142  double* metricTensor,
143  double& metricTensorDetSqrt);
144  inline void valFromDOF(const double* dof,const int* l2g_element,const double* trial_ref,double& val)
145  {
146  val=0.0;
147  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
148  val+=dof[l2g_element[j]]*trial_ref[j];
149  }
150 
151  inline void gradFromDOF(const double* dof,const int* l2g_element,const double* grad_trial,double* grad)
152  {
153  for(int I=0;I<NSPACE;I++)
154  grad[I] = 0.0;
155  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
156  for(int I=0;I<NSPACE;I++)
157  grad[I] += dof[l2g_element[j]]*grad_trial[j*NSPACE+I];
158  }
159 
160  inline void hessFromDOF(const double* dof,const int* l2g_element,const double* hess_trial,double* hess)
161  {
162  const int NSPACE2=NSPACE*NSPACE;
163  for(int I=0;I<NSPACE;I++)
164  for(int J=0;J<NSPACE;J++)
165  hess[I*NSPACE+J] = 0.0;
166  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
167  for(int I=0;I<NSPACE;I++)
168  for(int J=0;J<NSPACE;J++)
169  hess[I*NSPACE+J] += dof[l2g_element[j]]*hess_trial[j*NSPACE2+I*NSPACE+J];
170  }
171 };
172 
173 //specialization for 3D
174 template<int NDOF_MESH_TRIAL_ELEMENT>
175 class CompKernelSpaceMapping<3,NDOF_MESH_TRIAL_ELEMENT>
176 {
177 public:
178  const int X,Y,Z,
182  sXX,sXY,sXZ,
183  sYX,sYY,sYZ,
184  sZX,sZY,sZZ,
186  XHX,XHY,
187  YHX,YHY,
188  ZHX,ZHY,
189  HXHX,HXHY,
190  HYHX,HYHY;
191  ;
193  X(0),
194  Y(1),
195  Z(2),
196  XX(0),XY(1),XZ(2),
197  YX(3),YY(4),YZ(5),
198  ZX(6),ZY(7),ZZ(8),
199  sXX(0),sXY(5),sXZ(4),
200  sYX(5),sYY(1),sYZ(3),
201  sZX(4),sZY(3),sZZ(2),
202  nSymTen(6),
203  XHX(0),XHY(1),
204  YHX(2),YHY(3),
205  ZHX(4),ZHY(5),
206  HXHX(0),HXHY(1),
207  HYHX(2),HYHY(3)
208  {}
209  inline void calculateMapping_element(const int eN,
210  const int k,
211  double* mesh_dof,
212  int* mesh_l2g,
213  //xt::pyarray<double>& mesh_trial_ref,
214  double* mesh_trial_ref,
215  double* mesh_grad_trial_ref,
216  double* jac,
217  double& jacDet,
218  double* jacInv,
219  double& x,
220  double& y,
221  double& z)
222  {
223  register double Grad_x[3],Grad_y[3],Grad_z[3],oneOverJacDet;
224 
225  //
226  //mapping of reference element to physical element
227  //
228  x=0.0;y=0.0;z=0.0;
229  for (int I=0;I<3;I++)
230  {
231  Grad_x[I]=0.0;Grad_y[I]=0.0;Grad_z[I]=0.0;
232  }
233  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
234  {
235  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
236  //x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref(k, j);
237  //y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref(k, j);
238  //z += mesh_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_ref(k, j);
239  x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
240  y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
241  z += mesh_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
242  for (int I=0;I<3;I++)
243  {
244  Grad_x[I] += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*3+j*3+I];
245  Grad_y[I] += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*3+j*3+I];
246  Grad_z[I] += mesh_dof[mesh_l2g[eN_j]*3+2]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*3+j*3+I];
247  }
248  }
249  jac[XX] = Grad_x[X];
250  jac[XY] = Grad_x[Y];
251  jac[XZ] = Grad_x[Z];
252  jac[YX] = Grad_y[X];
253  jac[YY] = Grad_y[Y];
254  jac[YZ] = Grad_y[Z];
255  jac[ZX] = Grad_z[X];
256  jac[ZY] = Grad_z[Y];
257  jac[ZZ] = Grad_z[Z];
258  jacDet =
259  jac[XX]*(jac[YY]*jac[ZZ] - jac[YZ]*jac[ZY]) -
260  jac[XY]*(jac[YX]*jac[ZZ] - jac[YZ]*jac[ZX]) +
261  jac[XZ]*(jac[YX]*jac[ZY] - jac[YY]*jac[ZX]);
262  oneOverJacDet = 1.0/jacDet;
263  jacInv[XX] = oneOverJacDet*(jac[YY]*jac[ZZ] - jac[YZ]*jac[ZY]);
264  jacInv[YX] = oneOverJacDet*(jac[YZ]*jac[ZX] - jac[YX]*jac[ZZ]);
265  jacInv[ZX] = oneOverJacDet*(jac[YX]*jac[ZY] - jac[YY]*jac[ZX]);
266  jacInv[XY] = oneOverJacDet*(jac[ZY]*jac[XZ] - jac[ZZ]*jac[XY]);
267  jacInv[YY] = oneOverJacDet*(jac[ZZ]*jac[XX] - jac[ZX]*jac[XZ]);
268  jacInv[ZY] = oneOverJacDet*(jac[ZX]*jac[XY] - jac[ZY]*jac[XX]);
269  jacInv[XZ] = oneOverJacDet*(jac[XY]*jac[YZ] - jac[XZ]*jac[YY]);
270  jacInv[YZ] = oneOverJacDet*(jac[XZ]*jac[YX] - jac[XX]*jac[YZ]);
271  jacInv[ZZ] = oneOverJacDet*(jac[XX]*jac[YY] - jac[XY]*jac[YX]);
272  }
273 
274  inline void calculateH_element(const int eN,
275  const int k,
276  double* h_dof,
277  int* mesh_l2g,
278  //xt::pyarray<double>& mesh_trial_ref,
279  double* mesh_trial_ref,
280  double& h)
281  {
282  h=0.0;
283  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
284  {
285  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
286  //h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref(k, j);
287  h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
288  }
289  }
290 
291  inline void calculateMappingVelocity_element(const int eN,
292  const int k,
293  double* mesh_velocity_dof,
294  int* mesh_l2g,
295  //xt::pyarray<double>& mesh_trial_ref,
296  double* mesh_trial_ref,
297  double& xt,
298  double& yt,
299  double& zt)
300  {
301  //
302  //time derivative of mapping of reference element to physical element
303  //
304  xt=0.0;yt=0.0;zt=0.0;
305  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
306  {
307  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
308  //xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref(k, j);
309  //yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref(k, j);
310  //zt += mesh_velocity_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_ref(k, j);
311  xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
312  yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
313  zt += mesh_velocity_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
314  }
315  }
316 
317  inline void calculateMapping_elementBoundary(const int eN,
318  const int ebN_local,
319  const int kb,
320  const int ebN_local_kb,
321  double* mesh_dof,
322  int* mesh_l2g,
323  double* mesh_trial_trace_ref,
324  double* mesh_grad_trial_trace_ref,
325  double* boundaryJac_ref,
326  double* jac,
327  double& jacDet,
328  double* jacInv,
329  double* boundaryJac,
330  double* metricTensor,
331  double& metricTensorDetSqrt,
332  double* normal_ref,
333  double* normal,
334  double& x,
335  double& y,
336  double& z)
337  {
338  const int ebN_local_kb_nSpace = ebN_local_kb*3,
339  ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*3*2;
340 
341  register double Grad_x_ext[3],Grad_y_ext[3],Grad_z_ext[3],oneOverJacDet,norm_normal=0.0;
342  //
343  //calculate mapping from the reference element to the physical element
344  //
345  x=0.0;y=0.0;z=0.0;
346  for (int I=0;I<3;I++)
347  {
348  Grad_x_ext[I] = 0.0;
349  Grad_y_ext[I] = 0.0;
350  Grad_z_ext[I] = 0.0;
351  }
352  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
353  {
354  int eN_j = eN*NDOF_MESH_TRIAL_ELEMENT+j;
355  int ebN_local_kb_j = ebN_local_kb*NDOF_MESH_TRIAL_ELEMENT+j;
356  int ebN_local_kb_j_nSpace = ebN_local_kb_j*3;
357  x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_trace_ref[ebN_local_kb_j];
358  y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_trace_ref[ebN_local_kb_j];
359  z += mesh_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_trace_ref[ebN_local_kb_j];
360  for (int I=0;I<3;I++)
361  {
362  Grad_x_ext[I] += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I];
363  Grad_y_ext[I] += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I];
364  Grad_z_ext[I] += mesh_dof[mesh_l2g[eN_j]*3+2]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I];
365  }
366  }
367  //Space Mapping Jacobian
368  jac[XX] = Grad_x_ext[X];
369  jac[XY] = Grad_x_ext[Y];
370  jac[XZ] = Grad_x_ext[Z];
371  jac[YX] = Grad_y_ext[X];
372  jac[YY] = Grad_y_ext[Y];
373  jac[YZ] = Grad_y_ext[Z];
374  jac[ZX] = Grad_z_ext[X];
375  jac[ZY] = Grad_z_ext[Y];
376  jac[ZZ] = Grad_z_ext[Z];
377  jacDet =
378  jac[XX]*(jac[YY]*jac[ZZ] - jac[YZ]*jac[ZY]) -
379  jac[XY]*(jac[YX]*jac[ZZ] - jac[YZ]*jac[ZX]) +
380  jac[XZ]*(jac[YX]*jac[ZY] - jac[YY]*jac[ZX]);
381  oneOverJacDet = 1.0/jacDet;
382  jacInv[XX] = oneOverJacDet*(jac[YY]*jac[ZZ] - jac[YZ]*jac[ZY]);
383  jacInv[YX] = oneOverJacDet*(jac[YZ]*jac[ZX] - jac[YX]*jac[ZZ]);
384  jacInv[ZX] = oneOverJacDet*(jac[YX]*jac[ZY] - jac[YY]*jac[ZX]);
385  jacInv[XY] = oneOverJacDet*(jac[ZY]*jac[XZ] - jac[ZZ]*jac[XY]);
386  jacInv[YY] = oneOverJacDet*(jac[ZZ]*jac[XX] - jac[ZX]*jac[XZ]);
387  jacInv[ZY] = oneOverJacDet*(jac[ZX]*jac[XY] - jac[ZY]*jac[XX]);
388  jacInv[XZ] = oneOverJacDet*(jac[XY]*jac[YZ] - jac[XZ]*jac[YY]);
389  jacInv[YZ] = oneOverJacDet*(jac[XZ]*jac[YX] - jac[XX]*jac[YZ]);
390  jacInv[ZZ] = oneOverJacDet*(jac[XX]*jac[YY] - jac[XY]*jac[YX]);
391  //normal
392  norm_normal=0.0;
393  for (int I=0;I<3;I++)
394  normal[I] = 0.0;
395  for (int I=0;I<3;I++)
396  {
397  for (int J=0;J<3;J++)
398  {
399  normal[I] += jacInv[J*3+I]*normal_ref[ebN_local_kb_nSpace+J];
400  }
401  norm_normal+=normal[I]*normal[I];
402  }
403  norm_normal = sqrt(norm_normal);
404  for (int I=0;I<3;I++)
405  {
406  normal[I] /= norm_normal;
407  }
408  //metric tensor and determinant
409  boundaryJac[XHX] = jac[XX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHX]+jac[XY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHX]+jac[XZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHX];
410  boundaryJac[XHY] = jac[XX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHY]+jac[XY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHY]+jac[XZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHY];
411  boundaryJac[YHX] = jac[YX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHX]+jac[YY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHX]+jac[YZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHX];
412  boundaryJac[YHY] = jac[YX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHY]+jac[YY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHY]+jac[YZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHY];
413  boundaryJac[ZHX] = jac[ZX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHX]+jac[ZY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHX]+jac[ZZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHX];
414  boundaryJac[ZHY] = jac[ZX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHY]+jac[ZY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHY]+jac[ZZ]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+ZHY];
415 
416  metricTensor[HXHX] = boundaryJac[XHX]*boundaryJac[XHX]+boundaryJac[YHX]*boundaryJac[YHX]+boundaryJac[ZHX]*boundaryJac[ZHX];
417  metricTensor[HXHY] = boundaryJac[XHX]*boundaryJac[XHY]+boundaryJac[YHX]*boundaryJac[YHY]+boundaryJac[ZHX]*boundaryJac[ZHY];
418  metricTensor[HYHX] = boundaryJac[XHY]*boundaryJac[XHX]+boundaryJac[YHY]*boundaryJac[YHX]+boundaryJac[ZHY]*boundaryJac[ZHX];
419  metricTensor[HYHY] = boundaryJac[XHY]*boundaryJac[XHY]+boundaryJac[YHY]*boundaryJac[YHY]+boundaryJac[ZHY]*boundaryJac[ZHY];
420 
421  metricTensorDetSqrt=sqrt(metricTensor[HXHX]*metricTensor[HYHY]- metricTensor[HXHY]*metricTensor[HYHX]);
422  }
423 
425  const int ebN_local,
426  const int kb,
427  const int ebN_local_kb,
428  double* mesh_velocity_dof,
429  int* mesh_l2g,
430  double* mesh_trial_trace_ref,
431  double& xt,
432  double& yt,
433  double& zt,
434  double* normal,
435  double* boundaryJac,
436  double* metricTensor,
437  double& metricTensorDetSqrt)
438  {
439  //const int ebN_local_kb_nSpace = ebN_local_kb*3,
440  // ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*3*2;
441  //
442  //calculate velocity of mapping from the reference element to the physical element
443  //
444  xt=0.0;yt=0.0;zt=0.0;
445  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
446  {
447  int eN_j = eN*NDOF_MESH_TRIAL_ELEMENT+j;
448  int ebN_local_kb_j = ebN_local_kb*NDOF_MESH_TRIAL_ELEMENT+j;
449  xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_trace_ref[ebN_local_kb_j];
450  yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_trace_ref[ebN_local_kb_j];
451  zt += mesh_velocity_dof[mesh_l2g[eN_j]*3+2]*mesh_trial_trace_ref[ebN_local_kb_j];
452  }
453  //modify the metricTensorDetSqrt to include the effect of the moving domain
454  //it's not exactly the Sqrt(Det(G_tr_G)) now, see notes
455  //just do it brute force
456  double
457  Gy_tr_Gy_00 = 1.0 + xt*xt + yt*yt + zt*zt,
458  Gy_tr_Gy_01 = boundaryJac[XHX]*xt+boundaryJac[YHX]*yt+boundaryJac[ZHX]*zt,
459  Gy_tr_Gy_02 = boundaryJac[XHY]*xt+boundaryJac[YHY]*yt+boundaryJac[ZHY]*zt,
460  Gy_tr_Gy_10 = Gy_tr_Gy_01,
461  Gy_tr_Gy_20 = Gy_tr_Gy_02,
462  Gy_tr_Gy_11 = metricTensor[HXHX],
463  Gy_tr_Gy_12 = metricTensor[HXHY],
464  Gy_tr_Gy_21 = metricTensor[HYHX],
465  Gy_tr_Gy_22 = metricTensor[HYHY],
466  xt_dot_n = xt*normal[X]+yt*normal[Y]+zt*normal[Z];
467  metricTensorDetSqrt=sqrt((Gy_tr_Gy_00*Gy_tr_Gy_11*Gy_tr_Gy_22 +
468  Gy_tr_Gy_01*Gy_tr_Gy_12*Gy_tr_Gy_20 +
469  Gy_tr_Gy_02*Gy_tr_Gy_10*Gy_tr_Gy_21 -
470  Gy_tr_Gy_20*Gy_tr_Gy_11*Gy_tr_Gy_02 -
471  Gy_tr_Gy_21*Gy_tr_Gy_12*Gy_tr_Gy_00 -
472  Gy_tr_Gy_22*Gy_tr_Gy_10*Gy_tr_Gy_01) / (1.0+xt_dot_n*xt_dot_n));
473  }
474  inline void valFromDOF(const double* dof,const int* l2g_element,const double* trial_ref,double& val)
475  {
476  val=0.0;
477  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
478  val+=dof[l2g_element[j]]*trial_ref[j];
479  }
480 
481  inline void gradFromDOF(const double* dof,const int* l2g_element,const double* grad_trial,double* grad)
482  {
483  for(int I=0;I<3;I++)
484  grad[I] = 0.0;
485  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
486  for(int I=0;I<3;I++)
487  grad[I] += dof[l2g_element[j]]*grad_trial[j*3+I];
488  }
489 
490  inline void hessFromDOF(const double* dof,const int* l2g_element,const double* hess_trial,double* hess)
491  {
492  for(int I=0;I<3;I++)
493  for(int J=0;J<3;J++)
494  hess[I*3+J] = 0.0;
495  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
496  for(int I=0;I<3;I++)
497  for(int J=0;J<3;J++)
498  hess[I*3+J] += dof[l2g_element[j]]*hess_trial[j*9+I*3+J];
499  }
500 
501  inline void calculateMapping_element(const int eN,
502  const int k,
503  double* mesh_dof,
504  int* mesh_l2g,
505  //xt::pyarray<double>& mesh_trial_ref,
506  double* mesh_trial_ref,
507  double* mesh_grad_trial_ref,
508  double* jac,
509  double& jacDet,
510  double* jacInv,
511  double& x,
512  double& y)
513  {
515  k,
516  mesh_dof,
517  mesh_l2g,
518  mesh_trial_ref,
519  mesh_grad_trial_ref,
520  jac,
521  jacDet,
522  jacInv,
523  x,
524  y,
525  0.0);
526  }
527 
528  inline void calculateMappingVelocity_element(const int eN,
529  const int k,
530  double* mesh_velocity_dof,
531  int* mesh_l2g,
532  //xt::pyarray<double>& mesh_trial_ref,
533  double* mesh_trial_ref,
534  double& xt,
535  double& yt)
536  {
538  k,
539  mesh_velocity_dof,
540  mesh_l2g,
541  mesh_trial_ref,
542  xt,
543  yt,
544  0.0);
545  }
546  inline void calculateMapping_elementBoundary(const int eN,
547  const int ebN_local,
548  const int kb,
549  const int ebN_local_kb,
550  double* mesh_dof,
551  int* mesh_l2g,
552  double* mesh_trial_trace_ref,
553  double* mesh_grad_trial_trace_ref,
554  double* boundaryJac_ref,
555  double* jac,
556  double& jacDet,
557  double* jacInv,
558  double* boundaryJac,
559  double* metricTensor,
560  double& metricTensorDetSqrt,
561  double* normal_ref,
562  double* normal,
563  double& x,
564  double& y)
565  {
567  ebN_local,
568  kb,
569  ebN_local_kb,
570  mesh_dof,
571  mesh_l2g,
572  mesh_trial_trace_ref,
573  mesh_grad_trial_trace_ref,
574  boundaryJac_ref,
575  jac,
576  jacDet,
577  jacInv,
578  boundaryJac,
579  metricTensor,
580  metricTensorDetSqrt,
581  normal_ref,
582  normal,
583  x,
584  y,
585  0.0);
586  }
588  const int ebN_local,
589  const int kb,
590  const int ebN_local_kb,
591  double* mesh_velocity_dof,
592  int* mesh_l2g,
593  double* mesh_trial_trace_ref,
594  double& xt,
595  double& yt,
596  double* normal,
597  double* boundaryJac,
598  double* metricTensor,
599  double& metricTensorDetSqrt)
600  {
602  ebN_local,
603  kb,
604  ebN_local_kb,
605  mesh_velocity_dof,
606  mesh_l2g,
607  mesh_trial_trace_ref,
608  xt,
609  yt,
610  0.0,
611  normal,
612  boundaryJac,
613  metricTensor,
614  metricTensorDetSqrt);
615  }
616 
617 };
618 
619 //specialization for 2D
620 template<int NDOF_MESH_TRIAL_ELEMENT>
621 class CompKernelSpaceMapping<2,NDOF_MESH_TRIAL_ELEMENT>
622 {
623 public:
624  const int X,Y,
627  sXX,sXY,
628  sYX,sYY,
634  X(0),
635  Y(1),
636  XX(0),XY(1),
637  YX(2),YY(3),
638  sXX(0),sXY(2),
639  sYX(2),sYY(1),
640  nSymTen(3),
641  XHX(0),
642  YHX(1),
643  HXHX(0)
644  {}
645  inline void calculateMapping_element(const int eN,
646  const int k,
647  double* mesh_dof,
648  int* mesh_l2g,
649  //xt::pyarray<double>& mesh_trial_ref,
650  double* mesh_trial_ref,
651  double* mesh_grad_trial_ref,
652  double* jac,
653  double& jacDet,
654  double* jacInv,
655  double& x,
656  double& y)
657  {
658  register double Grad_x[2],Grad_y[2],oneOverJacDet;
659 
660  //
661  //mapping of reference element to physical element
662  //
663  x=0.0;y=0.0;
664  for (int I=0;I<2;I++)
665  {
666  Grad_x[I]=0.0;Grad_y[I]=0.0;
667  }
668  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
669  {
670  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
671  /* x += mesh_dof[mesh_l2g[eN_j]*2+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j]; */
672  /* y += mesh_dof[mesh_l2g[eN_j]*2+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j]; */
673  /* for (int I=0;I<2;I++) */
674  /* { */
675  /* Grad_x[I] += mesh_dof[mesh_l2g[eN_j]*2+0]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*2+j*2+I]; */
676  /* Grad_y[I] += mesh_dof[mesh_l2g[eN_j]*2+1]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*2+j*2+I]; */
677  /* } */
678  //x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref(k, j);
679  //y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref(k, j);
680  x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
681  y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
682  for (int I=0;I<2;I++)
683  {
684  Grad_x[I] += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*2+j*2+I];
685  Grad_y[I] += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_grad_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT*2+j*2+I];
686  }
687  }
688  jac[XX] = Grad_x[X];
689  jac[XY] = Grad_x[Y];
690  jac[YX] = Grad_y[X];
691  jac[YY] = Grad_y[Y];
692  jacDet = jac[XX]*jac[YY] - jac[XY]*jac[YX];
693  oneOverJacDet = 1.0/jacDet;
694  jacInv[XX] = oneOverJacDet*jac[YY];
695  jacInv[XY] = -oneOverJacDet*jac[XY];
696  jacInv[YX] = -oneOverJacDet*jac[YX];
697  jacInv[YY] = oneOverJacDet*jac[XX];
698  }
699 
700  inline void calculateH_element(const int eN,
701  const int k,
702  double* h_dof,
703  int* mesh_l2g,
704  //xt::pyarray<double>& mesh_trial_ref,
705  double* mesh_trial_ref,
706  double& h)
707  {
708  h=0.0;
709  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
710  {
711  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
712  //h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref(k, j);
713  h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
714  }
715  }
716 
717  inline void calculateMappingVelocity_element(const int eN,
718  const int k,
719  double* mesh_velocity_dof,
720  int* mesh_l2g,
721  //xt::pyarray<double>& mesh_trial_ref,
722  double* mesh_trial_ref,
723  double& xt,
724  double& yt)
725  {
726  //
727  //time derivative of mapping of reference element to physical element
728  //
729  xt=0.0;yt=0.0;
730  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
731  {
732  int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
733  /* xt += mesh_velocity_dof[mesh_l2g[eN_j]*2+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j]; */
734  /* yt += mesh_velocity_dof[mesh_l2g[eN_j]*2+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j]; */
735  //xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref(k, j);
736  //yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref(k, j);
737  xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
738  yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
739  }
740  }
741 
742  inline void calculateMapping_elementBoundary(const int eN,
743  const int ebN_local,
744  const int kb,
745  const int ebN_local_kb,
746  double* mesh_dof,
747  int* mesh_l2g,
748  double* mesh_trial_trace_ref,
749  double* mesh_grad_trial_trace_ref,
750  double* boundaryJac_ref,
751  double* jac,
752  double& jacDet,
753  double* jacInv,
754  double* boundaryJac,
755  double* metricTensor,
756  double& metricTensorDetSqrt,
757  double* normal_ref,
758  double* normal,
759  double& x,
760  double& y)
761  {
762  const int ebN_local_kb_nSpace = ebN_local_kb*2,
763  ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*2*1;
764 
765  register double Grad_x_ext[2],Grad_y_ext[2],oneOverJacDet,norm_normal=0.0;
766  //
767  //calculate mapping from the reference element to the physical element
768  //
769  x=0.0;y=0.0;
770  for (int I=0;I<2;I++)
771  {
772  Grad_x_ext[I] = 0.0;
773  Grad_y_ext[I] = 0.0;
774  }
775  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
776  {
777  int eN_j = eN*NDOF_MESH_TRIAL_ELEMENT+j;
778  int ebN_local_kb_j = ebN_local_kb*NDOF_MESH_TRIAL_ELEMENT+j;
779  int ebN_local_kb_j_nSpace = ebN_local_kb_j*2;
780  /* x += mesh_dof[mesh_l2g[eN_j]*2+0]*mesh_trial_trace_ref[ebN_local_kb_j]; */
781  /* y += mesh_dof[mesh_l2g[eN_j]*2+1]*mesh_trial_trace_ref[ebN_local_kb_j]; */
782  /* for (int I=0;I<2;I++) */
783  /* { */
784  /* Grad_x_ext[I] += mesh_dof[mesh_l2g[eN_j]*2+0]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I]; */
785  /* Grad_y_ext[I] += mesh_dof[mesh_l2g[eN_j]*2+1]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I]; */
786  /* } */
787  x += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_trace_ref[ebN_local_kb_j];
788  y += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_trace_ref[ebN_local_kb_j];
789  for (int I=0;I<2;I++)
790  {
791  Grad_x_ext[I] += mesh_dof[mesh_l2g[eN_j]*3+0]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I];
792  Grad_y_ext[I] += mesh_dof[mesh_l2g[eN_j]*3+1]*mesh_grad_trial_trace_ref[ebN_local_kb_j_nSpace+I];
793  }
794  }
795  //Space Mapping Jacobian
796  jac[XX] = Grad_x_ext[X];
797  jac[XY] = Grad_x_ext[Y];
798  jac[YX] = Grad_y_ext[X];
799  jac[YY] = Grad_y_ext[Y];
800  jacDet = jac[XX]*jac[YY] - jac[XY]*jac[YX];
801  oneOverJacDet = 1.0/jacDet;
802  jacInv[XX] = oneOverJacDet*jac[YY];
803  jacInv[XY] = -oneOverJacDet*jac[XY];
804  jacInv[YX] = -oneOverJacDet*jac[YX];
805  jacInv[YY] = oneOverJacDet*jac[XX];
806  //normal
807  norm_normal=0.0;
808  for (int I=0;I<2;I++)
809  normal[I] = 0.0;
810  for (int I=0;I<2;I++)
811  {
812  for (int J=0;J<2;J++)
813  {
814  normal[I] += jacInv[J*2+I]*normal_ref[ebN_local_kb_nSpace+J];
815  }
816  norm_normal+=normal[I]*normal[I];
817  }
818  norm_normal = sqrt(norm_normal);
819  for (int I=0;I<2;I++)
820  {
821  normal[I] /= norm_normal;
822  }
823  //metric tensor and determinant
824  boundaryJac[XHX] = jac[XX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHX]+jac[XY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHX];
825  boundaryJac[YHX] = jac[YX]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+XHX]+jac[YY]*boundaryJac_ref[ebN_local_kb_nSpace_nSpacem1+YHX];
826 
827  metricTensor[HXHX] = boundaryJac[XHX]*boundaryJac[XHX]+boundaryJac[YHX]*boundaryJac[YHX];
828 
829  metricTensorDetSqrt=sqrt(metricTensor[HXHX]);
830  }
831 
833  const int ebN_local,
834  const int kb,
835  const int ebN_local_kb,
836  double* mesh_velocity_dof,
837  int* mesh_l2g,
838  double* mesh_trial_trace_ref,
839  double& xt,
840  double& yt,
841  double* normal,
842  double* boundaryJac,
843  double* metricTensor,
844  double& metricTensorDetSqrt)
845  {
846  //const int ebN_local_kb_nSpace = ebN_local_kb*2,
847  // ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*2*2;
848  //
849  //calculate velocity of mapping from the reference element to the physical element
850  //
851  xt=0.0;yt=0.0;
852  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
853  {
854  int eN_j = eN*NDOF_MESH_TRIAL_ELEMENT+j;
855  int ebN_local_kb_j = ebN_local_kb*NDOF_MESH_TRIAL_ELEMENT+j;
856  /* xt += mesh_velocity_dof[mesh_l2g[eN_j]*2+0]*mesh_trial_trace_ref[ebN_local_kb_j]; */
857  /* yt += mesh_velocity_dof[mesh_l2g[eN_j]*2+1]*mesh_trial_trace_ref[ebN_local_kb_j]; */
858  xt += mesh_velocity_dof[mesh_l2g[eN_j]*3+0]*mesh_trial_trace_ref[ebN_local_kb_j];
859  yt += mesh_velocity_dof[mesh_l2g[eN_j]*3+1]*mesh_trial_trace_ref[ebN_local_kb_j];
860  }
861  //modify the metricTensorDetSqrt to include the effect of the moving domain
862  //it's not exactly the Sqrt(Det(G_tr_G)) now, see notes
863  //just do it brute force
864  double
865  Gy_tr_Gy_00 = 1.0 + xt*xt + yt*yt,
866  Gy_tr_Gy_01 = boundaryJac[XHX]*xt+boundaryJac[YHX]*yt,
867  Gy_tr_Gy_10 = Gy_tr_Gy_01,
868  Gy_tr_Gy_11 = metricTensor[HXHX],
869  xt_dot_n = xt*normal[X]+yt*normal[Y];
870  metricTensorDetSqrt=sqrt((Gy_tr_Gy_00*Gy_tr_Gy_11 - Gy_tr_Gy_01*Gy_tr_Gy_10) / (1.0+xt_dot_n*xt_dot_n));
871  }
872  inline void valFromDOF(const double* dof,const int* l2g_element,const double* trial_ref,double& val)
873  {
874  val=0.0;
875  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
876  val+=dof[l2g_element[j]]*trial_ref[j];
877  }
878 
879  inline void gradFromDOF(const double* dof,const int* l2g_element,const double* grad_trial,double* grad)
880  {
881  for(int I=0;I<2;I++)
882  grad[I] = 0.0;
883  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
884  for(int I=0;I<2;I++)
885  grad[I] += dof[l2g_element[j]]*grad_trial[j*2+I];
886  }
887 
888  inline void hessFromDOF(const double* dof,const int* l2g_element,const double* hess_trial,double* hess)
889  {
890  for(int I=0;I<2;I++)
891  for(int J=0;J<2;J++)
892  hess[I*2+J] = 0.0;
893  for (int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
894  for(int I=0;I<2;I++)
895  for(int J=0;J<2;J++)
896  hess[I*2+J] += dof[l2g_element[j]]*hess_trial[j*4+I*2+J];
897  }
898 
899  inline void calculateMapping_element(const int eN,
900  const int k,
901  double* mesh_dof,
902  int* mesh_l2g,
903  //xt::pyarray<double>& mesh_trial_ref,
904  double* mesh_trial_ref,
905  double* mesh_grad_trial_ref,
906  double* jac,
907  double& jacDet,
908  double* jacInv,
909  double& x,
910  double& y,
911  double& z)
912  {
914  k,
915  mesh_dof,
916  mesh_l2g,
917  mesh_trial_ref,
918  mesh_grad_trial_ref,
919  jac,
920  jacDet,
921  jacInv,
922  x,
923  y);
924  }
925  inline void calculateMappingVelocity_element(const int eN,
926  const int k,
927  double* mesh_velocity_dof,
928  int* mesh_l2g,
929  //xt::pyarray<double>& mesh_trial_ref,
930  double* mesh_trial_ref,
931  double& xt,
932  double& yt,
933  double& zt)
934  {
936  k,
937  mesh_velocity_dof,
938  mesh_l2g,
939  mesh_trial_ref,
940  xt,
941  yt);
942  }
943  inline void calculateMapping_elementBoundary(const int eN,
944  const int ebN_local,
945  const int kb,
946  const int ebN_local_kb,
947  double* mesh_dof,
948  int* mesh_l2g,
949  double* mesh_trial_trace_ref,
950  double* mesh_grad_trial_trace_ref,
951  double* boundaryJac_ref,
952  double* jac,
953  double& jacDet,
954  double* jacInv,
955  double* boundaryJac,
956  double* metricTensor,
957  double& metricTensorDetSqrt,
958  double* normal_ref,
959  double* normal,
960  double& x,
961  double& y,
962  double& z)
963  {
965  ebN_local,
966  kb,
967  ebN_local_kb,
968  mesh_dof,
969  mesh_l2g,
970  mesh_trial_trace_ref,
971  mesh_grad_trial_trace_ref,
972  boundaryJac_ref,
973  jac,
974  jacDet,
975  jacInv,
976  boundaryJac,
977  metricTensor,
978  metricTensorDetSqrt,
979  normal_ref,
980  normal,
981  x,
982  y);
983  }
985  const int ebN_local,
986  const int kb,
987  const int ebN_local_kb,
988  double* mesh_velocity_dof,
989  int* mesh_l2g,
990  double* mesh_trial_trace_ref,
991  double& xt,
992  double& yt,
993  double& zt,
994  double* normal,
995  double* boundaryJac,
996  double* metricTensor,
997  double& metricTensorDetSqrt)
998  {
1000  ebN_local,
1001  kb,
1002  ebN_local_kb,
1003  mesh_velocity_dof,
1004  mesh_l2g,
1005  mesh_trial_trace_ref,
1006  xt,
1007  yt,
1008  normal,
1009  boundaryJac,
1010  metricTensor,
1011  metricTensorDetSqrt);
1012  }
1013 };
1014 
1015 
1016 template<int NSPACE, int NDOF_MESH_TRIAL_ELEMENT, int NDOF_TRIAL_ELEMENT, int NDOF_TEST_ELEMENT>
1018 {
1019 public:
1021  const int X,
1022  Y,
1023  Z,
1037  X(mapping.X),
1038  Y(mapping.Y),
1039  Z(mapping.Z),
1052  {}
1053  inline void calculateG(double* jacInv,double* G,double& G_dd_G, double& tr_G)
1054  {
1055  //get the metric tensor
1056  //cek todo use symmetry
1057  for (int I=0;I<NSPACE;I++)
1058  for (int J=0;J<NSPACE;J++)
1059  {
1060  G[I*NSPACE+J] = 0.0;
1061  for (int K=0;K<NSPACE;K++)
1062  G[I*NSPACE+J] += jacInv[K*NSPACE+I]*jacInv[K*NSPACE+J];
1063  }
1064  G_dd_G = 0.0;
1065  tr_G = 0.0;
1066  for (int I=0;I<NSPACE;I++)
1067  {
1068  tr_G += G[I*NSPACE+I];
1069  for (int J=0;J<NSPACE;J++)
1070  {
1071  G_dd_G += G[I*NSPACE+J]*G[I*NSPACE+J];
1072  }
1073  }
1074  }
1075  inline void calculateGScale(double* G,double* v,double& h)
1076  {
1077  h = 0.0;
1078  for (int I=0;I<NSPACE;I++)
1079  for (int J=0;J<NSPACE;J++)
1080  h += v[I]*G[I*NSPACE+J]*v[J];
1081  h = 1.0/sqrt(h+1.0e-16);//cek hack
1082  }
1083  inline void valFromDOF(const double* dof,const int* l2g_element,const double* trial_ref,double& val)
1084  {
1085  val=0.0;
1086  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1087  val+=dof[l2g_element[j]]*trial_ref[j];
1088  }
1089 
1090  inline void gradFromDOF(const double* dof,const int* l2g_element,const double* grad_trial,double* grad)
1091  {
1092  for(int I=0;I<NSPACE;I++)
1093  grad[I] = 0.0;
1094  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1095  for(int I=0;I<NSPACE;I++)
1096  grad[I] += dof[l2g_element[j]]*grad_trial[j*NSPACE+I];
1097  }
1098 
1099  inline void hessFromDOF(const double* dof,const int* l2g_element,const double* hess_trial,double* hess)
1100  {
1101  const int NSPACE2=NSPACE*NSPACE;
1102  for(int I=0;I<NSPACE;I++)
1103  for(int J=0;J<NSPACE;J++)
1104  hess[I*NSPACE+J] = 0.0;
1105  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1106  for(int I=0;I<NSPACE;I++)
1107  for(int J=0;J<NSPACE;J++)
1108  hess[I*NSPACE+J] += dof[l2g_element[j]]*hess_trial[j*NSPACE2+I*NSPACE+J];
1109  }
1110 
1111  inline void valFromElementDOF(const double* dof,const double* trial_ref,double& val)
1112  {
1113  val=0.0;
1114  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1115  val+=dof[j]*trial_ref[j];
1116  }
1117 
1118  inline void gradFromElementDOF(const double* dof,const double* grad_trial,double* grad)
1119  {
1120  for(int I=0;I<NSPACE;I++)
1121  grad[I] = 0.0;
1122  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1123  for(int I=0;I<NSPACE;I++)
1124  grad[I] += dof[j]*grad_trial[j*NSPACE+I];
1125  }
1126 
1127  inline void gradTrialFromRef(const double* grad_trial_ref, const double* jacInv, double* grad_trial)
1128  {
1129  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1130  for(int I=0;I<NSPACE;I++)
1131  grad_trial[j*NSPACE+I] = 0.0;
1132  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1133  for(int I=0;I<NSPACE;I++)
1134  for(int J=0;J<NSPACE;J++)
1135  grad_trial[j*NSPACE+I] += jacInv[J*NSPACE+I]*grad_trial_ref[j*NSPACE+J];
1136  }
1137 
1138  /*
1139  * DOFaverage
1140  * ----------
1141  *
1142  * Calculate the average DOF value for at a given mesh element.
1143  *
1144  * @param dof array of finite element DOF values
1145  * @param l2g_element local 2 global mapping for the current mesh element
1146  * @param val return value with the average DOF values
1147  */
1148 
1149  inline void DOFaverage (const double* dof, const int* l2g_element, double& val)
1150  {
1151  val = 0.0;
1152 
1153  for (int j=0; j<NDOF_MESH_TRIAL_ELEMENT; j++)
1154  val+=dof[l2g_element[j]];
1155 
1156  val /= NDOF_MESH_TRIAL_ELEMENT;
1157  }
1158 
1159  inline void hessTrialFromRef(const double* hess_trial_ref, const double* jacInv, double* hess_trial)
1160  {
1161  const int NSPACE2=NSPACE*NSPACE;
1162  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1163  for(int I=0;I<NSPACE;I++)
1164  for(int J=0;J<NSPACE;J++)
1165  hess_trial[j*NSPACE2+I*NSPACE+J] = 0.0;
1166  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1167  for(int I=0;I<NSPACE;I++)
1168  for(int J=0;J<NSPACE;J++)
1169  for(int K=0;K<NSPACE;K++)
1170  for(int L=0;L<NSPACE;L++)
1171  hess_trial[j*NSPACE2+I*NSPACE+J] += hess_trial_ref[j*NSPACE2+K*NSPACE+L]*jacInv[L*NSPACE+J]*jacInv[K*NSPACE+I];
1172  }
1173 
1174  inline void gradTestFromRef(const double* grad_test_ref, const double* jacInv, double* grad_test)
1175  {
1176  for (int i=0;i<NDOF_TEST_ELEMENT;i++)
1177  for(int I=0;I<NSPACE;I++)
1178  grad_test[i*NSPACE+I] = 0.0;
1179  for (int i=0;i<NDOF_TEST_ELEMENT;i++)
1180  for(int I=0;I<NSPACE;I++)
1181  for(int J=0;J<NSPACE;J++)
1182  grad_test[i*NSPACE+I] += jacInv[J*NSPACE+I]*grad_test_ref[i*NSPACE+J];
1183  }
1184 
1185  inline void backwardEuler(const double& dt, const double& m_old, const double& m, const double& dm, double& mt, double& dmt)
1186  {
1187  mt =(m-m_old)/dt;
1188  dmt = dm/dt;
1189  }
1190 
1191  inline void bdf(const double& alpha, const double& beta, const double& m, const double& dm, double& mt, double& dmt)
1192  {
1193  mt =alpha*m + beta;
1194  dmt = alpha*dm;
1195  }
1196  inline void bdfC2(const double& alpha, const double& beta, const double& m, const double& dm, const double& dm2, double& mt, double& dmt, double& dm2t)
1197  {
1198  mt =alpha*m + beta;
1199  dmt = alpha*dm;
1200  dm2t = alpha*dm2;
1201  }
1202 
1203  inline double Mass_weak(const double& mt, const double& w_dV)
1204  {
1205  return mt*w_dV;
1206  }
1207 
1208  inline double MassJacobian_weak(const double& dmt,
1209  const double& v,
1210  const double& w_dV)
1211  {
1212  return dmt*v*w_dV;
1213  }
1214 
1215  inline double Mass_strong(const double& mt)
1216  {
1217  return mt;
1218  }
1219 
1220  inline double MassJacobian_strong(const double& dmt,
1221  const double& v)
1222  {
1223  return dmt*v;
1224  }
1225 
1226  inline double Mass_adjoint(const double& dmt,
1227  const double& w_dV)
1228  {
1229  return dmt*w_dV;
1230  }
1231 
1232  /*
1233  * pressureProjection_weak
1234  * -----------------------
1235  *
1236  * Inner product calculation of the pressure projection
1237  * stablization method of Bochev, Dohrmann and
1238  * Gunzburger (2006).
1239  *
1240  * @param viscosity viscosity at point
1241  * @param p the pressure value (either trial function
1242  * or actual value)
1243  * @param p_avg the pressure projection value (either
1244  * 1./3. for test functions of the average
1245  * value of the pressure on the element)
1246  * @param dV this is the integral weight
1247  *
1248  */
1249 
1250  inline double pressureProjection_weak(const double& viscosity,
1251  const double& p,
1252  const double& p_avg,
1253  const double& q,
1254  const double& dV)
1255  {
1256  if (viscosity==0.){ return 0.;}
1257  return (1./viscosity)*(p-p_avg)*(q-1./3.)*dV;
1258  }
1259 
1260  inline double Advection_weak(const double f[NSPACE],
1261  const double grad_w_dV[NSPACE])
1262  {
1263  double tmp=0.0;
1264  for(int I=0;I<NSPACE;I++)
1265  tmp -= f[I]*grad_w_dV[I];
1266  return tmp;
1267  }
1268 
1269  inline double AdvectionJacobian_weak(const double df[NSPACE],
1270  const double& v,
1271  const double grad_w_dV[NSPACE])
1272  {
1273  double tmp=0.0;
1274  for(int I=0;I<NSPACE;I++)
1275  tmp -= df[I]*v*grad_w_dV[I];
1276  return tmp;
1277  }
1278 
1279  inline double Advection_strong(const double df[NSPACE],
1280  const double grad_u[NSPACE])
1281  {
1282  double tmp=0.0;
1283  for(int I=0;I<NSPACE;I++)
1284  tmp += df[I]*grad_u[I];
1285  return tmp;
1286  }
1287 
1288  inline double AdvectionJacobian_strong(const double df[NSPACE],
1289  const double grad_v[NSPACE])
1290  {
1291  double tmp=0.0;
1292  for(int I=0;I<NSPACE;I++)
1293  tmp += df[I]*grad_v[I];
1294  return tmp;
1295  }
1296 
1297  inline double Advection_adjoint(const double df[NSPACE],
1298  const double grad_w_dV[NSPACE])
1299  {
1300  double tmp=0.0;
1301  for(int I=0;I<NSPACE;I++)
1302  tmp -= df[I]*grad_w_dV[I];
1303  return tmp;
1304  }
1305 
1306  inline double Hamiltonian_weak(const double& H,
1307  const double& w_dV)
1308  {
1309  return H*w_dV;
1310  }
1311 
1312  inline double HamiltonianJacobian_weak(const double dH[NSPACE],
1313  const double grad_v[NSPACE],
1314  const double& w_dV)
1315  {
1316  double tmp=0.0;
1317  for(int I=0;I<NSPACE;I++)
1318  tmp += dH[I]*grad_v[I]*w_dV;
1319  return tmp;
1320  }
1321 
1322  inline double Hamiltonian_strong(const double dH[NSPACE],
1323  const double grad_u[NSPACE])
1324  {
1325  double tmp=0.0;
1326  for(int I=0;I<NSPACE;I++)
1327  tmp += dH[I]*grad_u[I];
1328  return tmp;
1329  }
1330 
1331  inline double HamiltonianJacobian_strong(const double dH[NSPACE],
1332  const double grad_v[NSPACE])
1333  {
1334  double tmp=0.0;
1335  for(int I=0;I<NSPACE;I++)
1336  tmp += dH[I]*grad_v[I];
1337  return tmp;
1338  }
1339 
1340  inline double Hamiltonian_adjoint(const double dH[NSPACE],
1341  const double grad_w_dV[NSPACE])
1342  {
1343  double tmp=0.0;
1344  for(int I=0;I<NSPACE;I++)
1345  tmp -= dH[I]*grad_w_dV[I];
1346  return tmp;
1347  }
1348 
1349  inline double Diffusion_weak(int* rowptr,
1350  int* colind,
1351  double* a,
1352  const double grad_phi[NSPACE],
1353  const double grad_w_dV[NSPACE])
1354  {
1355  double tmp=0.0;
1356  for(int I=0;I<NSPACE;I++)
1357  for (int m=rowptr[I];m<rowptr[I+1];m++)
1358  tmp += a[m]*grad_phi[colind[m]]*grad_w_dV[I];
1359  return tmp;
1360  }
1361 
1362  inline double DiffusionJacobian_weak(int* rowptr,
1363  int* colind,
1364  double* a,
1365  double* da,
1366  const double grad_phi[NSPACE],
1367  const double grad_w_dV[NSPACE],
1368  const double& dphi,
1369  const double& v,
1370  const double grad_v[NSPACE])
1371  {
1372  double daProduct=0.0,dphiProduct=0.0;
1373  for (int I=0;I<NSPACE;I++)
1374  for (int m=rowptr[I];m<rowptr[I+1];m++)
1375  {
1376  daProduct += da[m]*grad_phi[colind[m]]*grad_w_dV[I];
1377  dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
1378  }
1379  return daProduct*v+dphiProduct*dphi;
1380  }
1381 
1382  inline double SimpleDiffusionJacobian_weak(int* rowptr,
1383  int* colind,
1384  double* a,
1385  const double grad_v[NSPACE],
1386  const double grad_w_dV[NSPACE])
1387  {
1388  double dphiProduct=0.0;
1389  for (int I=0;I<NSPACE;I++)
1390  for (int m=rowptr[I];m<rowptr[I+1];m++)
1391  {
1392  dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
1393  }
1394  return dphiProduct;
1395  }
1396 
1397  inline double Reaction_weak(const double& r,
1398  const double& w_dV)
1399  {
1400  return r*w_dV;
1401  }
1402 
1403  inline double ReactionJacobian_weak(const double& dr,
1404  const double& v,
1405  const double& w_dV)
1406  {
1407  return dr*v*w_dV;
1408  }
1409 
1410  inline double Reaction_strong(const double& r)
1411  {
1412  return r;
1413  }
1414 
1415  inline double ReactionJacobian_strong(const double& dr,
1416  const double& v)
1417  {
1418  return dr*v;
1419  }
1420 
1421  inline double Reaction_adjoint(const double& dr,
1422  const double& w_dV)
1423  {
1424  return dr*w_dV;
1425  }
1426 
1427  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
1428  const double& elementDiameter,
1429  const double& strong_residual,
1430  const double grad_u[NSPACE],
1431  double& numDiff)
1432  {
1433  double h,
1434  num,
1435  den,
1436  n_grad_u;
1437  h = elementDiameter;
1438  n_grad_u = 0.0;
1439  for (int I=0;I<NSPACE;I++)
1440  n_grad_u += grad_u[I]*grad_u[I];
1441  num = shockCapturingDiffusion*0.5*h*fabs(strong_residual);
1442  den = sqrt(n_grad_u+1.0e-12);
1443  numDiff = num/den;
1444  }
1445 
1446 
1447  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
1448  const double G[NSPACE*NSPACE],
1449  const double& strong_residual,
1450  const double grad_u[NSPACE],
1451  double& numDiff)
1452  {
1453  double den = 0.0;
1454  for (int I=0;I<NSPACE;I++)
1455  for (int J=0;J<NSPACE;J++)
1456  den += grad_u[I]*G[I*NSPACE+J]*grad_u[J];
1457  numDiff = shockCapturingDiffusion*fabs(strong_residual)/(sqrt(den+1.0e-12));
1458  }
1459 
1460  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
1461  const double& uref, const double& beta,
1462  const double G[NSPACE*NSPACE],
1463  const double& G_dd_G,
1464  const double& strong_residual,
1465  const double grad_u[NSPACE],
1466  double& numDiff)
1467  {
1468  double den = 0.0;
1469  for (int I=0;I<NSPACE;I++)
1470  for (int J=0;J<NSPACE;J++)
1471  den += grad_u[I]*G[I*NSPACE+J]*grad_u[J];
1472 
1473  double h2_uref_1 = 1.0/(sqrt(den+1.0e-12));
1474  double h2_uref_2 = 1.0/(uref*sqrt(G_dd_G+1.0e-12));
1475  numDiff = shockCapturingDiffusion*fabs(strong_residual)*pow(h2_uref_1, 2.0-beta)*pow(h2_uref_2,beta-1.0);
1476  }
1477 
1478 
1479 
1480  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
1481  const double G[NSPACE*NSPACE],
1482  const double& strong_residual,
1483  const double vel[NSPACE],
1484  const double grad_u[NSPACE],
1485  double& numDiff)
1486  {
1487  double den1 = 0.0,den2=0.0, nom=0.0;
1488  for (int I=0;I<NSPACE;I++)
1489  {
1490  nom += vel[I]*vel[I];
1491  den2+= grad_u[I]*grad_u[I];
1492  for (int J=0;J<NSPACE;J++)
1493  den1 += vel[I]*G[I*NSPACE+J]*vel[J];
1494  }
1495  numDiff = shockCapturingDiffusion*fabs(strong_residual)*(sqrt(nom/(den1*den2 + 1.0e-12)));
1496  }
1497 
1498 
1499  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
1500  const double& elementDiameter,
1501  const double& strong_residual,
1502  const double grad_u[NSPACE],
1503  double& gradNorm,
1504  double& gradNorm_last,
1505  double& numDiff)
1506  {
1507  double h,
1508  num,
1509  n_grad_u;
1510  h = elementDiameter;
1511  n_grad_u = 0.0;
1512  for (int I=0;I<NSPACE;I++)
1513  n_grad_u += grad_u[I]*grad_u[I];
1514  num = shockCapturingDiffusion*0.5*h*fabs(strong_residual);
1515  gradNorm = sqrt(n_grad_u+1.0e-12);
1516  //cek hack shockCapturingDiffusion*fabs(strong_residual)*grad_phi_G_grad_phi
1517  numDiff = num/gradNorm_last;
1518  }
1519 
1520  inline double SubgridError(const double& error,
1521  const double& Lstar_w_dV)
1522  {
1523  return error*Lstar_w_dV;
1524  }
1525 
1526  inline double SubgridErrorJacobian(const double& derror,
1527  const double& Lstar_w_dV)
1528  {
1529  return derror*Lstar_w_dV;
1530  }
1531 
1532  inline double NumericalDiffusion(const double& numDiff,
1533  const double grad_u[NSPACE],
1534  const double grad_w_dV[NSPACE])
1535  {
1536  double tmp=0.0;
1537  for (int I=0;I<NSPACE;I++)
1538  tmp += numDiff*grad_u[I]*grad_w_dV[I];
1539  return tmp;
1540  }
1541 
1542  inline double NumericalDiffusionJacobian(const double& numDiff,
1543  const double grad_v[NSPACE],
1544  const double grad_w_dV[NSPACE])
1545  {
1546  double tmp=0.0;
1547  for (int I=0;I<NSPACE;I++)
1548  tmp += numDiff*grad_v[I]*grad_w_dV[I];
1549  return tmp;
1550  }
1551 
1552 
1553 
1554  inline double ExteriorElementBoundaryFlux(const double& flux,
1555  const double& w_dS)
1556  {
1557  return flux*w_dS;
1558  }
1559 
1560  inline double InteriorElementBoundaryFlux(const double& flux,
1561  const double& w_dS)
1562  {
1563  return flux*w_dS;
1564  }
1565 
1566  inline double ExteriorNumericalAdvectiveFluxJacobian(const double& dflux_left,
1567  const double& v)
1568  {
1569  return dflux_left*v;
1570  }
1571 
1572  inline double InteriorNumericalAdvectiveFluxJacobian(const double& dflux_left,
1573  const double& v)
1574  {
1575  return dflux_left*v;
1576  }
1577 
1578  inline double ExteriorElementBoundaryScalarDiffusionAdjoint(const int& isDOFBoundary,
1579  const int& isFluxBoundary,
1580  const double& sigma,
1581  const double& u,
1582  const double& bc_u,
1583  const double normal[NSPACE],
1584  const double& a,
1585  const double grad_w_dS[NSPACE])
1586  {
1587  double tmp=0.0;
1588  for(int I=0;I<NSPACE;I++)
1589  {
1590  tmp += normal[I]*grad_w_dS[I];
1591  }
1592  tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*(u-bc_u)*a;
1593  return tmp;
1594  }
1595 
1596  inline double ExteriorElementBoundaryScalarDiffusionAdjointJacobian(const int& isDOFBoundary,
1597  const int& isFluxBoundary,
1598  const double& sigma,
1599  const double& v,
1600  const double normal[NSPACE],
1601  const double& a,
1602  const double grad_w_dS[NSPACE])
1603  {
1604  double tmp=0.0;
1605  for(int I=0;I<NSPACE;I++)
1606  {
1607  tmp += normal[I]*grad_w_dS[I];
1608  }
1609  tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*v*a;
1610  return tmp;
1611  }
1612 
1613  inline double ExteriorElementBoundaryDiffusionAdjoint(const int& isDOFBoundary,
1614  const int& isFluxBoundary,
1615  const double& sigma,
1616  const double& u,
1617  const double& bc_u,
1618  const double normal[NSPACE],
1619  int* rowptr,
1620  int* colind,
1621  double* a,
1622  const double grad_w_dS[NSPACE])
1623  {
1624  double tmp=0.0;
1625  for(int I=0;I<NSPACE;I++)
1626  for (int m=rowptr[I];m<rowptr[I+1];m++)
1627  tmp += (1.0-isFluxBoundary)*isDOFBoundary*sigma*(u-bc_u)*a[m]*normal[colind[m]]*grad_w_dS[I];
1628  return tmp;
1629  }
1630 
1631  inline double ExteriorElementBoundaryDiffusionAdjointJacobian(const int& isDOFBoundary,
1632  const int& isFluxBoundary,
1633  const double& sigma,
1634  const double& v,
1635  const double normal[NSPACE],
1636  int* rowptr,
1637  int* colind,
1638  double* a,
1639  const double grad_w_dS[NSPACE])
1640  {
1641  double tmp=0.0;
1642  for(int I=0;I<NSPACE;I++)
1643  for (int m=rowptr[I];m<rowptr[I+1];m++)
1644  tmp += (1.0-isFluxBoundary)*isDOFBoundary*sigma*v*a[m]*normal[colind[m]]*grad_w_dS[I];
1645  return tmp;
1646  }
1647 
1648  inline void calculateMapping_element(const int eN,
1649  const int k,
1650  double* mesh_dof,
1651  int* mesh_l2g,
1652  //xt::pyarray<double>& mesh_trial_ref,
1653  double* mesh_trial_ref,
1654  double* mesh_grad_trial_ref,
1655  double* jac,
1656  double& jacDet,
1657  double* jacInv,
1658  double& x,
1659  double& y,
1660  double& z)
1661  {
1662  mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y,z);
1663  }
1664 
1665  inline void calculateH_element(const int eN,
1666  const int k,
1667  double* h_dof,
1668  int* mesh_l2g,
1669  //xt::pyarray<double>& mesh_trial_ref,
1670  double* mesh_trial_ref,
1671  double& h)
1672  {
1673  mapping.calculateH_element(eN,
1674  k,
1675  h_dof,
1676  mesh_l2g,
1677  mesh_trial_ref,
1678  h);
1679  }
1680 
1681  inline void calculateMappingVelocity_element(const int eN,
1682  const int k,
1683  double* meshVelocity_dof,
1684  int* mesh_l2g,
1685  //xt::pyarray<double>& mesh_trial_ref,
1686  double* mesh_trial_ref,
1687  double& xt,
1688  double& yt,
1689  double& zt)
1690  {
1691  mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,xt,yt,zt);
1692  }
1693 
1694  inline
1696  const int ebN_local,
1697  const int kb,
1698  const int ebN_local_kb,
1699  double* mesh_dof,
1700  int* mesh_l2g,
1701  double* mesh_trial_trace_ref,
1702  double* mesh_grad_trial_trace_ref,
1703  double* boundaryJac_ref,
1704  double* jac,
1705  double& jacDet,
1706  double* jacInv,
1707  double* boundaryJac,
1708  double* metricTensor,
1709  double& metricTensorDetSqrt,
1710  double* normal_ref,
1711  double* normal,
1712  double& x,
1713  double& y,
1714  double& z)
1715  {
1716  mapping.calculateMapping_elementBoundary(eN,
1717  ebN_local,
1718  kb,
1719  ebN_local_kb,
1720  mesh_dof,
1721  mesh_l2g,
1722  mesh_trial_trace_ref,
1723  mesh_grad_trial_trace_ref,
1724  boundaryJac_ref,
1725  jac,
1726  jacDet,
1727  jacInv,
1728  boundaryJac,
1729  metricTensor,
1730  metricTensorDetSqrt,
1731  normal_ref,
1732  normal,
1733  x,
1734  y,
1735  z);
1736  }
1737 
1738  inline
1740  const int ebN_local,
1741  const int kb,
1742  const int ebN_local_kb,
1743  double* mesh_velocity_dof,
1744  int* mesh_l2g,
1745  double* mesh_trial_trace_ref,
1746  double& xt,
1747  double& yt,
1748  double& zt,
1749  double* normal,
1750  double* boundaryJac,
1751  double* metricTensor,
1752  double& metricTensorDetSqrt)
1753  {
1754  mapping.calculateMappingVelocity_elementBoundary(eN,
1755  ebN_local,
1756  kb,
1757  ebN_local_kb,
1758  mesh_velocity_dof,
1759  mesh_l2g,
1760  mesh_trial_trace_ref,
1761  xt,
1762  yt,
1763  zt,
1764  normal,
1765  boundaryJac,
1766  metricTensor,
1767  metricTensorDetSqrt);
1768  }
1769  double Stress_u_weak(double* stress, double* grad_test_dV)
1770  {
1771  return stress[sXX]*grad_test_dV[X] + stress[sXY]*grad_test_dV[Y] + stress[sXZ]*grad_test_dV[Z];
1772  }
1773  double StressJacobian_u_u_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1774  {
1775  return
1776  (dstress[sXX*nSymTen+sXX]*grad_trial[X]+dstress[sXX*nSymTen+sXY]*grad_trial[Y]+dstress[sXX*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[X] +
1777  (dstress[sXY*nSymTen+sXX]*grad_trial[X]+dstress[sXY*nSymTen+sXY]*grad_trial[Y]+dstress[sXY*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Y] +
1778  (dstress[sXZ*nSymTen+sXX]*grad_trial[X]+dstress[sXZ*nSymTen+sXY]*grad_trial[Y]+dstress[sXZ*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Z];
1779  }
1780  double StressJacobian_u_v_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1781  {
1782  return
1783  (dstress[sXX*nSymTen+sYX]*grad_trial[X]+dstress[sXX*nSymTen+sYY]*grad_trial[Y]+dstress[sXX*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[X] +
1784  (dstress[sXY*nSymTen+sYX]*grad_trial[X]+dstress[sXY*nSymTen+sYY]*grad_trial[Y]+dstress[sXY*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Y] +
1785  (dstress[sXZ*nSymTen+sYX]*grad_trial[X]+dstress[sXZ*nSymTen+sYY]*grad_trial[Y]+dstress[sXZ*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Z];
1786  }
1787  double StressJacobian_u_w_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1788  {
1789  return
1790  (dstress[sXX*nSymTen+sZX]*grad_trial[X]+dstress[sXX*nSymTen+sZY]*grad_trial[Y]+dstress[sXX*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[X] +
1791  (dstress[sXY*nSymTen+sZX]*grad_trial[X]+dstress[sXY*nSymTen+sZY]*grad_trial[Y]+dstress[sXY*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Y] +
1792  (dstress[sXZ*nSymTen+sZX]*grad_trial[X]+dstress[sXZ*nSymTen+sZY]*grad_trial[Y]+dstress[sXZ*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Z];
1793  }
1794  double Stress_v_weak(double* stress, double* grad_test_dV)
1795  {
1796  return stress[sYX]*grad_test_dV[X] + stress[sYY]*grad_test_dV[Y] + stress[sYZ]*grad_test_dV[Z];
1797  }
1798  double StressJacobian_v_u_weak(double* dstress, double* grad_trial,double* grad_test_dV)
1799  {
1800  return
1801  (dstress[sYX*nSymTen+sXX]*grad_trial[X]+dstress[sYX*nSymTen+sXY]*grad_trial[Y]+dstress[sYX*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[X] +
1802  (dstress[sYY*nSymTen+sXX]*grad_trial[X]+dstress[sYY*nSymTen+sXY]*grad_trial[Y]+dstress[sYY*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Y] +
1803  (dstress[sYZ*nSymTen+sXX]*grad_trial[X]+dstress[sYZ*nSymTen+sXY]*grad_trial[Y]+dstress[sYZ*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Z];
1804  }
1805  double StressJacobian_v_v_weak(double* dstress, double* grad_trial,double* grad_test_dV)
1806  {
1807  return
1808  (dstress[sYX*nSymTen+sYX]*grad_trial[X]+dstress[sYX*nSymTen+sYY]*grad_trial[Y]+dstress[sYX*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[X] +
1809  (dstress[sYY*nSymTen+sYX]*grad_trial[X]+dstress[sYY*nSymTen+sYY]*grad_trial[Y]+dstress[sYY*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Y] +
1810  (dstress[sYZ*nSymTen+sYX]*grad_trial[X]+dstress[sYZ*nSymTen+sYY]*grad_trial[Y]+dstress[sYZ*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Z];
1811  }
1812  double StressJacobian_v_w_weak(double* dstress, double* grad_trial,double* grad_test_dV)
1813  {
1814  return
1815  (dstress[sYX*nSymTen+sZX]*grad_trial[X]+dstress[sYX*nSymTen+sZY]*grad_trial[Y]+dstress[sYX*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[X] +
1816  (dstress[sYY*nSymTen+sZX]*grad_trial[X]+dstress[sYY*nSymTen+sZY]*grad_trial[Y]+dstress[sYY*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Y] +
1817  (dstress[sYZ*nSymTen+sZX]*grad_trial[X]+dstress[sYZ*nSymTen+sZY]*grad_trial[Y]+dstress[sYZ*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Z];
1818  }
1819  double Stress_w_weak(double* stress, double* grad_test_dV)
1820  {
1821  return stress[sZX]*grad_test_dV[X] + stress[sZY]*grad_test_dV[Y] + stress[sZZ]*grad_test_dV[Z];
1822  }
1823  double StressJacobian_w_u_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1824  {
1825  return
1826  (dstress[sZX*nSymTen+sXX]*grad_trial[X]+dstress[sZX*nSymTen+sXY]*grad_trial[Y]+dstress[sZX*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[X] +
1827  (dstress[sZY*nSymTen+sXX]*grad_trial[X]+dstress[sZY*nSymTen+sXY]*grad_trial[Y]+dstress[sZY*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Y] +
1828  (dstress[sZZ*nSymTen+sXX]*grad_trial[X]+dstress[sZZ*nSymTen+sXY]*grad_trial[Y]+dstress[sZZ*nSymTen+sXZ]*grad_trial[Z])*grad_test_dV[Z];
1829  }
1830  double StressJacobian_w_v_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1831  {
1832  return
1833  (dstress[sZX*nSymTen+sYX]*grad_trial[X]+dstress[sZX*nSymTen+sYY]*grad_trial[Y]+dstress[sZX*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[X] +
1834  (dstress[sZY*nSymTen+sYX]*grad_trial[X]+dstress[sZY*nSymTen+sYY]*grad_trial[Y]+dstress[sZY*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Y] +
1835  (dstress[sZZ*nSymTen+sYX]*grad_trial[X]+dstress[sZZ*nSymTen+sYY]*grad_trial[Y]+dstress[sZZ*nSymTen+sYZ]*grad_trial[Z])*grad_test_dV[Z];
1836  }
1837  double StressJacobian_w_w_weak(double* dstress, double* grad_trial, double* grad_test_dV)
1838  {
1839  return
1840  (dstress[sZX*nSymTen+sZX]*grad_trial[X]+dstress[sZX*nSymTen+sZY]*grad_trial[Y]+dstress[sZX*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[X] +
1841  (dstress[sZY*nSymTen+sZX]*grad_trial[X]+dstress[sZY*nSymTen+sZY]*grad_trial[Y]+dstress[sZY*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Y] +
1842  (dstress[sZZ*nSymTen+sZX]*grad_trial[X]+dstress[sZZ*nSymTen+sZY]*grad_trial[Y]+dstress[sZZ*nSymTen+sZZ]*grad_trial[Z])*grad_test_dV[Z];
1843  }
1844  double ExteriorElementBoundaryStressFlux(const double& stressFlux,const double& disp_test_dS)
1845  {
1846  return stressFlux*disp_test_dS;
1847  }
1848  double ExteriorElementBoundaryStressFluxJacobian(const double& dstressFlux,const double& disp_test_dS)
1849  {
1850  return dstressFlux*disp_test_dS;
1851  }
1852 };
1853 
1854 //specialization for 2D
1855 template<int NDOF_MESH_TRIAL_ELEMENT, int NDOF_TRIAL_ELEMENT, int NDOF_TEST_ELEMENT>
1856 class CompKernel<2,NDOF_MESH_TRIAL_ELEMENT,NDOF_TRIAL_ELEMENT,NDOF_TEST_ELEMENT>
1857 {
1858 public:
1860  const int X,
1861  Y,
1871  X(mapping.X),
1872  Y(mapping.Y),
1873  XX(mapping.XX),XY(mapping.XY),
1874  YX(mapping.YX),YY(mapping.YY),
1878  XHX(mapping.XHX),
1879  YHX(mapping.YHX),
1880  HXHX(mapping.HXHX)
1881  {}
1882  inline void calculateG(double* jacInv,double* G,double& G_dd_G, double& tr_G)
1883  {
1884  //get the metric tensor
1885  //cek todo use symmetry
1886  for (int I=0;I<2;I++)
1887  for (int J=0;J<2;J++)
1888  {
1889  G[I*2+J] = 0.0;
1890  for (int K=0;K<2;K++)
1891  G[I*2+J] += jacInv[K*2+I]*jacInv[K*2+J];
1892  }
1893  G_dd_G = 0.0;
1894  tr_G = 0.0;
1895  for (int I=0;I<2;I++)
1896  {
1897  tr_G += G[I*2+I];
1898  for (int J=0;J<2;J++)
1899  {
1900  G_dd_G += G[I*2+J]*G[I*2+J];
1901  }
1902  }
1903  }
1904  inline void calculateGScale(double* G,double* v,double& h)
1905  {
1906  h = 0.0;
1907  for (int I=0;I<2;I++)
1908  for (int J=0;J<2;J++)
1909  h += v[I]*G[I*2+J]*v[J];
1910  h = 1.0/sqrt(h+1.0e-12);
1911  }
1912  inline void valFromDOF(const double* dof,const int* l2g_element,const double* trial_ref,double& val)
1913  {
1914  val=0.0;
1915  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1916  val+=dof[l2g_element[j]]*trial_ref[j];
1917  }
1918 
1919  inline void gradFromDOF(const double* dof,const int* l2g_element,const double* grad_trial,double* grad)
1920  {
1921  for(int I=0;I<2;I++)
1922  grad[I] = 0.0;
1923  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1924  for(int I=0;I<2;I++)
1925  grad[I] += dof[l2g_element[j]]*grad_trial[j*2+I];
1926  }
1927 
1928  inline void hessFromDOF(const double* dof,const int* l2g_element,const double* hess_trial,double* hess)
1929  {
1930  for(int I=0;I<2;I++)
1931  for(int J=0;J<2;J++)
1932  hess[I*2+J] = 0.0;
1933  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1934  for(int I=0;I<2;I++)
1935  for(int J=0;J<2;J++)
1936  hess[I*2+J] += dof[l2g_element[j]]*hess_trial[j*4+I*2+J];
1937  }
1938 
1939  inline void valFromElementDOF(const double* dof,const double* trial_ref,double& val)
1940  {
1941  val=0.0;
1942  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1943  val+=dof[j]*trial_ref[j];
1944  }
1945 
1946  inline void gradFromElementDOF(const double* dof,const double* grad_trial,double* grad)
1947  {
1948  for(int I=0;I<2;I++)
1949  grad[I] = 0.0;
1950  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1951  for(int I=0;I<2;I++)
1952  grad[I] += dof[j]*grad_trial[j*2+I];
1953  }
1954 
1955  inline void gradTrialFromRef(const double* grad_trial_ref, const double* jacInv, double* grad_trial)
1956  {
1957  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1958  for(int I=0;I<2;I++)
1959  grad_trial[j*2+I] = 0.0;
1960  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1961  for(int I=0;I<2;I++)
1962  for(int J=0;J<2;J++)
1963  grad_trial[j*2+I] += jacInv[J*2+I]*grad_trial_ref[j*2+J];
1964  }
1965 
1966  /*
1967  * DOFaverage
1968  * ----------
1969  *
1970  * Calculate the average DOF value for at a given mesh element.
1971  *
1972  * @param dof array of finite element DOF values
1973  * @param l2g_element local 2 global mapping for the current mesh element
1974  * @param val return value with the average DOF values
1975  */
1976 
1977  inline void DOFaverage (const double* dof, const int* l2g_element, double& val)
1978  {
1979  val = 0.0;
1980 
1981  for (int j=0; j<NDOF_MESH_TRIAL_ELEMENT; j++)
1982  val+=dof[l2g_element[j]];
1983 
1984  val /= NDOF_MESH_TRIAL_ELEMENT;
1985  }
1986 
1987 
1988  inline void hessTrialFromRef(const double* hess_trial_ref, const double* jacInv, double* hess_trial)
1989  {
1990  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1991  for(int I=0;I<2;I++)
1992  for(int J=0;J<2;J++)
1993  hess_trial[j*4+I*2+J] = 0.0;
1994  for (int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1995  for(int I=0;I<2;I++)
1996  for(int J=0;J<2;J++)
1997  for(int K=0;K<2;K++)
1998  for(int L=0;L<2;L++)
1999  hess_trial[j*4+I*2+J] += hess_trial_ref[j*4+K*2+L]*jacInv[L*2+J]*jacInv[K*2+I];
2000  }
2001 
2002  inline void gradTestFromRef(const double* grad_test_ref, const double* jacInv, double* grad_test)
2003  {
2004  for (int i=0;i<NDOF_TEST_ELEMENT;i++)
2005  for(int I=0;I<2;I++)
2006  grad_test[i*2+I] = 0.0;
2007  for (int i=0;i<NDOF_TEST_ELEMENT;i++)
2008  for(int I=0;I<2;I++)
2009  for(int J=0;J<2;J++)
2010  grad_test[i*2+I] += jacInv[J*2+I]*grad_test_ref[i*2+J];
2011  }
2012 
2013  inline void backwardEuler(const double& dt, const double& m_old, const double& m, const double& dm, double& mt, double& dmt)
2014  {
2015  mt =(m-m_old)/dt;
2016  dmt = dm/dt;
2017  }
2018 
2019  inline void bdf(const double& alpha, const double& beta, const double& m, const double& dm, double& mt, double& dmt)
2020  {
2021  mt =alpha*m + beta;
2022  dmt = alpha*dm;
2023  }
2024 
2025  inline void bdfC2(const double& alpha, const double& beta, const double& m, const double& dm, const double& dm2, double& mt, double& dmt, double& dm2t)
2026  {
2027  mt =alpha*m + beta;
2028  dmt = alpha*dm;
2029  dm2t = alpha*dm2;
2030  }
2031 
2032  inline double Mass_weak(const double& mt, const double& w_dV)
2033  {
2034  return mt*w_dV;
2035  }
2036 
2037  inline double MassJacobian_weak(const double& dmt,
2038  const double& v,
2039  const double& w_dV)
2040  {
2041  return dmt*v*w_dV;
2042  }
2043 
2044  inline double Mass_strong(const double& mt)
2045  {
2046  return mt;
2047  }
2048 
2049  inline double MassJacobian_strong(const double& dmt,
2050  const double& v)
2051  {
2052  return dmt*v;
2053  }
2054 
2055  inline double Mass_adjoint(const double& dmt,
2056  const double& w_dV)
2057  {
2058  return dmt*w_dV;
2059  }
2060 
2061  /*
2062  * pressureProjection_weak
2063  * -----------------------
2064  *
2065  * Inner product calculation of the pressure projection
2066  * stablization method of Bochev, Dohrmann and
2067  * Gunzburger (2006).
2068  *
2069  * @param viscosity viscosity at point
2070  * @param p the pressure value (either trial function
2071  * or actual value)
2072  * @param p_avg the pressure projection value (either
2073  * 1./3. for test functions of the average
2074  * value of the pressure on the element)
2075  * @param dV this is the integral weight
2076  *
2077  */
2078 
2079  inline double pressureProjection_weak(const double& viscosity,
2080  const double& p,
2081  const double& p_avg,
2082  const double& q,
2083  const double& dV)
2084  {
2085  if (viscosity==0.){ return 0.;}
2086  return (1./viscosity)*(p-p_avg)*(q-1./3.)*dV;
2087  }
2088 
2089  inline double Advection_weak(const double f[2],
2090  const double grad_w_dV[2])
2091  {
2092  double tmp=0.0;
2093  for(int I=0;I<2;I++)
2094  tmp -= f[I]*grad_w_dV[I];
2095  return tmp;
2096  }
2097 
2098  inline double AdvectionJacobian_weak(const double df[2],
2099  const double& v,
2100  const double grad_w_dV[2])
2101  {
2102  double tmp=0.0;
2103  for(int I=0;I<2;I++)
2104  tmp -= df[I]*v*grad_w_dV[I];
2105  return tmp;
2106  }
2107 
2108  inline double Advection_strong(const double df[2],
2109  const double grad_u[2])
2110  {
2111  double tmp=0.0;
2112  for(int I=0;I<2;I++)
2113  tmp += df[I]*grad_u[I];
2114  return tmp;
2115  }
2116 
2117  inline double AdvectionJacobian_strong(const double df[2],
2118  const double grad_v[2])
2119  {
2120  double tmp=0.0;
2121  for(int I=0;I<2;I++)
2122  tmp += df[I]*grad_v[I];
2123  return tmp;
2124  }
2125 
2126  inline double Advection_adjoint(const double df[2],
2127  const double grad_w_dV[2])
2128  {
2129  double tmp=0.0;
2130  for(int I=0;I<2;I++)
2131  tmp -= df[I]*grad_w_dV[I];
2132  return tmp;
2133  }
2134 
2135  inline double Hamiltonian_weak(const double& H,
2136  const double& w_dV)
2137  {
2138  return H*w_dV;
2139  }
2140 
2141  inline double HamiltonianJacobian_weak(const double dH[2],
2142  const double grad_v[2],
2143  const double& w_dV)
2144  {
2145  double tmp=0.0;
2146  for(int I=0;I<2;I++)
2147  tmp += dH[I]*grad_v[I]*w_dV;
2148  return tmp;
2149  }
2150 
2151  inline double Hamiltonian_strong(const double dH[2],
2152  const double grad_u[2])
2153  {
2154  double tmp=0.0;
2155  for(int I=0;I<2;I++)
2156  tmp += dH[I]*grad_u[I];
2157  return tmp;
2158  }
2159 
2160  inline double HamiltonianJacobian_strong(const double dH[2],
2161  const double grad_v[2])
2162  {
2163  double tmp=0.0;
2164  for(int I=0;I<2;I++)
2165  tmp += dH[I]*grad_v[I];
2166  return tmp;
2167  }
2168 
2169  inline double Hamiltonian_adjoint(const double dH[2],
2170  const double grad_w_dV[2])
2171  {
2172  double tmp=0.0;
2173  for(int I=0;I<2;I++)
2174  tmp -= dH[I]*grad_w_dV[I];
2175  return tmp;
2176  }
2177 
2178  inline double Diffusion_weak(int* rowptr,
2179  int* colind,
2180  double* a,
2181  const double grad_phi[2],
2182  const double grad_w_dV[2])
2183  {
2184  double tmp=0.0;
2185  for(int I=0;I<2;I++)
2186  for (int m=rowptr[I];m<rowptr[I+1];m++)
2187  tmp += a[m]*grad_phi[colind[m]]*grad_w_dV[I];
2188  return tmp;
2189  }
2190 
2191  inline double DiffusionJacobian_weak(int* rowptr,
2192  int* colind,
2193  double* a,
2194  double* da,
2195  const double grad_phi[2],
2196  const double grad_w_dV[2],
2197  const double& dphi,
2198  const double& v,
2199  const double grad_v[2])
2200  {
2201  double daProduct=0.0,dphiProduct=0.0;
2202  for (int I=0;I<2;I++)
2203  for (int m=rowptr[I];m<rowptr[I+1];m++)
2204  {
2205  daProduct += da[m]*grad_phi[colind[m]]*grad_w_dV[I];
2206  dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
2207  }
2208  return daProduct*v+dphiProduct*dphi;
2209  }
2210 
2211  inline double SimpleDiffusionJacobian_weak(int* rowptr,
2212  int* colind,
2213  double* a,
2214  const double grad_v[2],
2215  const double grad_w_dV[2])
2216  {
2217  double dphiProduct=0.0;
2218  for (int I=0;I<2;I++)
2219  for (int m=rowptr[I];m<rowptr[I+1];m++)
2220  {
2221  dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
2222  }
2223  return dphiProduct;
2224  }
2225 
2226  inline double Reaction_weak(const double& r,
2227  const double& w_dV)
2228  {
2229  return r*w_dV;
2230  }
2231 
2232  inline double ReactionJacobian_weak(const double& dr,
2233  const double& v,
2234  const double& w_dV)
2235  {
2236  return dr*v*w_dV;
2237  }
2238 
2239  inline double Reaction_strong(const double& r)
2240  {
2241  return r;
2242  }
2243 
2244  inline double ReactionJacobian_strong(const double& dr,
2245  const double& v)
2246  {
2247  return dr*v;
2248  }
2249 
2250  inline double Reaction_adjoint(const double& dr,
2251  const double& w_dV)
2252  {
2253  return dr*w_dV;
2254  }
2255 
2256  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
2257  const double& elementDiameter,
2258  const double& strong_residual,
2259  const double grad_u[2],
2260  double& numDiff)
2261  {
2262  double h,
2263  num,
2264  den,
2265  n_grad_u;
2266  h = elementDiameter;
2267  n_grad_u = 0.0;
2268  for (int I=0;I<2;I++)
2269  n_grad_u += grad_u[I]*grad_u[I];
2270  num = shockCapturingDiffusion*0.5*h*fabs(strong_residual);
2271  den = sqrt(n_grad_u+1.0e-12);
2272  //cek hack shockCapturingDiffusion*fabs(strong_residual)*grad_phi_G_grad_phi
2273  numDiff = num/den;
2274  }
2275 
2276 
2277  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
2278  const double G[2*2],
2279  const double& strong_residual,
2280  const double grad_u[2],
2281  double& numDiff)
2282  {
2283  double den = 0.0;
2284  for (int I=0;I<2;I++)
2285  for (int J=0;J<2;J++)
2286  den += grad_u[I]*G[I*2+J]*grad_u[J];
2287 
2288  numDiff = shockCapturingDiffusion*fabs(strong_residual)/(sqrt(den+1.0e-12));
2289  }
2290 
2291  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
2292  const double& uref, const double& beta,
2293  const double G[2*2],
2294  const double& G_dd_G,
2295  const double& strong_residual,
2296  const double grad_u[2],
2297  double& numDiff)
2298  {
2299  double den = 0.0;
2300  for (int I=0;I<2;I++)
2301  for (int J=0;J<2;J++)
2302  den += grad_u[I]*G[I*2+J]*grad_u[J];
2303 
2304  double h2_uref_1 = 1.0/(sqrt(den+1.0e-12));
2305  double h2_uref_2 = 1.0/(uref*sqrt(G_dd_G+1.0e-12));
2306  numDiff = shockCapturingDiffusion*fabs(strong_residual)*pow(h2_uref_1, 2.0-beta)*pow(h2_uref_2,beta-1.0);
2307  }
2308 
2309 
2310 
2311  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
2312  const double G[2*2],
2313  const double& strong_residual,
2314  const double vel[2],
2315  const double grad_u[2],
2316  double& numDiff)
2317  {
2318  double den1 = 0.0,den2=0.0, nom=0.0;
2319  for (int I=0;I<2;I++)
2320  {
2321  nom += vel[I]*vel[I];
2322  den2+= grad_u[I]*grad_u[I];
2323  for (int J=0;J<2;J++)
2324  den1 += vel[I]*G[I*2+J]*vel[J];
2325  }
2326  numDiff = shockCapturingDiffusion*fabs(strong_residual)*(sqrt(nom/(den1*den2 + 1.0e-12)));
2327  }
2328 
2329 
2330  inline void calculateNumericalDiffusion(const double& shockCapturingDiffusion,
2331  const double& elementDiameter,
2332  const double& strong_residual,
2333  const double grad_u[2],
2334  double& gradNorm,
2335  double& gradNorm_last,
2336  double& numDiff)
2337  {
2338  double h,
2339  num,
2340  n_grad_u;
2341  h = elementDiameter;
2342  n_grad_u = 0.0;
2343  for (int I=0;I<2;I++)
2344  n_grad_u += grad_u[I]*grad_u[I];
2345  num = shockCapturingDiffusion*0.5*h*fabs(strong_residual);
2346  gradNorm = sqrt(n_grad_u+1.0e-12);
2347  //cek hack shockCapturingDiffusion*fabs(strong_residual)*grad_phi_G_grad_phi
2348  numDiff = num/gradNorm_last;
2349  }
2350 
2351  inline double SubgridError(const double& error,
2352  const double& Lstar_w_dV)
2353  {
2354  return error*Lstar_w_dV;
2355  }
2356 
2357  inline double SubgridErrorJacobian(const double& derror,
2358  const double& Lstar_w_dV)
2359  {
2360  return derror*Lstar_w_dV;
2361  }
2362 
2363  inline double NumericalDiffusion(const double& numDiff,
2364  const double grad_u[2],
2365  const double grad_w_dV[2])
2366  {
2367  double tmp=0.0;
2368  for (int I=0;I<2;I++)
2369  tmp += numDiff*grad_u[I]*grad_w_dV[I];
2370  return tmp;
2371  }
2372 
2373  inline double NumericalDiffusionJacobian(const double& numDiff,
2374  const double grad_v[2],
2375  const double grad_w_dV[2])
2376  {
2377  double tmp=0.0;
2378  for (int I=0;I<2;I++)
2379  tmp += numDiff*grad_v[I]*grad_w_dV[I];
2380  return tmp;
2381  }
2382 
2383 
2384 
2385  inline double ExteriorElementBoundaryFlux(const double& flux,
2386  const double& w_dS)
2387  {
2388  return flux*w_dS;
2389  }
2390 
2391  inline double InteriorElementBoundaryFlux(const double& flux,
2392  const double& w_dS)
2393  {
2394  return flux*w_dS;
2395  }
2396 
2397  inline double ExteriorNumericalAdvectiveFluxJacobian(const double& dflux_left,
2398  const double& v)
2399  {
2400  return dflux_left*v;
2401  }
2402 
2403  inline double InteriorNumericalAdvectiveFluxJacobian(const double& dflux_left,
2404  const double& v)
2405  {
2406  return dflux_left*v;
2407  }
2408 
2409  inline double ExteriorElementBoundaryScalarDiffusionAdjoint(const int& isDOFBoundary,
2410  const int& isFluxBoundary,
2411  const double& sigma,
2412  const double& u,
2413  const double& bc_u,
2414  const double normal[2],
2415  const double& a,
2416  const double grad_w_dS[2])
2417  {
2418  double tmp=0.0;
2419  for(int I=0;I<2;I++)
2420  {
2421  tmp += normal[I]*grad_w_dS[I];
2422  }
2423  tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*(u-bc_u)*a;
2424  return tmp;
2425  }
2426 
2427  inline double ExteriorElementBoundaryScalarDiffusionAdjointJacobian(const int& isDOFBoundary,
2428  const int& isFluxBoundary,
2429  const double& sigma,
2430  const double& v,
2431  const double normal[2],
2432  const double& a,
2433  const double grad_w_dS[2])
2434  {
2435  double tmp=0.0;
2436  for(int I=0;I<2;I++)
2437  {
2438  tmp += normal[I]*grad_w_dS[I];
2439  }
2440  tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*v*a;
2441  return tmp;
2442  }
2443 
2444  inline double ExteriorElementBoundaryDiffusionAdjoint(const int& isDOFBoundary,
2445  const int& isFluxBoundary,
2446  const double& sigma,
2447  const double& u,
2448  const double& bc_u,
2449  const double normal[2],
2450  int* rowptr,
2451  int* colind,
2452  double* a,
2453  const double grad_w_dS[2])
2454  {
2455  double tmp=0.0;
2456  for(int I=0;I<2;I++)
2457  for (int m=rowptr[I];m<rowptr[I+1];m++)
2458  tmp += (1.0-isFluxBoundary)*isDOFBoundary*sigma*(u-bc_u)*a[m]*normal[colind[m]]*grad_w_dS[I];
2459  return tmp;
2460  }
2461 
2462  inline double ExteriorElementBoundaryDiffusionAdjointJacobian(const int& isDOFBoundary,
2463  const int& isFluxBoundary,
2464  const double& sigma,
2465  const double& v,
2466  const double normal[2],
2467  int* rowptr,
2468  int* colind,
2469  double* a,
2470  const double grad_w_dS[2])
2471  {
2472  double tmp=0.0;
2473  for(int I=0;I<2;I++)
2474  for (int m=rowptr[I];m<rowptr[I+1];m++)
2475  tmp += (1.0-isFluxBoundary)*isDOFBoundary*sigma*v*a[m]*normal[colind[m]]*grad_w_dS[I];
2476  return tmp;
2477  }
2478 
2479  inline void calculateMapping_element(const int eN,
2480  const int k,
2481  double* mesh_dof,
2482  int* mesh_l2g,
2483  //xt::pyarray<double>& mesh_trial_ref,
2484  double* mesh_trial_ref,
2485  double* mesh_grad_trial_ref,
2486  double* jac,
2487  double& jacDet,
2488  double* jacInv,
2489  double& x,
2490  double& y)
2491  {
2492  mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y);
2493  }
2494 
2495  inline void calculateH_element(const int eN,
2496  const int k,
2497  double* h_dof,
2498  int* mesh_l2g,
2499  //xt::pyarray<double>& mesh_trial_ref,
2500  double* mesh_trial_ref,
2501  double& h)
2502  {
2503  mapping.calculateH_element(eN,
2504  k,
2505  h_dof,
2506  mesh_l2g,
2507  mesh_trial_ref,
2508  h);
2509  }
2510 
2511  inline void calculateMapping_element(const int eN,
2512  const int k,
2513  double* mesh_dof,
2514  int* mesh_l2g,
2515  //xt::pyarray<double>& mesh_trial_ref,
2516  double* mesh_trial_ref,
2517  double* mesh_grad_trial_ref,
2518  double* jac,
2519  double& jacDet,
2520  double* jacInv,
2521  double& x,
2522  double& y,
2523  double& z)
2524  {
2525  mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y,z);
2526  }
2527 
2528  inline void calculateMappingVelocity_element(const int eN,
2529  const int k,
2530  double* meshVelocity_dof,
2531  int* mesh_l2g,
2532  //xt::pyarray<double>& mesh_trial_ref,
2533  double* mesh_trial_ref,
2534  double& xt,
2535  double& yt)
2536  {
2537  mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,xt,yt);
2538  }
2539 
2540  inline void calculateMappingVelocity_element(const int eN,
2541  const int k,
2542  double* meshVelocity_dof,
2543  int* mesh_l2g,
2544  //xt::pyarray<double>& mesh_trial_ref,
2545  double* mesh_trial_ref,
2546  double& xt,
2547  double& yt,
2548  double& zt)
2549  {
2550  mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,xt,yt,zt);
2551  }
2552 
2553  inline
2555  const int ebN_local,
2556  const int kb,
2557  const int ebN_local_kb,
2558  double* mesh_dof,
2559  int* mesh_l2g,
2560  double* mesh_trial_trace_ref,
2561  double* mesh_grad_trial_trace_ref,
2562  double* boundaryJac_ref,
2563  double* jac,
2564  double& jacDet,
2565  double* jacInv,
2566  double* boundaryJac,
2567  double* metricTensor,
2568  double& metricTensorDetSqrt,
2569  double* normal_ref,
2570  double* normal,
2571  double& x,
2572  double& y)
2573  {
2574  mapping.calculateMapping_elementBoundary(eN,
2575  ebN_local,
2576  kb,
2577  ebN_local_kb,
2578  mesh_dof,
2579  mesh_l2g,
2580  mesh_trial_trace_ref,
2581  mesh_grad_trial_trace_ref,
2582  boundaryJac_ref,
2583  jac,
2584  jacDet,
2585  jacInv,
2586  boundaryJac,
2587  metricTensor,
2588  metricTensorDetSqrt,
2589  normal_ref,
2590  normal,
2591  x,
2592  y);
2593  }
2594 
2595  inline
2597  const int ebN_local,
2598  const int kb,
2599  const int ebN_local_kb,
2600  double* mesh_dof,
2601  int* mesh_l2g,
2602  double* mesh_trial_trace_ref,
2603  double* mesh_grad_trial_trace_ref,
2604  double* boundaryJac_ref,
2605  double* jac,
2606  double& jacDet,
2607  double* jacInv,
2608  double* boundaryJac,
2609  double* metricTensor,
2610  double& metricTensorDetSqrt,
2611  double* normal_ref,
2612  double* normal,
2613  double& x,
2614  double& y,
2615  double& z)
2616  {
2617  mapping.calculateMapping_elementBoundary(eN,
2618  ebN_local,
2619  kb,
2620  ebN_local_kb,
2621  mesh_dof,
2622  mesh_l2g,
2623  mesh_trial_trace_ref,
2624  mesh_grad_trial_trace_ref,
2625  boundaryJac_ref,
2626  jac,
2627  jacDet,
2628  jacInv,
2629  boundaryJac,
2630  metricTensor,
2631  metricTensorDetSqrt,
2632  normal_ref,
2633  normal,
2634  x,
2635  y,
2636  z);
2637  }
2638 
2639  inline
2641  const int ebN_local,
2642  const int kb,
2643  const int ebN_local_kb,
2644  double* mesh_velocity_dof,
2645  int* mesh_l2g,
2646  double* mesh_trial_trace_ref,
2647  double& xt,
2648  double& yt,
2649  double* normal,
2650  double* boundaryJac,
2651  double* metricTensor,
2652  double& metricTensorDetSqrt)
2653  {
2654  mapping.calculateMappingVelocity_elementBoundary(eN,
2655  ebN_local,
2656  kb,
2657  ebN_local_kb,
2658  mesh_velocity_dof,
2659  mesh_l2g,
2660  mesh_trial_trace_ref,
2661  xt,
2662  yt,
2663  normal,
2664  boundaryJac,
2665  metricTensor,
2666  metricTensorDetSqrt);
2667  }
2668  inline
2670  const int ebN_local,
2671  const int kb,
2672  const int ebN_local_kb,
2673  double* mesh_velocity_dof,
2674  int* mesh_l2g,
2675  double* mesh_trial_trace_ref,
2676  double& xt,
2677  double& yt,
2678  double& zt,
2679  double* normal,
2680  double* boundaryJac,
2681  double* metricTensor,
2682  double& metricTensorDetSqrt)
2683  {
2684  mapping.calculateMappingVelocity_elementBoundary(eN,
2685  ebN_local,
2686  kb,
2687  ebN_local_kb,
2688  mesh_velocity_dof,
2689  mesh_l2g,
2690  mesh_trial_trace_ref,
2691  xt,
2692  yt,
2693  zt,
2694  normal,
2695  boundaryJac,
2696  metricTensor,
2697  metricTensorDetSqrt);
2698  }
2699  double Stress_u_weak(double* stress, double* grad_test_dV)
2700  {
2701  return stress[sXX]*grad_test_dV[X] + stress[sXY]*grad_test_dV[Y];
2702  }
2703  double StressJacobian_u_u_weak(double* dstress, double* grad_trial, double* grad_test_dV)
2704  {
2705  return
2706  (dstress[sXX*nSymTen+sXX]*grad_trial[X]+dstress[sXX*nSymTen+sXY]*grad_trial[Y])*grad_test_dV[X] +
2707  (dstress[sXY*nSymTen+sXX]*grad_trial[X]+dstress[sXY*nSymTen+sXY]*grad_trial[Y])*grad_test_dV[Y];
2708  }
2709  double StressJacobian_u_v_weak(double* dstress, double* grad_trial, double* grad_test_dV)
2710  {
2711  return
2712  (dstress[sXX*nSymTen+sYX]*grad_trial[X]+dstress[sXX*nSymTen+sYY]*grad_trial[Y])*grad_test_dV[X] +
2713  (dstress[sXY*nSymTen+sYX]*grad_trial[X]+dstress[sXY*nSymTen+sYY]*grad_trial[Y])*grad_test_dV[Y];
2714  }
2715  double Stress_v_weak(double* stress, double* grad_test_dV)
2716  {
2717  return stress[sYX]*grad_test_dV[X] + stress[sYY]*grad_test_dV[Y];
2718  }
2719  double StressJacobian_v_u_weak(double* dstress, double* grad_trial,double* grad_test_dV)
2720  {
2721  return
2722  (dstress[sYX*nSymTen+sXX]*grad_trial[X]+dstress[sYX*nSymTen+sXY]*grad_trial[Y])*grad_test_dV[X] +
2723  (dstress[sYY*nSymTen+sXX]*grad_trial[X]+dstress[sYY*nSymTen+sXY]*grad_trial[Y])*grad_test_dV[Y];
2724  }
2725  double StressJacobian_v_v_weak(double* dstress, double* grad_trial,double* grad_test_dV)
2726  {
2727  return
2728  (dstress[sYX*nSymTen+sYX]*grad_trial[X]+dstress[sYX*nSymTen+sYY]*grad_trial[Y])*grad_test_dV[X] +
2729  (dstress[sYY*nSymTen+sYX]*grad_trial[X]+dstress[sYY*nSymTen+sYY]*grad_trial[Y])*grad_test_dV[Y];
2730  }
2731  double ExteriorElementBoundaryStressFlux(const double& stressFlux,const double& disp_test_dS)
2732  {
2733  return stressFlux*disp_test_dS;
2734  }
2735  double ExteriorElementBoundaryStressFluxJacobian(const double& dstressFlux,const double& disp_test_dS)
2736  {
2737  return dstressFlux*disp_test_dS;
2738  }
2739 };
2740 #endif
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::NumericalDiffusion
double NumericalDiffusion(const double &numDiff, const double grad_u[2], const double grad_w_dV[2])
Definition: CompKernel.h:2363
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::XY
const int XY
Definition: CompKernel.h:625
CompKernel::HYHX
const int HYHX
Definition: CompKernel.h:1035
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt)
Definition: CompKernel.h:528
CompKernel::sXZ
const int sXZ
Definition: CompKernel.h:1027
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Advection_adjoint
double Advection_adjoint(const double df[2], const double grad_w_dV[2])
Definition: CompKernel.h:2126
CompKernel::sXX
const int sXX
Definition: CompKernel.h:1027
CompKernelSpaceMapping::hessFromDOF
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
Definition: CompKernel.h:160
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::hessFromDOF
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
Definition: CompKernel.h:888
Y
Double * Y
Definition: Headers.h:48
CompKernelSpaceMapping::calculateH_element
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
CompKernel::ExteriorElementBoundaryScalarDiffusionAdjointJacobian
double ExteriorElementBoundaryScalarDiffusionAdjointJacobian(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &v, const double normal[NSPACE], const double &a, const double grad_w_dS[NSPACE])
Definition: CompKernel.h:1596
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::DOFaverage
void DOFaverage(const double *dof, const int *l2g_element, double &val)
Definition: CompKernel.h:1977
CompKernel::Stress_u_weak
double Stress_u_weak(double *stress, double *grad_test_dV)
Definition: CompKernel.h:1769
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::sYY
const int sYY
Definition: CompKernel.h:1865
CompKernel::pressureProjection_weak
double pressureProjection_weak(const double &viscosity, const double &p, const double &p_avg, const double &q, const double &dV)
Definition: CompKernel.h:1250
CompKernel::YX
const int YX
Definition: CompKernel.h:1025
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::AdvectionJacobian_weak
double AdvectionJacobian_weak(const double df[2], const double &v, const double grad_w_dV[2])
Definition: CompKernel.h:2098
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::AdvectionJacobian_strong
double AdvectionJacobian_strong(const double df[2], const double grad_v[2])
Definition: CompKernel.h:2117
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::MassJacobian_weak
double MassJacobian_weak(const double &dmt, const double &v, const double &w_dV)
Definition: CompKernel.h:2037
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::mapping
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT > mapping
Definition: CompKernel.h:1859
equivalent_polynomials::XY
const int XY(1)
EIndex< 2 >::nSymTen
const int nSymTen
Definition: CompKernel.h:59
CompKernel::XZ
const int XZ
Definition: CompKernel.h:1024
CompKernel::XHY
const int XHY
Definition: CompKernel.h:1031
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Hamiltonian_strong
double Hamiltonian_strong(const double dH[2], const double grad_u[2])
Definition: CompKernel.h:2151
CompKernel::DOFaverage
void DOFaverage(const double *dof, const int *l2g_element, double &val)
Definition: CompKernel.h:1149
CompKernel::NumericalDiffusion
double NumericalDiffusion(const double &numDiff, const double grad_u[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1532
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::ZHY
const int ZHY
Definition: CompKernel.h:188
CompKernelSpaceMapping::valFromDOF
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
Definition: CompKernel.h:144
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::gradFromDOF
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
Definition: CompKernel.h:481
EIndex< 3 >::sZZ
const int sZZ
Definition: CompKernel.h:24
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::YHX
const int YHX
Definition: CompKernel.h:631
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::valFromDOF
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
Definition: CompKernel.h:872
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryScalarDiffusionAdjoint
double ExteriorElementBoundaryScalarDiffusionAdjoint(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &u, const double &bc_u, const double normal[2], const double &a, const double grad_w_dS[2])
Definition: CompKernel.h:2409
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[2], double &numDiff)
Definition: CompKernel.h:2256
CompKernel::sXY
const int sXY
Definition: CompKernel.h:1027
CompKernel::ExteriorElementBoundaryScalarDiffusionAdjoint
double ExteriorElementBoundaryScalarDiffusionAdjoint(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &u, const double &bc_u, const double normal[NSPACE], const double &a, const double grad_w_dS[NSPACE])
Definition: CompKernel.h:1578
CompKernel::Diffusion_weak
double Diffusion_weak(int *rowptr, int *colind, double *a, const double grad_phi[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1349
EIndex< 3 >::YZ
const int YZ
Definition: CompKernel.h:20
CompKernel::ZX
const int ZX
Definition: CompKernel.h:1026
CompKernel::DiffusionJacobian_weak
double DiffusionJacobian_weak(int *rowptr, int *colind, double *a, double *da, const double grad_phi[NSPACE], const double grad_w_dV[NSPACE], const double &dphi, const double &v, const double grad_v[NSPACE])
Definition: CompKernel.h:1362
equivalent_polynomials::YY
const int YY(4)
CompKernel::XX
const int XX
Definition: CompKernel.h:1024
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::XZ
const int XZ
Definition: CompKernel.h:179
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::XHX
const int XHX
Definition: CompKernel.h:630
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::StressJacobian_v_v_weak
double StressJacobian_v_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:2725
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateGScale
void calculateGScale(double *G, double *v, double &h)
Definition: CompKernel.h:1904
CompKernel::HamiltonianJacobian_weak
double HamiltonianJacobian_weak(const double dH[NSPACE], const double grad_v[NSPACE], const double &w_dV)
Definition: CompKernel.h:1312
EIndex< 2 >::XY
const int XY
Definition: CompKernel.h:55
CompKernel::Hamiltonian_adjoint
double Hamiltonian_adjoint(const double dH[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1340
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::XHX
const int XHX
Definition: CompKernel.h:1867
CompKernel::ZHY
const int ZHY
Definition: CompKernel.h:1033
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::backwardEuler
void backwardEuler(const double &dt, const double &m_old, const double &m, const double &dm, double &mt, double &dmt)
Definition: CompKernel.h:2013
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Reaction_strong
double Reaction_strong(const double &r)
Definition: CompKernel.h:2239
f
Double f
Definition: Headers.h:64
CompKernel::gradFromDOF
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
Definition: CompKernel.h:1090
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Advection_weak
double Advection_weak(const double f[2], const double grad_w_dV[2])
Definition: CompKernel.h:2089
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::SubgridError
double SubgridError(const double &error, const double &Lstar_w_dV)
Definition: CompKernel.h:2351
CompKernel::MassJacobian_weak
double MassJacobian_weak(const double &dmt, const double &v, const double &w_dV)
Definition: CompKernel.h:1208
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y, double &z)
Definition: CompKernel.h:2511
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::HamiltonianJacobian_strong
double HamiltonianJacobian_strong(const double dH[2], const double grad_v[2])
Definition: CompKernel.h:2160
CompKernel::StressJacobian_w_u_weak
double StressJacobian_w_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1823
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::DiffusionJacobian_weak
double DiffusionJacobian_weak(int *rowptr, int *colind, double *a, double *da, const double grad_phi[2], const double grad_w_dV[2], const double &dphi, const double &v, const double grad_v[2])
Definition: CompKernel.h:2191
CompKernel::StressJacobian_u_w_weak
double StressJacobian_u_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1787
equivalent_polynomials::XX
const int XX(0)
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Diffusion_weak
double Diffusion_weak(int *rowptr, int *colind, double *a, const double grad_phi[2], const double grad_w_dV[2])
Definition: CompKernel.h:2178
CompKernel::hessFromDOF
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
Definition: CompKernel.h:1099
CompKernel::ReactionJacobian_strong
double ReactionJacobian_strong(const double &dr, const double &v)
Definition: CompKernel.h:1415
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y, double &z)
Definition: CompKernel.h:209
CompKernel::HYHY
const int HYHY
Definition: CompKernel.h:1035
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::YHY
const int YHY
Definition: CompKernel.h:187
CompKernel::ZY
const int ZY
Definition: CompKernel.h:1026
CompKernel::SubgridError
double SubgridError(const double &error, const double &Lstar_w_dV)
Definition: CompKernel.h:1520
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::InteriorElementBoundaryFlux
double InteriorElementBoundaryFlux(const double &flux, const double &w_dS)
Definition: CompKernel.h:2391
CompKernel::Hamiltonian_weak
double Hamiltonian_weak(const double &H, const double &w_dV)
Definition: CompKernel.h:1306
CompKernel::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[NSPACE], double &gradNorm, double &gradNorm_last, double &numDiff)
Definition: CompKernel.h:1499
EIndex< 3 >::Z
const int Z
Definition: CompKernel.h:18
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::SimpleDiffusionJacobian_weak
double SimpleDiffusionJacobian_weak(int *rowptr, int *colind, double *a, const double grad_v[2], const double grad_w_dV[2])
Definition: CompKernel.h:2211
EIndex< 2 >::sXY
const int sXY
Definition: CompKernel.h:57
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ReactionJacobian_weak
double ReactionJacobian_weak(const double &dr, const double &v, const double &w_dV)
Definition: CompKernel.h:2232
CompKernel::nSymTen
const int nSymTen
Definition: CompKernel.h:1030
L
Double L
Definition: Headers.h:72
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double &zt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:424
EIndex< 2 >::YHY
const int YHY
Definition: CompKernel.h:61
equivalent_polynomials::ZZ
const int ZZ(8)
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt, double &zt)
Definition: CompKernel.h:291
CompKernel::HXHY
const int HXHY
Definition: CompKernel.h:1034
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryStressFluxJacobian
double ExteriorElementBoundaryStressFluxJacobian(const double &dstressFlux, const double &disp_test_dS)
Definition: CompKernel.h:2735
CompKernel::sYY
const int sYY
Definition: CompKernel.h:1028
q
Double q
Definition: Headers.h:81
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::XY
const int XY
Definition: CompKernel.h:1862
df
double df(double C, double b, double a, int q, int r)
Definition: analyticalSolutions.c:2209
CompKernel::valFromDOF
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
Definition: CompKernel.h:1083
CompKernel::calculateG
void calculateG(double *jacInv, double *G, double &G_dd_G, double &tr_G)
Definition: CompKernel.h:1053
CompKernel::Advection_strong
double Advection_strong(const double df[NSPACE], const double grad_u[NSPACE])
Definition: CompKernel.h:1279
EIndex< 3 >::nSymTen
const int nSymTen
Definition: CompKernel.h:25
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *meshVelocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt)
Definition: CompKernel.h:2528
CompKernel::SimpleDiffusionJacobian_weak
double SimpleDiffusionJacobian_weak(int *rowptr, int *colind, double *a, const double grad_v[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1382
CompKernel::ExteriorElementBoundaryDiffusionAdjointJacobian
double ExteriorElementBoundaryDiffusionAdjointJacobian(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &v, const double normal[NSPACE], int *rowptr, int *colind, double *a, const double grad_w_dS[NSPACE])
Definition: CompKernel.h:1631
CompKernel::YZ
const int YZ
Definition: CompKernel.h:1025
CompKernel::YHX
const int YHX
Definition: CompKernel.h:1032
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >
Definition: CompKernel.h:622
CompKernel::ExteriorElementBoundaryStressFluxJacobian
double ExteriorElementBoundaryStressFluxJacobian(const double &dstressFlux, const double &disp_test_dS)
Definition: CompKernel.h:1848
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *meshVelocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt, double &zt)
Definition: CompKernel.h:2540
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::StressJacobian_u_v_weak
double StressJacobian_u_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:2709
CompKernelSpaceMapping::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y, double &z)
CompKernel::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &uref, const double &beta, const double G[NSPACE *NSPACE], const double &G_dd_G, const double &strong_residual, const double grad_u[NSPACE], double &numDiff)
Definition: CompKernel.h:1460
CompKernel::StressJacobian_v_v_weak
double StressJacobian_v_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1805
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::gradTestFromRef
void gradTestFromRef(const double *grad_test_ref, const double *jacInv, double *grad_test)
Definition: CompKernel.h:2002
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::MassJacobian_strong
double MassJacobian_strong(const double &dmt, const double &v)
Definition: CompKernel.h:2049
CompKernel::AdvectionJacobian_strong
double AdvectionJacobian_strong(const double df[NSPACE], const double grad_v[NSPACE])
Definition: CompKernel.h:1288
vel
void vel(double rS, double norm_v, double r, double theta, double *vR, double *vTHETA)
Definition: analyticalSolutions.c:2163
CompKernel::XY
const int XY
Definition: CompKernel.h:1024
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::XHY
const int XHY
Definition: CompKernel.h:186
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y, double &z)
Definition: CompKernel.h:317
num
Int num
Definition: Headers.h:32
EIndex< 2 >::Y
const int Y
Definition: CompKernel.h:54
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::valFromDOF
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
Definition: CompKernel.h:474
H
Double H
Definition: Headers.h:65
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:587
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryDiffusionAdjointJacobian
double ExteriorElementBoundaryDiffusionAdjointJacobian(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &v, const double normal[2], int *rowptr, int *colind, double *a, const double grad_w_dS[2])
Definition: CompKernel.h:2462
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt, double &zt)
Definition: CompKernel.h:925
EIndex< 3 >::ZHY
const int ZHY
Definition: CompKernel.h:28
CompKernelSpaceMapping::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double &zt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::HXHX
const int HXHX
Definition: CompKernel.h:1869
CompKernelSpaceMapping::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y, double &z)
EIndex< 3 >::ZZ
const int ZZ
Definition: CompKernel.h:21
CompKernel::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *meshVelocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt, double &zt)
Definition: CompKernel.h:1681
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::pressureProjection_weak
double pressureProjection_weak(const double &viscosity, const double &p, const double &p_avg, const double &q, const double &dV)
Definition: CompKernel.h:2079
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::valFromDOF
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
Definition: CompKernel.h:1912
CompKernel::X
const int X
Definition: CompKernel.h:1021
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::NumericalDiffusionJacobian
double NumericalDiffusionJacobian(const double &numDiff, const double grad_v[2], const double grad_w_dV[2])
Definition: CompKernel.h:2373
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::sYZ
const int sYZ
Definition: CompKernel.h:183
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y)
Definition: CompKernel.h:2479
v
Double v
Definition: Headers.h:95
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y)
Definition: CompKernel.h:742
CompKernel::StressJacobian_u_v_weak
double StressJacobian_u_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1780
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::CompKernel
CompKernel()
Definition: CompKernel.h:1870
CompKernel::calculateH_element
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
Definition: CompKernel.h:1665
CompKernel::Reaction_adjoint
double Reaction_adjoint(const double &dr, const double &w_dV)
Definition: CompKernel.h:1421
CompKernel::ExteriorElementBoundaryDiffusionAdjoint
double ExteriorElementBoundaryDiffusionAdjoint(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &u, const double &bc_u, const double normal[NSPACE], int *rowptr, int *colind, double *a, const double grad_w_dS[NSPACE])
Definition: CompKernel.h:1613
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::InteriorNumericalAdvectiveFluxJacobian
double InteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
Definition: CompKernel.h:2403
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::gradFromElementDOF
void gradFromElementDOF(const double *dof, const double *grad_trial, double *grad)
Definition: CompKernel.h:1946
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::sZZ
const int sZZ
Definition: CompKernel.h:184
CompKernel::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[NSPACE *NSPACE], const double &strong_residual, const double grad_u[NSPACE], double &numDiff)
Definition: CompKernel.h:1447
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::Y
const int Y
Definition: CompKernel.h:624
CompKernel::MassJacobian_strong
double MassJacobian_strong(const double &dmt, const double &v)
Definition: CompKernel.h:1220
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::YY
const int YY
Definition: CompKernel.h:1863
EIndex< 3 >::YHY
const int YHY
Definition: CompKernel.h:27
EIndex< 3 >::sXZ
const int sXZ
Definition: CompKernel.h:22
CompKernel::HXHX
const int HXHX
Definition: CompKernel.h:1034
z
Double * z
Definition: Headers.h:49
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::HXHY
const int HXHY
Definition: CompKernel.h:189
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorNumericalAdvectiveFluxJacobian
double ExteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
Definition: CompKernel.h:2397
CompKernel::Z
const int Z
Definition: CompKernel.h:1023
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::nSymTen
const int nSymTen
Definition: CompKernel.h:185
CompKernel::YY
const int YY
Definition: CompKernel.h:1025
CompKernel::sZY
const int sZY
Definition: CompKernel.h:1029
CompKernel::StressJacobian_v_w_weak
double StressJacobian_v_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1812
u
Double u
Definition: Headers.h:89
EIndex< 3 >::EIndex
EIndex()
Definition: CompKernel.h:31
CompKernel::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double &zt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:1739
CompKernel::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[NSPACE], double &numDiff)
Definition: CompKernel.h:1427
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y, double &z)
Definition: CompKernel.h:2596
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::gradFromDOF
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
Definition: CompKernel.h:879
EIndex< 2 >::HXHX
const int HXHX
Definition: CompKernel.h:62
CompKernel::sZX
const int sZX
Definition: CompKernel.h:1029
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::valFromElementDOF
void valFromElementDOF(const double *dof, const double *trial_ref, double &val)
Definition: CompKernel.h:1939
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y)
Definition: CompKernel.h:546
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:2640
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::Z
const int Z
Definition: CompKernel.h:178
CompKernel::AdvectionJacobian_weak
double AdvectionJacobian_weak(const double df[NSPACE], const double &v, const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1269
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Mass_strong
double Mass_strong(const double &mt)
Definition: CompKernel.h:2044
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::sYY
const int sYY
Definition: CompKernel.h:628
CompKernel::Advection_weak
double Advection_weak(const double f[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1260
xt
Definition: AddedMass.cpp:7
equivalent_polynomials::YZ
const int YZ(5)
CompKernel::CompKernel
CompKernel()
Definition: CompKernel.h:1036
CompKernel::gradTestFromRef
void gradTestFromRef(const double *grad_test_ref, const double *jacInv, double *grad_test)
Definition: CompKernel.h:1174
EIndex< 2 >::YY
const int YY
Definition: CompKernel.h:56
EIndex< 2 >::sYY
const int sYY
Definition: CompKernel.h:58
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Reaction_weak
double Reaction_weak(const double &r, const double &w_dV)
Definition: CompKernel.h:2226
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::SubgridErrorJacobian
double SubgridErrorJacobian(const double &derror, const double &Lstar_w_dV)
Definition: CompKernel.h:2357
CompKernel::StressJacobian_w_v_weak
double StressJacobian_w_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1830
CompKernel::ExteriorElementBoundaryFlux
double ExteriorElementBoundaryFlux(const double &flux, const double &w_dS)
Definition: CompKernel.h:1554
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ReactionJacobian_strong
double ReactionJacobian_strong(const double &dr, const double &v)
Definition: CompKernel.h:2244
CompKernel::gradTrialFromRef
void gradTrialFromRef(const double *grad_trial_ref, const double *jacInv, double *grad_trial)
Definition: CompKernel.h:1127
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:832
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::YZ
const int YZ
Definition: CompKernel.h:180
CompKernel
Definition: CompKernel.h:1018
CompKernel::StressJacobian_w_w_weak
double StressJacobian_w_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1837
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y)
Definition: CompKernel.h:2554
CompKernel::ExteriorNumericalAdvectiveFluxJacobian
double ExteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
Definition: CompKernel.h:1566
EIndex< 3 >::HXHY
const int HXHY
Definition: CompKernel.h:29
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::sXZ
const int sXZ
Definition: CompKernel.h:182
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::gradFromDOF
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
Definition: CompKernel.h:1919
CompKernel::hessTrialFromRef
void hessTrialFromRef(const double *hess_trial_ref, const double *jacInv, double *hess_trial)
Definition: CompKernel.h:1159
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y)
Definition: CompKernel.h:645
CompKernel::SubgridErrorJacobian
double SubgridErrorJacobian(const double &derror, const double &Lstar_w_dV)
Definition: CompKernel.h:1526
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::CompKernelSpaceMapping
CompKernelSpaceMapping()
Definition: CompKernel.h:192
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Hamiltonian_adjoint
double Hamiltonian_adjoint(const double dH[2], const double grad_w_dV[2])
Definition: CompKernel.h:2169
CompKernel::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[NSPACE *NSPACE], const double &strong_residual, const double vel[NSPACE], const double grad_u[NSPACE], double &numDiff)
Definition: CompKernel.h:1480
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::X
const int X
Definition: CompKernel.h:1860
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::CompKernelSpaceMapping
CompKernelSpaceMapping()
Definition: CompKernel.h:633
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Hamiltonian_weak
double Hamiltonian_weak(const double &H, const double &w_dV)
Definition: CompKernel.h:2135
EIndex< 3 >::sYZ
const int sYZ
Definition: CompKernel.h:23
CompKernel::Reaction_strong
double Reaction_strong(const double &r)
Definition: CompKernel.h:1410
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Stress_u_weak
double Stress_u_weak(double *stress, double *grad_test_dV)
Definition: CompKernel.h:2699
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y)
Definition: CompKernel.h:501
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::hessTrialFromRef
void hessTrialFromRef(const double *hess_trial_ref, const double *jacInv, double *hess_trial)
Definition: CompKernel.h:1988
EIndex< 3 >::XZ
const int XZ
Definition: CompKernel.h:19
CompKernel::backwardEuler
void backwardEuler(const double &dt, const double &m_old, const double &m, const double &dm, double &mt, double &dmt)
Definition: CompKernel.h:1185
CompKernel::Stress_w_weak
double Stress_w_weak(double *stress, double *grad_test_dV)
Definition: CompKernel.h:1819
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Advection_strong
double Advection_strong(const double df[2], const double grad_u[2])
Definition: CompKernel.h:2108
CompKernel::ZZ
const int ZZ
Definition: CompKernel.h:1026
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryScalarDiffusionAdjointJacobian
double ExteriorElementBoundaryScalarDiffusionAdjointJacobian(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &v, const double normal[2], const double &a, const double grad_w_dS[2])
Definition: CompKernel.h:2427
CompKernel::Mass_strong
double Mass_strong(const double &mt)
Definition: CompKernel.h:1215
CompKernel::ReactionJacobian_weak
double ReactionJacobian_weak(const double &dr, const double &v, const double &w_dV)
Definition: CompKernel.h:1403
CompKernel::Advection_adjoint
double Advection_adjoint(const double df[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1297
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Y
const int Y
Definition: CompKernel.h:1861
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::ZZ
const int ZZ
Definition: CompKernel.h:181
CompKernel::bdf
void bdf(const double &alpha, const double &beta, const double &m, const double &dm, double &mt, double &dmt)
Definition: CompKernel.h:1191
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::sXY
const int sXY
Definition: CompKernel.h:627
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::bdfC2
void bdfC2(const double &alpha, const double &beta, const double &m, const double &dm, const double &dm2, double &mt, double &dmt, double &dm2t)
Definition: CompKernel.h:2025
CompKernel::valFromElementDOF
void valFromElementDOF(const double *dof, const double *trial_ref, double &val)
Definition: CompKernel.h:1111
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::HamiltonianJacobian_weak
double HamiltonianJacobian_weak(const double dH[2], const double grad_v[2], const double &w_dV)
Definition: CompKernel.h:2141
equivalent_polynomials::XZ
const int XZ(2)
CompKernel::Y
const int Y
Definition: CompKernel.h:1022
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::StressJacobian_v_u_weak
double StressJacobian_v_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:2719
CompKernel::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y, double &z)
Definition: CompKernel.h:1648
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Mass_weak
double Mass_weak(const double &mt, const double &w_dV)
Definition: CompKernel.h:2032
CompKernel::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y, double &z)
Definition: CompKernel.h:1695
CompKernel::sZZ
const int sZZ
Definition: CompKernel.h:1029
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::YY
const int YY
Definition: CompKernel.h:626
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &uref, const double &beta, const double G[2 *2], const double &G_dd_G, const double &strong_residual, const double grad_u[2], double &numDiff)
Definition: CompKernel.h:2291
r
Double r
Definition: Headers.h:83
CompKernel::StressJacobian_v_u_weak
double StressJacobian_v_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1798
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::nSymTen
const int nSymTen
Definition: CompKernel.h:1866
EIndex< 2 >::XHY
const int XHY
Definition: CompKernel.h:60
CompKernel::HamiltonianJacobian_strong
double HamiltonianJacobian_strong(const double dH[NSPACE], const double grad_v[NSPACE])
Definition: CompKernel.h:1331
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::calculateH_element
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
Definition: CompKernel.h:274
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double &zt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:2669
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[2 *2], const double &strong_residual, const double vel[2], const double grad_u[2], double &numDiff)
Definition: CompKernel.h:2311
CompKernel::gradFromElementDOF
void gradFromElementDOF(const double *dof, const double *grad_trial, double *grad)
Definition: CompKernel.h:1118
CompKernel::InteriorElementBoundaryFlux
double InteriorElementBoundaryFlux(const double &flux, const double &w_dS)
Definition: CompKernel.h:1560
EIndex< 2 >::EIndex
EIndex()
Definition: CompKernel.h:63
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Stress_v_weak
double Stress_v_weak(double *stress, double *grad_test_dV)
Definition: CompKernel.h:2715
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::sXY
const int sXY
Definition: CompKernel.h:1864
equivalent_polynomials::ZX
const int ZX(6)
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_elementBoundary
void calculateMappingVelocity_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double &xt, double &yt, double &zt, double *normal, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt)
Definition: CompKernel.h:984
CompKernel::StressJacobian_u_u_weak
double StressJacobian_u_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:1773
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryFlux
double ExteriorElementBoundaryFlux(const double &flux, const double &w_dS)
Definition: CompKernel.h:2385
CompKernel::NumericalDiffusionJacobian
double NumericalDiffusionJacobian(const double &numDiff, const double grad_v[NSPACE], const double grad_w_dV[NSPACE])
Definition: CompKernel.h:1542
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryDiffusionAdjoint
double ExteriorElementBoundaryDiffusionAdjoint(const int &isDOFBoundary, const int &isFluxBoundary, const double &sigma, const double &u, const double &bc_u, const double normal[2], int *rowptr, int *colind, double *a, const double grad_w_dS[2])
Definition: CompKernel.h:2444
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[2 *2], const double &strong_residual, const double grad_u[2], double &numDiff)
Definition: CompKernel.h:2277
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateG
void calculateG(double *jacInv, double *G, double &G_dd_G, double &tr_G)
Definition: CompKernel.h:1882
CompKernel::sYX
const int sYX
Definition: CompKernel.h:1028
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::YHX
const int YHX
Definition: CompKernel.h:1868
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateH_element
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
Definition: CompKernel.h:700
CompKernel::Stress_v_weak
double Stress_v_weak(double *stress, double *grad_test_dV)
Definition: CompKernel.h:1794
CompKernel::sYZ
const int sYZ
Definition: CompKernel.h:1028
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Reaction_adjoint
double Reaction_adjoint(const double &dr, const double &w_dV)
Definition: CompKernel.h:2250
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateH_element
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
Definition: CompKernel.h:2495
CompKernel::bdfC2
void bdfC2(const double &alpha, const double &beta, const double &m, const double &dm, const double &dm2, double &mt, double &dmt, double &dm2t)
Definition: CompKernel.h:1196
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::hessFromDOF
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
Definition: CompKernel.h:490
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_element
void calculateMapping_element(const int eN, const int k, double *mesh_dof, int *mesh_l2g, double *mesh_trial_ref, double *mesh_grad_trial_ref, double *jac, double &jacDet, double *jacInv, double &x, double &y, double &z)
Definition: CompKernel.h:899
CompKernel::Mass_weak
double Mass_weak(const double &mt, const double &w_dV)
Definition: CompKernel.h:1203
EIndex< 3 >::XHY
const int XHY
Definition: CompKernel.h:26
CompKernel::calculateGScale
void calculateGScale(double *G, double *v, double &h)
Definition: CompKernel.h:1075
CompKernel::Mass_adjoint
double Mass_adjoint(const double &dmt, const double &w_dV)
Definition: CompKernel.h:1226
EIndex< 3 >::HYHY
const int HYHY
Definition: CompKernel.h:30
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::HXHX
const int HXHX
Definition: CompKernel.h:632
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt)
Definition: CompKernel.h:717
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::bdf
void bdf(const double &alpha, const double &beta, const double &m, const double &dm, double &mt, double &dmt)
Definition: CompKernel.h:2019
CompKernelSpaceMapping::calculateMappingVelocity_element
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt, double &zt)
CompKernelSpaceMapping
Definition: CompKernel.h:79
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::calculateMapping_elementBoundary
void calculateMapping_elementBoundary(const int eN, const int ebN_local, const int kb, const int ebN_local_kb, double *mesh_dof, int *mesh_l2g, double *mesh_trial_trace_ref, double *mesh_grad_trial_trace_ref, double *boundaryJac_ref, double *jac, double &jacDet, double *jacInv, double *boundaryJac, double *metricTensor, double &metricTensorDetSqrt, double *normal_ref, double *normal, double &x, double &y, double &z)
Definition: CompKernel.h:943
CompKernel::Reaction_weak
double Reaction_weak(const double &r, const double &w_dV)
Definition: CompKernel.h:1397
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::calculateNumericalDiffusion
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[2], double &gradNorm, double &gradNorm_last, double &numDiff)
Definition: CompKernel.h:2330
CompKernel::YHY
const int YHY
Definition: CompKernel.h:1032
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::ExteriorElementBoundaryStressFlux
double ExteriorElementBoundaryStressFlux(const double &stressFlux, const double &disp_test_dS)
Definition: CompKernel.h:2731
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::hessFromDOF
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
Definition: CompKernel.h:1928
CompKernelSpaceMapping::gradFromDOF
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
Definition: CompKernel.h:151
CompKernel::ZHX
const int ZHX
Definition: CompKernel.h:1033
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::Mass_adjoint
double Mass_adjoint(const double &dmt, const double &w_dV)
Definition: CompKernel.h:2055
CompKernel::mapping
CompKernelSpaceMapping< NSPACE, NDOF_MESH_TRIAL_ELEMENT > mapping
Definition: CompKernel.h:1020
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT >::nSymTen
const int nSymTen
Definition: CompKernel.h:629
CompKernel::Hamiltonian_strong
double Hamiltonian_strong(const double dH[NSPACE], const double grad_u[NSPACE])
Definition: CompKernel.h:1322
CompKernel::InteriorNumericalAdvectiveFluxJacobian
double InteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
Definition: CompKernel.h:1572
CompKernel::ExteriorElementBoundaryStressFlux
double ExteriorElementBoundaryStressFlux(const double &stressFlux, const double &disp_test_dS)
Definition: CompKernel.h:1844
EIndex
Definition: CompKernel.h:11
CompKernel::XHX
const int XHX
Definition: CompKernel.h:1031
CompKernelSpaceMapping< 3, NDOF_MESH_TRIAL_ELEMENT >::HYHY
const int HYHY
Definition: CompKernel.h:190
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::gradTrialFromRef
void gradTrialFromRef(const double *grad_trial_ref, const double *jacInv, double *grad_trial)
Definition: CompKernel.h:1955
equivalent_polynomials::YX
const int YX(3)
equivalent_polynomials::ZY
const int ZY(7)
CompKernel< 2, NDOF_MESH_TRIAL_ELEMENT, NDOF_TRIAL_ELEMENT, NDOF_TEST_ELEMENT >::StressJacobian_u_u_weak
double StressJacobian_u_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
Definition: CompKernel.h:2703