8#include PROTEUS_LAPACK_H
18 assert(fabs(A[0][0]) > 0.0);
19 AI[0][0] = 1.0/A[0][0];
23 detA = A[0][0]*A[1][1]-A[0][1]*A[1][0];
24 assert(fabs(detA) > 0.0);
26 AI[0][0] = detAinv*A[1][1]; AI[0][1] =-detAinv*A[0][1];
27 AI[1][0] =-detAinv*A[1][0]; AI[1][1] = detAinv*A[0][0];
32 A[0][0]*(A[1][1]*A[2][2]-A[2][1]*A[1][2])-
33 A[0][1]*(A[1][0]*A[2][2]-A[2][0]*A[1][2])+
34 A[0][2]*(A[1][0]*A[2][1]-A[2][0]*A[1][1]);
35 assert(fabs(detA) > 0.0);
37 AI[0][0] = detAinv*(A[1][1]*A[2][2]-A[1][2]*A[2][1]);
38 AI[0][1] = detAinv*(A[0][2]*A[2][1]-A[0][1]*A[2][2]);
39 AI[0][2] = detAinv*(A[0][1]*A[1][2]-A[0][2]*A[1][1]);
41 AI[1][0] = detAinv*(A[1][2]*A[2][0]-A[1][0]*A[2][2]);
42 AI[1][1] = detAinv*(A[0][0]*A[2][2]-A[0][2]*A[2][0]);
43 AI[1][2] = detAinv*(A[0][2]*A[1][0]-A[0][0]*A[1][2]);
45 AI[2][0] = detAinv*(A[1][0]*A[2][1]-A[1][1]*A[2][0]);
46 AI[2][1] = detAinv*(A[0][1]*A[2][0]-A[0][0]*A[2][1]);
47 AI[2][2] = detAinv*(A[0][0]*A[1][1]-A[0][1]*A[1][0]);
53 int nQuadraturePoints_element,
54 int nDOF_test_element,
55 int nElementBoundaries_element,
56 int nQuadraturePoints_elementBoundary,
58 int * nFreeDOF_element,
59 int * freeLocal_element,
63 double * elementBarycenters,
167 int eN,ebN,I,J,i,k,ebN_free,ebN_dir;
168 int nSpace2 = nSpace*nSpace;
169 int nDOF_RT0V_element = nSpace+1;
170 double volume,area,volFact,areaFact;
171 double ah[3][3] = {{0.0,0.0,0.0},
174 double vecf[3] = {0.0,0.0,0.0};
175 double rh[4] = {0.0,0.0,0.0,0.0};
176 double mth[4] = {0.0,0.0,0.0,0.0};
178 double G_E[3][3] = {{0.0,0.0,0.0},
181 double G_Ei[3][3]={{0.0,0.0,0.0},
184 double rhs_c[3] ={0.0,0.0,0.0};
185 double c_E[3] = {0.0,0.0,0.0};
187 double dDim = (double) nSpace;
190 assert(nDOF_test_element == nSpace+1);
191 volFact = 1.0; areaFact = 1.0;
196 volFact = 1.0/6.0; areaFact = 0.5;
204 for (eN = 0; eN < nElements_global; eN++)
207 rh[0] = 0.0; rh[1] = 0.0; rh[2] = 0.0; rh[3] = 0.0; rbar = 0.0;
208 mth[0]= 0.0; mth[1]= 0.0; mth[2] = 0.0; mth[3] = 0.0; mtbar= 0.0;
209 vecf[0]=0.0; vecf[1] = 0.0; vecf[2] = 0.0;
210 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
211 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
212 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
215 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
217 for (k = 0; k < nQuadraturePoints_element; k++)
220 for (I = 0; I < nSpace; I++)
223 f[eN*nQuadraturePoints_element*nSpace +
229 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
231 for (J = 0; J < nSpace; J++)
234 a[eN*nQuadraturePoints_element*nSpace2 +
241 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
245 for (i = 0; i < nDOF_test_element; i++)
248 r[eN*nQuadraturePoints_element + k]
250 w_dV_r[eN*nQuadraturePoints_element*nDOF_test_element +
251 k*nDOF_test_element +
255 mt[eN*nQuadraturePoints_element + k]
257 w_dV_m[eN*nQuadraturePoints_element*nDOF_test_element +
258 k*nDOF_test_element +
264 for (i = 0; i < nDOF_test_element; i++)
266 rbar += rh[i]/volume; mtbar += mth[i]/volume;
268 b_E = (-rbar - mtbar)/dDim;
270 rt0vdofs[eN*nDOF_RT0V_element + nSpace] = b_E;
272 for (I=0; I < nSpace; I++)
274 rt0vdofs[eN*nDOF_RT0V_element + I] = 0.0;
275 for (J=0; J < nSpace; J++)
278 rt0vdofs[eN*nDOF_RT0V_element + I] -=
281 gradu[eN*nQuadraturePoints_element*nSpace +
289 rt0vdofs[eN*nDOF_RT0V_element + I] += vecf[I];
291 rt0vdofs[eN*nDOF_RT0V_element + I] -=
294 elementBarycenters[eN*3 + I];
304 rhs_c[0] = 0.0; rhs_c[1] = 0.0; rhs_c[2] = 0.0;
305 G_E[0][0] = 1.0; G_E[0][1] = 0.0; G_E[0][2] = 0.0;
306 G_E[1][0] = 0.0; G_E[1][1] = 1.0; G_E[1][2] = 0.0;
307 G_E[2][0] = 0.0; G_E[2][1] = 0.0; G_E[2][2] = 1.0;
310 if (nFreeDOF_element[eN] < ebN_free)
311 ebN_free = nFreeDOF_element[eN];
312 for (i = 0; i < ebN_free; i++)
314 ebN = freeLocal_element[eN*nDOF_test_element + i];
316 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
317 ebN*nQuadraturePoints_elementBoundary + 0]
320 for (I = 0; I < nSpace; I++)
324 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
325 ebN*nQuadraturePoints_elementBoundary*nSpace +
329 rhs_c[i] = -rh[ebN] + volume*rbar/(dDim+1.) -mth[ebN] + mtbar*volume/(dDim+1.);
350 while (ebN_free < nSpace && ebN < nElementBoundaries_element)
357 for (k = 0; k < ebN_free; k++)
359 if (ebN == freeLocal_element[eN*nDOF_test_element + k])
365 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
366 ebN*nQuadraturePoints_elementBoundary + 0]
369 for (I = 0; I < nSpace; I++)
373 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
374 ebN*nQuadraturePoints_elementBoundary*nSpace +
377 rhs_c[ebN_free] = 0.0;
383 assert (ebN_free >= nSpace);
394 for (I = 0; I < nSpace; I++)
397 for (J = 0; J < nSpace; J++)
398 c_E[I] += G_Ei[I][J]*rhs_c[J];
410 for (I = 0; I < nSpace; I++)
411 rt0vdofs[eN*nDOF_RT0V_element + I] += c_E[I];
416 int nQuadraturePoints_element,
417 int nDOF_test_element,
418 int nElementBoundaries_element,
419 int nQuadraturePoints_elementBoundary,
423 int * nFreeDOF_element,
424 int * freeLocal_element,
428 double * elementBarycenters,
532 int eN,ebN,I,J,i,k,ebN_free,ebN_dir;
533 int m,
nnz=rowptr[nSpace];
534 int nDOF_RT0V_element = nSpace+1;
535 double volume,area,volFact,areaFact;
536 double ah[3][3] = {{0.0,0.0,0.0},
539 double vecf[3] = {0.0,0.0,0.0};
540 double rh[4] = {0.0,0.0,0.0,0.0};
541 double mth[4] = {0.0,0.0,0.0,0.0};
543 double G_E[3][3] = {{0.0,0.0,0.0},
546 double G_Ei[3][3]={{0.0,0.0,0.0},
549 double rhs_c[3] ={0.0,0.0,0.0};
550 double c_E[3] = {0.0,0.0,0.0};
552 double dDim = (double) nSpace;
555 assert(nDOF_test_element == nSpace+1);
556 volFact = 1.0; areaFact = 1.0;
561 volFact = 1.0/6.0; areaFact = 0.5;
569 for (eN = 0; eN < nElements_global; eN++)
572 rh[0] = 0.0; rh[1] = 0.0; rh[2] = 0.0; rh[3] = 0.0; rbar = 0.0;
573 mth[0]= 0.0; mth[1]= 0.0; mth[2] = 0.0; mth[3] = 0.0; mtbar= 0.0;
574 vecf[0]=0.0; vecf[1] = 0.0; vecf[2] = 0.0;
575 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
576 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
577 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
580 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
582 for (k = 0; k < nQuadraturePoints_element; k++)
585 for (I = 0; I < nSpace; I++)
588 f[eN*nQuadraturePoints_element*nSpace +
594 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
596 for (m=rowptr[I];m<rowptr[I+1];m++)
599 a[eN*nQuadraturePoints_element*
nnz+
605 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
609 for (i = 0; i < nDOF_test_element; i++)
612 r[eN*nQuadraturePoints_element + k]
614 w_dV_r[eN*nQuadraturePoints_element*nDOF_test_element +
615 k*nDOF_test_element +
619 mt[eN*nQuadraturePoints_element + k]
621 w_dV_m[eN*nQuadraturePoints_element*nDOF_test_element +
622 k*nDOF_test_element +
628 for (i = 0; i < nDOF_test_element; i++)
630 rbar += rh[i]/volume; mtbar += mth[i]/volume;
632 b_E = (-rbar - mtbar)/dDim;
634 rt0vdofs[eN*nDOF_RT0V_element + nSpace] = b_E;
636 for (I=0; I < nSpace; I++)
638 rt0vdofs[eN*nDOF_RT0V_element + I] = 0.0;
639 for (J=0; J < nSpace; J++)
642 rt0vdofs[eN*nDOF_RT0V_element + I] -=
645 gradu[eN*nQuadraturePoints_element*nSpace +
653 rt0vdofs[eN*nDOF_RT0V_element + I] += vecf[I];
655 rt0vdofs[eN*nDOF_RT0V_element + I] -=
658 elementBarycenters[eN*3 + I];
668 rhs_c[0] = 0.0; rhs_c[1] = 0.0; rhs_c[2] = 0.0;
669 G_E[0][0] = 1.0; G_E[0][1] = 0.0; G_E[0][2] = 0.0;
670 G_E[1][0] = 0.0; G_E[1][1] = 1.0; G_E[1][2] = 0.0;
671 G_E[2][0] = 0.0; G_E[2][1] = 0.0; G_E[2][2] = 1.0;
674 if (nFreeDOF_element[eN] < ebN_free)
675 ebN_free = nFreeDOF_element[eN];
676 for (i = 0; i < ebN_free; i++)
678 ebN = freeLocal_element[eN*nDOF_test_element + i];
680 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
681 ebN*nQuadraturePoints_elementBoundary + 0]
684 for (I = 0; I < nSpace; I++)
688 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
689 ebN*nQuadraturePoints_elementBoundary*nSpace +
693 rhs_c[i] = -rh[ebN] + volume*rbar/(dDim+1.) -mth[ebN] + mtbar*volume/(dDim+1.);
714 while (ebN_free < nSpace && ebN < nElementBoundaries_element)
721 for (k = 0; k < ebN_free; k++)
723 if (ebN == freeLocal_element[eN*nDOF_test_element + k])
729 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
730 ebN*nQuadraturePoints_elementBoundary + 0]
733 for (I = 0; I < nSpace; I++)
737 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
738 ebN*nQuadraturePoints_elementBoundary*nSpace +
741 rhs_c[ebN_free] = 0.0;
747 assert (ebN_free >= nSpace);
758 for (I = 0; I < nSpace; I++)
761 for (J = 0; J < nSpace; J++)
762 c_E[I] += G_Ei[I][J]*rhs_c[J];
774 for (I = 0; I < nSpace; I++)
775 rt0vdofs[eN*nDOF_RT0V_element + I] += c_E[I];
780 int nQuadraturePoints_element,
781 int nDOF_test_element,
782 int nElementBoundaries_element,
783 int nQuadraturePoints_elementBoundary,
785 int * nFreeDOF_element,
786 int * freeLocal_element,
790 double * elementBarycenters,
804 int eN,ebN,I,J,i,k,ebN_free,ebN_dir;
805 int nSpace2 = nSpace*nSpace;
806 int nDOF_RT0V_element = nSpace+1;
807 double volume,area,volFact,areaFact;
808 double ah[3][3] = {{0.0,0.0,0.0},
811 double vecf[3] = {0.0,0.0,0.0};
812 double rh[4] = {0.0,0.0,0.0,0.0};
814 double G_E[3][3] = {{0.0,0.0,0.0},
817 double G_Ei[3][3]={{0.0,0.0,0.0},
820 double rhs_c[3] ={0.0,0.0,0.0};
821 double c_E[3] = {0.0,0.0,0.0};
823 double dDim = (double) nSpace;
826 assert(nDOF_test_element == nSpace+1);
827 volFact = 1.0; areaFact = 1.0;
832 volFact = 1.0/6.0; areaFact = 0.5;
843 for (eN = 0; eN < nElements_global; eN++)
846 rh[0] = 0.0; rh[1] = 0.0; rh[2] = 0.0; rh[3] = 0.0; rbar = 0.0;
847 vecf[0]=0.0; vecf[1] = 0.0; vecf[2] = 0.0;
848 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
849 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
850 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
853 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
855 for (k = 0; k < nQuadraturePoints_element; k++)
858 for (I = 0; I < nSpace; I++)
861 f[eN*nQuadraturePoints_element*nSpace +
867 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
869 for (J = 0; J < nSpace; J++)
872 a[eN*nQuadraturePoints_element*nSpace2 +
879 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
883 for (i = 0; i < nDOF_test_element; i++)
886 r[eN*nQuadraturePoints_element + k]
888 w_dV_r[eN*nQuadraturePoints_element*nDOF_test_element +
889 k*nDOF_test_element +
896 for (i = 0; i < nDOF_test_element; i++)
898 rbar += rh[i]/volume;
902 rt0vdofs[eN*nDOF_RT0V_element + nSpace] = b_E;
904 for (I=0; I < nSpace; I++)
906 rt0vdofs[eN*nDOF_RT0V_element + I] = 0.0;
907 for (J=0; J < nSpace; J++)
910 rt0vdofs[eN*nDOF_RT0V_element + I] -=
913 gradu[eN*nQuadraturePoints_element*nSpace +
921 rt0vdofs[eN*nDOF_RT0V_element + I] += vecf[I];
923 rt0vdofs[eN*nDOF_RT0V_element + I] -=
926 elementBarycenters[eN*3 + I];
936 rhs_c[0] = 0.0; rhs_c[1] = 0.0; rhs_c[2] = 0.0;
937 G_E[0][0] = 1.0; G_E[0][1] = 0.0; G_E[0][2] = 0.0;
938 G_E[1][0] = 0.0; G_E[1][1] = 1.0; G_E[1][2] = 0.0;
939 G_E[2][0] = 0.0; G_E[2][1] = 0.0; G_E[2][2] = 1.0;
942 if (nFreeDOF_element[eN] < ebN_free)
943 ebN_free = nFreeDOF_element[eN];
944 for (i = 0; i < ebN_free; i++)
946 ebN = freeLocal_element[eN*nDOF_test_element + i];
948 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
949 ebN*nQuadraturePoints_elementBoundary + 0]
952 for (I = 0; I < nSpace; I++)
956 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
957 ebN*nQuadraturePoints_elementBoundary*nSpace +
961 rhs_c[i] = -rh[ebN] + volume*rbar/(dDim+1.);
982 while (ebN_free < nSpace && ebN < nElementBoundaries_element)
989 for (k = 0; k < ebN_free; k++)
991 if (ebN == freeLocal_element[eN*nDOF_test_element + k])
997 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
998 ebN*nQuadraturePoints_elementBoundary + 0]
1001 for (I = 0; I < nSpace; I++)
1005 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
1006 ebN*nQuadraturePoints_elementBoundary*nSpace +
1009 rhs_c[ebN_free] = 0.0;
1015 assert (ebN_free >= nSpace);
1026 for (I = 0; I < nSpace; I++)
1029 for (J = 0; J < nSpace; J++)
1030 c_E[I] += G_Ei[I][J]*rhs_c[J];
1042 for (I = 0; I < nSpace; I++)
1043 rt0vdofs[eN*nDOF_RT0V_element + I] += c_E[I];
1048 int nQuadraturePoints_element,
1049 int nDOF_test_element,
1050 int nElementBoundaries_element,
1051 int nQuadraturePoints_elementBoundary,
1055 int * nFreeDOF_element,
1056 int * freeLocal_element,
1058 double * sqrt_det_g,
1060 double * elementBarycenters,
1074 int eN,ebN,I,J,i,k,ebN_free,ebN_dir;
1075 int m,
nnz=rowptr[nSpace];
1076 int nDOF_RT0V_element = nSpace+1;
1077 double volume,area,volFact,areaFact;
1078 double ah[3][3] = {{0.0,0.0,0.0},
1081 double vecf[3] = {0.0,0.0,0.0};
1082 double rh[4] = {0.0,0.0,0.0,0.0};
1084 double G_E[3][3] = {{0.0,0.0,0.0},
1087 double G_Ei[3][3]={{0.0,0.0,0.0},
1090 double rhs_c[3] ={0.0,0.0,0.0};
1091 double c_E[3] = {0.0,0.0,0.0};
1093 double dDim = (double) nSpace;
1096 assert(nDOF_test_element == nSpace+1);
1097 volFact = 1.0; areaFact = 1.0;
1102 volFact = 1.0/6.0; areaFact = 0.5;
1113 for (eN = 0; eN < nElements_global; eN++)
1116 rh[0] = 0.0; rh[1] = 0.0; rh[2] = 0.0; rh[3] = 0.0; rbar = 0.0;
1117 vecf[0]=0.0; vecf[1] = 0.0; vecf[2] = 0.0;
1118 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
1119 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
1120 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
1123 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
1125 for (k = 0; k < nQuadraturePoints_element; k++)
1128 for (I = 0; I < nSpace; I++)
1131 f[eN*nQuadraturePoints_element*nSpace +
1137 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
1139 for (m=rowptr[I];m<rowptr[I+1];m++)
1142 a[eN*nQuadraturePoints_element*
nnz+
1148 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
1152 for (i = 0; i < nDOF_test_element; i++)
1155 r[eN*nQuadraturePoints_element + k]
1157 w_dV_r[eN*nQuadraturePoints_element*nDOF_test_element +
1158 k*nDOF_test_element +
1165 for (i = 0; i < nDOF_test_element; i++)
1167 rbar += rh[i]/volume;
1171 rt0vdofs[eN*nDOF_RT0V_element + nSpace] = b_E;
1173 for (I=0; I < nSpace; I++)
1175 rt0vdofs[eN*nDOF_RT0V_element + I] = 0.0;
1176 for (J=0; J < nSpace; J++)
1179 rt0vdofs[eN*nDOF_RT0V_element + I] -=
1182 gradu[eN*nQuadraturePoints_element*nSpace +
1190 rt0vdofs[eN*nDOF_RT0V_element + I] += vecf[I];
1192 rt0vdofs[eN*nDOF_RT0V_element + I] -=
1195 elementBarycenters[eN*3 + I];
1205 rhs_c[0] = 0.0; rhs_c[1] = 0.0; rhs_c[2] = 0.0;
1206 G_E[0][0] = 1.0; G_E[0][1] = 0.0; G_E[0][2] = 0.0;
1207 G_E[1][0] = 0.0; G_E[1][1] = 1.0; G_E[1][2] = 0.0;
1208 G_E[2][0] = 0.0; G_E[2][1] = 0.0; G_E[2][2] = 1.0;
1211 if (nFreeDOF_element[eN] < ebN_free)
1212 ebN_free = nFreeDOF_element[eN];
1213 for (i = 0; i < ebN_free; i++)
1215 ebN = freeLocal_element[eN*nDOF_test_element + i];
1217 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1218 ebN*nQuadraturePoints_elementBoundary + 0]
1221 for (I = 0; I < nSpace; I++)
1225 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
1226 ebN*nQuadraturePoints_elementBoundary*nSpace +
1230 rhs_c[i] = -rh[ebN] + volume*rbar/(dDim+1.);
1251 while (ebN_free < nSpace && ebN < nElementBoundaries_element)
1258 for (k = 0; k < ebN_free; k++)
1260 if (ebN == freeLocal_element[eN*nDOF_test_element + k])
1266 area = sqrt_det_g[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1267 ebN*nQuadraturePoints_elementBoundary + 0]
1270 for (I = 0; I < nSpace; I++)
1274 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
1275 ebN*nQuadraturePoints_elementBoundary*nSpace +
1278 rhs_c[ebN_free] = 0.0;
1284 assert (ebN_free >= nSpace);
1295 for (I = 0; I < nSpace; I++)
1298 for (J = 0; J < nSpace; J++)
1299 c_E[I] += G_Ei[I][J]*rhs_c[J];
1311 for (I = 0; I < nSpace; I++)
1312 rt0vdofs[eN*nDOF_RT0V_element + I] += c_E[I];
1317 int nQuadraturePoints_element,
1339 int nSpace2 = nSpace*nSpace;
1340 int nDOF_RT0V_element = nSpace+1;
1341 double volume,volFact;
1342 double ah[3][3] = {{0.0,0.0,0.0},
1358 for (eN = 0; eN < nElements_global; eN++)
1360 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
1361 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
1362 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
1365 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
1367 for (k = 0; k < nQuadraturePoints_element; k++)
1370 for (I = 0; I < nSpace; I++)
1372 for (J = 0; J < nSpace; J++)
1375 a[eN*nQuadraturePoints_element*nSpace2 +
1382 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
1388 for (I=0; I < nSpace; I++)
1390 for (J=0; J < nSpace; J++)
1393 rt0vdofs[eN*nDOF_RT0V_element + I] -=
1396 gradphi[eN*nQuadraturePoints_element*nSpace +
1411 int nQuadraturePoints_element,
1435 int m,
nnz=rowptr[nSpace];
1436 int nDOF_RT0V_element = nSpace+1;
1437 double volume,volFact;
1438 double ah[3][3] = {{0.0,0.0,0.0},
1454 for (eN = 0; eN < nElements_global; eN++)
1456 ah[0][0] = 0.0; ah[0][1]=0.0; ah[0][2] = 0.0;
1457 ah[1][0] = 0.0; ah[1][1]=0.0; ah[1][2] = 0.0;
1458 ah[2][0] = 0.0; ah[2][1]=0.0; ah[2][2] = 0.0;
1461 volume = fabs(detJ[eN*nQuadraturePoints_element + 0])*volFact;
1463 for (k = 0; k < nQuadraturePoints_element; k++)
1466 for (I = 0; I < nSpace; I++)
1468 for(m=rowptr[I];m<rowptr[I+1];m++)
1471 a[eN*nQuadraturePoints_element*
nnz+
1477 fabs(detJ[eN*nQuadraturePoints_element + k])/volume;
1483 for (I=0; I < nSpace; I++)
1485 for (J=0; J < nSpace; J++)
1488 rt0vdofs[eN*nDOF_RT0V_element + I] -=
1491 gradphi[eN*nQuadraturePoints_element*nSpace +
1506 int nPoints_element,
1509 double * rt0vdofs_element,
1526 int nDOF_RT0V_element = nSpace+1;
1528 for (eN = 0; eN < nElements_global; eN++)
1531 b_T = rt0vdofs_element[eN*nDOF_RT0V_element + nSpace];
1532 for (k = 0; k < nPoints_element; k++)
1534 for (I = 0; I < nSpace; I++)
1536 v_element[eN*nPoints_element*nSpace + k*nSpace + I] =
1537 rt0vdofs_element[eN*nDOF_RT0V_element + I] +
1538 b_T * x_element[eN*nPoints_element*3 + k*3 + I];
1545 int nElementBoundaries_element,
1546 int nPoints_elementBoundary,
1548 double * x_elementBoundary,
1549 double * rt0vdofs_element,
1550 double * v_elementBoundary)
1568 int nDOF_RT0V_element = nSpace+1;
1570 for (eN = 0; eN < nElements_global; eN++)
1573 b_T = rt0vdofs_element[eN*nDOF_RT0V_element + nSpace];
1574 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
1576 for (k = 0; k < nPoints_elementBoundary; k++)
1578 for (I = 0; I < nSpace; I++)
1580 v_elementBoundary[eN*nElementBoundaries_element*nPoints_elementBoundary*nSpace +
1581 ebN*nPoints_elementBoundary*nSpace +
1584 rt0vdofs_element[eN*nDOF_RT0V_element + I] +
1585 b_T * x_elementBoundary[eN*nElementBoundaries_element*nPoints_elementBoundary*3 +
1586 ebN*nPoints_elementBoundary*3 +
1595 int nPoints_elementBoundary,
1597 int * elementBoundaryElementsArray,
1598 double * x_elementBoundary_global,
1599 double * rt0vdofs_element,
1600 double * v_elementBoundary_global)
1619 int nDOF_RT0V_element = nSpace+1;
1621 for (ebN = 0; ebN < nElementBoundaries_global; ebN++)
1623 eN = elementBoundaryElementsArray[ebN*2 + 0];
1624 b_T = rt0vdofs_element[eN*nDOF_RT0V_element + nSpace];
1625 for (k = 0; k < nPoints_elementBoundary; k++)
1627 for (I = 0; I < nSpace; I++)
1629 v_elementBoundary_global[ebN*nPoints_elementBoundary*nSpace + k*nSpace + I] =
1630 rt0vdofs_element[eN*nDOF_RT0V_element + I] +
1631 b_T * x_elementBoundary_global[ebN*nPoints_elementBoundary*3 + k*3 + I];
1638 int nPoints_elementBoundary,
1640 int * elementBoundaryElementsArray,
1641 int * exteriorElementBoundariesArray,
1642 double * x_elementBoundary_global,
1643 double * rt0vdofs_element,
1644 double * v_elementBoundary_global)
1662 int ebNE,ebN,eN,I,k;
1663 int nDOF_RT0V_element = nSpace+1;
1665 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
1667 ebN = exteriorElementBoundariesArray[ebNE];
1668 eN = elementBoundaryElementsArray[ebN*2 + 0];
1669 b_T = rt0vdofs_element[eN*nDOF_RT0V_element + nSpace];
1670 for (k = 0; k < nPoints_elementBoundary; k++)
1672 for (I = 0; I < nSpace; I++)
1674 v_elementBoundary_global[ebNE*nPoints_elementBoundary*nSpace + k*nSpace + I] =
1675 rt0vdofs_element[eN*nDOF_RT0V_element + I] +
1676 b_T * x_elementBoundary_global[ebNE*nPoints_elementBoundary*3 + k*3 + I];
1684 int nQuadraturePoints_element,
1685 int nElementBoundaries_element,
1686 int nQuadraturePoints_elementBoundary,
1688 double * uQuadratureWeights_element,
1689 double * elementBarycenters,
1690 double * aElementQuadratureWeights,
1692 double * uQuadratureWeights_elementBoundary,
1696 double * x_elementBoundary,
1697 double * u_elementBoundary,
1703 double * rt0potential)
1730 int nSpace2 = nSpace*nSpace;
1731 int nDOF_RT0V_element = nSpace+1;
1732 double volume,vmass,bndsum,adot,ahqInvI,xdotn,gravsum;
1733 double ah[3][3] = {{0.0,0.0,0.0},
1736 double ahInv[3][3] = {{0.0,0.0,0.0},
1739 double vecc[3] = {0.0,0.0,0.0};
1741 double dDim = nSpace;
1742 for (eN = 0; eN < nElements_global; eN++)
1745 for (k = 0; k < nQuadraturePoints_element; k++)
1747 volume += uQuadratureWeights_element[eN*nQuadraturePoints_element + k];
1752 for (I = 0; I < nSpace; I++)
1754 for (J = 0; J < nSpace; J++)
1759 for (k = 0; k < nQuadraturePoints_element; k++)
1762 a[eN*nQuadraturePoints_element*nSpace2 +
1767 aElementQuadratureWeights[k]*fabs(detJ[eN*nQuadraturePoints_element+k]);
1769 ah[I][J] = ah[I][J]/volume;
1772 for (k = 0; k < nQuadraturePoints_element; k++)
1775 f[eN*nQuadraturePoints_element*nSpace +
1778 aElementQuadratureWeights[k]*fabs(detJ[eN*nQuadraturePoints_element+k]);
1780 vecc[I] = vecc[I]/volume;
1792 for (k = 0; k < nQuadraturePoints_element; k++)
1795 for (I = 0; I < nSpace; I++)
1798 for (J = 0; J < nSpace; J++)
1799 ahqInvI+= ahInv[I][J]*(rt0vdofs[eN*nDOF_RT0V_element + J]
1801 rt0vdofs[eN*nDOF_RT0V_element + nSpace]
1803 x[eN*nQuadraturePoints_element*3 +
1806 adot += ahqInvI*x[eN*nQuadraturePoints_element*3 +
1809 vmass += adot*uQuadratureWeights_element[eN*nQuadraturePoints_element + k];
1813 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
1815 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
1818 for (I = 0; I < nSpace; I++)
1821 x_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*3 +
1822 ebN*nQuadraturePoints_elementBoundary*3 +
1825 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
1826 ebN*nQuadraturePoints_elementBoundary*nSpace +
1829 bndsum += u_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1830 ebN*nQuadraturePoints_elementBoundary + k]
1832 * uQuadratureWeights_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1833 ebN*nQuadraturePoints_elementBoundary + k];
1837 for (I=0; I < nSpace; I++)
1838 gravsum -= vecc[I]*elementBarycenters[eN*3 + I]*volume;
1839 rt0potential[eN] = (bndsum + vmass + gravsum)/(dDim*volume);
1844 int nQuadraturePoints_element,
1845 int nElementBoundaries_element,
1846 int nQuadraturePoints_elementBoundary,
1850 double * uQuadratureWeights_element,
1851 double * elementBarycenters,
1852 double * aElementQuadratureWeights,
1854 double * uQuadratureWeights_elementBoundary,
1858 double * x_elementBoundary,
1859 double * u_elementBoundary,
1865 double * rt0potential)
1892 int m,
nnz=rowptr[nSpace];
1893 int nDOF_RT0V_element = nSpace+1;
1894 double volume,vmass,bndsum,adot,ahqInvI,xdotn,gravsum;
1895 double ah[3][3] = {{0.0,0.0,0.0},
1898 double ahInv[3][3] = {{0.0,0.0,0.0},
1901 double vecc[3] = {0.0,0.0,0.0};
1903 double dDim = nSpace;
1904 for (eN = 0; eN < nElements_global; eN++)
1907 for (k = 0; k < nQuadraturePoints_element; k++)
1909 volume += uQuadratureWeights_element[eN*nQuadraturePoints_element + k];
1914 for (I = 0; I < nSpace; I++)
1916 for(m=rowptr[I];m<rowptr[I+1];m++)
1920 ah[I][colind[m]] = 0.0;
1921 for (k = 0; k < nQuadraturePoints_element; k++)
1924 a[eN*nQuadraturePoints_element*
nnz+
1928 aElementQuadratureWeights[k]*fabs(detJ[eN*nQuadraturePoints_element+k]);
1930 ah[I][colind[m]] = ah[I][colind[m]]/volume;
1933 for (k = 0; k < nQuadraturePoints_element; k++)
1936 f[eN*nQuadraturePoints_element*nSpace +
1939 aElementQuadratureWeights[k]*fabs(detJ[eN*nQuadraturePoints_element+k]);
1941 vecc[I] = vecc[I]/volume;
1953 for (k = 0; k < nQuadraturePoints_element; k++)
1956 for (I = 0; I < nSpace; I++)
1959 for (J = 0; J < nSpace; J++)
1960 ahqInvI+= ahInv[I][J]*(rt0vdofs[eN*nDOF_RT0V_element + J]
1962 rt0vdofs[eN*nDOF_RT0V_element + nSpace]
1964 x[eN*nQuadraturePoints_element*3 +
1967 adot += ahqInvI*x[eN*nQuadraturePoints_element*3 +
1970 vmass += adot*uQuadratureWeights_element[eN*nQuadraturePoints_element + k];
1974 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
1976 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
1979 for (I = 0; I < nSpace; I++)
1982 x_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*3 +
1983 ebN*nQuadraturePoints_elementBoundary*3 +
1986 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
1987 ebN*nQuadraturePoints_elementBoundary*nSpace +
1990 bndsum += u_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1991 ebN*nQuadraturePoints_elementBoundary + k]
1993 * uQuadratureWeights_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
1994 ebN*nQuadraturePoints_elementBoundary + k];
1998 for (I=0; I < nSpace; I++)
1999 gravsum -= vecc[I]*elementBarycenters[eN*3 + I]*volume;
2000 rt0potential[eN] = (bndsum + vmass + gravsum)/(dDim*volume);
2005 int nElementBoundaries_element,
2006 int nQuadraturePoints_elementBoundary,
2008 double * elementBoundaryQuadratureWeights,
2010 double * v_elementBoundary,
2011 double * rt0vdofs_element)
2035 double fluxsum,dotk;
2036 int nDOF_RT0V_element = nSpace+1;
2039 for (eN = 0; eN < nElements_global; eN++)
2041 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2046 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
2049 for (I=0; I < nSpace; I++)
2052 v_elementBoundary[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2053 ebN*nQuadraturePoints_elementBoundary*nSpace+
2056 n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2057 ebN*nQuadraturePoints_elementBoundary*nSpace+
2070 fluxsum += dotk*elementBoundaryQuadratureWeights[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
2071 ebN*nQuadraturePoints_elementBoundary+
2074 area += elementBoundaryQuadratureWeights[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
2075 ebN*nQuadraturePoints_elementBoundary+
2078 rt0vdofs_element[eN*nDOF_RT0V_element + ebN] = fluxsum;
2086 int nElementBoundaries_element,
2087 int nQuadraturePoints_elementBoundary,
2088 int nDOF_RT0V_element,
2089 int* elementBoundaryElementsArray,
2090 int* elementBoundariesArray,
2091 double * elementBoundaryQuadratureWeights,
2092 double * flux_elementBoundary,
2093 double * rt0vdofs_element)
2116 int eN,ebN,ebN_global,k;
2117 double fluxsum,
sign;
2118 for (eN = 0; eN < nElements_global; eN++)
2120 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2122 ebN_global = elementBoundariesArray[eN*nElementBoundaries_element+ebN];
2125 if(elementBoundaryElementsArray[2*ebN_global+1] == eN)
2127 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
2129 fluxsum +=
sign*flux_elementBoundary[ebN_global*nQuadraturePoints_elementBoundary+
2132 elementBoundaryQuadratureWeights[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
2133 ebN*nQuadraturePoints_elementBoundary+
2136 rt0vdofs_element[eN*nDOF_RT0V_element + ebN] = fluxsum;
2145 int nElementBoundaries_element,
2146 int nPoints_element,
2148 int nDetVals_element,
2150 int * elementNodesArray,
2153 double * rt0vdofs_element,
2173 int nDOF_RT0V_element = nSpace+1;
2174 double volFact,dvolInv;
2175 double ddim = nSpace;
2176 double volume = 0.0;
2178 if (nSpace > 1) volFact = 0.5;
2179 if (nSpace > 2) volFact = 1.0/6.0;
2181 for (eN = 0; eN < nElements_global; eN++)
2183 volume = volFact*abs_det_J[eN*nDetVals_element + 0];
2184 assert(volume > 0.0);
2185 dvolInv = 1.0/(ddim*volume);
2187 for (k = 0; k < nPoints_element; k++)
2189 for (I = 0; I < nSpace; I++)
2191 v_element[eN*nPoints_element*nSpace + k*nSpace + I] = 0.0;
2192 for (j = 0; j < nElementBoundaries_element; j++)
2194 jg = elementNodesArray[eN*nElementBoundaries_element + j];
2195 v_element[eN*nPoints_element*nSpace + k*nSpace + I] +=
2196 rt0vdofs_element[eN*nDOF_RT0V_element + j]
2199 *(x_element[eN*nPoints_element*3 + k*3 + I]- nodeArray[jg*3 + I]);
2211 int nElementBoundaries_element,
2212 int nPoints_elementBoundary,
2214 int nDetVals_element,
2216 int * elementNodesArray,
2218 double * x_elementBoundary,
2219 double * rt0vdofs_element,
2220 double * v_elementBoundary)
2238 int eN,ebN,I,k,j,jg;
2239 int nDOF_RT0V_element = nSpace+1;
2240 double volFact,dvolInv;
2241 double ddim = nSpace;
2242 double volume = 0.0;
2244 if (nSpace > 1) volFact = 0.5;
2245 if (nSpace > 2) volFact = 1.0/6.0;
2247 for (eN = 0; eN < nElements_global; eN++)
2249 volume = volFact*abs_det_J[eN*nDetVals_element + 0];
2250 assert(volume > 0.0);
2251 dvolInv = 1.0/(ddim*volume);
2252 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2254 for (k = 0; k < nPoints_elementBoundary; k++)
2256 for (I = 0; I < nSpace; I++)
2258 v_elementBoundary[eN*nElementBoundaries_element*nPoints_elementBoundary*nSpace +
2259 ebN*nPoints_elementBoundary*nSpace+
2260 k*nSpace + I] = 0.0;
2261 for (j = 0; j < nElementBoundaries_element; j++)
2263 jg = elementNodesArray[eN*nElementBoundaries_element + j];
2264 v_elementBoundary[eN*nElementBoundaries_element*nPoints_elementBoundary*nSpace +
2265 ebN*nPoints_elementBoundary*nSpace+
2267 rt0vdofs_element[eN*nDOF_RT0V_element + j]
2270 *(x_elementBoundary[eN*nElementBoundaries_element*nPoints_elementBoundary*3 + ebN*nPoints_elementBoundary*3+k*3 + I]- nodeArray[jg*3 + I]);
2279 int nPoints_elementBoundary_global,
2281 int nDetVals_element,
2283 int *elementNodesArray,
2284 int *elementBoundaryElementsArray,
2286 double * x_elementBoundary_global,
2287 double * rt0vdofs_element,
2288 double * v_elementBoundary_global)
2306 int eN,ebN,I,k,j,jg;
2307 int nDOF_RT0V_element = nSpace+1;
2308 double volFact,dvolInv;
2309 double ddim = nSpace;
2310 double volume = 0.0;
2312 if (nSpace > 1) volFact = 0.5;
2313 if (nSpace > 2) volFact = 1.0/6.0;
2315 for (ebN = 0; ebN < nElementBoundaries_global; ebN++)
2317 eN = elementBoundaryElementsArray[ebN*2 + 0];
2318 volume = volFact*abs_det_J[eN*nDetVals_element + 0];
2319 assert(volume > 0.0);
2320 dvolInv = 1.0/(ddim*volume);
2321 for (k = 0; k < nPoints_elementBoundary_global; k++)
2323 for (I = 0; I < nSpace; I++)
2325 v_elementBoundary_global[ebN*nPoints_elementBoundary_global*nSpace +
2328 for (j = 0; j < nDOF_RT0V_element; j++)
2330 jg = elementNodesArray[eN*nDOF_RT0V_element + j];
2331 v_elementBoundary_global[ebN*nPoints_elementBoundary_global*nSpace+k*nSpace + I] +=
2332 rt0vdofs_element[eN*nDOF_RT0V_element + j]
2335 *(x_elementBoundary_global[ebN*nPoints_elementBoundary_global*3+k*3 + I]- nodeArray[jg*3 + I]);
2342 int nPoints_elementBoundary_global,
2344 int nDetVals_element,
2346 int *elementNodesArray,
2347 int *elementBoundaryElementsArray,
2348 int* exteriorElementBoundariesArray,
2351 double * rt0vdofs_element,
2370 int eN,ebN,ebNE,I,k,j,jg;
2371 int nDOF_RT0V_element = nSpace+1;
2372 double volFact,dvolInv;
2373 double ddim = nSpace;
2374 double volume = 0.0;
2376 if (nSpace > 1) volFact = 0.5;
2377 if (nSpace > 2) volFact = 1.0/6.0;
2378 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
2380 ebN = exteriorElementBoundariesArray[ebNE];
2381 eN = elementBoundaryElementsArray[ebN*2 + 0];
2382 volume = volFact*abs_det_J[eN*nDetVals_element + 0];
2383 assert(volume > 0.0);
2384 dvolInv = 1.0/(ddim*volume);
2385 for (k = 0; k < nPoints_elementBoundary_global; k++)
2387 for (I = 0; I < nSpace; I++)
2389 v_ebqe[ebNE*nPoints_elementBoundary_global*nSpace +
2392 for (j = 0; j < nDOF_RT0V_element; j++)
2394 jg = elementNodesArray[eN*nDOF_RT0V_element + j];
2395 v_ebqe[ebNE*nPoints_elementBoundary_global*nSpace+k*nSpace + I] +=
2396 rt0vdofs_element[eN*nDOF_RT0V_element + j]
2399 *(x_ebqe[ebNE*nPoints_elementBoundary_global*3+k*3 + I]- nodeArray[jg*3 + I]);
2407 int nElementBoundaries_element,
2410 int nDetVals_element,
2411 const double * nodeArray,
2412 const int * elementNodesArray,
2413 const double * abs_det_J,
2415 const int * element_locations,
2416 const double * rt0vdofs_element,
2436 int nDOF_RT0V_element = nSpace+1;
2437 double volFact,dvolInv;
2438 double ddim = nSpace;
2439 double volume = 0.0;
2441 if (nSpace > 1) volFact = 0.5;
2442 if (nSpace > 2) volFact = 1.0/6.0;
2443 for (k = 0; k < nPoints; k++)
2445 eN = element_locations[k];
2446 assert(0 <= eN && eN < nElements_global);
2447 volume = volFact*abs_det_J[eN*nDetVals_element + 0];
2448 assert(volume > 0.0);
2449 dvolInv = 1.0/(ddim*volume);
2450 for (I = 0; I < nSpace; I++)
2452 v_element[k*nSpace + I] = 0.0;
2453 for (j = 0; j < nElementBoundaries_element; j++)
2455 jg = elementNodesArray[eN*nElementBoundaries_element + j];
2456 v_element[k*nSpace + I] +=
2457 rt0vdofs_element[eN*nDOF_RT0V_element + j]
2460 *(x[k*3 + I]- nodeArray[jg*3 + I]);
2471 int nElementBoundaries_element,
2472 int nQuadraturePoints_elementBoundary,
2474 int nDOFs_test_element,
2475 int nDOFs_trial_element,
2480 double * BDMprojectionMat_element)
2506 int eN,ebN,
s,j,k,l,kp,irow,ibq,nVDOFs_element2,nSimplex;
2507 int TRANSPOSE_FOR_LAPACK=1;
2509 nSimplex = nSpace+1;
2510 assert(nVDOFs_element == nSpace*(nSpace+1));
2511 assert(nSimplex == nDOFs_trial_element);
2512 assert(nSimplex == nDOFs_test_element);
2513 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
2520 for (eN=0; eN < nElements_global; eN++)
2522 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2524 for (
s = 0;
s < nSpace;
s++)
2526 irow = ebN*nSpace +
s;
2527 for (j = 0; j < nVDOFs_element; j++)
2531 kp= (ebN+
s+1) % nSimplex;
2536 if (TRANSPOSE_FOR_LAPACK > 0)
2537 BDMprojectionMat_element[eN*nVDOFs_element2 + irow + j*nVDOFs_element] = 0.0;
2539 BDMprojectionMat_element[eN*nVDOFs_element2 + irow*nVDOFs_element + j] = 0.0;
2540 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
2544 ebq_n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
2545 ebN*nQuadraturePoints_elementBoundary*nSpace+
2549 w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_test_element+
2550 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
2551 ibq*nDOFs_test_element+
2554 ebq_v[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_trial_element+
2555 ebN*nQuadraturePoints_elementBoundary*nDOFs_trial_element+
2556 ibq*nDOFs_trial_element+
2558 if (TRANSPOSE_FOR_LAPACK > 0)
2559 BDMprojectionMat_element[eN*nVDOFs_element2 + irow + j*nVDOFs_element] += pval;
2561 BDMprojectionMat_element[eN*nVDOFs_element2 + irow*nVDOFs_element + j] += pval;
2573 int nElementBoundaries_element,
2574 int nQuadraturePoints_elementBoundary,
2576 int nDOFs_test_element,
2577 int nDOFs_trial_element,
2582 double * BDMprojectionMat_element)
2628 int eN,ebN,
s,j,k,l,kp,irow,ibq,nVDOFs_element2,nSimplex;
2629 int TRANSPOSE_FOR_LAPACK=1;
2631 nSimplex = nSpace+1;
2632 assert(nVDOFs_element == nSpace*(nSpace+1));
2633 assert(nSimplex == nDOFs_trial_element);
2634 assert(nSimplex == nDOFs_test_element);
2635 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
2645 for (eN=0; eN < nElements_global; eN++)
2647 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2649 for (
s = 0;
s < nSpace;
s++)
2651 irow = ebN*nSpace +
s;
2652 for (j = 0; j < nVDOFs_element; j++)
2656 kp= (ebN+
s+1) % nSimplex;
2664 if (TRANSPOSE_FOR_LAPACK > 0)
2665 BDMprojectionMat_element[eN*nVDOFs_element2 + irow + j*nVDOFs_element] = 0.0;
2667 BDMprojectionMat_element[eN*nVDOFs_element2 + irow*nVDOFs_element + j] = 0.0;
2668 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
2672 ebq_n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
2673 ebN*nQuadraturePoints_elementBoundary*nSpace+
2677 w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_test_element+
2678 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
2679 ibq*nDOFs_test_element+
2682 ebq_v[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_trial_element+
2683 ebN*nQuadraturePoints_elementBoundary*nDOFs_trial_element+
2684 ibq*nDOFs_trial_element+
2686 if (TRANSPOSE_FOR_LAPACK > 0){
2687 BDMprojectionMat_element[eN*nVDOFs_element2 + irow + j*nVDOFs_element] += pval;
2690 BDMprojectionMat_element[eN*nVDOFs_element2 + irow*nVDOFs_element + j] += pval;
2711 int nElements_global,
2712 int nElementBoundaries_element,
2713 int nQuadraturePoints_elementBoundary,
2714 int nQuadraturePoints_elementInterior,
2716 int nDOFs_test_element,
2717 int nDOFs_trial_boundary_element,
2718 int nDOFs_trial_interior_element,
2724 double * BDMprojectionMat_element,
2725 double * q_basis_vals,
2726 double * w_int_test_grads,
2727 double * w_int_div_free,
2728 double * piola_trial_fun)
2736 int eN,ebN,
s,i,j,k,l,kp,irow,ibq,nSimplex;
2737 int dof, dof_edge, boundary_dof;
2739 int TRANSPOSE_FOR_LAPACK=1;
2740 double pval, pvalx, pvaly;
2741 nSimplex = nSpace+1;
2742 assert(degree == 2);
2744 int interiorPspace = nDOFs_trial_interior_element;
2747 dof = (degree+1)*(degree+2);
2748 dof_edge = degree + 1;
2749 boundary_dof = nElementBoundaries_element*dof_edge;
2752 else if (nSpace == 3){
2753 dof = (degree+1)*(degree+2)*(degree+3) / 2;
2754 dof_edge = degree*(degree+1);
2755 boundary_dof = nElementBoundaries_element*dof_edge;
2762 int interior_dof = dof - boundary_dof;
2766 for (eN=0; eN < nElements_global; eN++)
2770 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
2772 for (
s = 0;
s < dof_edge;
s++)
2774 irow = ebN*dof_edge +
s;
2776 for (j = 0; j < dof; j++)
2781 kp = edgeFlags[ebN*dof_edge+
s];
2783 if (TRANSPOSE_FOR_LAPACK > 0)
2784 BDMprojectionMat_element[eN*dof*dof + irow + j*nVDOFs_element] = 0.;
2786 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j] = 0.;
2788 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
2792 ebq_n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace +
2793 ebN*nQuadraturePoints_elementBoundary*nSpace+
2797 w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary* nDOFs_test_element+
2798 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
2799 ibq*nDOFs_test_element+
2802 ebq_v[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_trial_boundary_element+
2803 ebN*nQuadraturePoints_elementBoundary*nDOFs_trial_boundary_element+
2804 ibq*nDOFs_trial_boundary_element+
2808 if (TRANSPOSE_FOR_LAPACK > 0)
2809 BDMprojectionMat_element[eN*dof*dof + irow + j*nVDOFs_element] += pval;
2811 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j] += pval;
2821 for (
s = 0;
s < interiorPspace-1;
s++){
2823 irow = boundary_dof +
s;
2824 for (j=0; j < (dof/nSpace); j++){
2827 if (TRANSPOSE_FOR_LAPACK > 0){
2828 for (i = 0; i < nSpace; i++){
2829 BDMprojectionMat_element[eN*dof*dof + irow + j*dof*nSpace + i*dof] = 0.0;
2834 for (i = 0; i < nSpace; i++){
2835 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j + i] = 0.0;
2839 for (ibq=0; ibq < nQuadraturePoints_elementInterior; ibq++){
2842 for (i = 0; i < nSpace; i++){
2844 if (TRANSPOSE_FOR_LAPACK > 0){
2846 BDMprojectionMat_element[eN*dof*dof + irow + j*dof*nSpace + i*dof] +=
2848 q_basis_vals[eN* (dof/nSpace) *nQuadraturePoints_elementInterior +
2849 ibq*nDOFs_test_element +
2851 * w_int_test_grads[eN*nSpace*interiorPspace*nQuadraturePoints_elementInterior+
2853 ibq* nSpace *interiorPspace + i];
2857 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j] += pval;
2858 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j + 1] += pval;
2868 irow = boundary_dof + interiorPspace - 1;
2869 for (j=0; j < dof; j++){
2871 if (TRANSPOSE_FOR_LAPACK > 0){
2872 for (
s = 0;
s < num_div_free;
s++){
2873 BDMprojectionMat_element[eN*dof*dof + (irow +
s) + j*nVDOFs_element] = 0.0;
2877 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j] = 0.0;
2879 for (ibq=0; ibq<nQuadraturePoints_elementInterior; ibq++)
2882 if (TRANSPOSE_FOR_LAPACK > 0){
2883 for(
s = 0;
s < num_div_free;
s++){
2884 for (i=0 ; i < nSpace; i++){
2885 BDMprojectionMat_element[eN*dof*dof + (irow +
s) + j*nVDOFs_element] +=
2887 w_int_div_free[eN * nQuadraturePoints_elementInterior * nSpace * num_div_free +
2888 ibq * nSpace * num_div_free +
2892 * piola_trial_fun[eN * nQuadraturePoints_elementInterior * dof * nSpace +
2893 ibq * dof * nSpace +
2900 BDMprojectionMat_element[eN*dof*dof + irow*nVDOFs_element + j] = 0.0;
2909 double *BDMprojectionMat_element,
2910 int *BDMprojectionMatPivots_element)
2912 PROTEUS_LAPACK_INTEGER INFO=0;
2913 int eN,i,nVDOFs_element2;
2914 PROTEUS_LAPACK_INTEGER pivots_element[12];
2915 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
2916 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
2917 for (eN = 0; eN < nElements_global; eN++)
2921 &BDMprojectionMat_element[eN*nVDOFs_element2],
2928 for (i = 0; i < nVDOFs_element; i++)
2929 BDMprojectionMatPivots_element[eN*nVDOFs_element+i] = (
int) pivots_element[i];
2938 double *BDMprojectionMat_element,
2939 int *BDMprojectionMatPivots_element)
2941 PROTEUS_LAPACK_INTEGER INFO=0;
2942 int eN,i,nVDOFs_element2;
2943 PROTEUS_LAPACK_INTEGER pivots_element[30];
2944 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
2945 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
2946 for (eN = 0; eN < nElements_global; eN++)
2950 &BDMprojectionMat_element[eN*nVDOFs_element2],
2957 for (i = 0; i < nVDOFs_element; i++)
2958 BDMprojectionMatPivots_element[eN*nVDOFs_element+i] = (
int) pivots_element[i];
2966 int nElementBoundaries_element,
2967 int nQuadraturePoints_elementBoundary,
2969 int nDOFs_test_element,
2971 double * BDMprojectionMatFact_element,
2972 int* BDMprojectionMatPivots_element,
2975 double * ebq_velocity,
2976 double * p1_velocity_dofs)
2995 PROTEUS_LAPACK_INTEGER INFO=0,NRHS=1;
2997 int eN,ebN,
s,irow,kp,ibq,J,nSimplex,nVDOFs_element2;
2999 PROTEUS_LAPACK_INTEGER pivots_element[12];
3000 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
3002 nSimplex = nSpace+1;
3003 assert(nVDOFs_element == nSpace*(nSpace+1));
3004 assert(nSimplex == nDOFs_test_element);
3005 assert(BDMprojectionMatPivots_element);
3006 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
3008 for (eN = 0; eN < nElements_global; eN++)
3010 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
3012 for (
s = 0;
s < nSpace;
s++)
3014 irow = ebN*nSpace +
s;
3015 kp = (ebN+
s+1) % nSimplex;
3017 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
3019 for (J = 0; J < nSpace; J++)
3022 ebq_n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3023 ebN*nQuadraturePoints_elementBoundary*nSpace+
3027 ebq_velocity[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3028 ebN*nQuadraturePoints_elementBoundary*nSpace+
3031 * w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3032 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3033 ibq*nDOFs_test_element+
3037 p1_velocity_dofs[eN*nVDOFs_element+irow] = btmp;
3040 for (irow = 0; irow < nVDOFs_element; irow++)
3041 pivots_element[irow] = BDMprojectionMatPivots_element[eN*nVDOFs_element+irow];
3045 &BDMprojectionMatFact_element[eN*nVDOFs_element2],
3048 &p1_velocity_dofs[eN*nVDOFs_element],
3056 int nElementBoundaries_element,
3057 int nQuadraturePoints_elementBoundary,
3058 int nQuadraturePoints_elementInterior,
3060 int nDOFs_test_element,
3062 int nDOFs_trial_interior_element,
3063 double * BDMprojectionMatFact_element,
3064 int* BDMprojectionMatPivots_element,
3068 double * w_interior_grads,
3069 double * w_interior_divfree,
3070 double * ebq_velocity,
3071 double * q_velocity,
3072 double * p1_velocity_dofs)
3093 PROTEUS_LAPACK_INTEGER INFO=0,NRHS=1;
3095 int eN,ebN,
s,irow,kp,ibq,j,dof_edge,num_div_free,boundary_dof,dof;
3096 double btmp,pvalx,pvaly;
3097 PROTEUS_LAPACK_INTEGER pivots_element[30];
3098 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
3102 int interiorPspace = nDOFs_trial_interior_element;
3105 dof = (degree+1)*(degree+2);
3106 dof_edge = degree + 1;
3107 boundary_dof = nElementBoundaries_element*dof_edge;
3110 else if (nSpace == 3){
3111 dof = (degree+1)*(degree+2)*(degree+3) / 2;
3112 dof_edge = degree*(degree+1);
3113 boundary_dof = nElementBoundaries_element*dof_edge;
3120 assert(nVDOFs_element == dof);
3121 assert(BDMprojectionMatPivots_element);
3123 for (eN = 0; eN < nElements_global; eN++)
3126 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
3128 for (
s = 0;
s < dof_edge;
s++)
3130 irow = ebN*dof_edge +
s;
3131 kp = edgeFlags[ebN*dof_edge +
s];
3134 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
3136 for (j = 0; j < nSpace; j++) {
3139 ebq_n[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3140 ebN*nQuadraturePoints_elementBoundary*nSpace+
3144 ebq_velocity[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3145 ebN*nQuadraturePoints_elementBoundary*nSpace+
3148 * w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3149 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3150 ibq*nDOFs_test_element+
3155 p1_velocity_dofs[eN*nVDOFs_element+irow] = btmp;
3161 for (
s = 0;
s < interiorPspace-1;
s++){
3163 irow = boundary_dof +
s;
3164 p1_velocity_dofs[eN*nVDOFs_element+irow] = 0. ;
3166 for (ibq=0; ibq < nQuadraturePoints_elementInterior; ibq++){
3169 for (j = 0 ; j < nSpace; j++){
3171 p1_velocity_dofs[eN*nVDOFs_element+irow] +=
3173 q_velocity[eN*nQuadraturePoints_elementInterior*nSpace +
3176 w_interior_grads[eN*nSpace*interiorPspace*nQuadraturePoints_elementInterior +
3178 ibq * nSpace * interiorPspace +
3187 irow = boundary_dof + interiorPspace - 1;
3188 for (
s = 0 ;
s < num_div_free ;
s++){
3189 p1_velocity_dofs[eN*nVDOFs_element + (irow +
s) ] = 0.0 ;
3192 for (ibq = 0; ibq < nQuadraturePoints_elementInterior; ibq++){
3193 for (
s = 0 ;
s < num_div_free ;
s++){
3194 for (j = 0 ; j < nSpace ; j++){
3196 p1_velocity_dofs[eN*nVDOFs_element + (irow +
s) ] +=
3198 q_velocity[eN * nQuadraturePoints_elementInterior * nSpace +
3202 w_interior_divfree[eN * nQuadraturePoints_elementInterior * num_div_free * nSpace+
3203 ibq * num_div_free * nSpace +
3215 int nElementBoundaries_element,
3216 int nQuadraturePoints_elementBoundary,
3218 int nDOFs_test_element,
3220 double * BDMprojectionMatFact_element,
3221 int* BDMprojectionMatPivots_element,
3224 double * w_interior_gradients,
3225 double * q_velocity,
3226 double * ebq_velocity,
3227 double * p1_velocity_dofs)
3234 PROTEUS_LAPACK_INTEGER INFO=0,NRHS=1;
3236 int eN,ebN,
s,irow,kp,ibq,J,nSimplex,nVDOFs_element2;
3238 PROTEUS_LAPACK_INTEGER pivots_element[30];
3239 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
3241 for (eN = 0; eN < nElements_global; eN++)
3244 for (irow = 0; irow < nVDOFs_element; irow++)
3245 pivots_element[irow] = BDMprojectionMatPivots_element[eN*nVDOFs_element+irow];
3250 &BDMprojectionMatFact_element[eN*nVDOFs_element*nVDOFs_element],
3253 &p1_velocity_dofs[eN*nVDOFs_element],
3263 int nElementBoundaries_element,
3264 int nQuadraturePoints_elementBoundary,
3265 int nDOFs_test_element,
3267 double * BDMprojectionMatFact_element,
3268 int* BDMprojectionMatPivots_element,
3269 int* elementBoundaryElementsArray,
3270 int* elementBoundariesArray,
3272 double * ebq_global_flux,
3273 double * p1_velocity_dofs)
3292 PROTEUS_LAPACK_INTEGER INFO=0,NRHS=1;
3294 int eN,ebN,ebN_global,nSpace,
s,irow,kp,ibq,nSimplex,nVDOFs_element2;
3296 PROTEUS_LAPACK_INTEGER pivots_element[12];
3297 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER) nVDOFs_element);
3299 nSimplex = nDOFs_test_element;
3300 nSpace = nSimplex - 1;
3301 assert(nVDOFs_element == nSpace*(nSpace+1));
3302 assert(nSimplex == nDOFs_test_element);
3303 assert(BDMprojectionMatPivots_element);
3304 nVDOFs_element2 = nVDOFs_element*nVDOFs_element;
3306 for (eN = 0; eN < nElements_global; eN++)
3308 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
3310 ebN_global = elementBoundariesArray[eN*nElementBoundaries_element+ebN];
3312 if(elementBoundaryElementsArray[2*ebN_global+1] == eN)
3314 for (
s = 0;
s < nSimplex;
s++)
3316 irow = ebN*nSpace +
s;
3317 kp = (ebN+
s+1) % nSimplex;
3319 for (ibq = 0; ibq < nQuadraturePoints_elementBoundary; ibq++)
3321 btmp +=
sign*ebq_global_flux[ebN_global*nQuadraturePoints_elementBoundary+ibq]
3323 w_dS_f[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3324 ebN*nQuadraturePoints_elementBoundary*nDOFs_test_element+
3325 ibq*nDOFs_test_element+
3328 p1_velocity_dofs[eN*nVDOFs_element+irow] = btmp;
3331 for (irow = 0; irow < nVDOFs_element; irow++)
3332 pivots_element[irow] = BDMprojectionMatPivots_element[eN*nVDOFs_element+irow];
3336 &BDMprojectionMatFact_element[eN*nVDOFs_element2],
3339 &p1_velocity_dofs[eN*nVDOFs_element],
3347 int nQuadraturePoints_element,
3349 int nDOF_trial_element,
3352 double * p1_velocity_dofs,
3353 double * q_velocity)
3366 for (eN = 0; eN < nElements_global; eN++)
3368 for (iq = 0; iq < nQuadraturePoints_element; iq++)
3370 for (
id = 0;
id < nSpace;
id++)
3372 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] = 0.0;
3373 for (k = 0; k < nSpace+1; k++)
3375 j =
id*(nSpace+1) + k;
3376 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] +=
3377 q_v[eN*nQuadraturePoints_element*nDOF_trial_element + iq*nDOF_trial_element + k]
3379 p1_velocity_dofs[eN*nVDOF_element + j];
3388 int nQuadraturePoints_element,
3390 int nDOF_trial_element,
3393 double * p1_velocity_dofs,
3394 double * q_velocity)
3407 for (eN = 0; eN < nElements_global; eN++)
3409 for (iq = 0; iq < nQuadraturePoints_element; iq++)
3411 for (
id = 0;
id < nSpace;
id++)
3413 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] = 0.0;
3414 for (k = 0; k < nSpace+1; k++)
3417 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] +=
3418 q_v[eN*nQuadraturePoints_element*nDOF_trial_element + iq*nDOF_trial_element + k]
3420 p1_velocity_dofs[eN*nVDOF_element + j];
3429 int nQuadraturePoints_element,
3431 int nDOF_trial_element,
3434 double * p1_velocity_dofs,
3435 double * q_velocity)
3447 for (eN = 0; eN < nElements_global; eN++)
3449 for (iq = 0; iq < nQuadraturePoints_element; iq++)
3451 for (
id = 0;
id < nSpace;
id++)
3453 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] = 0.0;
3454 for (k = 0; k < nDOF_trial_element; k++)
3457 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] +=
3458 q_v[eN*nQuadraturePoints_element*nDOF_trial_element + iq*nDOF_trial_element + k]
3460 p1_velocity_dofs[eN*nVDOF_element + j];
3470 int nQuadraturePoints_element,
3472 int nDOF_trial_element,
3475 double * velocity_dofs,
3476 double * q_velocity)
3484 for (eN = 0; eN < nElements_global; eN++)
3486 for (iq = 0; iq < nQuadraturePoints_element; iq++)
3488 for (
id = 0;
id < nSpace;
id++)
3490 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] = 0.0;
3492 for (k=0; k < nDOF_trial_element; k++)
3496 q_velocity[eN*nQuadraturePoints_element*nSpace + iq*nSpace + id] +=
3497 q_v[eN*nQuadraturePoints_element*nDOF_trial_element + iq*nDOF_trial_element + k]
3499 velocity_dofs[eN*nVDOF_element + j];
3508 int nQuadraturePoints_elementBoundary,
3510 int nDOF_trial_element,
3512 int *elementBoundaryElementsArray,
3513 int *exteriorElementBoundariesArray,
3515 double * p1_velocity_dofs,
3516 double * ebqe_velocity)
3527 int ebN,ebNE,eN,iq,id,k,j;
3529 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
3531 ebN = exteriorElementBoundariesArray[ebNE];
3532 eN = elementBoundaryElementsArray[ebN*2 + 0];
3534 for (iq = 0; iq < nQuadraturePoints_elementBoundary; iq++)
3536 for (
id = 0;
id < nSpace;
id++)
3538 ebqe_velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] = 0.0;
3539 for (k = 0; k < nSpace+1; k++)
3542 ebqe_velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] +=
3543 ebqe_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element + iq*nDOF_trial_element + k]
3545 p1_velocity_dofs[eN*nVDOF_element + j];
3553 int nQuadraturePoints_elementBoundary,
3555 int nDOF_trial_element,
3557 int *elementBoundaryElementsArray,
3558 int *exteriorElementBoundariesArray,
3560 double * p1_velocity_dofs,
3561 double * ebq_global_velocity)
3572 int ebN,ebNE,eN,iq,id,k,j;
3574 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
3576 ebN = exteriorElementBoundariesArray[ebNE];
3577 eN = elementBoundaryElementsArray[ebN*2 + 0];
3579 for (iq = 0; iq < nQuadraturePoints_elementBoundary; iq++)
3581 for (
id = 0;
id < nSpace;
id++)
3583 ebq_global_velocity[ebN*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] = 0.0;
3584 for (k = 0; k < nSpace+1; k++)
3587 ebq_global_velocity[ebN*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] +=
3588 ebqe_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element + iq*nDOF_trial_element + k]
3590 p1_velocity_dofs[eN*nVDOF_element + j];
3599 int nBoundaries_Element,
3600 int nQuadraturePoints_elementBoundary,
3602 int nDOF_trial_element,
3604 int *elementBoundaryElementsArray,
3605 int *exteriorElementBoundariesArray,
3607 double * p1_velocity_dofs,
3608 double * ebq_velocity)
3619 int ebN,eN,iq,id,k,j;
3621 for (eN = 0; eN < nElements_global; eN++)
3624 for (ebN=0; ebN < nBoundaries_Element; ebN ++)
3626 for (iq = 0; iq < nQuadraturePoints_elementBoundary; iq++)
3628 for (
id = 0;
id < nSpace;
id++)
3630 ebq_velocity[eN*nBoundaries_Element*nQuadraturePoints_elementBoundary*nSpace
3631 + ebN*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] = 0.0;
3632 for (k = 0; k < nSpace+1; k++)
3635 ebq_velocity[eN*ebN*nQuadraturePoints_elementBoundary*nSpace
3636 + nBoundaries_Element*nQuadraturePoints_elementBoundary*nSpace + iq*nSpace + id] +=
3637 ebq_v[eN*nBoundaries_Element*nQuadraturePoints_elementBoundary*nDOF_trial_element
3638 + ebN*nQuadraturePoints_elementBoundary*iq*nDOF_trial_element + k]
3640 p1_velocity_dofs[eN*nVDOF_element + j];
3653 int nInteriorElementBoundaries_global,
3654 int nExteriorElementBoundaries_global,
3655 int nElementBoundaries_element,
3656 int nQuadraturePoints_elementBoundary,
3659 int* interiorElementBoundaries,
3660 int* exteriorElementBoundaries,
3661 int* elementBoundaryElements,
3662 int* elementBoundaryLocalElementBoundaries,
3663 int* exteriorElementBoundariesToSkip,
3666 double* elementResidual,
3668 double* conservationResidual)
3670 int ebNI,ebNE,ebN,eN,nN,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,k,I;
3671 register double flux,ds;
3675 for (eN = 0; eN < nElements_global; eN++)
3677 for (nN = 0; nN < nNodes_element; nN++)
3679 conservationResidual[eN] += elementResidual[eN*nNodes_element + nN];
3684 for (ebNI = 0; ebNI < nInteriorElementBoundaries_global; ebNI++)
3686 ebN = interiorElementBoundaries[ebNI];
3687 left_eN = elementBoundaryElements[ebN*2+0];
3688 right_eN = elementBoundaryElements[ebN*2+1];
3689 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3690 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
3693 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3695 ds = dS[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
3696 left_ebN_element*nQuadraturePoints_elementBoundary+
3698 for (I = 0; I < nSpace; I++)
3700 flux+= velocity[ebN*nQuadraturePoints_elementBoundary*nSpace+
3704 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
3711 conservationResidual[left_eN] += flux;
3712 conservationResidual[right_eN]-= flux;
3716 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
3718 if (!exteriorElementBoundariesToSkip[ebNE])
3720 ebN = exteriorElementBoundaries[ebNE];
3721 eN = elementBoundaryElements[ebN*2+0];
3722 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3724 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3726 ds = dS[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
3727 ebN_element*nQuadraturePoints_elementBoundary+
3729 for (I = 0; I < nSpace; I++)
3731 flux+= velocity[ebN*nQuadraturePoints_elementBoundary*nSpace+
3735 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
3742 conservationResidual[eN] += flux;
3748 int nElementBoundaries_global,
3749 int nInteriorElementBoundaries_global,
3750 int nExteriorElementBoundaries_global,
3751 int nElementBoundaries_element,
3752 int nQuadraturePoints_elementBoundary,
3754 int* interiorElementBoundaries,
3755 int* exteriorElementBoundaries,
3756 int* elementBoundaryElements,
3757 int* elementBoundaryLocalElementBoundaries,
3762 double* fluxCorrection,
3763 double* conservationResidual)
3765 int ebNI,ebN,left_eN,right_eN,left_ebN_element,right_ebN_element;
3766 register double area,areaFact,F_ebN;
3771 for (ebNI = 0; ebNI < nInteriorElementBoundaries_global; ebNI++)
3773 ebN = interiorElementBoundaries[ebNI];
3774 left_eN = elementBoundaryElements[ebN*2+0];
3775 right_eN = elementBoundaryElements[ebN*2+1];
3776 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3777 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
3779 area = areaFact*sqrt_det_g[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
3780 left_ebN_element*nQuadraturePoints_elementBoundary + 0];
3781 F_ebN = alpha[ebN*2+0]*conservationResidual[left_eN]
3782 + alpha[ebN*2+1]*conservationResidual[right_eN];
3784 fluxCorrection[ebN] += F_ebN;
3787 conservationResidual[left_eN] -= area*F_ebN;
3788 conservationResidual[right_eN]+= area*F_ebN;
3797 int nElementBoundaries_global,
3798 int nInteriorElementBoundaries_global,
3799 int nExteriorElementBoundaries_global,
3800 int nElementBoundaries_element,
3801 int nQuadraturePoints_elementBoundary,
3803 int* interiorElementBoundaries,
3804 int* exteriorElementBoundaries,
3805 int* elementBoundaryElements,
3806 int* elementBoundaryLocalElementBoundaries,
3809 double* fluxCorrection,
3810 double* vConservative,
3811 double* vConservative_element)
3813 int eN,ebN_element,ebNI,ebNE,ebN,left_eN,right_eN,left_ebN_element,right_ebN_element,k,I;
3815 for (ebN = 0; ebN < nElementBoundaries_global; ebN++)
3817 for (k=0; k < nQuadraturePoints_elementBoundary; k++)
3819 for (I=0; I < nSpace; I++)
3821 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace +
3823 -= fluxCorrection[ebN]
3824 * normal[ebN*nQuadraturePoints_elementBoundary*nSpace +
3830 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
3832 ebN = interiorElementBoundaries[ebNI];
3833 left_eN = elementBoundaryElements[ebN*2+0];
3834 right_eN = elementBoundaryElements[ebN*2+1];
3835 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3836 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
3837 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3838 for(I=0;I<nSpace;I++)
3840 vConservative_element[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3841 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3845 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
3848 vConservative_element[right_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3849 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3853 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
3858 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3860 ebN = exteriorElementBoundaries[ebNE];
3861 eN = elementBoundaryElements[ebN*2+0];
3862 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3863 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3864 for(I=0;I<nSpace;I++)
3866 vConservative_element[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3867 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3871 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
3879 int nInteriorElementBoundaries_global,
3880 int nExteriorElementBoundaries_global,
3881 int* interiorElementBoundaries,
3882 int* exteriorElementBoundaries,
3883 int* elementBoundaryElements,
3886 double* fluxCorrection)
3894 int ebNI,ebNE,ebN,eN_left,eN_right;
3895 double V_left,V_right,w_left,w_right;
3896 for (ebNI = 0; ebNI < nInteriorElementBoundaries_global; ebNI++)
3898 ebN = interiorElementBoundaries[ebNI];
3899 eN_left = elementBoundaryElements[ebN*2 + 0];
3900 eN_right= elementBoundaryElements[ebN*2 + 1];
3901 V_left = pwcV[eN_left];
3902 V_right = pwcV[eN_right];
3903 w_left = pwcW[ebN*2 + 0];
3904 w_right = pwcW[ebN*2 + 1];
3905 fluxCorrection[ebN] = V_left*w_left + V_right*w_right;
3907 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
3909 ebN = exteriorElementBoundaries[ebNE];
3910 eN_left = elementBoundaryElements[ebN*2 + 0];
3911 V_left = pwcV[eN_left];
3912 w_left = pwcW[ebN*2 + 0];
3913 fluxCorrection[ebN] = V_left*w_left;
3925 int* nElements_node,
3926 int* nodeStarElementsArray,
3927 int* nodeStarElementNeighborsArray,
3929 int** subdomain_dim_p,
3930 double *** subdomain_L_p,
3931 double *** subdomain_R_p,
3932 double *** subdomain_U_p,
3933 PROTEUS_LAPACK_INTEGER*** subdomain_pivots_p,
3934 PROTEUS_LAPACK_INTEGER*** subdomain_column_pivots_p)
3940 double** subdomain_R;
3941 double** subdomain_U;
3942 double** subdomain_L;
3943 PROTEUS_LAPACK_INTEGER** subdomain_pivots;
3944 PROTEUS_LAPACK_INTEGER** subdomain_column_pivots;
3949 *subdomain_dim_p = (
int*) malloc(N*
sizeof(
int));
3950 *subdomain_pivots_p = (PROTEUS_LAPACK_INTEGER**)malloc(N*
sizeof(PROTEUS_LAPACK_INTEGER*));
3951 *subdomain_column_pivots_p = (PROTEUS_LAPACK_INTEGER**)malloc(N*
sizeof(PROTEUS_LAPACK_INTEGER*));
3952 *subdomain_R_p = (
double**)malloc(N*
sizeof(
double*));
3953 *subdomain_U_p = (
double**)malloc(N*
sizeof(
double*));
3954 *subdomain_L_p = (
double**)malloc(N*
sizeof(
double*));
3956 if ( (*subdomain_dim_p == NULL) ||
3957 (*subdomain_R_p == NULL) ||
3958 (*subdomain_U_p == NULL) ||
3959 (*subdomain_L_p == NULL) ||
3960 (*subdomain_pivots_p == NULL) ||
3961 (*subdomain_column_pivots_p == NULL))
3966 subdomain_dim = *subdomain_dim_p;
3967 subdomain_pivots = *subdomain_pivots_p;
3968 subdomain_column_pivots = *subdomain_column_pivots_p;
3969 subdomain_R = *subdomain_R_p;
3970 subdomain_U = *subdomain_U_p;
3971 subdomain_L = *subdomain_L_p;
3974 for (I = 0; I < N; I++)
3976 subdomain_dim[I] = nElements_node[I];
3977 subdomain_pivots[I] = (PROTEUS_LAPACK_INTEGER*) malloc(subdomain_dim[I]*
sizeof(PROTEUS_LAPACK_INTEGER));
3978 subdomain_column_pivots[I] = (PROTEUS_LAPACK_INTEGER*) malloc(subdomain_dim[I]*
sizeof(PROTEUS_LAPACK_INTEGER));
3979 subdomain_R[I] = (
double*) malloc(subdomain_dim[I]*
sizeof(
double));
3980 subdomain_U[I] = (
double*) malloc(subdomain_dim[I]*
sizeof(
double));
3981 subdomain_L[I] = (
double*) malloc(subdomain_dim[I]*subdomain_dim[I]*
sizeof(
double));
3983 if ((subdomain_pivots[I] == NULL) ||
3984 (subdomain_column_pivots[I] == NULL) ||
3985 (subdomain_R[I] == NULL) ||
3986 (subdomain_U[I] == NULL) ||
3987 (subdomain_L[I] == NULL))
3998 int * subdomain_dim,
3999 double ** subdomain_L,
4000 double ** subdomain_R,
4001 double ** subdomain_U,
4002 PROTEUS_LAPACK_INTEGER** subdomain_pivots,
4003 PROTEUS_LAPACK_INTEGER** subdomain_column_pivots)
4006 free(subdomain_dim);
4007 for (I = 0; I < N; I++)
4009 free(subdomain_pivots[I]);
4010 free(subdomain_column_pivots[I]);
4011 free(subdomain_R[I]);
4012 free(subdomain_U[I]);
4013 free(subdomain_L[I]);
4015 free(subdomain_pivots);
4016 free(subdomain_column_pivots);
4021 subdomain_pivots = 0;
4022 subdomain_column_pivots = 0;
4032 assert(nodeStarFactor);
4033 for (I = 0; I < nodeStarFactor->
N; I++)
4040 int * other_subdomain_dim,
4041 double ** other_subdomain_L,
4042 double ** other_subdomain_R,
4043 double ** other_subdomain_U,
4044 PROTEUS_LAPACK_INTEGER** other_subdomain_pivots,
4045 PROTEUS_LAPACK_INTEGER** other_subdomain_column_pivots,
4047 int** subdomain_dim_p,
4048 double *** subdomain_L_p,
4049 double *** subdomain_R_p,
4050 double *** subdomain_U_p,
4051 PROTEUS_LAPACK_INTEGER*** subdomain_pivots_p,
4052 PROTEUS_LAPACK_INTEGER*** subdomain_column_pivots_p)
4057 double** subdomain_R;
4058 double** subdomain_U;
4059 double** subdomain_L;
4060 PROTEUS_LAPACK_INTEGER** subdomain_pivots;
4061 PROTEUS_LAPACK_INTEGER** subdomain_column_pivots;
4065 realloc = other_N != *N_p;
4068 for (I=0; I < other_N; I++)
4070 realloc = realloc || (other_subdomain_dim[I] != (*subdomain_dim_p)[I]);
4076 printf(
"nodeStar_copy needs to reaalloc self_N=%d other_N=%d \n",*N_p,other_N);
4082 *subdomain_pivots_p,
4083 *subdomain_column_pivots_p);
4089 *subdomain_dim_p = (
int*)malloc(N*
sizeof(
int));
4090 *subdomain_pivots_p = (PROTEUS_LAPACK_INTEGER**)malloc(N*
sizeof(PROTEUS_LAPACK_INTEGER*));
4091 *subdomain_column_pivots_p = (PROTEUS_LAPACK_INTEGER**)malloc(N*
sizeof(PROTEUS_LAPACK_INTEGER*));
4092 *subdomain_R_p = (
double**)malloc(N*
sizeof(
double*));
4093 *subdomain_U_p = (
double**)malloc(N*
sizeof(
double*));
4094 *subdomain_L_p = (
double**)malloc(N*
sizeof(
double*));
4096 if ( (*subdomain_dim_p == NULL) ||
4097 (*subdomain_R_p == NULL) ||
4098 (*subdomain_U_p == NULL) ||
4099 (*subdomain_L_p == NULL) ||
4100 (*subdomain_pivots_p == NULL) ||
4101 (*subdomain_column_pivots_p == NULL) )
4105 subdomain_dim = *subdomain_dim_p;
4106 subdomain_pivots = *subdomain_pivots_p;
4107 subdomain_column_pivots = *subdomain_column_pivots_p;
4108 subdomain_R = *subdomain_R_p;
4109 subdomain_U = *subdomain_U_p;
4110 subdomain_L = *subdomain_L_p;
4113 for (I = 0; I < N; I++)
4115 subdomain_dim[I] = other_subdomain_dim[I];
4116 subdomain_pivots[I] = (PROTEUS_LAPACK_INTEGER*)malloc(subdomain_dim[I]*
sizeof(PROTEUS_LAPACK_INTEGER));
4117 subdomain_column_pivots[I] = (PROTEUS_LAPACK_INTEGER*)malloc(subdomain_dim[I]*
sizeof(PROTEUS_LAPACK_INTEGER));
4118 subdomain_R[I] = (
double*)malloc(subdomain_dim[I]*
sizeof(
double));
4119 subdomain_U[I] = (
double*)malloc(subdomain_dim[I]*
sizeof(
double));
4120 subdomain_L[I] = (
double*)malloc(subdomain_dim[I]*subdomain_dim[I]*
sizeof(
double));
4122 if ((subdomain_pivots[I] == NULL) ||
4123 (subdomain_column_pivots[I] == NULL) ||
4124 (subdomain_R[I] == NULL) ||
4125 (subdomain_U[I] == NULL) ||
4126 (subdomain_L[I] == NULL))
4134 subdomain_dim = *subdomain_dim_p;
4135 subdomain_pivots = *subdomain_pivots_p;
4136 subdomain_column_pivots = *subdomain_column_pivots_p;
4137 subdomain_R = *subdomain_R_p;
4138 subdomain_U = *subdomain_U_p;
4139 subdomain_L = *subdomain_L_p;
4145 for (I = 0; I < N; I++)
4147 assert(subdomain_dim[I] == other_subdomain_dim[I]);
4148 for (i = 0; i < subdomain_dim[I]; i++)
4150 subdomain_pivots[I][i] = other_subdomain_pivots[I][i];
4151 subdomain_column_pivots[I][i] = other_subdomain_column_pivots[I][i];
4152 subdomain_R[I][i] = other_subdomain_R[I][i];
4153 subdomain_U[I][i] = other_subdomain_U[I][i];
4155 for (i = 0; i < subdomain_dim[I]*subdomain_dim[I]; i++)
4156 subdomain_L[I][i] = other_subdomain_L[I][i];
4187 int nInteriorElementBoundaries_global,
4188 int nExteriorElementBoundaries_global,
4189 int nElementBoundaries_element,
4190 int nQuadraturePoints_elementBoundary,
4194 int* interiorElementBoundaries,
4195 int* exteriorElementBoundaries,
4196 int* elementBoundaryElements,
4197 int* elementBoundaryLocalElementBoundaries,
4200 int* nodeStarElements,
4201 int* nodeStarElementNeighbors,
4202 int* nElements_node,
4203 int* fluxElementBoundaries,
4204 double* elementResidual,
4210 double* conservationResidual,
4211 double* vConservative,
4212 double* vConservative_element)
4214 int ebNI,ebNE,ebN,eN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,k,I;
4215 register double flux,fluxAverage,fluxCorrection,dx=0.0;
4217 double ** starR, ** starU;
4225 memset(conservationResidual,0,
sizeof(
double)*nElements_global);
4230 assert(nodeStarFactor);
4234 for (eN=0;eN<nElements_global;eN++)
4236 for (nN=0;nN<nNodes_element;nN++)
4238 nN_global = dofMapl2g[eN*nDOF_element+
4240 eN_star = nodeStarElements[eN*nNodes_element+
4242 starR[nN_global][eN_star]
4244 elementResidual[eN*nNodes_element+
4246 conservationResidual[eN]
4248 elementResidual[eN*nNodes_element+
4261 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4263 ebN = interiorElementBoundaries[ebNI];
4264 left_eN = elementBoundaryElements[ebN*2+0];
4265 right_eN = elementBoundaryElements[ebN*2+1];
4266 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4267 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4274 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4278 dx = dX[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4279 left_ebN_element*nQuadraturePoints_elementBoundary+
4284 for (I=0;I<nSpace;I++)
4286 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4290 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
4301 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
4305 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4309 for (nN=0;nN<nNodes_element;nN++)
4312 nN_global = dofMapl2g[left_eN*nDOF_element+
4314 left_eN_star = nodeStarElements[left_eN*nNodes_element+
4318 if (nN != left_ebN_element)
4320 right_eN_star = nodeStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
4321 nN*nElementBoundaries_element+
4323 fluxCorrection = (starU[nN_global][left_eN_star]
4325 starU[nN_global][right_eN_star])
4327 w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4328 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4331 for (I=0;I<nSpace;I++)
4333 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4339 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4343 flux = (fluxAverage*
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4344 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4347 + fluxCorrection)*dx;
4348 starR[nN_global][left_eN_star]
4350 starR[nN_global][right_eN_star]
4352 conservationResidual[left_eN] += flux;
4353 conservationResidual[right_eN] -= flux;
4367 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4369 ebN = exteriorElementBoundaries[ebNE];
4370 eN = elementBoundaryElements[ebN*2+0];
4371 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4373 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4376 dx = dX[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4377 ebN_element*nQuadraturePoints_elementBoundary+
4381 for (I=0;I<nSpace;I++)
4383 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4387 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
4397 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
4401 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4405 for (nN=0;nN<nNodes_element;nN++)
4407 nN_global = dofMapl2g[eN*nDOF_element+
4409 eN_star = nodeStarElements[eN*nNodes_element+
4414 if (nN != ebN_element && !fluxElementBoundaries[ebNE])
4416 fluxCorrection = starU[nN_global][eN_star]
4418 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4419 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4422 for (I=0;I<nSpace;I++)
4423 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4428 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4433 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4434 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4439 starR[nN_global][eN_star]
4441 conservationResidual[eN] += flux;
4457 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4459 ebN = interiorElementBoundaries[ebNI];
4460 left_eN = elementBoundaryElements[ebN*2+0];
4461 right_eN = elementBoundaryElements[ebN*2+1];
4462 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4463 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4464 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4465 for(I=0;I<nSpace;I++)
4467 vConservative_element[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4468 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4472 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4475 vConservative_element[right_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4476 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4480 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4500 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4502 ebN = exteriorElementBoundaries[ebNE];
4503 eN = elementBoundaryElements[ebN*2+0];
4504 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4505 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4506 for(I=0;I<nSpace;I++)
4508 vConservative_element[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4509 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4513 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4549 int nNodes_internal,
4550 int nElements_global,
4551 int nInteriorElementBoundaries_global,
4552 int nExteriorElementBoundaries_global,
4553 int nElementBoundaries_element,
4554 int nQuadraturePoints_elementBoundary,
4558 int* interiorElementBoundaries,
4559 int* exteriorElementBoundaries,
4560 int* elementBoundaryElements,
4561 int* elementBoundaryLocalElementBoundaries,
4564 int* dofStarElements,
4565 int* dofStarElementNeighbors,
4566 int* nElements_node,
4568 int* fluxElementBoundaries,
4569 int* fluxBoundaryNodes,
4575 int eN,ebNI,ebNE,ebN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,nNI,k;
4576 PROTEUS_LAPACK_INTEGER INFO=0;
4577 register double wflux;
4580 double ** starJacobian = nodeStarFactor->
subdomain_L;
4587 assert(nodeStarFactor);
4588 for (nN = 0; nN < nDOF_global; nN++)
4590 for(ii=0; ii < subdomain_dim[nN]; ii++)
4592 starPivots[nN][ii]=0;
4593 starColPivots[nN][ii]=0;
4594 for (jj=0; jj < subdomain_dim[nN]; jj++)
4595 starJacobian[nN][ii + jj*subdomain_dim[nN]] = 0.0;
4600 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4602 ebN = interiorElementBoundaries[ebNI];
4603 left_eN = elementBoundaryElements[ebN*2+0];
4604 right_eN = elementBoundaryElements[ebN*2+1];
4605 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4606 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4607 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4609 for (nN=0;nN<nNodes_element;nN++)
4611 nN_global = dofMapl2g[left_eN*nDOF_element+
4613 left_eN_star = dofStarElements[left_eN*nNodes_element+
4617 if (nN != left_ebN_element)
4619 right_eN_star = dofStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
4620 nN*nElementBoundaries_element+
4622 wflux =
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4623 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4627 starJacobian[nN_global][left_eN_star+
4628 left_eN_star*subdomain_dim[nN_global]]
4630 starJacobian[nN_global][left_eN_star+
4631 right_eN_star*subdomain_dim[nN_global]]
4633 starJacobian[nN_global][right_eN_star+
4634 left_eN_star*subdomain_dim[nN_global]]
4636 starJacobian[nN_global][right_eN_star+
4637 right_eN_star*subdomain_dim[nN_global]]
4645 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4647 ebN = exteriorElementBoundaries[ebNE];
4648 eN = elementBoundaryElements[ebN*2+0];
4649 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4650 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4652 for (nN=0;nN<nNodes_element;nN++)
4654 nN_global = dofMapl2g[eN*nDOF_element+
4656 eN_star = dofStarElements[eN*nNodes_element+
4665 if (nN != ebN_element && !fluxElementBoundaries[ebNE])
4667 starJacobian[nN_global][eN_star+
4668 eN_star*nElements_node[nN_global]]
4670 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4671 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4679 for (nNI=0;nNI<nNodes_internal;nNI++)
4681 nN = internalNodes[nNI];
4682 starJacobian[nN][0]=1.0;
4683 for (eN=1;eN<nElements_node[nN];eN++)
4684 starJacobian[nN][eN*subdomain_dim[nN]]
4688 for (nN=0; nN < nDOF_global; nN++)
4690 if (fluxBoundaryNodes[nN]==1)
4692 starJacobian[nN][0]=1.0;
4693 for (eN=1;eN<nElements_node[nN];eN++)
4694 starJacobian[nN][eN*subdomain_dim[nN]]
4704 for (nN=0;nN<nDOF_global;nN++)
4706 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
4740 int nNodes_internal,
4741 int* nElements_node,
4743 int* fluxBoundaryNodes,
4747 PROTEUS_LAPACK_INTEGER NRHS=1,INFO=0;
4758 for (nN=0;nN<nNodes_global;nN++)
4759 for(eN=0;eN<subdomain_dim[nN];eN++)
4760 starU[nN][eN] = -starR[nN][eN];
4762 for (nNI=0;nNI<nNodes_internal;nNI++)
4764 nN = internalNodes[nNI];
4768 for (nN=0; nN < nNodes_global; nN++)
4770 if (fluxBoundaryNodes[nN] == 1)
4776 for (nN=0;nN<nNodes_global;nN++)
4778 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
4803 int* nElements_node,
4807 PROTEUS_LAPACK_INTEGER NRHS=1,INFO=0;
4818 for (nN=0;nN<nNodes_global;nN++)
4819 for(eN=0;eN<subdomain_dim[nN];eN++)
4820 starU[nN][eN] = -starR[nN][eN];
4822 for (nN=0;nN<nNodes_global;nN++)
4824 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
4836 int nElements_global,
4837 int nInteriorElementBoundaries_global,
4838 int nExteriorElementBoundaries_global,
4839 int nElementBoundaries_element,
4840 int nQuadraturePoints_elementBoundary,
4843 int* interiorElementBoundaries,
4844 int* exteriorElementBoundaries,
4845 int* elementBoundaryElements,
4846 int* elementBoundaryLocalElementBoundaries,
4848 int* nodeStarElements,
4849 int* nodeStarElementNeighbors,
4850 int* nElements_node,
4851 int* fluxElementBoundaries,
4852 double* elementResidual,
4858 double* conservationResidual,
4859 double* vConservative,
4860 double* vConservative_element)
4863 int ebNI,ebNE,ebN,eN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,k,I;
4864 register double flux,fluxAverage,fluxCorrection,dx=0.0;
4866 double ** starR, ** starU;
4874 memset(conservationResidual,0,
sizeof(
double)*nElements_global);
4875 memset(vConservative,0,
sizeof(
double)*(nInteriorElementBoundaries_global+nExteriorElementBoundaries_global)*nQuadraturePoints_elementBoundary*nSpace);
4880 assert(nodeStarFactor);
4884 for (nN=nNodes_owned;nN<nodeStarFactor->
N;nN++)
4890 for (eN=0;eN<nElements_global;eN++)
4892 for (nN=0;nN<nNodes_element;nN++)
4894 nN_global = elementNodes[eN*nNodes_element+
4896 eN_star = nodeStarElements[eN*nNodes_element+
4898 starR[nN_global][eN_star]
4900 elementResidual[eN*nNodes_element+
4902 conservationResidual[eN]
4904 elementResidual[eN*nNodes_element+
4917 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4919 ebN = interiorElementBoundaries[ebNI];
4920 left_eN = elementBoundaryElements[ebN*2+0];
4921 right_eN = elementBoundaryElements[ebN*2+1];
4922 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4923 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4924 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4928 dx = dX[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4929 left_ebN_element*nQuadraturePoints_elementBoundary+
4934 for (I=0;I<nSpace;I++)
4939 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
4943 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4947 for (nN=0;nN<nNodes_element;nN++)
4949 nN_global = elementNodes[left_eN*nNodes_element+
4951 left_eN_star = nodeStarElements[left_eN*nNodes_element+
4955 if (nN != left_ebN_element)
4957 right_eN_star = nodeStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
4958 nN*nElementBoundaries_element+
4960 fluxCorrection = (starU[nN_global][left_eN_star]
4962 starU[nN_global][right_eN_star])
4964 w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4965 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4968 for (I=0;I<nSpace;I++)
4970 if (nN_global < nNodes_owned)
4972 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
4978 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
4983 flux = (fluxAverage*
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
4984 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
4987 + fluxCorrection)*dx;
4988 starR[nN_global][left_eN_star]
4990 starR[nN_global][right_eN_star]
4992 conservationResidual[left_eN] += flux;
4993 conservationResidual[right_eN] -= flux;
5007 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5009 ebN = exteriorElementBoundaries[ebNE];
5010 eN = elementBoundaryElements[ebN*2+0];
5011 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5013 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5016 dx = dX[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5017 ebN_element*nQuadraturePoints_elementBoundary+
5021 for (I=0;I<nSpace;I++)
5024 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
5028 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5032 for (nN=0;nN<nNodes_element;nN++)
5034 nN_global = elementNodes[eN*nNodes_element+
5036 eN_star = nodeStarElements[eN*nNodes_element+
5041 if (nN != ebN_element && !fluxElementBoundaries[ebNE])
5043 fluxCorrection = starU[nN_global][eN_star]
5045 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5046 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5049 if (nN_global < nNodes_owned)
5051 for (I=0;I<nSpace;I++)
5053 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5058 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5065 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5066 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5071 starR[nN_global][eN_star]
5073 conservationResidual[eN] += flux;
5081 int nInteriorElementBoundaries_global,
5082 int nExteriorElementBoundaries_global,
5083 int nElementBoundaries_element,
5084 int nQuadraturePoints_elementBoundary,
5087 int* interiorElementBoundaries,
5088 int* exteriorElementBoundaries,
5089 int* elementBoundaryElements,
5090 int* elementBoundaryLocalElementBoundaries,
5091 int* skipflag_elementBoundaries,
5092 double* elementResidual,
5095 double* conservationResidual,
5096 double* vConservative)
5098 int ebNI,ebNE,ebN,eN,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,nN,k,I;
5099 register double flux,divergence=0.0;
5100 memset(conservationResidual,0,
sizeof(
double)*nElements_global);
5113 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
5115 ebN = interiorElementBoundaries[ebNI];
5116 left_eN = elementBoundaryElements[ebN*2+0];
5117 right_eN = elementBoundaryElements[ebN*2+1];
5118 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5119 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
5120 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5123 for (I=0;I<nSpace;I++)
5127 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5131 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5135 flux*=dX[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5136 left_ebN_element*nQuadraturePoints_elementBoundary+
5138 conservationResidual[left_eN] += flux;
5139 conservationResidual[right_eN] -= flux;
5143 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5145 ebN = exteriorElementBoundaries[ebNE];
5146 eN = elementBoundaryElements[ebN*2+0];
5147 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5148 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5151 for (I=0;I<nSpace;I++)
5154 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5158 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5162 flux*=dX[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5163 ebN_element*nQuadraturePoints_elementBoundary+
5165 conservationResidual[eN] += flux;
5173 int nNodes_internal,
5174 int nElements_global,
5175 int nInteriorElementBoundaries_global,
5176 int nExteriorElementBoundaries_global,
5177 int nElementBoundaries_element,
5178 int nQuadraturePoints_elementBoundary,
5181 int* interiorElementBoundaries,
5182 int* exteriorElementBoundaries,
5183 int* elementBoundaryElements,
5184 int* elementBoundaryLocalElementBoundaries,
5186 int* nodeStarElements,
5187 int* nodeStarElementNeighbors,
5188 int* nElements_node,
5190 int* fluxElementBoundaries,
5191 int* fluxBoundaryNodes,
5197 int eN,ebNI,ebNE,ebN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,nNI,k;
5198 PROTEUS_LAPACK_INTEGER INFO=0;
5199 register double wflux;
5202 double ** starJacobian = nodeStarFactor->
subdomain_L;
5209 assert(nodeStarFactor);
5210 for (nN = 0; nN < nNodes_global; nN++)
5212 for(ii=0; ii < subdomain_dim[nN]; ii++)
5214 starPivots[nN][ii]=0;
5215 starColPivots[nN][ii]=0;
5216 for (jj=0; jj < subdomain_dim[nN]; jj++)
5217 starJacobian[nN][ii + jj*subdomain_dim[nN]] = 0.0;
5221 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
5223 ebN = interiorElementBoundaries[ebNI];
5224 left_eN = elementBoundaryElements[ebN*2+0];
5225 right_eN = elementBoundaryElements[ebN*2+1];
5226 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5227 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
5228 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5230 for (nN=0;nN<nNodes_element;nN++)
5232 nN_global = elementNodes[left_eN*nNodes_element+
5234 left_eN_star = nodeStarElements[left_eN*nNodes_element+
5238 if (nN != left_ebN_element && nN_global < nNodes_owned)
5240 right_eN_star = nodeStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
5241 nN*nElementBoundaries_element+
5243 wflux =
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5244 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5248 starJacobian[nN_global][left_eN_star+
5249 left_eN_star*subdomain_dim[nN_global]]
5251 starJacobian[nN_global][left_eN_star+
5252 right_eN_star*subdomain_dim[nN_global]]
5254 starJacobian[nN_global][right_eN_star+
5255 left_eN_star*subdomain_dim[nN_global]]
5257 starJacobian[nN_global][right_eN_star+
5258 right_eN_star*subdomain_dim[nN_global]]
5265 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5267 ebN = exteriorElementBoundaries[ebNE];
5268 eN = elementBoundaryElements[ebN*2+0];
5269 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5270 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5272 for (nN=0;nN<nNodes_element;nN++)
5274 nN_global = elementNodes[eN*nNodes_element+
5276 eN_star = nodeStarElements[eN*nNodes_element+
5285 if (nN != ebN_element && !fluxElementBoundaries[ebNE] && nN_global < nNodes_owned)
5287 starJacobian[nN_global][eN_star+
5288 eN_star*nElements_node[nN_global]]
5290 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5291 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5299 for (nNI=0;nNI<nNodes_internal;nNI++)
5301 nN = internalNodes[nNI];
5302 if (nN < nNodes_owned)
5304 starJacobian[nN][0]=1.0;
5305 for (eN=1;eN<nElements_node[nN];eN++)
5306 starJacobian[nN][eN*subdomain_dim[nN]]
5311 for (nN=0; nN < nNodes_owned; nN++)
5313 if (fluxBoundaryNodes[nN]==1)
5315 starJacobian[nN][0]=1.0;
5316 for (eN=1;eN<nElements_node[nN];eN++)
5317 starJacobian[nN][eN*subdomain_dim[nN]]
5327 for (nN=0;nN<nNodes_owned;nN++)
5329 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
5348 printf(
"velPP jac dgetrf INFO=%d nN=%d \n",(
int)(INFO),nN);
5349 for (ii=0;ii<nE_n;ii++)
5351 for(jj=0;jj<nE_n;jj++)
5354 printf(
"%12.5e \t",starJacobian[nN][ii*nE_n + jj]);
5364 int nNodes_internal,
5365 int* nElements_node,
5367 int* fluxBoundaryNodes,
5371 PROTEUS_LAPACK_INTEGER NRHS=1,INFO=0;
5382 for (nN=0;nN<nNodes_owned;nN++)
5383 for(eN=0;eN<subdomain_dim[nN];eN++)
5384 starU[nN][eN] = -starR[nN][eN];
5386 for (nNI=0;nNI<nNodes_internal;nNI++)
5388 nN = internalNodes[nNI];
5389 if (nN < nNodes_owned)
5393 for (nN=0; nN < nNodes_owned; nN++)
5395 if (fluxBoundaryNodes[nN] == 1)
5401 for (nN=0;nN<nNodes_owned;nN++)
5403 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
5427 int nElements_global,
5430 int* nodeStarElements,
5432 double* subdomain_U)
5434 int eN,nN,eN_star,nN_global;
5436 for (eN=0;eN<nElements_global;eN++)
5437 for (nN=0;nN<nNodes_element;nN++)
5439 nN_global = elementNodes[eN*nNodes_element+
5441 eN_star = nodeStarElements[eN*nNodes_element+
5443 starU[nN_global][eN_star]
5445 subdomain_U[eN*nNodes_element+
5451 int nElements_global,
5454 int* nodeStarElements,
5456 double* subdomain_U)
5458 int eN,nN,eN_star,nN_global;
5460 for (eN=0;eN<nElements_global;eN++)
5461 for (nN=0;nN<nNodes_element;nN++)
5464 nN_global = elementNodes[eN*nNodes_element+
5466 eN_star = nodeStarElements[eN*nNodes_element+
5468 if (nN_global < max_nN_owned)
5469 subdomain_U[eN*nNodes_element+
5471 starU[nN_global][eN_star];
5474 subdomain_U[eN*nNodes_element+
5484 int nElementBoundaries_element,
5485 int nQuadraturePoints_elementBoundary,
5486 int nDOF_test_element,
5487 int* exteriorElementBoundaries,
5488 int* elementBoundaryElements,
5489 int* elementBoundaryLocalElementBoundaries,
5490 int* skipflag_elementBoundaries,
5495 int ebNE,ebN,eN_global,ebN_element,i,k;
5496 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5498 ebN = exteriorElementBoundaries[ebNE];
5499 eN_global = elementBoundaryElements[ebN*2+0];
5500 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5501 if (skipflag_elementBoundaries[ebNE] == 0)
5503 for(i=0;i<nDOF_test_element;i++)
5504 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5515 residual[eN_global*nDOF_test_element+
5518 flux[ebN*nQuadraturePoints_elementBoundary+
5521 w_dS[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_test_element+
5522 ebN_element*nQuadraturePoints_elementBoundary*nDOF_test_element+
5523 k*nDOF_test_element+
5543 for (k = 0; k < nPoints; k++)
5545 for (I = 0; I < nSpace; I++)
5547 velocity[k*nSpace + I] *= updateCoef;
5548 velocity[k*nSpace + I] +=
f[k*nSpace + I];
5557 const double* grad_phi,
5567 const int nSpace2 = nSpace*nSpace;
5568 for (k = 0; k < nPoints; k++)
5570 for (I = 0; I < nSpace; I++)
5572 velocity[k*nSpace + I] *= updateCoef;
5573 for (J=0; J < nSpace; J++)
5575 velocity[k*nSpace + I] -=
5576 a[k*nSpace2 + I*nSpace + J]
5578 grad_phi[k*nSpace + J];
5590 const double* grad_phi,
5600 const int nnz=rowptr[nSpace];
5601 for (k = 0; k < nPoints; k++)
5603 for (I = 0; I < nSpace; I++)
5605 velocity[k*nSpace + I] *= updateCoef;
5606 for(m=rowptr[I];m<rowptr[I+1];m++)
5608 velocity[k*nSpace + I] -=
5611 grad_phi[k*nSpace + colind[m]];
5617void calculateElementResidualPWL(
int nElements,
int nDOF_element_res,
int nDOF_element_resPWL,
double* alpha,
double* elementResidual,
double* elementResidualPWL)
5620 memset(elementResidualPWL,0,
sizeof(
double)*nElements*nDOF_element_resPWL);
5621 for(eN=0;eN<nElements;eN++)
5622 for(i=0;i<nDOF_element_resPWL;i++)
5623 for(j=0;j<nDOF_element_res;j++)
5624 elementResidualPWL[eN*nDOF_element_resPWL+i] += alpha[i*nDOF_element_res+j]*elementResidual[eN*nDOF_element_res+j];
5651 int nInteriorElementBoundaries_global,
5652 int nExteriorElementBoundaries_global,
5653 int nElementBoundaries_element,
5654 int nQuadraturePoints_elementBoundary,
5657 int* interiorElementBoundaries,
5658 int* exteriorElementBoundaries,
5659 int* elementBoundaryElements,
5660 int* elementBoundaryLocalElementBoundaries,
5662 int* nodeStarElements,
5663 int* nodeStarElementNeighbors,
5664 int* nElements_node,
5665 int* fluxElementBoundaries,
5666 double* elementResidual,
5672 double* conservationResidual,
5673 double* vConservative,
5674 double* vConservative_element)
5676 int ebNI,ebNE,ebN,eN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,k,I;
5677 register double flux,fluxAverage,fluxCorrection,dx=0.0;
5679 double ** starR, ** starU;
5687 memset(conservationResidual,0,
sizeof(
double)*nElements_global);
5692 assert(nodeStarFactor);
5697 for (eN=0;eN<nElements_global;eN++)
5699 for (nN=0;nN<nNodes_element;nN++)
5701 nN_global = elementNodes[eN*nNodes_element+
5703 eN_star = nodeStarElements[eN*nNodes_element+
5705 starR[nN_global][eN_star]
5707 elementResidual[eN*nNodes_element+
5709 conservationResidual[eN]
5711 elementResidual[eN*nNodes_element+
5724 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
5726 ebN = interiorElementBoundaries[ebNI];
5727 left_eN = elementBoundaryElements[ebN*2+0];
5728 right_eN = elementBoundaryElements[ebN*2+1];
5729 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5730 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
5731 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5735 dx = dX[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5736 left_ebN_element*nQuadraturePoints_elementBoundary+
5741 for (I=0;I<nSpace;I++)
5743 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5747 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
5758 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
5762 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5766 for (nN=0;nN<nNodes_element;nN++)
5768 nN_global = elementNodes[left_eN*nNodes_element+
5770 left_eN_star = nodeStarElements[left_eN*nNodes_element+
5774 if (nN != left_ebN_element && !fluxElementBoundaries[ebN])
5776 right_eN_star = nodeStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
5777 nN*nElementBoundaries_element+
5779 fluxCorrection = (starU[nN_global][left_eN_star]
5781 starU[nN_global][right_eN_star])
5783 w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5784 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5787 for (I=0;I<nSpace;I++)
5789 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5795 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5799 flux = (fluxAverage*
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5800 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5803 + fluxCorrection)*dx;
5804 starR[nN_global][left_eN_star]
5806 starR[nN_global][right_eN_star]
5808 conservationResidual[left_eN] += flux;
5809 conservationResidual[right_eN] -= flux;
5823 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5825 ebN = exteriorElementBoundaries[ebNE];
5826 eN = elementBoundaryElements[ebN*2+0];
5827 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5829 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5832 dx = dX[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5833 ebN_element*nQuadraturePoints_elementBoundary+
5837 for (I=0;I<nSpace;I++)
5839 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5843 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
5853 vAverage[ebN*nQuadraturePoints_elementBoundary*nSpace+
5857 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5861 for (nN=0;nN<nNodes_element;nN++)
5863 nN_global = elementNodes[eN*nNodes_element+
5865 eN_star = nodeStarElements[eN*nNodes_element+
5870 if (nN != ebN_element && !fluxElementBoundaries[ebN])
5872 fluxCorrection = starU[nN_global][eN_star]
5874 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5875 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5878 for (I=0;I<nSpace;I++)
5879 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5884 normal[ebN*nQuadraturePoints_elementBoundary*nSpace+
5889 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
5890 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
5895 starR[nN_global][eN_star]
5897 conservationResidual[eN] += flux;
5913 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
5915 ebN = interiorElementBoundaries[ebNI];
5916 left_eN = elementBoundaryElements[ebN*2+0];
5917 right_eN = elementBoundaryElements[ebN*2+1];
5918 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5919 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
5920 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5921 for(I=0;I<nSpace;I++)
5923 vConservative_element[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5924 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5928 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5931 vConservative_element[right_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5932 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5936 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
5955 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5957 ebN = exteriorElementBoundaries[ebNE];
5958 eN = elementBoundaryElements[ebN*2+0];
5959 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5960 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5961 for(I=0;I<nSpace;I++)
5963 vConservative_element[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5964 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5968 vConservative[ebN*nQuadraturePoints_elementBoundary*nSpace+
6007 int nElements_global,
6008 int nInteriorElementBoundaries_global,
6009 int nExteriorElementBoundaries_global,
6010 int nElementBoundaries_element,
6011 int nQuadraturePoints_elementBoundary,
6014 int* interiorElementBoundaries,
6015 int* exteriorElementBoundaries,
6016 int* elementBoundaryElements,
6017 int* elementBoundaryLocalElementBoundaries,
6019 int* nodeStarElements,
6020 int* nodeStarElementNeighbors,
6021 int* nElements_node,
6022 int* fluxElementBoundaries,
6028 int eN,ebNI,ebNE,ebN,eN_star,left_eN,right_eN,ebN_element,left_ebN_element,right_ebN_element,left_eN_star,right_eN_star,nN,nN_global,nNI,k;
6029 PROTEUS_LAPACK_INTEGER INFO=0;
6030 register double wflux;
6033 double ** starJacobian = nodeStarFactor->
subdomain_L;
6040 assert(nodeStarFactor);
6041 for (nN = 0; nN < nNodes_global; nN++)
6043 for(ii=0; ii < subdomain_dim[nN]; ii++)
6045 starPivots[nN][ii]=0;
6046 starColPivots[nN][ii]=0;
6047 for (jj=0; jj < subdomain_dim[nN]; jj++)
6048 starJacobian[nN][ii + jj*subdomain_dim[nN]] = 0.0;
6052 for (ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
6054 ebN = interiorElementBoundaries[ebNI];
6055 left_eN = elementBoundaryElements[ebN*2+0];
6056 right_eN = elementBoundaryElements[ebN*2+1];
6057 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
6058 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
6059 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
6061 for (nN=0;nN<nNodes_element;nN++)
6063 nN_global = elementNodes[left_eN*nNodes_element+
6065 left_eN_star = nodeStarElements[left_eN*nNodes_element+
6070 if (nN != left_ebN_element && !fluxElementBoundaries[ebN])
6072 right_eN_star = nodeStarElementNeighbors[left_eN*nNodes_element*nElementBoundaries_element+
6073 nN*nElementBoundaries_element+
6075 wflux =
w[left_eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
6076 left_ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
6080 starJacobian[nN_global][left_eN_star+
6081 left_eN_star*subdomain_dim[nN_global]]
6083 starJacobian[nN_global][left_eN_star+
6084 right_eN_star*subdomain_dim[nN_global]]
6086 starJacobian[nN_global][right_eN_star+
6087 left_eN_star*subdomain_dim[nN_global]]
6089 starJacobian[nN_global][right_eN_star+
6090 right_eN_star*subdomain_dim[nN_global]]
6097 for (ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
6099 ebN = exteriorElementBoundaries[ebNE];
6100 eN = elementBoundaryElements[ebN*2+0];
6101 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
6102 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
6104 for (nN=0;nN<nNodes_element;nN++)
6106 nN_global = elementNodes[eN*nNodes_element+
6108 eN_star = nodeStarElements[eN*nNodes_element+
6114 if (nN != ebN_element && !fluxElementBoundaries[ebN])
6116 starJacobian[nN_global][eN_star+
6117 eN_star*nElements_node[nN_global]]
6119 w[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nNodes_element+
6120 ebN_element*nQuadraturePoints_elementBoundary*nNodes_element+
6129 for (nN=0;nN<nNodes_global;nN++)
6131 PROTEUS_LAPACK_INTEGER nE_n = ((PROTEUS_LAPACK_INTEGER)subdomain_dim[nN]);
void calculateConservationResidualPWL(int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nodeStarOffsets, int *nElements_node, double *elementResidual, double *vAverage, double *starU, double *dX, double *w, double *normal, double *conservationResidual, double *starR, double *vConservative, double *vConservative_element)
void calculateConservationFluxPWL(int nNodes_global, int nNodes_internal, int *nElements_node, int *nodeStarOffsets, int *nodeStarJacobianOffsets, int *internalNodes, double *starR, double *starJ, double *starU)
void calculateConservationResidualGlobalBoundaries(int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, double *dS, double *normal, double *elementResidual, double *velocity, double *conservationResidual)
void calculateConservationJacobianPWL(int nNodes_global, int nNodes_internal, int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nodeStarOffsets, int *nodeStarJacobianOffsets, int *nElements_node, int *internalNodes, double *w, double *normal, double *starJacobian)
void calculateConservationResidualPWL_opt(int nNodes_owned, int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nElements_node, int *fluxElementBoundaries, double *elementResidual, double *vAverage, double *dX, double *w, double *normal, NodeStarFactorStruct *nodeStarFactor, double *conservationResidual, double *vConservative, double *vConservative_element)
void calculateConservationResidualPWL_primative(int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *skipflag_elementBoundaries, double *elementResidual, double *dX, double *normal, double *conservationResidual, double *vConservative)
void updateSelectedExteriorElementBoundaryFlux(int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nDOF_test_element, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *skipflag_elementBoundaries, double *flux, double *w_dS, double *residual)
Update the element boundary flux on exterior element boundaries.
void calculateConservationJacobianPWL_interiorBoundaries(int nNodes_global, int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nElements_node, int *fluxElementBoundaries, double *w, double *normal, NodeStarFactorStruct *nodeStarFactor)
void getElementBoundaryBDM1velocityValuesLagrangeRep(int nElements_global, int nBoundaries_Element, int nQuadraturePoints_elementBoundary, int nSpace, int nDOF_trial_element, int nVDOF_element, int *elementBoundaryElementsArray, int *exteriorElementBoundariesArray, double *ebq_v, double *p1_velocity_dofs, double *ebq_velocity)
void calculateConservationFluxPWL_noNeumannFix(int nNodes_global, int *nElements_node, NodeStarFactorStruct *nodeStarFactor)
void getElementBoundaryRT0velocityValues(int nElements_global, int nElementBoundaries_element, int nPoints_elementBoundary, int nSpace, double *x_elementBoundary, double *rt0vdofs_element, double *v_elementBoundary)
void getGlobalExteriorElementBoundaryBDM1velocityValuesLagrangeRep(int nExteriorElementBoundaries_global, int nQuadraturePoints_elementBoundary, int nSpace, int nDOF_trial_element, int nVDOF_element, int *elementBoundaryElementsArray, int *exteriorElementBoundariesArray, double *ebqe_v, double *p1_velocity_dofs, double *ebqe_velocity)
void updateRT0velocityWithAveragedPotentialP1nc(int nElements_global, int nQuadraturePoints_element, int nSpace, double *detJ, double *quad_a, double *phi, double *gradphi, double *a, double *rt0vdofs)
int nodeStar_init(int nElements_global, int nNodes_element, int nNodes_global, int *nElements_node, int *nodeStarElementsArray, int *nodeStarElementNeighborsArray, int *N_p, int **subdomain_dim_p, double ***subdomain_L_p, double ***subdomain_R_p, double ***subdomain_U_p, PROTEUS_LAPACK_INTEGER ***subdomain_pivots_p, PROTEUS_LAPACK_INTEGER ***subdomain_column_pivots_p)
void solveLocalBDM2projection(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int nDOFs_test_element, int nVDOFs_element, double *BDMprojectionMatFact_element, int *BDMprojectionMatPivots_element, double *w_dS_f, double *ebq_n, double *w_interior_gradients, double *q_velocity, double *ebq_velocity, double *p1_velocity_dofs)
void postProcessRT0velocityFromP1nc(int nElements_global, int nQuadraturePoints_element, int nDOF_test_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *nFreeDOF_element, int *freeLocal_element, double *detJ, double *sqrt_det_g, double *n, double *elementBarycenters, double *quad_a, double *quad_f, double *w_dV_r, double *w_dV_m, double *u, double *gradu, double *a, double *f, double *r, double *mt, double *rt0vdofs)
void postProcessRT0velocityFromP1ncNoMass_sd(int nElements_global, int nQuadraturePoints_element, int nDOF_test_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *rowptr, int *colind, int *nFreeDOF_element, int *freeLocal_element, double *detJ, double *sqrt_det_g, double *n, double *elementBarycenters, double *quad_a, double *quad_f, double *w_dV_r, double *u, double *gradu, double *a, double *f, double *r, double *rt0vdofs)
int nodeStar_copy(int other_N, int *other_subdomain_dim, double **other_subdomain_L, double **other_subdomain_R, double **other_subdomain_U, PROTEUS_LAPACK_INTEGER **other_subdomain_pivots, PROTEUS_LAPACK_INTEGER **other_subdomain_column_pivots, int *N_p, int **subdomain_dim_p, double ***subdomain_L_p, double ***subdomain_R_p, double ***subdomain_U_p, PROTEUS_LAPACK_INTEGER ***subdomain_pivots_p, PROTEUS_LAPACK_INTEGER ***subdomain_column_pivots_p)
void solveLocalBDM1projectionFromFlux(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nDOFs_test_element, int nVDOFs_element, double *BDMprojectionMatFact_element, int *BDMprojectionMatPivots_element, int *elementBoundaryElementsArray, int *elementBoundariesArray, double *w_dS_f, double *ebq_global_flux, double *p1_velocity_dofs)
void computeFluxCorrectionPWC(int nElementBoundaries_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, double *pwcW, double *pwcV, double *fluxCorrection)
void fluxCorrectionVelocityUpdate(int nElements_global, int nElementBoundaries_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, double *dS, double *normal, double *fluxCorrection, double *vConservative, double *vConservative_element)
void postprocessDiffusiveVelocityPointEval(int nPoints, int nSpace, double updateCoef, const double *a, const double *grad_phi, double *velocity)
void getGlobalExteriorElementBoundaryRT0velocityValues(int nExteriorElementBoundaries_global, int nPoints_elementBoundary, int nSpace, int *elementBoundaryElementsArray, int *exteriorElementBoundariesArray, double *x_elementBoundary_global, double *rt0vdofs_element, double *v_elementBoundary_global)
void getGlobalExteriorElementBoundaryRT0velocityValuesFluxRep(int nExteriorElementBoundaries_global, int nPoints_elementBoundary_global, int nSpace, int nDetVals_element, double *nodeArray, int *elementNodesArray, int *elementBoundaryElementsArray, int *exteriorElementBoundariesArray, double *abs_det_J, double *x_ebqe, double *rt0vdofs_element, double *v_ebqe)
void getElementRT0velocityValues(int nElements_global, int nPoints_element, int nSpace, double *x_element, double *rt0vdofs_element, double *v_element)
int nodeStar_setU(NodeStarFactorStruct *nodeStarFactor, double val)
void calculateElementResidualPWL(int nElements, int nDOF_element_res, int nDOF_element_resPWL, double *alpha, double *elementResidual, double *elementResidualPWL)
void postProcessRT0velocityFromP1ncNoMass(int nElements_global, int nQuadraturePoints_element, int nDOF_test_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *nFreeDOF_element, int *freeLocal_element, double *detJ, double *sqrt_det_g, double *n, double *elementBarycenters, double *quad_a, double *quad_f, double *w_dV_r, double *u, double *gradu, double *a, double *f, double *r, double *rt0vdofs)
void subdomain_U_copy_local2global(int max_nN_owned, int nElements_global, int nNodes_element, int *elementNodes, int *nodeStarElements, NodeStarFactorStruct *nodeStarFactor, double *subdomain_U)
void postprocessAdvectiveVelocityPointEval(int nPoints, int nSpace, double updateCoef, const double *f, double *velocity)
void getElementBDM2velocityValuesLagrangeRep(int nElements_global, int nQuadraturePoints_element, int nSpace, int nDOF_trial_element, int nVDOF_element, double *q_v, double *p1_velocity_dofs, double *q_velocity)
void getElementBoundaryRT0velocityValuesFluxRep(int nElements_global, int nElementBoundaries_element, int nPoints_elementBoundary, int nSpace, int nDetVals_element, double *nodeArray, int *elementNodesArray, double *abs_det_J, double *x_elementBoundary, double *rt0vdofs_element, double *v_elementBoundary)
void postProcessRT0velocityFromP1nc_sd(int nElements_global, int nQuadraturePoints_element, int nDOF_test_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *rowptr, int *colind, int *nFreeDOF_element, int *freeLocal_element, double *detJ, double *sqrt_det_g, double *n, double *elementBarycenters, double *quad_a, double *quad_f, double *w_dV_r, double *w_dV_m, double *u, double *gradu, double *a, double *f, double *r, double *mt, double *rt0vdofs)
void getElementBDM1velocityValuesLagrangeRep(int nElements_global, int nQuadraturePoints_element, int nSpace, int nDOF_trial_element, int nVDOF_element, double *q_v, double *p1_velocity_dofs, double *q_velocity)
void calculateConservationResidualPWL_interiorBoundaries(int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nElements_node, int *fluxElementBoundaries, double *elementResidual, double *vAverage, double *dX, double *w, double *normal, NodeStarFactorStruct *nodeStarFactor, double *conservationResidual, double *vConservative, double *vConservative_element)
void getGlobalElementBoundaryRT0velocityValuesFluxRep(int nElementBoundaries_global, int nPoints_elementBoundary_global, int nSpace, int nDetVals_element, double *nodeArray, int *elementNodesArray, int *elementBoundaryElementsArray, double *abs_det_J, double *x_elementBoundary_global, double *rt0vdofs_element, double *v_elementBoundary_global)
void sunWheelerGSsweep(int nElements_global, int nElementBoundaries_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, double *dS, double *normal, double *sqrt_det_g, double *alpha, double *fluxCorrection, double *conservationResidual)
void buildBDM2rhs(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nQuadraturePoints_elementInterior, int nSpace, int nDOFs_test_element, int nVDOFs_element, int nDOFs_trial_interior_element, double *BDMprojectionMatFact_element, int *BDMprojectionMatPivots_element, int *edgeFlags, double *w_dS_f, double *ebq_n, double *w_interior_grads, double *w_interior_divfree, double *ebq_velocity, double *q_velocity, double *p1_velocity_dofs)
void postProcessRT0potentialFromP1nc_sd(int nElements_global, int nQuadraturePoints_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int *rowptr, int *colind, double *uQuadratureWeights_element, double *elementBarycenters, double *aElementQuadratureWeights, double *detJ, double *uQuadratureWeights_elementBoundary, double *x, double *u, double *gradu, double *x_elementBoundary, double *u_elementBoundary, double *n, double *a, double *f, double *r, double *rt0vdofs, double *rt0potential)
void buildLocalBDM2projectionMatrices(int degree, int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nQuadraturePoints_elementInterior, int nSpace, int nDOFs_test_element, int nDOFs_trial_boundary_element, int nDOFs_trial_interior_element, int nVDOFs_element, int *edgeFlags, double *w_dS_f, double *ebq_n, double *ebq_v, double *BDMprojectionMat_element, double *q_basis_vals, double *w_int_test_grads, double *w_int_div_free, double *piola_trial_fun)
void subdomain_U_copy_global2local(int max_nN_owned, int nElements_global, int nNodes_element, int *elementNodes, int *nodeStarElements, NodeStarFactorStruct *nodeStarFactor, double *subdomain_U)
void getRT0velocityValuesFluxRep_arbitraryElementMembership(int nElements_global, int nElementBoundaries_element, int nPoints, int nSpace, int nDetVals_element, const double *nodeArray, const int *elementNodesArray, const double *abs_det_J, const double *x, const int *element_locations, const double *rt0vdofs_element, double *v_element)
void updateRT0velocityWithAveragedPotentialP1nc_sd(int nElements_global, int nQuadraturePoints_element, int nSpace, int *rowptr, int *colind, double *detJ, double *quad_a, double *phi, double *gradphi, double *a, double *rt0vdofs)
void projectElementBoundaryFluxToRT0fluxRep(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nDOF_RT0V_element, int *elementBoundaryElementsArray, int *elementBoundariesArray, double *elementBoundaryQuadratureWeights, double *flux_elementBoundary, double *rt0vdofs_element)
void solveLocalBDM1projection(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int nDOFs_test_element, int nVDOFs_element, double *BDMprojectionMatFact_element, int *BDMprojectionMatPivots_element, double *w_dS_f, double *ebq_n, double *ebq_velocity, double *p1_velocity_dofs)
void factorLocalBDM1projectionMatrices(int nElements_global, int nVDOFs_element, double *BDMprojectionMat_element, int *BDMprojectionMatPivots_element)
void buildLocalBDM1projectionMatrices(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int nDOFs_test_element, int nDOFs_trial_element, int nVDOFs_element, double *w_dS_f, double *ebq_n, double *ebq_v, double *BDMprojectionMat_element)
void getElementLDGvelocityValuesLagrangeRep(int nElements_global, int nQuadraturePoints_element, int nSpace, int nDOF_trial_element, int nVDOF_element, double *q_v, double *velocity_dofs, double *q_velocity)
void getElementRT0velocityValuesFluxRep(int nElements_global, int nElementBoundaries_element, int nPoints_element, int nSpace, int nDetVals_element, double *nodeArray, int *elementNodesArray, double *abs_det_J, double *x_element, double *rt0vdofs_element, double *v_element)
void postprocessDiffusiveVelocityPointEval_sd(int nPoints, int nSpace, double updateCoef, int *rowptr, int *colind, const double *a, const double *grad_phi, double *velocity)
void factorLocalBDM2projectionMatrices(int nElements_global, int nVDOFs_element, double *BDMprojectionMat_element, int *BDMprojectionMatPivots_element)
void projectElementBoundaryVelocityToRT0fluxRep(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, double *elementBoundaryQuadratureWeights, double *n, double *v_elementBoundary, double *rt0vdofs_element)
void calculateConservationJacobianPWL_opt(int nNodes_owned, int nNodes_global, int nNodes_internal, int nElements_global, int nInteriorElementBoundaries_global, int nExteriorElementBoundaries_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nNodes_element, int nSpace, int *interiorElementBoundaries, int *exteriorElementBoundaries, int *elementBoundaryElements, int *elementBoundaryLocalElementBoundaries, int *elementNodes, int *nodeStarElements, int *nodeStarElementNeighbors, int *nElements_node, int *internalNodes, int *fluxElementBoundaries, int *fluxBoundaryNodes, double *w, double *normal, NodeStarFactorStruct *nodeStarFactor)
int nodeStar_free(int N, int *subdomain_dim, double **subdomain_L, double **subdomain_R, double **subdomain_U, PROTEUS_LAPACK_INTEGER **subdomain_pivots, PROTEUS_LAPACK_INTEGER **subdomain_column_pivots)
void getGlobalElementBoundaryRT0velocityValues(int nElementBoundaries_global, int nPoints_elementBoundary, int nSpace, int *elementBoundaryElementsArray, double *x_elementBoundary_global, double *rt0vdofs_element, double *v_elementBoundary_global)
void postProcessRT0potentialFromP1nc(int nElements_global, int nQuadraturePoints_element, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, double *uQuadratureWeights_element, double *elementBarycenters, double *aElementQuadratureWeights, double *detJ, double *uQuadratureWeights_elementBoundary, double *x, double *u, double *gradu, double *x_elementBoundary, double *u_elementBoundary, double *n, double *a, double *f, double *r, double *rt0vdofs, double *rt0potential)
void calculateConservationFluxPWL_opt(int nNodes_owned, int nNodes_global, int nNodes_internal, int *nElements_node, int *internalNodes, int *fluxBoundaryNodes, NodeStarFactorStruct *nodeStarFactor)
void getGlobalElementBoundaryBDM1velocityValuesLagrangeRep(int nExteriorElementBoundaries_global, int nQuadraturePoints_elementBoundary, int nSpace, int nDOF_trial_element, int nVDOF_element, int *elementBoundaryElementsArray, int *exteriorElementBoundariesArray, double *ebqe_v, double *p1_velocity_dofs, double *ebq_global_velocity)
void invertLocal(int nSpace, double A[3][3], double AI[3][3])
void getElementBDM1velocityValuesLagrangeRep_orig(int nElements_global, int nQuadraturePoints_element, int nSpace, int nDOF_trial_element, int nVDOF_element, double *q_v, double *p1_velocity_dofs, double *q_velocity)
void buildLocalBDM1projectionMatrices_orig(int nElements_global, int nElementBoundaries_element, int nQuadraturePoints_elementBoundary, int nSpace, int nDOFs_test_element, int nDOFs_trial_element, int nVDOFs_element, double *w_dS_f, double *ebq_n, double *ebq_v, double *BDMprojectionMat_element)
Python interface to velocity postprocessing library.
int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info)
int dgesc2_(int *n, double *a, int *lda, double *rhs, int *ipiv, int *jpiv, double *scale)
int dgetrs_(char *trans, int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info)
int dgetc2_(int *n, double *a, int *lda, int *ipiv, int *jpiv, int *info)
PROTEUS_LAPACK_INTEGER ** subdomain_column_pivots
PROTEUS_LAPACK_INTEGER ** subdomain_pivots