proteus
1.8.1
C/C++/Fortran libraries
|
Go to the documentation of this file.
77 template<
int NSPACE,
int NDOF_MESH_TRIAL_ELEMENT>
86 double* mesh_trial_ref,
87 double* mesh_grad_trial_ref,
99 double* mesh_trial_ref,
103 double* mesh_velocity_dof,
106 double* mesh_trial_ref,
113 const int ebN_local_kb,
116 double* mesh_trial_trace_ref,
117 double* mesh_grad_trial_trace_ref,
118 double* boundaryJac_ref,
123 double* metricTensor,
124 double& metricTensorDetSqrt,
133 const int ebN_local_kb,
134 double* mesh_velocity_dof,
136 double* mesh_trial_trace_ref,
142 double* metricTensor,
143 double& metricTensorDetSqrt);
144 inline void valFromDOF(
const double* dof,
const int* l2g_element,
const double* trial_ref,
double& val)
147 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
148 val+=dof[l2g_element[j]]*trial_ref[j];
151 inline void gradFromDOF(
const double* dof,
const int* l2g_element,
const double* grad_trial,
double* grad)
153 for(
int I=0;I<NSPACE;I++)
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];
160 inline void hessFromDOF(
const double* dof,
const int* l2g_element,
const double* hess_trial,
double* hess)
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];
174 template<
int NDOF_MESH_TRIAL_ELEMENT>
199 sXX(0),sXY(5),sXZ(4),
200 sYX(5),sYY(1),sYZ(3),
201 sZX(4),sZY(3),sZZ(2),
214 double* mesh_trial_ref,
215 double* mesh_grad_trial_ref,
223 register double Grad_x[3],Grad_y[3],Grad_z[3],oneOverJacDet;
229 for (
int I=0;I<3;I++)
231 Grad_x[I]=0.0;Grad_y[I]=0.0;Grad_z[I]=0.0;
233 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
235 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+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++)
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];
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]);
279 double* mesh_trial_ref,
283 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
285 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
287 h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
293 double* mesh_velocity_dof,
296 double* mesh_trial_ref,
304 xt=0.0;yt=0.0;zt=0.0;
305 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
307 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+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];
320 const int ebN_local_kb,
323 double* mesh_trial_trace_ref,
324 double* mesh_grad_trial_trace_ref,
325 double* boundaryJac_ref,
330 double* metricTensor,
331 double& metricTensorDetSqrt,
338 const int ebN_local_kb_nSpace = ebN_local_kb*3,
339 ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*3*2;
341 register double Grad_x_ext[3],Grad_y_ext[3],Grad_z_ext[3],oneOverJacDet,norm_normal=0.0;
346 for (
int I=0;I<3;I++)
352 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
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++)
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];
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];
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]);
393 for (
int I=0;I<3;I++)
395 for (
int I=0;I<3;I++)
397 for (
int J=0;J<3;J++)
399 normal[I] += jacInv[J*3+I]*normal_ref[ebN_local_kb_nSpace+J];
401 norm_normal+=normal[I]*normal[I];
403 norm_normal = sqrt(norm_normal);
404 for (
int I=0;I<3;I++)
406 normal[I] /= norm_normal;
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];
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];
421 metricTensorDetSqrt=sqrt(metricTensor[HXHX]*metricTensor[HYHY]- metricTensor[HXHY]*metricTensor[HYHX]);
427 const int ebN_local_kb,
428 double* mesh_velocity_dof,
430 double* mesh_trial_trace_ref,
436 double* metricTensor,
437 double& metricTensorDetSqrt)
444 xt=0.0;yt=0.0;zt=0.0;
445 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
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];
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));
474 inline void valFromDOF(
const double* dof,
const int* l2g_element,
const double* trial_ref,
double& val)
477 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
478 val+=dof[l2g_element[j]]*trial_ref[j];
481 inline void gradFromDOF(
const double* dof,
const int* l2g_element,
const double* grad_trial,
double* grad)
485 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
487 grad[I] += dof[l2g_element[j]]*grad_trial[j*3+I];
490 inline void hessFromDOF(
const double* dof,
const int* l2g_element,
const double* hess_trial,
double* hess)
495 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
498 hess[I*3+J] += dof[l2g_element[j]]*hess_trial[j*9+I*3+J];
506 double* mesh_trial_ref,
507 double* mesh_grad_trial_ref,
530 double* mesh_velocity_dof,
533 double* mesh_trial_ref,
549 const int ebN_local_kb,
552 double* mesh_trial_trace_ref,
553 double* mesh_grad_trial_trace_ref,
554 double* boundaryJac_ref,
559 double* metricTensor,
560 double& metricTensorDetSqrt,
572 mesh_trial_trace_ref,
573 mesh_grad_trial_trace_ref,
590 const int ebN_local_kb,
591 double* mesh_velocity_dof,
593 double* mesh_trial_trace_ref,
598 double* metricTensor,
599 double& metricTensorDetSqrt)
607 mesh_trial_trace_ref,
614 metricTensorDetSqrt);
620 template<
int NDOF_MESH_TRIAL_ELEMENT>
650 double* mesh_trial_ref,
651 double* mesh_grad_trial_ref,
658 register double Grad_x[2],Grad_y[2],oneOverJacDet;
664 for (
int I=0;I<2;I++)
666 Grad_x[I]=0.0;Grad_y[I]=0.0;
668 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
670 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+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++)
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];
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];
705 double* mesh_trial_ref,
709 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
711 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+j;
713 h += h_dof[mesh_l2g[eN_j]]*mesh_trial_ref[k*NDOF_MESH_TRIAL_ELEMENT+j];
719 double* mesh_velocity_dof,
722 double* mesh_trial_ref,
730 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
732 int eN_j=eN*NDOF_MESH_TRIAL_ELEMENT+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];
745 const int ebN_local_kb,
748 double* mesh_trial_trace_ref,
749 double* mesh_grad_trial_trace_ref,
750 double* boundaryJac_ref,
755 double* metricTensor,
756 double& metricTensorDetSqrt,
762 const int ebN_local_kb_nSpace = ebN_local_kb*2,
763 ebN_local_kb_nSpace_nSpacem1 = ebN_local_kb*2*1;
765 register double Grad_x_ext[2],Grad_y_ext[2],oneOverJacDet,norm_normal=0.0;
770 for (
int I=0;I<2;I++)
775 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
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;
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++)
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];
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];
808 for (
int I=0;I<2;I++)
810 for (
int I=0;I<2;I++)
812 for (
int J=0;J<2;J++)
814 normal[I] += jacInv[J*2+I]*normal_ref[ebN_local_kb_nSpace+J];
816 norm_normal+=normal[I]*normal[I];
818 norm_normal = sqrt(norm_normal);
819 for (
int I=0;I<2;I++)
821 normal[I] /= norm_normal;
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];
827 metricTensor[HXHX] = boundaryJac[XHX]*boundaryJac[XHX]+boundaryJac[YHX]*boundaryJac[YHX];
829 metricTensorDetSqrt=sqrt(metricTensor[HXHX]);
835 const int ebN_local_kb,
836 double* mesh_velocity_dof,
838 double* mesh_trial_trace_ref,
843 double* metricTensor,
844 double& metricTensorDetSqrt)
852 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
854 int eN_j = eN*NDOF_MESH_TRIAL_ELEMENT+j;
855 int ebN_local_kb_j = ebN_local_kb*NDOF_MESH_TRIAL_ELEMENT+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];
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));
872 inline void valFromDOF(
const double* dof,
const int* l2g_element,
const double* trial_ref,
double& val)
875 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
876 val+=dof[l2g_element[j]]*trial_ref[j];
879 inline void gradFromDOF(
const double* dof,
const int* l2g_element,
const double* grad_trial,
double* grad)
883 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
885 grad[I] += dof[l2g_element[j]]*grad_trial[j*2+I];
888 inline void hessFromDOF(
const double* dof,
const int* l2g_element,
const double* hess_trial,
double* hess)
893 for (
int j=0;j<NDOF_MESH_TRIAL_ELEMENT;j++)
896 hess[I*2+J] += dof[l2g_element[j]]*hess_trial[j*4+I*2+J];
904 double* mesh_trial_ref,
905 double* mesh_grad_trial_ref,
927 double* mesh_velocity_dof,
930 double* mesh_trial_ref,
946 const int ebN_local_kb,
949 double* mesh_trial_trace_ref,
950 double* mesh_grad_trial_trace_ref,
951 double* boundaryJac_ref,
956 double* metricTensor,
957 double& metricTensorDetSqrt,
970 mesh_trial_trace_ref,
971 mesh_grad_trial_trace_ref,
987 const int ebN_local_kb,
988 double* mesh_velocity_dof,
990 double* mesh_trial_trace_ref,
996 double* metricTensor,
997 double& metricTensorDetSqrt)
1005 mesh_trial_trace_ref,
1011 metricTensorDetSqrt);
1016 template<
int NSPACE,
int NDOF_MESH_TRIAL_ELEMENT,
int NDOF_TRIAL_ELEMENT,
int NDOF_TEST_ELEMENT>
1053 inline void calculateG(
double* jacInv,
double* G,
double& G_dd_G,
double& tr_G)
1057 for (
int I=0;I<NSPACE;I++)
1058 for (
int J=0;J<NSPACE;J++)
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];
1066 for (
int I=0;I<NSPACE;I++)
1068 tr_G += G[I*NSPACE+I];
1069 for (
int J=0;J<NSPACE;J++)
1071 G_dd_G += G[I*NSPACE+J]*G[I*NSPACE+J];
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);
1083 inline void valFromDOF(
const double* dof,
const int* l2g_element,
const double* trial_ref,
double& val)
1086 for (
int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1087 val+=dof[l2g_element[j]]*trial_ref[j];
1090 inline void gradFromDOF(
const double* dof,
const int* l2g_element,
const double* grad_trial,
double* grad)
1092 for(
int I=0;I<NSPACE;I++)
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];
1099 inline void hessFromDOF(
const double* dof,
const int* l2g_element,
const double* hess_trial,
double* hess)
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];
1114 for (
int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1115 val+=dof[j]*trial_ref[j];
1120 for(
int I=0;I<NSPACE;I++)
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];
1127 inline void gradTrialFromRef(
const double* grad_trial_ref,
const double* jacInv,
double* grad_trial)
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];
1149 inline void DOFaverage (
const double* dof,
const int* l2g_element,
double& val)
1153 for (
int j=0; j<NDOF_MESH_TRIAL_ELEMENT; j++)
1154 val+=dof[l2g_element[j]];
1156 val /= NDOF_MESH_TRIAL_ELEMENT;
1159 inline void hessTrialFromRef(
const double* hess_trial_ref,
const double* jacInv,
double* hess_trial)
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];
1174 inline void gradTestFromRef(
const double* grad_test_ref,
const double* jacInv,
double* grad_test)
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];
1185 inline void backwardEuler(
const double& dt,
const double& m_old,
const double& m,
const double& dm,
double& mt,
double& dmt)
1191 inline void bdf(
const double& alpha,
const double& beta,
const double& m,
const double& dm,
double& mt,
double& dmt)
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)
1203 inline double Mass_weak(
const double& mt,
const double& w_dV)
1252 const double& p_avg,
1256 if (viscosity==0.){
return 0.;}
1257 return (1./viscosity)*(p-p_avg)*(
q-1./3.)*dV;
1261 const double grad_w_dV[NSPACE])
1264 for(
int I=0;I<NSPACE;I++)
1265 tmp -=
f[I]*grad_w_dV[I];
1271 const double grad_w_dV[NSPACE])
1274 for(
int I=0;I<NSPACE;I++)
1275 tmp -=
df[I]*
v*grad_w_dV[I];
1280 const double grad_u[NSPACE])
1283 for(
int I=0;I<NSPACE;I++)
1284 tmp +=
df[I]*grad_u[I];
1289 const double grad_v[NSPACE])
1292 for(
int I=0;I<NSPACE;I++)
1293 tmp +=
df[I]*grad_v[I];
1298 const double grad_w_dV[NSPACE])
1301 for(
int I=0;I<NSPACE;I++)
1302 tmp -=
df[I]*grad_w_dV[I];
1313 const double grad_v[NSPACE],
1317 for(
int I=0;I<NSPACE;I++)
1318 tmp += dH[I]*grad_v[I]*w_dV;
1323 const double grad_u[NSPACE])
1326 for(
int I=0;I<NSPACE;I++)
1327 tmp += dH[I]*grad_u[I];
1332 const double grad_v[NSPACE])
1335 for(
int I=0;I<NSPACE;I++)
1336 tmp += dH[I]*grad_v[I];
1341 const double grad_w_dV[NSPACE])
1344 for(
int I=0;I<NSPACE;I++)
1345 tmp -= dH[I]*grad_w_dV[I];
1352 const double grad_phi[NSPACE],
1353 const double grad_w_dV[NSPACE])
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];
1366 const double grad_phi[NSPACE],
1367 const double grad_w_dV[NSPACE],
1370 const double grad_v[NSPACE])
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++)
1376 daProduct += da[m]*grad_phi[colind[m]]*grad_w_dV[I];
1377 dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
1379 return daProduct*
v+dphiProduct*dphi;
1385 const double grad_v[NSPACE],
1386 const double grad_w_dV[NSPACE])
1388 double dphiProduct=0.0;
1389 for (
int I=0;I<NSPACE;I++)
1390 for (
int m=rowptr[I];m<rowptr[I+1];m++)
1392 dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
1428 const double& elementDiameter,
1429 const double& strong_residual,
1430 const double grad_u[NSPACE],
1437 h = elementDiameter;
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);
1448 const double G[NSPACE*NSPACE],
1449 const double& strong_residual,
1450 const double grad_u[NSPACE],
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));
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],
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];
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);
1481 const double G[NSPACE*NSPACE],
1482 const double& strong_residual,
1483 const double vel[NSPACE],
1484 const double grad_u[NSPACE],
1487 double den1 = 0.0,den2=0.0, nom=0.0;
1488 for (
int I=0;I<NSPACE;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];
1495 numDiff = shockCapturingDiffusion*fabs(strong_residual)*(sqrt(nom/(den1*den2 + 1.0e-12)));
1500 const double& elementDiameter,
1501 const double& strong_residual,
1502 const double grad_u[NSPACE],
1504 double& gradNorm_last,
1510 h = elementDiameter;
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);
1517 numDiff =
num/gradNorm_last;
1521 const double& Lstar_w_dV)
1523 return error*Lstar_w_dV;
1527 const double& Lstar_w_dV)
1529 return derror*Lstar_w_dV;
1533 const double grad_u[NSPACE],
1534 const double grad_w_dV[NSPACE])
1537 for (
int I=0;I<NSPACE;I++)
1538 tmp += numDiff*grad_u[I]*grad_w_dV[I];
1543 const double grad_v[NSPACE],
1544 const double grad_w_dV[NSPACE])
1547 for (
int I=0;I<NSPACE;I++)
1548 tmp += numDiff*grad_v[I]*grad_w_dV[I];
1569 return dflux_left*
v;
1575 return dflux_left*
v;
1579 const int& isFluxBoundary,
1580 const double& sigma,
1583 const double normal[NSPACE],
1585 const double grad_w_dS[NSPACE])
1588 for(
int I=0;I<NSPACE;I++)
1590 tmp += normal[I]*grad_w_dS[I];
1592 tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*(
u-bc_u)*a;
1597 const int& isFluxBoundary,
1598 const double& sigma,
1600 const double normal[NSPACE],
1602 const double grad_w_dS[NSPACE])
1605 for(
int I=0;I<NSPACE;I++)
1607 tmp += normal[I]*grad_w_dS[I];
1609 tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*
v*a;
1614 const int& isFluxBoundary,
1615 const double& sigma,
1618 const double normal[NSPACE],
1622 const double grad_w_dS[NSPACE])
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];
1632 const int& isFluxBoundary,
1633 const double& sigma,
1635 const double normal[NSPACE],
1639 const double grad_w_dS[NSPACE])
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];
1653 double* mesh_trial_ref,
1654 double* mesh_grad_trial_ref,
1662 mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y,
z);
1670 double* mesh_trial_ref,
1673 mapping.calculateH_element(eN,
1683 double* meshVelocity_dof,
1686 double* mesh_trial_ref,
1691 mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,
xt,yt,zt);
1696 const int ebN_local,
1698 const int ebN_local_kb,
1701 double* mesh_trial_trace_ref,
1702 double* mesh_grad_trial_trace_ref,
1703 double* boundaryJac_ref,
1707 double* boundaryJac,
1708 double* metricTensor,
1709 double& metricTensorDetSqrt,
1716 mapping.calculateMapping_elementBoundary(eN,
1722 mesh_trial_trace_ref,
1723 mesh_grad_trial_trace_ref,
1730 metricTensorDetSqrt,
1740 const int ebN_local,
1742 const int ebN_local_kb,
1743 double* mesh_velocity_dof,
1745 double* mesh_trial_trace_ref,
1750 double* boundaryJac,
1751 double* metricTensor,
1752 double& metricTensorDetSqrt)
1754 mapping.calculateMappingVelocity_elementBoundary(eN,
1760 mesh_trial_trace_ref,
1767 metricTensorDetSqrt);
1771 return stress[
sXX]*grad_test_dV[
X] + stress[
sXY]*grad_test_dV[
Y] + stress[
sXZ]*grad_test_dV[
Z];
1796 return stress[
sYX]*grad_test_dV[
X] + stress[
sYY]*grad_test_dV[
Y] + stress[
sYZ]*grad_test_dV[
Z];
1821 return stress[
sZX]*grad_test_dV[
X] + stress[
sZY]*grad_test_dV[
Y] + stress[
sZZ]*grad_test_dV[
Z];
1846 return stressFlux*disp_test_dS;
1850 return dstressFlux*disp_test_dS;
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>
1882 inline void calculateG(
double* jacInv,
double* G,
double& G_dd_G,
double& tr_G)
1886 for (
int I=0;I<2;I++)
1887 for (
int J=0;J<2;J++)
1890 for (
int K=0;K<2;K++)
1891 G[I*2+J] += jacInv[K*2+I]*jacInv[K*2+J];
1895 for (
int I=0;I<2;I++)
1898 for (
int J=0;J<2;J++)
1900 G_dd_G += G[I*2+J]*G[I*2+J];
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);
1912 inline void valFromDOF(
const double* dof,
const int* l2g_element,
const double* trial_ref,
double& val)
1915 for (
int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1916 val+=dof[l2g_element[j]]*trial_ref[j];
1919 inline void gradFromDOF(
const double* dof,
const int* l2g_element,
const double* grad_trial,
double* grad)
1921 for(
int I=0;I<2;I++)
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];
1928 inline void hessFromDOF(
const double* dof,
const int* l2g_element,
const double* hess_trial,
double* hess)
1930 for(
int I=0;I<2;I++)
1931 for(
int J=0;J<2;J++)
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];
1942 for (
int j=0;j<NDOF_TRIAL_ELEMENT;j++)
1943 val+=dof[j]*trial_ref[j];
1948 for(
int I=0;I<2;I++)
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];
1955 inline void gradTrialFromRef(
const double* grad_trial_ref,
const double* jacInv,
double* grad_trial)
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];
1977 inline void DOFaverage (
const double* dof,
const int* l2g_element,
double& val)
1981 for (
int j=0; j<NDOF_MESH_TRIAL_ELEMENT; j++)
1982 val+=dof[l2g_element[j]];
1984 val /= NDOF_MESH_TRIAL_ELEMENT;
1988 inline void hessTrialFromRef(
const double* hess_trial_ref,
const double* jacInv,
double* hess_trial)
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];
2002 inline void gradTestFromRef(
const double* grad_test_ref,
const double* jacInv,
double* grad_test)
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];
2013 inline void backwardEuler(
const double& dt,
const double& m_old,
const double& m,
const double& dm,
double& mt,
double& dmt)
2019 inline void bdf(
const double& alpha,
const double& beta,
const double& m,
const double& dm,
double& mt,
double& dmt)
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)
2032 inline double Mass_weak(
const double& mt,
const double& w_dV)
2081 const double& p_avg,
2085 if (viscosity==0.){
return 0.;}
2086 return (1./viscosity)*(p-p_avg)*(
q-1./3.)*dV;
2090 const double grad_w_dV[2])
2093 for(
int I=0;I<2;I++)
2094 tmp -=
f[I]*grad_w_dV[I];
2100 const double grad_w_dV[2])
2103 for(
int I=0;I<2;I++)
2104 tmp -=
df[I]*
v*grad_w_dV[I];
2109 const double grad_u[2])
2112 for(
int I=0;I<2;I++)
2113 tmp +=
df[I]*grad_u[I];
2118 const double grad_v[2])
2121 for(
int I=0;I<2;I++)
2122 tmp +=
df[I]*grad_v[I];
2127 const double grad_w_dV[2])
2130 for(
int I=0;I<2;I++)
2131 tmp -=
df[I]*grad_w_dV[I];
2142 const double grad_v[2],
2146 for(
int I=0;I<2;I++)
2147 tmp += dH[I]*grad_v[I]*w_dV;
2152 const double grad_u[2])
2155 for(
int I=0;I<2;I++)
2156 tmp += dH[I]*grad_u[I];
2161 const double grad_v[2])
2164 for(
int I=0;I<2;I++)
2165 tmp += dH[I]*grad_v[I];
2170 const double grad_w_dV[2])
2173 for(
int I=0;I<2;I++)
2174 tmp -= dH[I]*grad_w_dV[I];
2181 const double grad_phi[2],
2182 const double grad_w_dV[2])
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];
2195 const double grad_phi[2],
2196 const double grad_w_dV[2],
2199 const double grad_v[2])
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++)
2205 daProduct += da[m]*grad_phi[colind[m]]*grad_w_dV[I];
2206 dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
2208 return daProduct*
v+dphiProduct*dphi;
2214 const double grad_v[2],
2215 const double grad_w_dV[2])
2217 double dphiProduct=0.0;
2218 for (
int I=0;I<2;I++)
2219 for (
int m=rowptr[I];m<rowptr[I+1];m++)
2221 dphiProduct += a[m]*grad_v[colind[m]]*grad_w_dV[I];
2257 const double& elementDiameter,
2258 const double& strong_residual,
2259 const double grad_u[2],
2266 h = elementDiameter;
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);
2278 const double G[2*2],
2279 const double& strong_residual,
2280 const double grad_u[2],
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];
2288 numDiff = shockCapturingDiffusion*fabs(strong_residual)/(sqrt(den+1.0e-12));
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],
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];
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);
2312 const double G[2*2],
2313 const double& strong_residual,
2314 const double vel[2],
2315 const double grad_u[2],
2318 double den1 = 0.0,den2=0.0, nom=0.0;
2319 for (
int I=0;I<2;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];
2326 numDiff = shockCapturingDiffusion*fabs(strong_residual)*(sqrt(nom/(den1*den2 + 1.0e-12)));
2331 const double& elementDiameter,
2332 const double& strong_residual,
2333 const double grad_u[2],
2335 double& gradNorm_last,
2341 h = elementDiameter;
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);
2348 numDiff =
num/gradNorm_last;
2352 const double& Lstar_w_dV)
2354 return error*Lstar_w_dV;
2358 const double& Lstar_w_dV)
2360 return derror*Lstar_w_dV;
2364 const double grad_u[2],
2365 const double grad_w_dV[2])
2368 for (
int I=0;I<2;I++)
2369 tmp += numDiff*grad_u[I]*grad_w_dV[I];
2374 const double grad_v[2],
2375 const double grad_w_dV[2])
2378 for (
int I=0;I<2;I++)
2379 tmp += numDiff*grad_v[I]*grad_w_dV[I];
2400 return dflux_left*
v;
2406 return dflux_left*
v;
2410 const int& isFluxBoundary,
2411 const double& sigma,
2414 const double normal[2],
2416 const double grad_w_dS[2])
2419 for(
int I=0;I<2;I++)
2421 tmp += normal[I]*grad_w_dS[I];
2423 tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*(
u-bc_u)*a;
2428 const int& isFluxBoundary,
2429 const double& sigma,
2431 const double normal[2],
2433 const double grad_w_dS[2])
2436 for(
int I=0;I<2;I++)
2438 tmp += normal[I]*grad_w_dS[I];
2440 tmp *= (1.0-isFluxBoundary)*isDOFBoundary*sigma*
v*a;
2445 const int& isFluxBoundary,
2446 const double& sigma,
2449 const double normal[2],
2453 const double grad_w_dS[2])
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];
2463 const int& isFluxBoundary,
2464 const double& sigma,
2466 const double normal[2],
2470 const double grad_w_dS[2])
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];
2484 double* mesh_trial_ref,
2485 double* mesh_grad_trial_ref,
2492 mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y);
2500 double* mesh_trial_ref,
2503 mapping.calculateH_element(eN,
2516 double* mesh_trial_ref,
2517 double* mesh_grad_trial_ref,
2525 mapping.calculateMapping_element(eN,k,mesh_dof,mesh_l2g,mesh_trial_ref,mesh_grad_trial_ref,jac,jacDet,jacInv,x,y,
z);
2530 double* meshVelocity_dof,
2533 double* mesh_trial_ref,
2537 mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,
xt,yt);
2542 double* meshVelocity_dof,
2545 double* mesh_trial_ref,
2550 mapping.calculateMappingVelocity_element(eN,k,meshVelocity_dof,mesh_l2g,mesh_trial_ref,
xt,yt,zt);
2555 const int ebN_local,
2557 const int ebN_local_kb,
2560 double* mesh_trial_trace_ref,
2561 double* mesh_grad_trial_trace_ref,
2562 double* boundaryJac_ref,
2566 double* boundaryJac,
2567 double* metricTensor,
2568 double& metricTensorDetSqrt,
2574 mapping.calculateMapping_elementBoundary(eN,
2580 mesh_trial_trace_ref,
2581 mesh_grad_trial_trace_ref,
2588 metricTensorDetSqrt,
2597 const int ebN_local,
2599 const int ebN_local_kb,
2602 double* mesh_trial_trace_ref,
2603 double* mesh_grad_trial_trace_ref,
2604 double* boundaryJac_ref,
2608 double* boundaryJac,
2609 double* metricTensor,
2610 double& metricTensorDetSqrt,
2617 mapping.calculateMapping_elementBoundary(eN,
2623 mesh_trial_trace_ref,
2624 mesh_grad_trial_trace_ref,
2631 metricTensorDetSqrt,
2641 const int ebN_local,
2643 const int ebN_local_kb,
2644 double* mesh_velocity_dof,
2646 double* mesh_trial_trace_ref,
2650 double* boundaryJac,
2651 double* metricTensor,
2652 double& metricTensorDetSqrt)
2654 mapping.calculateMappingVelocity_elementBoundary(eN,
2660 mesh_trial_trace_ref,
2666 metricTensorDetSqrt);
2670 const int ebN_local,
2672 const int ebN_local_kb,
2673 double* mesh_velocity_dof,
2675 double* mesh_trial_trace_ref,
2680 double* boundaryJac,
2681 double* metricTensor,
2682 double& metricTensorDetSqrt)
2684 mapping.calculateMappingVelocity_elementBoundary(eN,
2690 mesh_trial_trace_ref,
2697 metricTensorDetSqrt);
2701 return stress[
sXX]*grad_test_dV[
X] + stress[
sXY]*grad_test_dV[
Y];
2717 return stress[
sYX]*grad_test_dV[
X] + stress[
sYY]*grad_test_dV[
Y];
2733 return stressFlux*disp_test_dS;
2737 return dstressFlux*disp_test_dS;
double NumericalDiffusion(const double &numDiff, const double grad_u[2], const double grad_w_dV[2])
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 Advection_adjoint(const double df[2], const double grad_w_dV[2])
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
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])
void DOFaverage(const double *dof, const int *l2g_element, double &val)
double Stress_u_weak(double *stress, double *grad_test_dV)
double pressureProjection_weak(const double &viscosity, const double &p, const double &p_avg, const double &q, const double &dV)
double AdvectionJacobian_weak(const double df[2], const double &v, const double grad_w_dV[2])
double AdvectionJacobian_strong(const double df[2], const double grad_v[2])
double MassJacobian_weak(const double &dmt, const double &v, const double &w_dV)
CompKernelSpaceMapping< 2, NDOF_MESH_TRIAL_ELEMENT > mapping
double Hamiltonian_strong(const double dH[2], const double grad_u[2])
void DOFaverage(const double *dof, const int *l2g_element, double &val)
double NumericalDiffusion(const double &numDiff, const double grad_u[NSPACE], const double grad_w_dV[NSPACE])
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
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])
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[2], double &numDiff)
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])
double Diffusion_weak(int *rowptr, int *colind, double *a, const double grad_phi[NSPACE], const double grad_w_dV[NSPACE])
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])
double StressJacobian_v_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
void calculateGScale(double *G, double *v, double &h)
double HamiltonianJacobian_weak(const double dH[NSPACE], const double grad_v[NSPACE], const double &w_dV)
double Hamiltonian_adjoint(const double dH[NSPACE], const double grad_w_dV[NSPACE])
void backwardEuler(const double &dt, const double &m_old, const double &m, const double &dm, double &mt, double &dmt)
double Reaction_strong(const double &r)
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
double Advection_weak(const double f[2], const double grad_w_dV[2])
double SubgridError(const double &error, const double &Lstar_w_dV)
double MassJacobian_weak(const double &dmt, const double &v, const double &w_dV)
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)
double HamiltonianJacobian_strong(const double dH[2], const double grad_v[2])
double StressJacobian_w_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
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])
double StressJacobian_u_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
double Diffusion_weak(int *rowptr, int *colind, double *a, const double grad_phi[2], const double grad_w_dV[2])
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
double ReactionJacobian_strong(const double &dr, const double &v)
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)
double SubgridError(const double &error, const double &Lstar_w_dV)
double InteriorElementBoundaryFlux(const double &flux, const double &w_dS)
double Hamiltonian_weak(const double &H, const double &w_dV)
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[NSPACE], double &gradNorm, double &gradNorm_last, double &numDiff)
double SimpleDiffusionJacobian_weak(int *rowptr, int *colind, double *a, const double grad_v[2], const double grad_w_dV[2])
double ReactionJacobian_weak(const double &dr, const double &v, const double &w_dV)
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)
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)
double ExteriorElementBoundaryStressFluxJacobian(const double &dstressFlux, const double &disp_test_dS)
double df(double C, double b, double a, int q, int r)
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
void calculateG(double *jacInv, double *G, double &G_dd_G, double &tr_G)
double Advection_strong(const double df[NSPACE], const double grad_u[NSPACE])
void calculateMappingVelocity_element(const int eN, const int k, double *meshVelocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt)
double SimpleDiffusionJacobian_weak(int *rowptr, int *colind, double *a, const double grad_v[NSPACE], const double grad_w_dV[NSPACE])
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])
double ExteriorElementBoundaryStressFluxJacobian(const double &dstressFlux, const double &disp_test_dS)
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)
double StressJacobian_u_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
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)
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)
double StressJacobian_v_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
void gradTestFromRef(const double *grad_test_ref, const double *jacInv, double *grad_test)
double MassJacobian_strong(const double &dmt, const double &v)
double AdvectionJacobian_strong(const double df[NSPACE], const double grad_v[NSPACE])
void vel(double rS, double norm_v, double r, double theta, double *vR, double *vTHETA)
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)
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
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)
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])
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)
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)
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)
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)
double pressureProjection_weak(const double &viscosity, const double &p, const double &p_avg, const double &q, const double &dV)
void valFromDOF(const double *dof, const int *l2g_element, const double *trial_ref, double &val)
double NumericalDiffusionJacobian(const double &numDiff, const double grad_v[2], const double grad_w_dV[2])
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)
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 StressJacobian_u_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
double Reaction_adjoint(const double &dr, const double &w_dV)
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])
double InteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
void gradFromElementDOF(const double *dof, const double *grad_trial, double *grad)
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[NSPACE *NSPACE], const double &strong_residual, const double grad_u[NSPACE], double &numDiff)
double MassJacobian_strong(const double &dmt, const double &v)
double ExteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
double StressJacobian_v_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
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)
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[NSPACE], double &numDiff)
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)
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
void valFromElementDOF(const double *dof, const double *trial_ref, double &val)
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)
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)
double AdvectionJacobian_weak(const double df[NSPACE], const double &v, const double grad_w_dV[NSPACE])
double Mass_strong(const double &mt)
double Advection_weak(const double f[NSPACE], const double grad_w_dV[NSPACE])
void gradTestFromRef(const double *grad_test_ref, const double *jacInv, double *grad_test)
double Reaction_weak(const double &r, const double &w_dV)
double SubgridErrorJacobian(const double &derror, const double &Lstar_w_dV)
double StressJacobian_w_v_weak(double *dstress, double *grad_trial, double *grad_test_dV)
double ExteriorElementBoundaryFlux(const double &flux, const double &w_dS)
double ReactionJacobian_strong(const double &dr, const double &v)
void gradTrialFromRef(const double *grad_trial_ref, const double *jacInv, double *grad_trial)
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)
double StressJacobian_w_w_weak(double *dstress, double *grad_trial, double *grad_test_dV)
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 ExteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
void hessTrialFromRef(const double *hess_trial_ref, const double *jacInv, double *hess_trial)
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 SubgridErrorJacobian(const double &derror, const double &Lstar_w_dV)
double Hamiltonian_adjoint(const double dH[2], const double grad_w_dV[2])
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)
double Hamiltonian_weak(const double &H, const double &w_dV)
double Reaction_strong(const double &r)
double Stress_u_weak(double *stress, double *grad_test_dV)
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)
void hessTrialFromRef(const double *hess_trial_ref, const double *jacInv, double *hess_trial)
void backwardEuler(const double &dt, const double &m_old, const double &m, const double &dm, double &mt, double &dmt)
double Stress_w_weak(double *stress, double *grad_test_dV)
double Advection_strong(const double df[2], const double grad_u[2])
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])
double Mass_strong(const double &mt)
double ReactionJacobian_weak(const double &dr, const double &v, const double &w_dV)
double Advection_adjoint(const double df[NSPACE], const double grad_w_dV[NSPACE])
void bdf(const double &alpha, const double &beta, const double &m, const double &dm, double &mt, double &dmt)
void bdfC2(const double &alpha, const double &beta, const double &m, const double &dm, const double &dm2, double &mt, double &dmt, double &dm2t)
void valFromElementDOF(const double *dof, const double *trial_ref, double &val)
double HamiltonianJacobian_weak(const double dH[2], const double grad_v[2], const double &w_dV)
double StressJacobian_v_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
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)
double Mass_weak(const double &mt, const double &w_dV)
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)
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)
double StressJacobian_v_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
double HamiltonianJacobian_strong(const double dH[NSPACE], const double grad_v[NSPACE])
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
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)
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)
void gradFromElementDOF(const double *dof, const double *grad_trial, double *grad)
double InteriorElementBoundaryFlux(const double &flux, const double &w_dS)
double Stress_v_weak(double *stress, double *grad_test_dV)
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)
double StressJacobian_u_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)
double ExteriorElementBoundaryFlux(const double &flux, const double &w_dS)
double NumericalDiffusionJacobian(const double &numDiff, const double grad_v[NSPACE], const double grad_w_dV[NSPACE])
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])
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double G[2 *2], const double &strong_residual, const double grad_u[2], double &numDiff)
void calculateG(double *jacInv, double *G, double &G_dd_G, double &tr_G)
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
double Stress_v_weak(double *stress, double *grad_test_dV)
double Reaction_adjoint(const double &dr, const double &w_dV)
void calculateH_element(const int eN, const int k, double *h_dof, int *mesh_l2g, double *mesh_trial_ref, double &h)
void bdfC2(const double &alpha, const double &beta, const double &m, const double &dm, const double &dm2, double &mt, double &dmt, double &dm2t)
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
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)
double Mass_weak(const double &mt, const double &w_dV)
void calculateGScale(double *G, double *v, double &h)
double Mass_adjoint(const double &dmt, const double &w_dV)
void calculateMappingVelocity_element(const int eN, const int k, double *mesh_velocity_dof, int *mesh_l2g, double *mesh_trial_ref, double &xt, double &yt)
void bdf(const double &alpha, const double &beta, const double &m, const double &dm, double &mt, double &dmt)
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)
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)
double Reaction_weak(const double &r, const double &w_dV)
void calculateNumericalDiffusion(const double &shockCapturingDiffusion, const double &elementDiameter, const double &strong_residual, const double grad_u[2], double &gradNorm, double &gradNorm_last, double &numDiff)
double ExteriorElementBoundaryStressFlux(const double &stressFlux, const double &disp_test_dS)
void hessFromDOF(const double *dof, const int *l2g_element, const double *hess_trial, double *hess)
void gradFromDOF(const double *dof, const int *l2g_element, const double *grad_trial, double *grad)
double Mass_adjoint(const double &dmt, const double &w_dV)
CompKernelSpaceMapping< NSPACE, NDOF_MESH_TRIAL_ELEMENT > mapping
double Hamiltonian_strong(const double dH[NSPACE], const double grad_u[NSPACE])
double InteriorNumericalAdvectiveFluxJacobian(const double &dflux_left, const double &v)
double ExteriorElementBoundaryStressFlux(const double &stressFlux, const double &disp_test_dS)
void gradTrialFromRef(const double *grad_trial_ref, const double *jacInv, double *grad_trial)
double StressJacobian_u_u_weak(double *dstress, double *grad_trial, double *grad_test_dV)