4 #define TR_ALPHA_EXT 1.0
16 int nInteriorElementBoundaries_global,
17 int nElementBoundaries_element,
18 int nQuadraturePoints_elementBoundary,
20 int* interiorElementBoundaries,
21 int* elementBoundaryElements,
22 int* elementBoundaryLocalElementBoundaries,
31 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
32 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,sonicSpeed;
34 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
36 ebN = interiorElementBoundaries[ebNI];
37 left_eN_global = elementBoundaryElements[ebN*2+0];
38 right_eN_global = elementBoundaryElements[ebN*2+1];
39 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
40 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
41 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
51 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
52 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
56 df[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
57 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
62 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
63 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
67 df[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
68 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
73 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
74 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
78 f[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
79 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
84 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
85 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
89 f[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
90 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
95 u_left =
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
96 left_ebN_element*nQuadraturePoints_elementBoundary+
98 u_right=
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
99 right_ebN_element*nQuadraturePoints_elementBoundary+
108 if (u_left >= u_right)
110 if (left_flux >= right_flux)
112 flux[ebN*nQuadraturePoints_elementBoundary+
114 dflux_left[ebN*nQuadraturePoints_elementBoundary+
116 dflux_right[ebN*nQuadraturePoints_elementBoundary+
121 flux[ebN*nQuadraturePoints_elementBoundary+
123 dflux_left[ebN*nQuadraturePoints_elementBoundary+
125 dflux_right[ebN*nQuadraturePoints_elementBoundary+
132 flux[ebN*nQuadraturePoints_elementBoundary+
134 dflux_left[ebN*nQuadraturePoints_elementBoundary+
136 dflux_right[ebN*nQuadraturePoints_elementBoundary+
139 if (right_flux <= flux[ebN*nQuadraturePoints_elementBoundary+k])
141 flux[ebN*nQuadraturePoints_elementBoundary+
143 dflux_left[ebN*nQuadraturePoints_elementBoundary+
145 dflux_right[ebN*nQuadraturePoints_elementBoundary+
148 if (u_left <= sonicPoint && sonicPoint <= u_right &&
149 sonicFlux < flux[ebN*nQuadraturePoints_elementBoundary+k])
151 flux[ebN*nQuadraturePoints_elementBoundary+
154 dflux_left[ebN*nQuadraturePoints_elementBoundary+
156 dflux_right[ebN*nQuadraturePoints_elementBoundary+
180 int nInteriorElementBoundaries_global,
181 int nElementBoundaries_element,
182 int nQuadraturePoints_elementBoundary,
183 int nQuadraturePoints_element,
185 int* interiorElementBoundaries,
186 int* elementBoundaryElements,
187 int* elementBoundaryLocalElementBoundaries,
197 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
198 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,
199 maxSpeed_left,maxSpeed_right,maxSpeed_element,maxSpeed,tmp_left,tmp_right;
202 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
204 ebN = interiorElementBoundaries[ebNI];
205 left_eN_global = elementBoundaryElements[ebN*2+0];
206 right_eN_global = elementBoundaryElements[ebN*2+1];
207 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
208 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
213 maxSpeed_left =0.0; maxSpeed_right=0.0; maxSpeed=0.0;
214 for (k=0; k < nQuadraturePoints_element; k++)
216 tmp_left = 0.0; tmp_right=0.0;
218 for (J=0; J < nSpace; J++)
221 df_element[left_eN_global*nQuadraturePoints_element*nSpace+ k*nSpace + J]
223 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
224 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
229 df_element[right_eN_global*nQuadraturePoints_element*nSpace+ k*nSpace + J]
231 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
232 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
236 maxSpeed_left = fabs(tmp_left) > maxSpeed_left ? fabs(tmp_left) : maxSpeed_left;
237 maxSpeed_right= fabs(tmp_right) > maxSpeed_right ? fabs(tmp_right) : maxSpeed_right;
239 maxSpeed_element = maxSpeed_right > maxSpeed_left ? maxSpeed_right : maxSpeed_left;
240 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
246 for(J=0;J<nSpace;J++)
250 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
251 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
255 df[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
256 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
261 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
262 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
266 df[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
267 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
272 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
273 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
277 f[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
278 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
283 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
284 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
288 f[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
289 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
294 u_left =
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
295 left_ebN_element*nQuadraturePoints_elementBoundary+
297 u_right=
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
298 right_ebN_element*nQuadraturePoints_elementBoundary+
300 maxSpeed = fabs(left_speed) > maxSpeed_element ? fabs(left_speed) : maxSpeed_element;
301 maxSpeed = fabs(right_speed) > maxSpeed ? fabs(right_speed) : maxSpeed;
302 maxSpeed*= safetyFactor;
303 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
304 dflux_left[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*left_speed + 0.5*maxSpeed;
305 dflux_right[ebN*nQuadraturePoints_elementBoundary+k]= 0.5*right_speed - 0.5*maxSpeed;
327 int nExteriorElementBoundaries_global,
328 int nElementBoundaries_element,
329 int nQuadraturePoints_elementBoundary,
330 int nQuadraturePoints_element,
332 int* exteriorElementBoundaries,
333 int* elementBoundaryElements,
334 int* elementBoundaryLocalElementBoundaries,
348 int ebNE,ebN,eN_global,ebN_element,k,J;
349 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,
350 maxSpeed_element,maxSpeed,tmp_left;
353 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
355 ebN = exteriorElementBoundaries[ebNE];
356 eN_global = elementBoundaryElements[ebN*2+0];
357 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
362 maxSpeed_element =0.0; maxSpeed=0.0;
363 for (k=0; k < nQuadraturePoints_element; k++)
367 for (J=0; J < nSpace; J++)
370 df_element[eN_global*nQuadraturePoints_element*nSpace+ k*nSpace + J]
372 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
373 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
377 maxSpeed_element = fabs(tmp_left) > maxSpeed_element ? fabs(tmp_left) : maxSpeed_element;
379 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
385 for(J=0;J<nSpace;J++)
389 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
390 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
394 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
395 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
400 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
401 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
405 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
410 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
411 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
415 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
416 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
421 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
422 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
426 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
431 u_left =
u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
432 ebN_element*nQuadraturePoints_elementBoundary+
434 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
436 maxSpeed = fabs(left_speed) > maxSpeed_element ? fabs(left_speed) : maxSpeed_element;
437 maxSpeed = fabs(right_speed) > maxSpeed ? fabs(right_speed) : maxSpeed;
438 maxSpeed*= safetyFactor;
439 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
440 dflux[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*left_speed + 0.5*maxSpeed;
464 int nExteriorElementBoundaries_global,
465 int nQuadraturePoints_elementBoundary,
466 int nQuadraturePoints_element,
468 int* exteriorElementBoundaries,
469 int* elementBoundaryElements,
470 int* elementBoundaryLocalElementBoundaries,
484 int ebNE,ebN,eN_global,k,J;
485 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,
486 maxSpeed_element,maxSpeed,tmp_left;
489 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
491 ebN = exteriorElementBoundaries[ebNE];
492 eN_global = elementBoundaryElements[ebN*2+0];
497 maxSpeed_element =0.0; maxSpeed=0.0;
498 for (k=0; k < nQuadraturePoints_element; k++)
502 for (J=0; J < nSpace; J++)
505 df_element[eN_global*nQuadraturePoints_element*nSpace+ k*nSpace + J]
507 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
511 maxSpeed_element = fabs(tmp_left) > maxSpeed_element ? fabs(tmp_left) : maxSpeed_element;
513 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
519 for(J=0;J<nSpace;J++)
523 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
527 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
532 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
536 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
541 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
545 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
550 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
554 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
559 u_left =
u[ebNE*nQuadraturePoints_elementBoundary+
561 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
563 maxSpeed = fabs(left_speed) > maxSpeed_element ? fabs(left_speed) : maxSpeed_element;
564 maxSpeed = fabs(right_speed) > maxSpeed ? fabs(right_speed) : maxSpeed;
565 maxSpeed*= safetyFactor;
566 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
567 dflux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.5*left_speed + 0.5*maxSpeed;
592 int nInteriorElementBoundaries_global,
593 int nElementBoundaries_element,
594 int nQuadraturePoints_elementBoundary,
595 int nQuadraturePoints_element,
597 int* interiorElementBoundaries,
598 int* elementBoundaryElements,
599 int* elementBoundaryLocalElementBoundaries,
603 double* lambda_bar_element,
606 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
607 double left_flux,right_flux,u_left,u_right,
608 maxSpeed_left,maxSpeed_right,maxSpeed_element,maxSpeed,tmp_left,tmp_right;
611 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
613 ebN = interiorElementBoundaries[ebNI];
614 left_eN_global = elementBoundaryElements[ebN*2+0];
615 right_eN_global = elementBoundaryElements[ebN*2+1];
616 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
617 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
622 maxSpeed_left =0.0; maxSpeed_right=0.0; maxSpeed=0.0;
623 for (k=0; k < nQuadraturePoints_element; k++)
625 tmp_left = lambda_bar_element[left_eN_global*nQuadraturePoints_element + k];
626 tmp_right= lambda_bar_element[right_eN_global*nQuadraturePoints_element + k];
627 maxSpeed_left = fabs(tmp_left) > maxSpeed_left ? fabs(tmp_left) : maxSpeed_left;
628 maxSpeed_right= fabs(tmp_right) > maxSpeed_right ? fabs(tmp_right) : maxSpeed_right;
630 maxSpeed_element = maxSpeed_right > maxSpeed_left ? maxSpeed_right : maxSpeed_left;
631 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
635 for(J=0;J<nSpace;J++)
639 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
640 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
644 f[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
645 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
650 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
651 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
655 f[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
656 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
661 u_left =
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
662 left_ebN_element*nQuadraturePoints_elementBoundary+
664 u_right=
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
665 right_ebN_element*nQuadraturePoints_elementBoundary+
669 maxSpeed = maxSpeed_element;
670 maxSpeed*= safetyFactor;
671 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
693 int nExteriorElementBoundaries_global,
694 int nQuadraturePoints_elementBoundary,
695 int nQuadraturePoints_element,
697 int* exteriorElementBoundaries,
698 int* elementBoundaryElements,
699 int* elementBoundaryLocalElementBoundaries,
710 int ebNE,ebN,eN_global,k,J;
711 double left_flux,right_flux,u_left,u_right,
712 maxSpeed_element,maxSpeed,tmp_left;
715 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
717 ebN = exteriorElementBoundaries[ebNE];
718 eN_global = elementBoundaryElements[ebN*2+0];
723 maxSpeed_element =0.0; maxSpeed=0.0;
724 for (k=0; k < nQuadraturePoints_element; k++)
726 tmp_left = lambda_bar[eN_global*nQuadraturePoints_element + k];
727 maxSpeed_element = fabs(tmp_left) > maxSpeed_element ? fabs(tmp_left) : maxSpeed_element;
729 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
733 for(J=0;J<nSpace;J++)
737 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
741 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
746 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
750 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
755 u_left =
u[ebNE*nQuadraturePoints_elementBoundary+
757 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
761 maxSpeed =maxSpeed_element;
762 maxSpeed*= safetyFactor;
763 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
785 int nExteriorElementBoundaries_global,
786 int nElementBoundaries_element,
787 int nQuadraturePoints_elementBoundary,
788 int nQuadraturePoints_element,
790 int* exteriorElementBoundaries,
791 int* elementBoundaryElements,
792 int* elementBoundaryLocalElementBoundaries,
803 int ebNE,ebN,eN_global,ebN_element,k,J;
804 double left_flux,right_flux,u_left,u_right,
805 maxSpeed_element,maxSpeed,tmp_left;
808 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
810 ebN = exteriorElementBoundaries[ebNE];
811 eN_global = elementBoundaryElements[ebN*2+0];
812 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
817 maxSpeed_element =0.0; maxSpeed=0.0;
818 for (k=0; k < nQuadraturePoints_element; k++)
820 tmp_left = lambda_bar[eN_global*nQuadraturePoints_element+k];
821 maxSpeed_element = fabs(tmp_left) > maxSpeed_element ? fabs(tmp_left) : maxSpeed_element;
823 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
827 for(J=0;J<nSpace;J++)
831 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
832 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
836 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
837 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
842 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
843 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
847 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
852 u_left =
u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
853 ebN_element*nQuadraturePoints_elementBoundary+
855 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
859 maxSpeed = maxSpeed_element;
860 maxSpeed*= safetyFactor;
861 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.5*(left_flux + right_flux) - 0.5*maxSpeed*(u_right-u_left);
892 double penalty_floor,
893 int nInteriorElementBoundaries_global,
894 int nElementBoundaries_element,
895 int nQuadraturePoints_elementBoundary,
897 int* interiorElementBoundaries,
898 int* elementBoundaryElements,
899 int* elementBoundaryLocalElementBoundaries,
907 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J,I,nSpace2=nSpace*nSpace;
908 double diffusiveVelocityComponent_I,max_a=0.0;
909 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
911 ebN = interiorElementBoundaries[ebNI];
912 left_eN_global = elementBoundaryElements[ebN*2+0];
913 right_eN_global = elementBoundaryElements[ebN*2+1];
914 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
915 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
916 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
919 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
920 for(I=0;I<nSpace;I++)
922 diffusiveVelocityComponent_I=0.0;
923 for(J=0;J<nSpace;J++)
925 diffusiveVelocityComponent_I
927 (a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
928 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
933 grad_phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
934 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
937 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
938 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
943 grad_phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
944 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
946 max_a = fmax(max_a,a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
947 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
951 max_a = fmax(max_a,a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
952 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
957 flux[ebN*nQuadraturePoints_elementBoundary+
960 diffusiveVelocityComponent_I
962 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
963 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
967 flux[ebN*nQuadraturePoints_elementBoundary+
970 max_a = fmax(max_a,penalty_floor);
971 double penalty_flux = penalty[ebN*nQuadraturePoints_elementBoundary+
974 (
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
975 left_ebN_element*nQuadraturePoints_elementBoundary+
977 u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
978 right_ebN_element*nQuadraturePoints_elementBoundary+
980 if (scale_penalty) penalty_flux *= max_a;
981 flux[ebN*nQuadraturePoints_elementBoundary+
988 double penalty_floor,
989 int nInteriorElementBoundaries_global,
990 int nElementBoundaries_element,
991 int nQuadraturePoints_elementBoundary,
995 int* interiorElementBoundaries,
996 int* elementBoundaryElements,
997 int* elementBoundaryLocalElementBoundaries,
1005 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,I,m,
nnz=rowptr[nSpace];
1006 double diffusiveVelocityComponent_I,max_a=0.0;
1007 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
1009 ebN = interiorElementBoundaries[ebNI];
1010 left_eN_global = elementBoundaryElements[ebN*2+0];
1011 right_eN_global = elementBoundaryElements[ebN*2+1];
1012 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
1013 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
1014 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
1017 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
1018 for(I=0;I<nSpace;I++)
1020 diffusiveVelocityComponent_I=0.0;
1021 for(m=rowptr[I];m<rowptr[I+1];m++)
1023 diffusiveVelocityComponent_I
1025 (a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1026 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1030 grad_phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1031 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1034 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1035 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1039 grad_phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1040 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1041 k*nSpace+colind[m]]);
1042 max_a = fmax(max_a,a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1043 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1046 max_a = fmax(max_a,a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1047 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1051 flux[ebN*nQuadraturePoints_elementBoundary+
1054 diffusiveVelocityComponent_I
1056 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1057 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1061 flux[ebN*nQuadraturePoints_elementBoundary+
1064 max_a = fmax(max_a,penalty_floor);
1065 double penalty_flux = penalty[ebN*nQuadraturePoints_elementBoundary+
1068 (
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
1069 left_ebN_element*nQuadraturePoints_elementBoundary+
1071 u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
1072 right_ebN_element*nQuadraturePoints_elementBoundary+
1074 if (scale_penalty) penalty_flux *= max_a;
1078 flux[ebN*nQuadraturePoints_elementBoundary+
1256 double penalty_floor,
1257 int nInteriorElementBoundaries_global,
1258 int nElementBoundaries_element,
1259 int nQuadraturePoints_elementBoundary,
1260 int nDOF_trial_element,
1263 int* interiorElementBoundaries,
1264 int* elementBoundaryElements,
1265 int* elementBoundaryLocalElementBoundaries,
1274 double* fluxJacobian)
1276 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j,left_j_global,right_j_global,I,J,nSpace2=nSpace*nSpace;
1277 double leftJacobian,rightJacobian,diffusiveVelocityComponent_I_leftJacobian,diffusiveVelocityComponent_I_rightJacobian,diffusiveVelocityComponent_I_leftJacobian2,diffusiveVelocityComponent_I_rightJacobian2,max_a=0.0;
1278 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
1280 ebN = interiorElementBoundaries[ebNI];
1281 left_eN_global = elementBoundaryElements[ebN*2+0];
1282 right_eN_global = elementBoundaryElements[ebN*2+1];
1283 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
1284 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
1285 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
1288 for(j=0;j<nDOF_trial_element;j++)
1292 left_j_global = l2g[left_eN_global*nDOF_trial_element+j];
1293 right_j_global= l2g[right_eN_global*nDOF_trial_element+j];
1294 for(I=0;I<nSpace;I++)
1296 diffusiveVelocityComponent_I_leftJacobian=0.0;
1297 diffusiveVelocityComponent_I_leftJacobian2=0.0;
1298 diffusiveVelocityComponent_I_rightJacobian=0.0;
1299 diffusiveVelocityComponent_I_rightJacobian2=0.0;
1300 for(J=0;J<nSpace;J++)
1302 diffusiveVelocityComponent_I_leftJacobian
1304 da[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1305 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1310 grad_phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1311 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1314 diffusiveVelocityComponent_I_rightJacobian
1316 da[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1317 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1322 grad_phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1323 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1326 diffusiveVelocityComponent_I_leftJacobian2
1328 a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1329 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1334 grad_v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1335 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1336 k*nDOF_trial_element*nSpace+
1339 diffusiveVelocityComponent_I_rightJacobian2
1341 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1342 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1347 grad_v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1348 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1349 k*nDOF_trial_element*nSpace+
1352 max_a = fmax(max_a,a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1353 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1357 max_a = fmax(max_a,a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1358 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1366 (diffusiveVelocityComponent_I_leftJacobian
1368 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1369 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1370 k*nDOF_trial_element+
1373 diffusiveVelocityComponent_I_leftJacobian2*
1374 dphi[left_j_global])
1376 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1377 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1382 (diffusiveVelocityComponent_I_rightJacobian
1384 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1385 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1386 k*nDOF_trial_element+
1389 diffusiveVelocityComponent_I_rightJacobian2*dphi[right_j_global])
1391 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1392 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1396 leftJacobian *= 0.5;
1397 rightJacobian *= 0.5;
1398 max_a = fmax(max_a,penalty_floor);
1399 double penaltyJacobian_term = penalty[ebN*nQuadraturePoints_elementBoundary+
1401 if (scale_penalty) penaltyJacobian_term *= max_a;
1404 penaltyJacobian_term
1406 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1407 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1408 k*nDOF_trial_element+
1412 penaltyJacobian_term
1414 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1415 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1416 k*nDOF_trial_element+
1418 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1419 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1420 k*nDOF_trial_element+
1422 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1423 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1424 k*nDOF_trial_element+
1425 j] += rightJacobian;
1432 double penalty_floor,
1433 int nInteriorElementBoundaries_global,
1434 int nElementBoundaries_element,
1435 int nQuadraturePoints_elementBoundary,
1436 int nDOF_trial_element,
1441 int* interiorElementBoundaries,
1442 int* elementBoundaryElements,
1443 int* elementBoundaryLocalElementBoundaries,
1452 double* fluxJacobian)
1454 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j,left_j_global,right_j_global,I,m,
nnz=rowptr[nSpace];
1455 double leftJacobian,rightJacobian,diffusiveVelocityComponent_I_leftJacobian,diffusiveVelocityComponent_I_rightJacobian,diffusiveVelocityComponent_I_leftJacobian2,diffusiveVelocityComponent_I_rightJacobian2,max_a;
1456 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
1458 ebN = interiorElementBoundaries[ebNI];
1459 left_eN_global = elementBoundaryElements[ebN*2+0];
1460 right_eN_global = elementBoundaryElements[ebN*2+1];
1461 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
1462 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
1463 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
1466 for(j=0;j<nDOF_trial_element;j++)
1470 left_j_global = l2g[left_eN_global*nDOF_trial_element+j];
1471 right_j_global= l2g[right_eN_global*nDOF_trial_element+j];
1472 for(I=0;I<nSpace;I++)
1474 diffusiveVelocityComponent_I_leftJacobian=0.0;
1475 diffusiveVelocityComponent_I_leftJacobian2=0.0;
1476 diffusiveVelocityComponent_I_rightJacobian=0.0;
1477 diffusiveVelocityComponent_I_rightJacobian2=0.0;
1478 for(m=rowptr[I];m<rowptr[I+1];m++)
1480 diffusiveVelocityComponent_I_leftJacobian
1482 da[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1483 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1487 grad_phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1488 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1491 diffusiveVelocityComponent_I_rightJacobian
1493 da[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1494 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1498 grad_phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1499 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1502 diffusiveVelocityComponent_I_leftJacobian2
1504 a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1505 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1509 grad_v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1510 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1511 k*nDOF_trial_element*nSpace+
1514 diffusiveVelocityComponent_I_rightJacobian2
1516 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1517 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1521 grad_v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1522 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
1523 k*nDOF_trial_element*nSpace+
1526 max_a = fmax(max_a,a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1527 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1530 max_a = fmax(max_a,a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
1531 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
1538 (diffusiveVelocityComponent_I_leftJacobian
1540 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1541 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1542 k*nDOF_trial_element+
1545 diffusiveVelocityComponent_I_leftJacobian2*
1546 dphi[left_j_global])
1548 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1549 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1554 (diffusiveVelocityComponent_I_rightJacobian
1556 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1557 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1558 k*nDOF_trial_element+
1561 diffusiveVelocityComponent_I_rightJacobian2*dphi[right_j_global])
1563 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1564 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1568 leftJacobian *= 0.5;
1569 rightJacobian *= 0.5;
1570 max_a = fmax(max_a,penalty_floor);
1571 double penaltyJacobian_term = penalty[ebN*nQuadraturePoints_elementBoundary+
1573 if (scale_penalty) penaltyJacobian_term *= max_a;
1576 penaltyJacobian_term
1578 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1579 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1580 k*nDOF_trial_element+
1584 penaltyJacobian_term
1586 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1587 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1588 k*nDOF_trial_element+
1590 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1591 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1592 k*nDOF_trial_element+
1594 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1595 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
1596 k*nDOF_trial_element+
1597 j] += rightJacobian;
1931 double penalty_floor,
1932 int nExteriorElementBoundaries_global,
1933 int nElementBoundaries_element,
1934 int nQuadraturePoints_elementBoundary,
1936 int* exteriorElementBoundaries,
1937 int* elementBoundaryElements,
1938 int* elementBoundaryLocalElementBoundaries,
1942 double* bc_grad_phi,
1950 int ebNE,ebN,eN_global,ebN_element,k,J,I,nSpace2=nSpace*nSpace;
1951 double diffusiveVelocityComponent_I,penaltyFlux,max_a=0.0;
1952 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
1954 ebN = exteriorElementBoundaries[ebNE];
1955 eN_global = elementBoundaryElements[ebN*2+0];
1956 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
1957 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
1959 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
1962 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
1963 for(I=0;I<nSpace;I++)
1965 diffusiveVelocityComponent_I=0.0;
1966 for(J=0;J<nSpace;J++)
1968 diffusiveVelocityComponent_I
1970 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1971 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1976 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1977 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1979 max_a = fmax(max_a,a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
1980 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
1985 flux[ebN*nQuadraturePoints_elementBoundary+k]
1987 diffusiveVelocityComponent_I
1989 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
1990 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
1994 max_a = fmax(penalty_floor,max_a);
1995 penaltyFlux = penalty[ebN*nQuadraturePoints_elementBoundary+
1998 (
u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
1999 ebN_element*nQuadraturePoints_elementBoundary+
2002 bc_u[ebNE*nQuadraturePoints_elementBoundary+
2004 if (scale_penalty) penaltyFlux *= max_a;
2005 flux[ebN*nQuadraturePoints_elementBoundary+k] += penaltyFlux;
2011 double penalty_floor,
2012 int nExteriorElementBoundaries_global,
2013 int nElementBoundaries_element,
2014 int nQuadraturePoints_elementBoundary,
2018 int* exteriorElementBoundaries,
2019 int* elementBoundaryElements,
2020 int* elementBoundaryLocalElementBoundaries,
2024 double* bc_grad_phi,
2032 int ebNE,ebN,eN_global,ebN_element,k,I,m,
nnz=rowptr[nSpace];
2033 double diffusiveVelocityComponent_I,penaltyFlux,max_a=0.0;
2034 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2036 ebN = exteriorElementBoundaries[ebNE];
2037 eN_global = elementBoundaryElements[ebN*2+0];
2038 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
2039 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2041 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
2042 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
2045 for(I=0;I<nSpace;I++)
2047 diffusiveVelocityComponent_I=0.0;
2048 for(m=rowptr[I];m<rowptr[I+1];m++)
2050 diffusiveVelocityComponent_I
2052 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2053 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2057 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2058 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2059 k*nSpace+colind[m]];
2060 max_a = fmax(max_a,a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2061 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2065 flux[ebN*nQuadraturePoints_elementBoundary+k]
2067 diffusiveVelocityComponent_I
2069 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2070 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2074 max_a = fmax(penalty_floor,max_a);
2075 penaltyFlux = penalty[ebN*nQuadraturePoints_elementBoundary+
2078 (
u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
2079 ebN_element*nQuadraturePoints_elementBoundary+
2082 bc_u[ebNE*nQuadraturePoints_elementBoundary+
2084 if (scale_penalty) penaltyFlux *= max_a;
2085 flux[ebN*nQuadraturePoints_elementBoundary+k] += penaltyFlux;
2094 double penalty_floor,
2095 int nExteriorElementBoundaries_global,
2096 int nQuadraturePoints_elementBoundary,
2098 int* exteriorElementBoundaries,
2099 int* elementBoundaryElements,
2100 int* elementBoundaryLocalElementBoundaries,
2104 double* bc_grad_phi,
2112 int ebNE,k,J,I,nSpace2=nSpace*nSpace;
2113 double diffusiveVelocityComponent_I,penaltyFlux,max_a=0.0;
2114 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2116 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2118 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
2120 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
2122 for(I=0;I<nSpace;I++)
2124 diffusiveVelocityComponent_I=0.0;
2125 for(J=0;J<nSpace;J++)
2127 diffusiveVelocityComponent_I
2129 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
2134 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2136 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
2141 flux[ebNE*nQuadraturePoints_elementBoundary+k]
2143 diffusiveVelocityComponent_I
2145 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2149 max_a = fmax(max_a,penalty_floor);
2150 penaltyFlux = penalty[ebNE*nQuadraturePoints_elementBoundary+
2153 (
u[ebNE*nQuadraturePoints_elementBoundary+
2156 bc_u[ebNE*nQuadraturePoints_elementBoundary+
2158 if (scale_penalty) penaltyFlux *= max_a;
2159 flux[ebNE*nQuadraturePoints_elementBoundary+k] += penaltyFlux;
2166 double penalty_floor,
2167 int nExteriorElementBoundaries_global,
2168 int nQuadraturePoints_elementBoundary,
2172 int* exteriorElementBoundaries,
2173 int* elementBoundaryElements,
2174 int* elementBoundaryLocalElementBoundaries,
2178 double* bc_grad_phi,
2186 int ebNE,k,I,m,
nnz=rowptr[nSpace];
2187 double diffusiveVelocityComponent_I,penaltyFlux,max_a;
2188 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2190 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2192 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
2194 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
2196 for(I=0;I<nSpace;I++)
2198 diffusiveVelocityComponent_I=0.0;
2199 for(m=rowptr[I];m<rowptr[I+1];m++)
2201 diffusiveVelocityComponent_I
2203 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
2207 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2208 k*nSpace+colind[m]];
2209 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
2213 flux[ebNE*nQuadraturePoints_elementBoundary+k]
2215 diffusiveVelocityComponent_I
2217 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2221 max_a = fmax(penalty_floor,max_a);
2222 penaltyFlux = penalty[ebNE*nQuadraturePoints_elementBoundary+
2225 (
u[ebNE*nQuadraturePoints_elementBoundary+
2228 bc_u[ebNE*nQuadraturePoints_elementBoundary+
2231 if (scale_penalty) penaltyFlux *= max_a;
2232 flux[ebNE*nQuadraturePoints_elementBoundary+k] += penaltyFlux;
2524 int nElementBoundaries_element,
2525 int nQuadraturePoints_elementBoundary,
2527 int* exteriorElementBoundaries,
2528 int* elementBoundaryElements,
2529 int* elementBoundaryLocalElementBoundaries,
2533 double* bc_grad_phi,
2541 int ebNE,ebN,eN_global,ebN_element,k,J,I,nSpace2=nSpace*nSpace;
2542 double diffusiveVelocityComponent_I;
2543 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2545 ebN = exteriorElementBoundaries[ebNE];
2546 eN_global = elementBoundaryElements[ebN*2+0];
2547 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
2548 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2550 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
2551 for(I=0;I<nSpace;I++)
2553 diffusiveVelocityComponent_I=0.0;
2554 for(J=0;J<nSpace;J++)
2556 diffusiveVelocityComponent_I
2558 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
2559 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
2564 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2565 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2568 flux[ebN*nQuadraturePoints_elementBoundary+k]
2570 diffusiveVelocityComponent_I
2572 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2573 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2581 int nElementBoundaries_element,
2582 int nQuadraturePoints_elementBoundary,
2586 int* exteriorElementBoundaries,
2587 int* elementBoundaryElements,
2588 int* elementBoundaryLocalElementBoundaries,
2592 double* bc_grad_phi,
2600 int ebNE,ebN,eN_global,ebN_element,k,I,m,
nnz=rowptr[nSpace];
2601 double diffusiveVelocityComponent_I;
2602 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2604 ebN = exteriorElementBoundaries[ebNE];
2605 eN_global = elementBoundaryElements[ebN*2+0];
2606 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
2607 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2609 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
2610 for(I=0;I<nSpace;I++)
2612 diffusiveVelocityComponent_I=0.0;
2613 for(m=rowptr[I];m<rowptr[I+1];m++)
2615 diffusiveVelocityComponent_I
2617 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2618 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2622 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2623 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2624 k*nSpace+colind[m]];
2626 flux[ebN*nQuadraturePoints_elementBoundary+k]
2628 diffusiveVelocityComponent_I
2630 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2631 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2639 int nQuadraturePoints_elementBoundary,
2641 int* exteriorElementBoundaries,
2642 int* elementBoundaryElements,
2643 int* elementBoundaryLocalElementBoundaries,
2647 double* bc_grad_phi,
2655 int ebNE,k,J,I,nSpace2=nSpace*nSpace;
2656 double diffusiveVelocityComponent_I;
2657 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2659 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2661 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
2662 for(I=0;I<nSpace;I++)
2664 diffusiveVelocityComponent_I=0.0;
2665 for(J=0;J<nSpace;J++)
2667 diffusiveVelocityComponent_I
2669 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
2674 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2677 flux[ebNE*nQuadraturePoints_elementBoundary+k]
2679 diffusiveVelocityComponent_I
2681 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2689 int nQuadraturePoints_elementBoundary,
2693 int* exteriorElementBoundaries,
2694 int* elementBoundaryElements,
2695 int* elementBoundaryLocalElementBoundaries,
2699 double* bc_grad_phi,
2707 int ebNE,k,I,m,
nnz=rowptr[nSpace];
2708 double diffusiveVelocityComponent_I;
2709 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2711 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2713 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
2714 for(I=0;I<nSpace;I++)
2716 diffusiveVelocityComponent_I=0.0;
2717 for(m=rowptr[I];m<rowptr[I+1];m++)
2719 diffusiveVelocityComponent_I
2721 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
2725 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2726 k*nSpace+colind[m]];
2728 flux[ebNE*nQuadraturePoints_elementBoundary+k]
2730 diffusiveVelocityComponent_I
2732 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
2744 double penalty_floor,
2745 int nExteriorElementBoundaries_global,
2746 int nElementBoundaries_element,
2747 int nQuadraturePoints_elementBoundary,
2748 int nDOF_trial_element,
2751 int* exteriorElementBoundaries,
2752 int* elementBoundaryElements,
2753 int* elementBoundaryLocalElementBoundaries,
2763 double* fluxJacobian)
2765 int ebNE,ebN,eN_global,ebN_element,k,j,j_global,I,J,nSpace2=nSpace*nSpace;
2766 double Jacobian,diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2,max_a=0.0;
2767 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2769 ebN = exteriorElementBoundaries[ebNE];
2770 eN_global = elementBoundaryElements[ebN*2+0];
2771 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
2772 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2774 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
2777 for(j=0;j<nDOF_trial_element;j++)
2780 j_global = l2g[eN_global*nDOF_trial_element+j];
2781 for(I=0;I<nSpace;I++)
2783 diffusiveVelocityComponent_I_Jacobian=0.0;
2784 diffusiveVelocityComponent_I_Jacobian2=0.0;
2785 for(J=0;J<nSpace;J++)
2787 diffusiveVelocityComponent_I_Jacobian
2789 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
2790 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
2795 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2796 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2799 diffusiveVelocityComponent_I_Jacobian2
2801 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
2802 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
2807 grad_v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
2808 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
2809 k*nDOF_trial_element*nSpace+
2812 max_a = fmax(max_a,a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
2813 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
2820 (diffusiveVelocityComponent_I_Jacobian
2822 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2823 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2824 k*nDOF_trial_element+
2827 diffusiveVelocityComponent_I_Jacobian2*
2830 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2831 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2835 max_a = fmax(penalty_floor,max_a);
2836 double penaltyJacobian = penalty[ebN*nQuadraturePoints_elementBoundary+
2839 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2840 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2841 k*nDOF_trial_element+
2843 if (scale_penalty) penaltyJacobian *= max_a;
2844 Jacobian += penaltyJacobian;
2845 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2846 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2847 k*nDOF_trial_element+
2857 double penalty_floor,
2858 int nExteriorElementBoundaries_global,
2859 int nElementBoundaries_element,
2860 int nQuadraturePoints_elementBoundary,
2861 int nDOF_trial_element,
2866 int* exteriorElementBoundaries,
2867 int* elementBoundaryElements,
2868 int* elementBoundaryLocalElementBoundaries,
2878 double* fluxJacobian)
2880 int ebNE,ebN,eN_global,ebN_element,k,j,j_global,I,m,
nnz=rowptr[nSpace];
2881 double Jacobian,diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2,max_a=0.0;
2882 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2884 ebN = exteriorElementBoundaries[ebNE];
2885 eN_global = elementBoundaryElements[ebN*2+0];
2886 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
2887 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
2889 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
2892 for(j=0;j<nDOF_trial_element;j++)
2895 j_global = l2g[eN_global*nDOF_trial_element+j];
2896 for(I=0;I<nSpace;I++)
2898 diffusiveVelocityComponent_I_Jacobian=0.0;
2899 diffusiveVelocityComponent_I_Jacobian2=0.0;
2900 for(m=rowptr[I];m<rowptr[I+1];m++)
2902 diffusiveVelocityComponent_I_Jacobian
2904 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2905 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2909 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2910 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2913 diffusiveVelocityComponent_I_Jacobian2
2915 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2916 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2920 grad_v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
2921 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
2922 k*nDOF_trial_element*nSpace+
2925 max_a = fmax(max_a,a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
2926 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
2932 (diffusiveVelocityComponent_I_Jacobian
2934 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2935 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2936 k*nDOF_trial_element+
2939 diffusiveVelocityComponent_I_Jacobian2*
2942 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
2943 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
2947 max_a = fmax(penalty_floor,max_a);
2948 double penaltyJacobian = penalty[ebN*nQuadraturePoints_elementBoundary+
2951 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2952 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2953 k*nDOF_trial_element+
2956 if (scale_penalty) penaltyJacobian *= max_a;
2958 Jacobian += penaltyJacobian;
2960 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2961 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
2962 k*nDOF_trial_element+
2974 double penalty_floor,
2975 int nExteriorElementBoundaries_global,
2976 int nQuadraturePoints_elementBoundary,
2977 int nDOF_trial_element,
2980 int* exteriorElementBoundaries,
2981 int* elementBoundaryElements,
2982 int* elementBoundaryLocalElementBoundaries,
2992 double* fluxJacobian)
2994 int ebNE,ebN,eN_global,k,j,j_global,I,J,nSpace2=nSpace*nSpace;
2995 double Jacobian,diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2,max_a;
2996 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
2998 ebN = exteriorElementBoundaries[ebNE];
2999 eN_global = elementBoundaryElements[ebN*2+0];
3000 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3002 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] >= 1)
3004 for(j=0;j<nDOF_trial_element;j++)
3007 j_global = l2g[eN_global*nDOF_trial_element+j];
3009 for(I=0;I<nSpace;I++)
3011 diffusiveVelocityComponent_I_Jacobian=0.0;
3012 diffusiveVelocityComponent_I_Jacobian2=0.0;
3013 for(J=0;J<nSpace;J++)
3015 diffusiveVelocityComponent_I_Jacobian
3017 da[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
3022 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3025 diffusiveVelocityComponent_I_Jacobian2
3027 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
3032 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3033 k*nDOF_trial_element*nSpace+
3036 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
3044 (diffusiveVelocityComponent_I_Jacobian
3046 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3047 k*nDOF_trial_element+
3050 diffusiveVelocityComponent_I_Jacobian2*
3053 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3057 max_a = fmax(penalty_floor,max_a);
3058 double penaltyJacobian = penalty[ebNE*nQuadraturePoints_elementBoundary+
3061 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3062 k*nDOF_trial_element+
3064 if (scale_penalty) penaltyJacobian *= max_a;
3066 Jacobian += penaltyJacobian;
3068 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3069 k*nDOF_trial_element+
3078 double penalty_floor,
3079 int nExteriorElementBoundaries_global,
3080 int nQuadraturePoints_elementBoundary,
3081 int nDOF_trial_element,
3086 int* exteriorElementBoundaries,
3087 int* elementBoundaryElements,
3088 int* elementBoundaryLocalElementBoundaries,
3098 double* fluxJacobian)
3100 int ebNE,ebN,eN_global,k,j,j_global,I,m,
nnz=rowptr[nSpace];
3101 double Jacobian,diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2,max_a;
3102 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3104 ebN = exteriorElementBoundaries[ebNE];
3105 eN_global = elementBoundaryElements[ebN*2+0];
3106 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3108 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] >= 1)
3110 for(j=0;j<nDOF_trial_element;j++)
3113 j_global = l2g[eN_global*nDOF_trial_element+j];
3115 for(I=0;I<nSpace;I++)
3117 diffusiveVelocityComponent_I_Jacobian=0.0;
3118 diffusiveVelocityComponent_I_Jacobian2=0.0;
3119 for(m=rowptr[I];m<rowptr[I+1];m++)
3121 diffusiveVelocityComponent_I_Jacobian
3123 da[ebNE*nQuadraturePoints_elementBoundary*
nnz+
3127 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3130 diffusiveVelocityComponent_I_Jacobian2
3132 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
3136 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3137 k*nDOF_trial_element*nSpace+
3140 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
3147 (diffusiveVelocityComponent_I_Jacobian
3149 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3150 k*nDOF_trial_element+
3153 diffusiveVelocityComponent_I_Jacobian2*
3156 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3160 max_a = fmax(penalty_floor,max_a);
3162 double penaltyJacobian = penalty[ebNE*nQuadraturePoints_elementBoundary+
3165 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3166 k*nDOF_trial_element+
3168 if (scale_penalty) penaltyJacobian *= max_a;
3170 Jacobian += penaltyJacobian;
3172 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3173 k*nDOF_trial_element+
3594 int nElementBoundaries_element,
3595 int nQuadraturePoints_elementBoundary,
3596 int nDOF_trial_element,
3599 int* exteriorElementBoundaries,
3600 int* elementBoundaryElements,
3601 int* elementBoundaryLocalElementBoundaries,
3611 double* fluxJacobian)
3613 int ebNE,ebN,eN_global,ebN_element,k,j,j_global,I,J,nSpace2=nSpace*nSpace;
3614 double diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2;
3615 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3617 ebN = exteriorElementBoundaries[ebNE];
3618 eN_global = elementBoundaryElements[ebN*2+0];
3619 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3620 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3622 for(j=0;j<nDOF_trial_element;j++)
3624 j_global = l2g[eN_global*nDOF_trial_element+j];
3625 for(I=0;I<nSpace;I++)
3627 diffusiveVelocityComponent_I_Jacobian=0.0;
3628 diffusiveVelocityComponent_I_Jacobian2=0.0;
3629 for(J=0;J<nSpace;J++)
3631 diffusiveVelocityComponent_I_Jacobian
3633 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
3634 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
3639 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3640 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3643 diffusiveVelocityComponent_I_Jacobian2
3645 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
3646 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
3651 grad_v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3652 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3653 k*nDOF_trial_element*nSpace+
3657 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3658 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3659 k*nDOF_trial_element+
3661 (diffusiveVelocityComponent_I_Jacobian
3663 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3664 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3665 k*nDOF_trial_element+
3668 diffusiveVelocityComponent_I_Jacobian2*
3671 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3672 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3681 int nElementBoundaries_element,
3682 int nQuadraturePoints_elementBoundary,
3683 int nDOF_trial_element,
3688 int* exteriorElementBoundaries,
3689 int* elementBoundaryElements,
3690 int* elementBoundaryLocalElementBoundaries,
3700 double* fluxJacobian)
3702 int ebNE,ebN,eN_global,ebN_element,k,j,j_global,I,m,
nnz=rowptr[nSpace];
3703 double diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2;
3704 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3706 ebN = exteriorElementBoundaries[ebNE];
3707 eN_global = elementBoundaryElements[ebN*2+0];
3708 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3709 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3711 for(j=0;j<nDOF_trial_element;j++)
3713 j_global = l2g[eN_global*nDOF_trial_element+j];
3714 for(I=0;I<nSpace;I++)
3716 diffusiveVelocityComponent_I_Jacobian=0.0;
3717 diffusiveVelocityComponent_I_Jacobian2=0.0;
3718 for(m=rowptr[I];m<rowptr[I+1];m++)
3720 diffusiveVelocityComponent_I_Jacobian
3722 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
3723 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
3727 grad_phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3728 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3731 diffusiveVelocityComponent_I_Jacobian2
3733 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
3734 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
3738 grad_v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3739 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3740 k*nDOF_trial_element*nSpace+
3744 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3745 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3746 k*nDOF_trial_element+
3748 (diffusiveVelocityComponent_I_Jacobian
3750 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3751 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3752 k*nDOF_trial_element+
3755 diffusiveVelocityComponent_I_Jacobian2*
3758 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3759 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3769 int nQuadraturePoints_elementBoundary,
3770 int nDOF_trial_element,
3773 int* exteriorElementBoundaries,
3774 int* elementBoundaryElements,
3775 int* elementBoundaryLocalElementBoundaries,
3785 double* fluxJacobian)
3787 int ebNE,ebN,eN_global,k,j,j_global,I,J,nSpace2=nSpace*nSpace;
3788 double diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2;
3789 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3791 ebN = exteriorElementBoundaries[ebNE];
3792 eN_global = elementBoundaryElements[ebN*2+0];
3793 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3795 for(j=0;j<nDOF_trial_element;j++)
3797 j_global = l2g[eN_global*nDOF_trial_element+j];
3798 for(I=0;I<nSpace;I++)
3800 diffusiveVelocityComponent_I_Jacobian=0.0;
3801 diffusiveVelocityComponent_I_Jacobian2=0.0;
3802 for(J=0;J<nSpace;J++)
3804 diffusiveVelocityComponent_I_Jacobian
3806 da[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
3811 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3814 diffusiveVelocityComponent_I_Jacobian2
3816 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
3821 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3822 k*nDOF_trial_element*nSpace+
3826 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3827 k*nDOF_trial_element+
3829 (diffusiveVelocityComponent_I_Jacobian
3831 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3832 k*nDOF_trial_element+
3835 diffusiveVelocityComponent_I_Jacobian2*
3838 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3847 int nQuadraturePoints_elementBoundary,
3848 int nDOF_trial_element,
3853 int* exteriorElementBoundaries,
3854 int* elementBoundaryElements,
3855 int* elementBoundaryLocalElementBoundaries,
3865 double* fluxJacobian)
3867 int ebNE,ebN,eN_global,k,j,j_global,I,m,
nnz=rowptr[nSpace];
3868 double diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2;
3869 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
3871 ebN = exteriorElementBoundaries[ebNE];
3872 eN_global = elementBoundaryElements[ebN*2+0];
3873 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3875 for(j=0;j<nDOF_trial_element;j++)
3877 j_global = l2g[eN_global*nDOF_trial_element+j];
3878 for(I=0;I<nSpace;I++)
3880 diffusiveVelocityComponent_I_Jacobian=0.0;
3881 diffusiveVelocityComponent_I_Jacobian2=0.0;
3882 for(m=rowptr[I];m<rowptr[I+1];m++)
3884 diffusiveVelocityComponent_I_Jacobian
3886 da[ebNE*nQuadraturePoints_elementBoundary*
nnz+
3890 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3893 diffusiveVelocityComponent_I_Jacobian2
3895 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
3899 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
3900 k*nDOF_trial_element*nSpace+
3904 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3905 k*nDOF_trial_element+
3907 (diffusiveVelocityComponent_I_Jacobian
3909 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
3910 k*nDOF_trial_element+
3913 diffusiveVelocityComponent_I_Jacobian2*
3916 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
3928 int nElementBoundaries_element,
3929 int nQuadraturePoints_elementBoundary,
3931 int* interiorElementBoundaries,
3932 int* elementBoundaryElements,
3933 int* elementBoundaryLocalElementBoundaries,
3940 double* dflux_right)
3942 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
3943 double left_speed,right_speed,left_flux,right_flux,shock_speed,flux_jump,u_jump;
3944 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
3946 ebN = interiorElementBoundaries[ebNI];
3947 left_eN_global = elementBoundaryElements[ebN*2+0];
3948 right_eN_global = elementBoundaryElements[ebN*2+1];
3949 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
3950 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
3951 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
3959 for(J=0;J<nSpace;J++)
3963 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3964 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3968 df[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3969 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3974 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3975 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3979 df[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3980 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3985 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3986 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3990 f[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3991 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
3996 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
3997 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4001 f[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4002 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4006 flux_jump = (right_flux - left_flux);
4007 u_jump = (
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4008 right_ebN_element*nQuadraturePoints_elementBoundary+
4011 u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4012 left_ebN_element*nQuadraturePoints_elementBoundary+
4014 if (fabs(u_jump) > fabs(flux_jump*1.0e-16))
4015 shock_speed = flux_jump/u_jump;
4016 if (left_speed >= 0.0 && right_speed >= 0.0)
4018 flux[ebN*nQuadraturePoints_elementBoundary+
4020 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4022 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4025 else if (left_speed <= 0.0 && right_speed <= 0.0)
4027 flux[ebN*nQuadraturePoints_elementBoundary+
4029 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4031 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4034 else if (left_speed >= 0.0 && right_speed <= 0.0)
4036 if (shock_speed >= 0.0)
4038 flux[ebN*nQuadraturePoints_elementBoundary+
4040 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4042 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4047 flux[ebN*nQuadraturePoints_elementBoundary+
4049 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4051 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4058 printf(
"Transonic rarefaction detected in interior. This numerical flux treats transonic rarefactions incorrectly. left_speed= %12.5e right_speed= %12.5e \n",left_speed,right_speed);
4059 for (J=0; J < nSpace; J++)
4061 printf(
"n_l[%d]=%g df_l[%d]=%g df_r[%d]=%g \n",J,
4062 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4063 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4067 df[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4068 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4072 df[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4073 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4078 flux[ebN*nQuadraturePoints_elementBoundary+
4079 k] = 0.5*(left_flux + right_flux);
4080 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4081 k] = 0.5*left_speed;
4082 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4083 k] = 0.5*right_speed;
4093 int nElementBoundaries_element,
4094 int nQuadraturePoints_elementBoundary,
4095 int nDOF_trial_element,
4096 int* interiorElementBoundaries,
4097 int* elementBoundaryElements,
4098 int* elementBoundaryLocalElementBoundaries,
4100 double* dflux_right,
4102 double* fluxJacobian)
4104 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j;
4105 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4107 ebN = interiorElementBoundaries[ebNI];
4108 left_eN_global = elementBoundaryElements[ebN*2+0];
4109 right_eN_global = elementBoundaryElements[ebN*2+1];
4110 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4111 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4112 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4113 for(j=0;j<nDOF_trial_element;j++)
4115 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4116 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4117 k*nDOF_trial_element+
4120 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4123 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4124 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4125 k*nDOF_trial_element+
4127 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4128 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4129 k*nDOF_trial_element+
4132 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4135 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4136 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4137 k*nDOF_trial_element+
4146 int nElementBoundaries_element,
4147 int nQuadraturePoints_elementBoundary,
4148 int nDOF_trial_element,
4149 int* interiorElementBoundaries,
4150 int* elementBoundaryElements,
4151 int* elementBoundaryLocalElementBoundaries,
4153 double* dflux_right,
4155 double* fluxJacobian_2sided)
4157 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j;
4158 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4160 ebN = interiorElementBoundaries[ebNI];
4161 left_eN_global = elementBoundaryElements[ebN*2+0];
4162 right_eN_global = elementBoundaryElements[ebN*2+1];
4163 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4164 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4165 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4166 for(j=0;j<nDOF_trial_element;j++)
4169 fluxJacobian_2sided[ebN*2*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4170 0*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4171 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4172 k*nDOF_trial_element+
4175 dflux_left[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4176 left_ebN_element*nQuadraturePoints_elementBoundary+
4179 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4180 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4181 k*nDOF_trial_element+
4183 fluxJacobian_2sided[ebN*2*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4184 0*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4185 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4186 k*nDOF_trial_element+
4189 dflux_right[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4190 left_ebN_element*nQuadraturePoints_elementBoundary+
4193 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4194 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4195 k*nDOF_trial_element+
4198 fluxJacobian_2sided[ebN*2*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4199 1*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4200 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4201 k*nDOF_trial_element+
4204 dflux_left[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4205 right_ebN_element*nQuadraturePoints_elementBoundary+
4208 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4209 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4210 k*nDOF_trial_element+
4212 fluxJacobian_2sided[ebN*2*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4213 1*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4214 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4215 k*nDOF_trial_element+
4218 dflux_right[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4219 right_ebN_element*nQuadraturePoints_elementBoundary+
4222 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4223 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
4224 k*nDOF_trial_element+
4234 int nElementBoundaries_element,
4235 int nQuadraturePoints_elementBoundary,
4237 int* interiorElementBoundaries,
4238 int* elementBoundaryElements,
4239 int* elementBoundaryLocalElementBoundaries,
4246 double* dflux_right)
4248 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
4249 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
4251 ebN = interiorElementBoundaries[ebNI];
4252 left_eN_global = elementBoundaryElements[ebN*2+0];
4253 right_eN_global = elementBoundaryElements[ebN*2+1];
4254 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4255 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
4256 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4258 flux[ebN*nQuadraturePoints_elementBoundary+
4260 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4262 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4264 for(J=0;J<nSpace;J++)
4266 flux[ebN*nQuadraturePoints_elementBoundary+
4267 k] +=
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4268 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4272 (
f[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4273 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4277 f[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4278 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4281 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4282 k] +=
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4283 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4287 df[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4288 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4291 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4292 k] +=
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4293 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4297 df[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4298 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4302 flux[ebN*nQuadraturePoints_elementBoundary+
4304 dflux_left[ebN*nQuadraturePoints_elementBoundary+
4306 dflux_right[ebN*nQuadraturePoints_elementBoundary+
4316 int nElementBoundaries_element,
4317 int nQuadraturePoints_elementBoundary,
4319 int* exteriorElementBoundaries,
4320 int* elementBoundaryElements,
4321 int* elementBoundaryLocalElementBoundaries,
4329 int ebNE,ebN,eN_global,ebN_element,k,J;
4330 memset(inflowFlag,0,
sizeof(
int)*nExteriorElementBoundaries_global*nQuadraturePoints_elementBoundary);
4331 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4333 ebN = exteriorElementBoundaries[ebNE];
4334 eN_global = elementBoundaryElements[ebN*2+0];
4335 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4336 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4338 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
4339 dflux_left[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
4340 inflowFlag[ebNE*nQuadraturePoints_elementBoundary+k]=0;
4341 for(J=0;J<nSpace;J++)
4343 flux[ebN*nQuadraturePoints_elementBoundary+k]
4345 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4346 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4350 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4351 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4354 dflux_left[ebN*nQuadraturePoints_elementBoundary+k]
4356 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4357 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4361 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4362 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4366 if(dflux_left[ebN*nQuadraturePoints_elementBoundary+k] < 0.0)
4369 inflowFlag[ebNE*nQuadraturePoints_elementBoundary+k] = 1;
4370 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
4371 dflux_left[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
4380 int nQuadraturePoints_elementBoundary,
4382 int* exteriorElementBoundaries,
4383 int* elementBoundaryElements,
4384 int* elementBoundaryLocalElementBoundaries,
4392 int ebNE,ebN,eN_global,ebN_element,k,J;
4393 memset(inflowFlag,0,
sizeof(
int)*nExteriorElementBoundaries_global*nQuadraturePoints_elementBoundary);
4394 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4396 ebN = exteriorElementBoundaries[ebNE];
4397 eN_global = elementBoundaryElements[ebN*2+0];
4398 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4399 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4401 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
4402 dflux_left[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
4403 inflowFlag[ebNE*nQuadraturePoints_elementBoundary+k]=0;
4404 for(J=0;J<nSpace;J++)
4406 flux[ebNE*nQuadraturePoints_elementBoundary+k]
4408 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4412 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4415 dflux_left[ebNE*nQuadraturePoints_elementBoundary+k]
4417 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4421 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4425 if(dflux_left[ebNE*nQuadraturePoints_elementBoundary+k] < 0.0)
4428 inflowFlag[ebNE*nQuadraturePoints_elementBoundary+k] = 1;
4429 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
4430 dflux_left[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
4440 int nElementBoundaries_element,
4441 int nQuadraturePoints_elementBoundary,
4443 int* exteriorElementBoundaries,
4444 int* elementBoundaryElements,
4445 int* elementBoundaryLocalElementBoundaries,
4458 int ebNE,ebN,eN_global,ebN_element,k,J;
4459 double left_speed,right_speed,left_flux,right_flux,shock_speed,flux_jump,u_jump;
4460 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4462 ebN = exteriorElementBoundaries[ebNE];
4463 eN_global = elementBoundaryElements[ebN*2+0];
4464 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4465 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4473 for(J=0;J<nSpace;J++)
4477 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4478 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4482 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4483 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4488 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4489 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4493 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4498 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4499 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4503 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4504 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4509 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4510 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4514 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4518 flux_jump = (right_flux - left_flux);
4519 u_jump = (bc_u[ebNE*nQuadraturePoints_elementBoundary+
4522 u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
4523 ebN_element*nQuadraturePoints_elementBoundary+
4525 if (fabs(u_jump) > fabs(flux_jump*1.0e-16))
4526 shock_speed = flux_jump/u_jump;
4527 if (left_speed >= 0.0 && right_speed >= 0.0)
4529 flux[ebN*nQuadraturePoints_elementBoundary+
4531 dflux[ebN*nQuadraturePoints_elementBoundary+
4534 else if (left_speed <= 0.0 && right_speed <= 0.0)
4536 flux[ebN*nQuadraturePoints_elementBoundary+
4538 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4539 dflux[ebN*nQuadraturePoints_elementBoundary+
4542 dflux[ebN*nQuadraturePoints_elementBoundary+
4545 else if (left_speed >= 0.0 && right_speed <= 0.0)
4547 if (shock_speed >= 0.0)
4549 flux[ebN*nQuadraturePoints_elementBoundary+
4551 dflux[ebN*nQuadraturePoints_elementBoundary+
4556 flux[ebN*nQuadraturePoints_elementBoundary+
4558 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4559 dflux[ebN*nQuadraturePoints_elementBoundary+
4562 dflux[ebN*nQuadraturePoints_elementBoundary+
4569 printf(
"Transonic rarefaction detected on exterior. This numerical flux treats transonic rarefactions incorrectly. left_speed= %12.5e right_speed= %12.5e \n",left_speed,right_speed);
4570 for (J=0; J < nSpace; J++)
4572 printf(
"n_l[%d]=%g df_l[%d]=%g df_r[%d]=%g \n",J,
4573 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4574 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4578 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4579 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4583 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4588 flux[ebN*nQuadraturePoints_elementBoundary+
4589 k] = 0.5*(left_flux + right_flux);
4590 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4591 dflux[ebN*nQuadraturePoints_elementBoundary+
4592 k] = 0.5*left_speed;
4594 dflux[ebN*nQuadraturePoints_elementBoundary+
4595 k] = 0.5*(left_speed+right_speed);
4633 int nQuadraturePoints_elementBoundary,
4635 int* exteriorElementBoundaries,
4636 int* elementBoundaryElements,
4637 int* elementBoundaryLocalElementBoundaries,
4650 int ebNE,ebN,eN_global,k,J;
4651 double left_speed,right_speed,left_flux,right_flux,shock_speed,flux_jump,u_jump;
4652 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4654 ebN = exteriorElementBoundaries[ebNE];
4655 eN_global = elementBoundaryElements[ebN*2+0];
4656 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4663 for(J=0;J<nSpace;J++)
4667 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4671 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4676 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4680 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4685 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4689 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4694 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4698 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4702 flux_jump = (right_flux - left_flux);
4703 u_jump = (bc_u[ebNE*nQuadraturePoints_elementBoundary+
4706 u[ebNE*nQuadraturePoints_elementBoundary+
4708 if (fabs(u_jump) > fabs(flux_jump*1.0e-16))
4709 shock_speed = flux_jump/u_jump;
4710 if (left_speed >= 0.0 && right_speed >= 0.0)
4712 flux[ebNE*nQuadraturePoints_elementBoundary+
4714 dflux[ebNE*nQuadraturePoints_elementBoundary+
4717 else if (left_speed <= 0.0 && right_speed <= 0.0)
4719 flux[ebNE*nQuadraturePoints_elementBoundary+
4721 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4722 dflux[ebNE*nQuadraturePoints_elementBoundary+
4725 dflux[ebNE*nQuadraturePoints_elementBoundary+
4728 else if (left_speed >= 0.0 && right_speed <= 0.0)
4730 if (shock_speed >= 0.0)
4732 flux[ebNE*nQuadraturePoints_elementBoundary+
4734 dflux[ebNE*nQuadraturePoints_elementBoundary+
4739 flux[ebNE*nQuadraturePoints_elementBoundary+
4741 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4742 dflux[ebNE*nQuadraturePoints_elementBoundary+
4745 dflux[ebNE*nQuadraturePoints_elementBoundary+
4752 printf(
"Transonic rarefaction detected on exterior. This numerical flux treats transonic rarefactions incorrectly. left_speed= %12.5e right_speed= %12.5e \n",left_speed,right_speed);
4753 for (J=0; J < nSpace; J++)
4755 printf(
"n_l[%d]=%g df_l[%d]=%g df_r[%d]=%g \n",J,
4756 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4760 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4764 bc_df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4769 flux[ebNE*nQuadraturePoints_elementBoundary+
4770 k] = 0.5*(left_flux + right_flux);
4771 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
4772 dflux[ebNE*nQuadraturePoints_elementBoundary+
4773 k] = 0.5*left_speed;
4775 dflux[ebNE*nQuadraturePoints_elementBoundary+
4776 k] = 0.5*(left_speed+right_speed);
4790 int nElementBoundaries_element,
4791 int nQuadraturePoints_elementBoundary,
4793 int* exteriorElementBoundaries,
4794 int* elementBoundaryElements,
4795 int* elementBoundaryLocalElementBoundaries,
4808 int ebNE,ebN,eN_global,ebN_element,k,J;
4809 double left_speed,right_speed,left_flux,right_flux,shock_speed;
4810 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4812 ebN = exteriorElementBoundaries[ebNE];
4813 eN_global = elementBoundaryElements[ebN*2+0];
4814 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4815 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4823 for(J=0;J<nSpace;J++)
4827 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4828 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4832 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4833 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4838 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4839 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4843 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4844 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4848 flux[ebN*nQuadraturePoints_elementBoundary+
4850 dflux[ebN*nQuadraturePoints_elementBoundary+
4857 int nQuadraturePoints_elementBoundary,
4859 int* exteriorElementBoundaries,
4860 int* elementBoundaryElements,
4861 int* elementBoundaryLocalElementBoundaries,
4874 int ebNE,ebN,eN_global,k,J;
4875 double left_speed,right_speed,left_flux,right_flux,shock_speed;
4876 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4878 ebN = exteriorElementBoundaries[ebNE];
4879 eN_global = elementBoundaryElements[ebN*2+0];
4880 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4887 for(J=0;J<nSpace;J++)
4891 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4895 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4900 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4904 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
4908 flux[ebNE*nQuadraturePoints_elementBoundary+
4910 dflux[ebNE*nQuadraturePoints_elementBoundary+
4919 int nElementBoundaries_element,
4920 int nQuadraturePoints_elementBoundary,
4922 int* exteriorElementBoundaries,
4923 int* elementBoundaryElements,
4924 int* elementBoundaryLocalElementBoundaries,
4925 int *isDOFBoundary_p,
4926 int *isDOFBoundary_u,
4927 int *isDOFBoundary_v,
4947 int ebNE,ebN,eN_global,ebN_element,k;
4948 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
4950 ebN = exteriorElementBoundaries[ebNE];
4951 eN_global = elementBoundaryElements[ebN*2+0];
4952 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
4953 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
4955 fluxpu[ebN*nQuadraturePoints_elementBoundary+
4957 fluxpv[ebN*nQuadraturePoints_elementBoundary+
4959 flux[ebN*nQuadraturePoints_elementBoundary+
4963 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
4965 dfluxpu_dp[ebN*nQuadraturePoints_elementBoundary+
4968 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4969 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4973 dfpu_dp[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4974 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4977 fluxpu[ebN*nQuadraturePoints_elementBoundary+
4979 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4980 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4984 fpu[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4985 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4988 dfluxpv_dp[ebN*nQuadraturePoints_elementBoundary+
4991 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4992 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
4996 dfpv_dp[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
4997 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5000 fluxpv[ebN*nQuadraturePoints_elementBoundary+
5002 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5003 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5007 fpv[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5008 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5014 fluxpu[ebN*nQuadraturePoints_elementBoundary+
5016 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5017 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5021 bc_fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5024 fluxpv[ebN*nQuadraturePoints_elementBoundary+
5026 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5027 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5031 bc_fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5036 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5038 dflux_du[ebN*nQuadraturePoints_elementBoundary+
5041 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5042 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5046 df_du[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5047 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5050 flux[ebN*nQuadraturePoints_elementBoundary+
5052 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5053 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5057 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5058 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5064 flux[ebN*nQuadraturePoints_elementBoundary+
5066 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5067 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5071 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5075 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5077 dflux_dv[ebN*nQuadraturePoints_elementBoundary+
5080 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5081 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5085 df_dv[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5086 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5089 flux[ebN*nQuadraturePoints_elementBoundary+
5091 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5092 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5096 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5097 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5103 flux[ebN*nQuadraturePoints_elementBoundary+
5105 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5106 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5110 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5118 int nElementBoundaries_element,
5119 int nQuadraturePoints_elementBoundary,
5121 int* exteriorElementBoundaries,
5122 int* elementBoundaryElements,
5123 int* elementBoundaryLocalElementBoundaries,
5124 int *isDOFBoundary_p,
5125 int *isDOFBoundary_u,
5126 int *isDOFBoundary_v,
5145 double* dflux_mass_du,
5146 double* dflux_mass_dv,
5147 double* dflux_umom_dp,
5148 double* dflux_umom_du,
5149 double* dflux_umom_dv,
5150 double* dflux_vmom_dp,
5151 double* dflux_vmom_du,
5152 double* dflux_vmom_dv)
5154 int ebNE,ebN,eN_global,ebN_element,k;
5155 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5157 ebN = exteriorElementBoundaries[ebNE];
5158 eN_global = elementBoundaryElements[ebN*2+0];
5159 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
5160 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5162 flux_umom[ebN*nQuadraturePoints_elementBoundary+
5164 flux_vmom[ebN*nQuadraturePoints_elementBoundary+
5166 flux_mass[ebN*nQuadraturePoints_elementBoundary+
5168 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5170 dflux_mass_du[ebN*nQuadraturePoints_elementBoundary+
5173 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5174 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5178 df_mass_du[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5179 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5182 flux_mass[ebN*nQuadraturePoints_elementBoundary+
5184 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5185 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5189 f_mass[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5190 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5193 dflux_umom_du[ebN*nQuadraturePoints_elementBoundary+
5196 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5197 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5201 df_umom_du[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5202 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5205 flux_umom[ebN*nQuadraturePoints_elementBoundary+
5208 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5209 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5213 f_umom[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5214 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5217 dflux_vmom_du[ebN*nQuadraturePoints_elementBoundary+
5220 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5221 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5225 df_vmom_du[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5226 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5229 flux_vmom[ebN*nQuadraturePoints_elementBoundary+
5232 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5233 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5237 f_vmom[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5238 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5244 flux_mass[ebN*nQuadraturePoints_elementBoundary+
5247 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5248 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5252 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5255 flux_umom[ebN*nQuadraturePoints_elementBoundary+
5258 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5259 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5263 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5266 flux_vmom[ebN*nQuadraturePoints_elementBoundary+
5269 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5270 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5274 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5278 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
5280 dflux_umom_dp[ebN*nQuadraturePoints_elementBoundary+
5283 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5284 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5287 flux_umom[ebN*nQuadraturePoints_elementBoundary+
5290 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5291 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5295 (p[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5296 ebN_element*nQuadraturePoints_elementBoundary+
5299 bc_p[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5300 ebN_element*nQuadraturePoints_elementBoundary+
5302 dflux_vmom_dp[ebN*nQuadraturePoints_elementBoundary+
5305 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5306 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5309 flux_vmom[ebN*nQuadraturePoints_elementBoundary+
5311 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
5312 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
5316 (p[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5317 ebN_element*nQuadraturePoints_elementBoundary+
5320 bc_p[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
5321 ebN_element*nQuadraturePoints_elementBoundary+
5329 int nQuadraturePoints_elementBoundary,
5331 int* exteriorElementBoundaries,
5332 int* elementBoundaryElements,
5333 int* elementBoundaryLocalElementBoundaries,
5334 int *isDOFBoundary_p,
5335 int *isDOFBoundary_u,
5336 int *isDOFBoundary_v,
5358 double* dflux_mass_dp,
5359 double* dflux_mass_du,
5360 double* dflux_mass_dv,
5361 double* dflux_umom_dp,
5362 double* dflux_umom_du,
5363 double* dflux_umom_dv,
5364 double* dflux_vmom_dp,
5365 double* dflux_vmom_du,
5366 double* dflux_vmom_dv,
5370 double flowDirection;
5371 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5373 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5375 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5377 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
5379 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
5382 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5384 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
5386 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5388 dflux_umom_dv[ebNE*nQuadraturePoints_elementBoundary+
5391 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5393 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
5395 dflux_vmom_du[ebNE*nQuadraturePoints_elementBoundary+
5397 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5400 flowDirection=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5404 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5408 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5412 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5415 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5417 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5420 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5424 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5427 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5431 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5434 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
5437 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5441 df_mass_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5444 if (flowDirection >= 0.0)
5446 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5449 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5453 f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5456 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5459 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5463 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5466 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5469 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5473 f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5476 dflux_vmom_du[ebNE*nQuadraturePoints_elementBoundary+
5479 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5483 df_vmom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5486 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5489 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5493 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5500 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5503 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5507 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5510 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5514 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5517 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5520 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5524 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5527 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5530 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5534 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5537 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5538 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5541 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5545 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5549 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5551 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5554 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5558 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5561 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5565 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5568 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
5571 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5575 df_mass_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5578 if (flowDirection >= 0.0)
5580 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5583 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5587 f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5590 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5593 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5597 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5600 dflux_umom_dv[ebNE*nQuadraturePoints_elementBoundary+
5603 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5607 df_umom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5610 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5613 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5617 f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5620 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5622 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5626 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5633 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5636 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5640 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5643 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5647 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5651 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5654 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5658 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5661 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5662 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5665 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5669 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5672 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5675 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5679 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5683 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
5698 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5701 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5705 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
5708 p[ebNE*nQuadraturePoints_elementBoundary+
5710 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
5712 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5715 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5717 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5721 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
5724 p[ebNE*nQuadraturePoints_elementBoundary+
5726 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
5728 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5736 int nQuadraturePoints_elementBoundary,
5738 int* exteriorElementBoundaries,
5739 int* elementBoundaryElements,
5740 int* elementBoundaryLocalElementBoundaries,
5741 int *isDOFBoundary_p,
5742 int *isDOFBoundary_u,
5743 int *isDOFBoundary_v,
5744 int *isDOFBoundary_w,
5775 double* dflux_mass_du,
5776 double* dflux_mass_dv,
5777 double* dflux_mass_dw,
5778 double* dflux_umom_dp,
5779 double* dflux_umom_du,
5780 double* dflux_umom_dv,
5781 double* dflux_umom_dw,
5782 double* dflux_vmom_dp,
5783 double* dflux_vmom_du,
5784 double* dflux_vmom_dv,
5785 double* dflux_vmom_dw,
5786 double* dflux_wmom_dp,
5787 double* dflux_wmom_du,
5788 double* dflux_wmom_dv,
5789 double* dflux_wmom_dw,
5793 double flowDirection;
5794 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
5796 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
5798 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5800 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
5802 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
5804 dflux_mass_dw[ebNE*nQuadraturePoints_elementBoundary+
5807 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5809 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
5811 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5813 dflux_umom_dv[ebNE*nQuadraturePoints_elementBoundary+
5815 dflux_umom_dw[ebNE*nQuadraturePoints_elementBoundary+
5818 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5820 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
5822 dflux_vmom_du[ebNE*nQuadraturePoints_elementBoundary+
5824 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5826 dflux_vmom_dw[ebNE*nQuadraturePoints_elementBoundary+
5829 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
5831 dflux_wmom_dp[ebNE*nQuadraturePoints_elementBoundary+
5833 dflux_wmom_du[ebNE*nQuadraturePoints_elementBoundary+
5835 dflux_wmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5837 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
5840 flowDirection=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5844 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5848 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5852 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5855 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5859 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5862 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
5864 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5867 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5871 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5874 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5878 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5881 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
5884 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5888 df_mass_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5891 if (flowDirection >= 0.0)
5893 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5896 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5900 f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5903 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
5906 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5910 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5913 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
5916 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5920 f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5923 dflux_vmom_du[ebNE*nQuadraturePoints_elementBoundary+
5926 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5930 df_vmom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5933 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
5936 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5940 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5943 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
5946 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5950 f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5953 dflux_wmom_du[ebNE*nQuadraturePoints_elementBoundary+
5956 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5960 df_wmom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5963 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
5966 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5970 df_wmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5977 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
5980 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5984 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5987 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5991 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
5994 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
5997 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6001 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6004 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6007 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6011 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6014 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6015 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
6018 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6022 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6025 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6028 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6032 bc_f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6035 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6036 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
6039 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6043 df_wmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6047 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6049 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
6052 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6056 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6059 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6063 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6066 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
6069 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6073 df_mass_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6076 if (flowDirection >= 0.0)
6078 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
6081 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6085 f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6088 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
6091 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6095 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6098 dflux_umom_dv[ebNE*nQuadraturePoints_elementBoundary+
6101 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6105 df_umom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6108 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6111 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6115 f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6118 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
6120 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6124 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6127 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6130 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6134 f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6137 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
6140 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6144 df_wmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6147 dflux_wmom_dv[ebNE*nQuadraturePoints_elementBoundary+
6150 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6154 df_wmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6161 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
6164 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6168 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6171 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6175 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6178 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
6181 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6185 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6188 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6189 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
6192 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6196 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6199 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6202 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6206 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6209 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6212 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6216 bc_f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6219 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6220 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
6223 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6227 df_wmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6231 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6233 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
6236 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6240 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6243 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6247 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6250 dflux_mass_dw[ebNE*nQuadraturePoints_elementBoundary+
6253 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6257 df_mass_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6260 if (flowDirection >= 0.0)
6262 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
6265 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6269 f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6272 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
6275 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6279 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6282 dflux_umom_dw[ebNE*nQuadraturePoints_elementBoundary+
6285 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6289 df_umom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6292 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6295 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6299 f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6302 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
6304 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6308 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6311 dflux_vmom_dw[ebNE*nQuadraturePoints_elementBoundary+
6313 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6317 df_vmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6320 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6323 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6327 f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6330 dflux_wmom_dw[ebNE*nQuadraturePoints_elementBoundary+
6333 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6337 df_wmom_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6344 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
6347 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6351 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6354 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6358 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6361 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
6364 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6368 bc_f_umom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6371 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6372 dflux_umom_du[ebNE*nQuadraturePoints_elementBoundary+
6375 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6379 df_umom_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6382 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6385 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6389 bc_f_vmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6392 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6393 dflux_vmom_dv[ebNE*nQuadraturePoints_elementBoundary+
6396 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6400 df_vmom_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6403 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6406 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6410 bc_f_wmom[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6414 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
6416 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
6419 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6423 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
6426 p[ebNE*nQuadraturePoints_elementBoundary+
6428 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
6430 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6433 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
6435 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6439 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
6442 p[ebNE*nQuadraturePoints_elementBoundary+
6444 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
6446 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6449 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
6451 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6455 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
6458 p[ebNE*nQuadraturePoints_elementBoundary+
6460 dflux_wmom_dp[ebNE*nQuadraturePoints_elementBoundary+
6462 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6473 int nQuadraturePoints_elementBoundary,
6475 int* exteriorElementBoundaries,
6476 int* elementBoundaryElements,
6477 int* elementBoundaryLocalElementBoundaries,
6478 int *isDOFBoundary_p,
6479 int *isDOFBoundary_u,
6480 int *isDOFBoundary_v,
6501 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
6503 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
6505 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
6507 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
6509 flux[ebNE*nQuadraturePoints_elementBoundary+
6513 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6515 dfluxpu_dp[ebNE*nQuadraturePoints_elementBoundary+
6518 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6522 dfpu_dp[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6525 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
6527 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6531 fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6534 dfluxpv_dp[ebNE*nQuadraturePoints_elementBoundary+
6537 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6541 dfpv_dp[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6544 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
6546 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6550 fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6556 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
6558 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6562 bc_fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6565 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
6567 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6571 bc_fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6576 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6578 dflux_du[ebNE*nQuadraturePoints_elementBoundary+
6581 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6585 df_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6588 flux[ebNE*nQuadraturePoints_elementBoundary+
6590 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6594 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6600 flux[ebNE*nQuadraturePoints_elementBoundary+
6602 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6606 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6610 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6612 dflux_dv[ebNE*nQuadraturePoints_elementBoundary+
6615 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6619 df_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6622 flux[ebNE*nQuadraturePoints_elementBoundary+
6624 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6628 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6634 flux[ebNE*nQuadraturePoints_elementBoundary+
6636 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6640 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6651 int nElementBoundaries_element,
6652 int nQuadraturePoints_elementBoundary,
6654 int* exteriorElementBoundaries,
6655 int* elementBoundaryElements,
6656 int* elementBoundaryLocalElementBoundaries,
6657 int *isDOFBoundary_p,
6658 int *isDOFBoundary_u,
6659 int *isDOFBoundary_v,
6660 int *isDOFBoundary_w,
6687 int ebNE,ebN,eN_global,ebN_element,k;
6688 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
6690 ebN = exteriorElementBoundaries[ebNE];
6691 eN_global = elementBoundaryElements[ebN*2+0];
6692 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
6693 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
6695 fluxpu[ebN*nQuadraturePoints_elementBoundary+
6697 fluxpv[ebN*nQuadraturePoints_elementBoundary+
6699 fluxpw[ebN*nQuadraturePoints_elementBoundary+
6701 flux[ebN*nQuadraturePoints_elementBoundary+
6705 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6707 dfluxpu_dp[ebN*nQuadraturePoints_elementBoundary+
6710 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6711 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6715 dfpu_dp[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6716 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6719 fluxpu[ebN*nQuadraturePoints_elementBoundary+
6721 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6722 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6726 fpu[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6727 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6730 dfluxpv_dp[ebN*nQuadraturePoints_elementBoundary+
6733 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6734 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6738 dfpv_dp[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6739 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6742 fluxpv[ebN*nQuadraturePoints_elementBoundary+
6744 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6745 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6749 fpv[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6750 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6753 dfluxpw_dp[ebN*nQuadraturePoints_elementBoundary+
6756 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6757 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6761 dfpw_dp[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6762 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6765 fluxpw[ebN*nQuadraturePoints_elementBoundary+
6767 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6768 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6772 fpw[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6773 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6779 fluxpu[ebN*nQuadraturePoints_elementBoundary+
6781 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6782 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6786 bc_fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6789 fluxpv[ebN*nQuadraturePoints_elementBoundary+
6791 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6792 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6796 bc_fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6799 fluxpw[ebN*nQuadraturePoints_elementBoundary+
6801 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6802 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6806 bc_fpw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6811 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6813 dflux_du[ebN*nQuadraturePoints_elementBoundary+
6816 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6817 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6821 df_du[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6822 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6825 flux[ebN*nQuadraturePoints_elementBoundary+
6827 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6828 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6832 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6833 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6839 flux[ebN*nQuadraturePoints_elementBoundary+
6841 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6842 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6846 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6850 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6852 dflux_dv[ebN*nQuadraturePoints_elementBoundary+
6855 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6856 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6860 df_dv[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6861 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6864 flux[ebN*nQuadraturePoints_elementBoundary+
6866 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6867 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6871 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6872 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6878 flux[ebN*nQuadraturePoints_elementBoundary+
6880 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6881 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6885 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6889 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6891 dflux_dw[ebN*nQuadraturePoints_elementBoundary+
6894 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6895 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6899 df_dw[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6900 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6903 flux[ebN*nQuadraturePoints_elementBoundary+
6905 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6906 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6910 f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6911 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6917 flux[ebN*nQuadraturePoints_elementBoundary+
6919 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
6920 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
6924 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6935 int nQuadraturePoints_elementBoundary,
6937 int* exteriorElementBoundaries,
6938 int* elementBoundaryElements,
6939 int* elementBoundaryLocalElementBoundaries,
6940 int *isDOFBoundary_p,
6941 int *isDOFBoundary_u,
6942 int *isDOFBoundary_v,
6943 int *isDOFBoundary_w,
6971 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
6973 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
6975 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
6977 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
6979 fluxpw[ebNE*nQuadraturePoints_elementBoundary+
6981 flux[ebNE*nQuadraturePoints_elementBoundary+
6985 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
6987 dfluxpu_dp[ebNE*nQuadraturePoints_elementBoundary+
6990 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6994 dfpu_dp[ebNE*nQuadraturePoints_elementBoundary*nSpace+
6997 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
6999 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7003 fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7006 dfluxpv_dp[ebNE*nQuadraturePoints_elementBoundary+
7009 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7013 dfpv_dp[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7016 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
7018 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7022 fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7025 dfluxpw_dp[ebNE*nQuadraturePoints_elementBoundary+
7028 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7032 dfpw_dp[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7035 fluxpw[ebNE*nQuadraturePoints_elementBoundary+
7037 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7041 fpw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7047 fluxpu[ebNE*nQuadraturePoints_elementBoundary+
7049 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7053 bc_fpu[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7056 fluxpv[ebNE*nQuadraturePoints_elementBoundary+
7058 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7062 bc_fpv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7065 fluxpw[ebNE*nQuadraturePoints_elementBoundary+
7067 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7071 bc_fpw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7076 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7078 dflux_du[ebNE*nQuadraturePoints_elementBoundary+
7081 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7085 df_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7088 flux[ebNE*nQuadraturePoints_elementBoundary+
7090 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7094 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7100 flux[ebNE*nQuadraturePoints_elementBoundary+
7102 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7106 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7110 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7112 dflux_dv[ebNE*nQuadraturePoints_elementBoundary+
7115 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7119 df_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7122 flux[ebNE*nQuadraturePoints_elementBoundary+
7124 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7128 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7134 flux[ebNE*nQuadraturePoints_elementBoundary+
7136 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7140 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7144 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7146 dflux_dw[ebNE*nQuadraturePoints_elementBoundary+
7149 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7153 df_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7156 flux[ebNE*nQuadraturePoints_elementBoundary+
7158 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7162 f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7168 flux[ebNE*nQuadraturePoints_elementBoundary+
7170 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7174 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7187 int nQuadraturePoints_elementBoundary,
7189 int* exteriorElementBoundaries,
7190 int* elementBoundaryElements,
7191 int* elementBoundaryLocalElementBoundaries,
7192 int *isDOFBoundary_p,
7193 int *isDOFBoundary_u,
7194 int *isDOFBoundary_v,
7205 double* dflux_mass_du,
7206 double* dflux_mass_dv,
7207 double* dflux_umom_dp,
7208 double* dflux_vmom_dp,
7213 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7215 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7217 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7219 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
7221 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
7224 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
7226 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
7228 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
7230 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7233 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7235 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7238 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7241 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7244 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7248 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7251 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
7254 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7258 df_mass_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7264 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7267 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7270 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7273 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7277 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7281 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7283 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7286 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7289 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7292 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7296 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7299 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
7302 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7306 df_mass_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7312 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7315 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7318 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7321 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7325 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7329 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
7331 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
7334 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7338 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
7341 p[ebNE*nQuadraturePoints_elementBoundary+
7343 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
7345 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7348 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
7350 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7354 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
7357 p[ebNE*nQuadraturePoints_elementBoundary+
7359 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7361 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7370 int nQuadraturePoints_elementBoundary,
7372 int* exteriorElementBoundaries,
7373 int* elementBoundaryElements,
7374 int* elementBoundaryLocalElementBoundaries,
7375 int *isDOFBoundary_p,
7376 int *isDOFBoundary_u,
7377 int *isDOFBoundary_v,
7378 int *isDOFBoundary_w,
7391 double* dflux_mass_du,
7392 double* dflux_mass_dv,
7393 double* dflux_mass_dw,
7394 double* dflux_umom_dp,
7395 double* dflux_vmom_dp,
7396 double* dflux_wmom_dp,
7401 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7403 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7405 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7407 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
7409 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
7411 dflux_mass_dw[ebNE*nQuadraturePoints_elementBoundary+
7414 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
7416 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
7419 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
7421 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7424 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
7426 dflux_wmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7429 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7431 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7434 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7437 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7440 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7444 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7447 dflux_mass_du[ebNE*nQuadraturePoints_elementBoundary+
7450 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7454 df_mass_du[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7460 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7463 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7466 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7469 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7473 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7477 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7479 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7482 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7485 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7488 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7492 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7495 dflux_mass_dv[ebNE*nQuadraturePoints_elementBoundary+
7498 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7502 df_mass_dv[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7508 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7511 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7514 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7517 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7521 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7525 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
7527 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7530 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7533 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7536 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7540 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7543 dflux_mass_dw[ebNE*nQuadraturePoints_elementBoundary+
7546 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7550 df_mass_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7556 velocity[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7559 f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7562 flux_mass[ebNE*nQuadraturePoints_elementBoundary+
7565 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7569 bc_f_mass[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7573 if (isDOFBoundary_p[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
7575 flux_umom[ebNE*nQuadraturePoints_elementBoundary+
7578 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7582 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
7585 p[ebNE*nQuadraturePoints_elementBoundary+
7587 dflux_umom_dp[ebNE*nQuadraturePoints_elementBoundary+
7589 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7592 flux_vmom[ebNE*nQuadraturePoints_elementBoundary+
7594 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7598 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
7601 p[ebNE*nQuadraturePoints_elementBoundary+
7603 dflux_vmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7605 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7608 flux_wmom[ebNE*nQuadraturePoints_elementBoundary+
7610 +=
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7614 (bc_p[ebNE*nQuadraturePoints_elementBoundary+
7617 p[ebNE*nQuadraturePoints_elementBoundary+
7619 dflux_wmom_dp[ebNE*nQuadraturePoints_elementBoundary+
7621 = -
n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7634 int nElementBoundaries_element,
7635 int nQuadraturePoints_elementBoundary,
7637 int* exteriorElementBoundaries,
7638 int* elementBoundaryElements,
7639 int* elementBoundaryLocalElementBoundaries,
7652 int ebNE,ebN,eN_global,ebN_element,k,J;
7653 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7655 ebN = exteriorElementBoundaries[ebNE];
7656 eN_global = elementBoundaryElements[ebN*2+0];
7657 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
7658 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7660 flux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
7661 dflux[ebN*nQuadraturePoints_elementBoundary+k] = 0.0;
7662 for(J=0;J<nSpace;J++)
7664 flux[ebN*nQuadraturePoints_elementBoundary+k] +=
7665 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
7666 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
7670 (
f[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
7671 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
7675 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7678 dflux[ebN*nQuadraturePoints_elementBoundary+k] +=
7679 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
7680 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
7684 df[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
7685 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
7712 int nQuadraturePoints_elementBoundary,
7714 int* exteriorElementBoundaries,
7715 int* elementBoundaryElements,
7716 int* elementBoundaryLocalElementBoundaries,
7730 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7732 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7734 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
7735 dflux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
7736 for(J=0;J<nSpace;J++)
7738 flux[ebNE*nQuadraturePoints_elementBoundary+k] +=
7739 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7743 (
f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7747 bc_f[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7750 dflux[ebNE*nQuadraturePoints_elementBoundary+k] +=
7751 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7755 df[ebNE*nQuadraturePoints_elementBoundary*nSpace+
7766 int nQuadraturePoints_elementBoundary,
7768 int* exteriorElementBoundaries,
7769 int* elementBoundaryElements,
7770 int* elementBoundaryLocalElementBoundaries,
7780 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7782 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7784 if (inflowFlag[ebNE*nQuadraturePoints_elementBoundary+k])
7786 flux[ebNE*nQuadraturePoints_elementBoundary+k] =
7787 inflowFlux[ebNE*nQuadraturePoints_elementBoundary+
7789 dflux_left[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
7798 int nElementBoundaries_element,
7799 int nQuadraturePoints_elementBoundary,
7800 int nDOF_trial_element,
7801 int* exteriorElementBoundaries,
7802 int* elementBoundaryElements,
7803 int* elementBoundaryLocalElementBoundaries,
7807 double* fluxJacobian)
7809 int ebNE,ebN,left_eN_global,left_ebN_element,k,j;
7810 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7812 ebN = exteriorElementBoundaries[ebNE];
7813 left_eN_global = elementBoundaryElements[ebN*2+0];
7814 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
7816 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7822 for(j=0;j<nDOF_trial_element;j++)
7824 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7825 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7826 k*nDOF_trial_element+
7829 dflux_left[ebN*nQuadraturePoints_elementBoundary+
7832 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7833 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7834 k*nDOF_trial_element+
7845 int nQuadraturePoints_elementBoundary,
7846 int nDOF_trial_element,
7847 int* exteriorElementBoundaries,
7848 int* elementBoundaryElements,
7849 int* elementBoundaryLocalElementBoundaries,
7853 double* fluxJacobian)
7855 int ebNE,ebN,left_eN_global,left_ebN_element,k,j;
7856 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7858 ebN = exteriorElementBoundaries[ebNE];
7859 left_eN_global = elementBoundaryElements[ebN*2+0];
7860 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
7862 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7868 for(j=0;j<nDOF_trial_element;j++)
7870 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7871 k*nDOF_trial_element+
7874 dflux_left[ebNE*nQuadraturePoints_elementBoundary+
7877 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7878 k*nDOF_trial_element+
7886 int nElementBoundaries_element,
7887 int nQuadraturePoints_elementBoundary,
7888 int nDOF_trial_element,
7889 int* exteriorElementBoundaries,
7890 int* elementBoundaryElements,
7891 int* elementBoundaryLocalElementBoundaries,
7895 double* fluxJacobian)
7897 int ebNE,ebN,left_eN_global,left_ebN_element,k,j;
7898 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7900 ebN = exteriorElementBoundaries[ebNE];
7901 left_eN_global = elementBoundaryElements[ebN*2+0];
7902 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
7903 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7905 for(j=0;j<nDOF_trial_element;j++)
7907 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7908 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7909 k*nDOF_trial_element+
7912 dflux_left[ebN*nQuadraturePoints_elementBoundary+
7915 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7916 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7917 k*nDOF_trial_element+
7924 int nQuadraturePoints_elementBoundary,
7925 int nDOF_trial_element,
7926 int* exteriorElementBoundaries,
7927 int* elementBoundaryElements,
7928 int* elementBoundaryLocalElementBoundaries,
7932 double* fluxJacobian)
7934 int ebNE,ebN,left_eN_global,left_ebN_element,k,j;
7935 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7937 ebN = exteriorElementBoundaries[ebNE];
7938 left_eN_global = elementBoundaryElements[ebN*2+0];
7939 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
7940 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7942 for(j=0;j<nDOF_trial_element;j++)
7944 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7945 k*nDOF_trial_element+
7948 dflux_left[ebNE*nQuadraturePoints_elementBoundary+
7951 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
7952 k*nDOF_trial_element+
7974 int nQuadraturePoints_elementBoundary,
7975 int* exteriorElementBoundaries,
7980 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
7982 ebN = exteriorElementBoundaries[ebNE];
7983 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
7984 inflowFlux[ebNE*nQuadraturePoints_elementBoundary+
7987 flux[ebN*nQuadraturePoints_elementBoundary+
7997 int nElementBoundaries_element,
7998 int nQuadraturePoints_elementBoundary,
8000 int* interiorElementBoundaries,
8001 int* elementBoundaryElements,
8002 int* elementBoundaryLocalElementBoundaries,
8011 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,I,J,nSpace2=nSpace*nSpace;
8012 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
8014 ebN = interiorElementBoundaries[ebNI];
8015 left_eN_global = elementBoundaryElements[ebN*2+0];
8016 right_eN_global = elementBoundaryElements[ebN*2+1];
8017 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8018 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
8019 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8021 flux[ebN*nQuadraturePoints_elementBoundary+
8023 for(I=0;I<nSpace;I++)
8024 for(J=0;J<nSpace;J++)
8026 flux[ebN*nQuadraturePoints_elementBoundary+
8030 a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8031 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8036 V[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8037 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8041 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8042 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8045 flux[ebN*nQuadraturePoints_elementBoundary+
8049 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8050 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8055 V[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8056 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8060 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8061 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8065 flux[ebN*nQuadraturePoints_elementBoundary+
8068 penalty[ebN*nQuadraturePoints_elementBoundary+k]
8070 (
phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8071 left_ebN_element*nQuadraturePoints_elementBoundary+
8074 phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8075 right_ebN_element*nQuadraturePoints_elementBoundary+
8082 int nElementBoundaries_element,
8083 int nQuadraturePoints_elementBoundary,
8087 int* interiorElementBoundaries,
8088 int* elementBoundaryElements,
8089 int* elementBoundaryLocalElementBoundaries,
8098 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,I,m,
nnz=rowptr[nSpace];
8099 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
8101 ebN = interiorElementBoundaries[ebNI];
8102 left_eN_global = elementBoundaryElements[ebN*2+0];
8103 right_eN_global = elementBoundaryElements[ebN*2+1];
8104 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8105 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
8106 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8108 flux[ebN*nQuadraturePoints_elementBoundary+
8110 for(I=0;I<nSpace;I++)
8111 for(m=rowptr[I];m<rowptr[I+1];m++)
8113 flux[ebN*nQuadraturePoints_elementBoundary+
8117 a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8118 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8122 V[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8123 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8127 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8128 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8131 flux[ebN*nQuadraturePoints_elementBoundary+
8135 a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8136 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8140 V[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8141 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8145 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8146 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8150 flux[ebN*nQuadraturePoints_elementBoundary+
8153 penalty[ebN*nQuadraturePoints_elementBoundary+k]
8155 (
phi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8156 left_ebN_element*nQuadraturePoints_elementBoundary+
8159 phi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8160 right_ebN_element*nQuadraturePoints_elementBoundary+
8170 int nElementBoundaries_element,
8171 int nQuadraturePoints_elementBoundary,
8172 int nDOF_trial_element,
8174 int* interiorElementBoundaries,
8175 int* elementBoundaryElements,
8176 int* elementBoundaryLocalElementBoundaries,
8186 double* fluxJacobian,
8187 double* fluxJacobian_eb)
8189 int ebNI,ebN,eN_ebN_element,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j,I,J,nSpace2=nSpace*nSpace;
8190 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
8192 ebN = interiorElementBoundaries[ebNI];
8193 left_eN_global = elementBoundaryElements[ebN*2+0];
8194 right_eN_global = elementBoundaryElements[ebN*2+1];
8195 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8196 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
8197 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8199 for(j=0;j<nDOF_trial_element;j++)
8201 for(I=0;I<nSpace;I++)
8202 for(J=0;J<nSpace;J++)
8204 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8205 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8206 k*nDOF_trial_element+
8209 TR_ALPHA*(a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8210 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8215 DV[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8216 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8217 k*nDOF_trial_element*nSpace+
8221 da[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8222 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8227 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8228 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8229 k*nDOF_trial_element+
8232 V[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8233 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8238 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8239 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8242 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8243 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8244 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8245 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8246 k*nDOF_trial_element+
8249 TR_ALPHA*a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8250 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8255 DV_eb[left_eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8256 left_ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8257 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8258 k*nDOF_trial_element*nSpace+
8262 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8263 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8266 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8267 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8268 k*nDOF_trial_element+
8271 (1.0-
TR_ALPHA)*a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8272 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8277 DV[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8278 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8279 k*nDOF_trial_element*nSpace+
8283 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8284 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8287 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8288 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8289 1*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8290 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8291 k*nDOF_trial_element+
8294 (1.0-
TR_ALPHA)*a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8295 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8300 DV_eb[right_eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8301 right_ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8302 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8303 k*nDOF_trial_element*nSpace+
8307 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8308 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8312 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8313 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8314 k*nDOF_trial_element+
8317 penalty[ebN*nQuadraturePoints_elementBoundary +k]
8319 dphi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8320 left_ebN_element*nQuadraturePoints_elementBoundary+
8323 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8324 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8325 k*nDOF_trial_element+
8327 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8328 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8329 k*nDOF_trial_element+
8332 penalty[ebN*nQuadraturePoints_elementBoundary + k]
8334 dphi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8335 right_ebN_element*nQuadraturePoints_elementBoundary+
8338 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8339 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8340 k*nDOF_trial_element+
8348 int nElementBoundaries_element,
8349 int nQuadraturePoints_elementBoundary,
8350 int nDOF_trial_element,
8354 int* interiorElementBoundaries,
8355 int* elementBoundaryElements,
8356 int* elementBoundaryLocalElementBoundaries,
8366 double* fluxJacobian,
8367 double* fluxJacobian_eb)
8369 int ebNI,ebN,eN_ebN_element,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,j,I,m,
nnz=rowptr[nSpace];
8370 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
8372 ebN = interiorElementBoundaries[ebNI];
8373 left_eN_global = elementBoundaryElements[ebN*2+0];
8374 right_eN_global = elementBoundaryElements[ebN*2+1];
8375 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8376 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
8377 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8379 for(j=0;j<nDOF_trial_element;j++)
8381 for(I=0;I<nSpace;I++)
8382 for(m=rowptr[I];m<rowptr[I+1];m++)
8384 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8385 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8386 k*nDOF_trial_element+
8389 TR_ALPHA*(a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8390 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8394 DV[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8395 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8396 k*nDOF_trial_element*nSpace+
8400 da[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8401 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8405 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8406 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8407 k*nDOF_trial_element+
8410 V[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8411 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8416 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8417 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8420 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8421 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8422 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8423 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8424 k*nDOF_trial_element+
8427 TR_ALPHA*a[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8428 left_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8432 DV_eb[left_eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8433 left_ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8434 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8435 k*nDOF_trial_element*nSpace+
8439 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8440 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8443 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8444 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8445 k*nDOF_trial_element+
8448 (1.0-
TR_ALPHA)*a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8449 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8453 DV[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8454 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8455 k*nDOF_trial_element*nSpace+
8459 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8460 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8463 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8464 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8465 1*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8466 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8467 k*nDOF_trial_element+
8470 (1.0-
TR_ALPHA)*a[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8471 right_ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8475 DV_eb[right_eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8476 right_ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8477 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8478 k*nDOF_trial_element*nSpace+
8482 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8483 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8487 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8488 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8489 k*nDOF_trial_element+
8492 penalty[ebN*nQuadraturePoints_elementBoundary +k]
8494 dphi[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8495 left_ebN_element*nQuadraturePoints_elementBoundary+
8498 v[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8499 left_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8500 k*nDOF_trial_element+
8502 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8503 1*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8504 k*nDOF_trial_element+
8507 penalty[ebN*nQuadraturePoints_elementBoundary + k]
8509 dphi[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8510 right_ebN_element*nQuadraturePoints_elementBoundary+
8513 v[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8514 right_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8515 k*nDOF_trial_element+
8526 int nElementBoundaries_element,
8527 int nQuadraturePoints_elementBoundary,
8529 int* exteriorElementBoundaries,
8530 int* elementBoundaryElements,
8531 int* elementBoundaryLocalElementBoundaries,
8541 int ebNE,ebN,eN_global,ebN_element,k,I,J,nSpace2=nSpace*nSpace;
8542 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8544 ebN = exteriorElementBoundaries[ebNE];
8545 eN_global = elementBoundaryElements[ebN*2+0];
8546 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8547 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8549 flux[ebN*nQuadraturePoints_elementBoundary+
8551 for(I=0;I<nSpace;I++)
8552 for(J=0;J<nSpace;J++)
8554 flux[ebN*nQuadraturePoints_elementBoundary+
8558 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8559 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8564 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8565 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8569 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8570 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8574 flux[ebN*nQuadraturePoints_elementBoundary+
8576 penalty[ebN*nQuadraturePoints_elementBoundary+
8578 (
phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8579 ebN_element*nQuadraturePoints_elementBoundary+
8582 phi_bc[ebNE*nQuadraturePoints_elementBoundary+
8589 int nElementBoundaries_element,
8590 int nQuadraturePoints_elementBoundary,
8594 int* exteriorElementBoundaries,
8595 int* elementBoundaryElements,
8596 int* elementBoundaryLocalElementBoundaries,
8606 int ebNE,ebN,eN_global,ebN_element,k,I,m,
nnz=rowptr[nSpace];
8607 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8609 ebN = exteriorElementBoundaries[ebNE];
8610 eN_global = elementBoundaryElements[ebN*2+0];
8611 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8612 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8614 flux[ebN*nQuadraturePoints_elementBoundary+
8616 for(I=0;I<nSpace;I++)
8617 for(m=rowptr[I];m<rowptr[I+1];m++)
8619 flux[ebN*nQuadraturePoints_elementBoundary+
8623 a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8624 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8628 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8629 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8633 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8634 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8638 flux[ebN*nQuadraturePoints_elementBoundary+
8640 penalty[ebN*nQuadraturePoints_elementBoundary+
8642 (
phi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8643 ebN_element*nQuadraturePoints_elementBoundary+
8646 phi_bc[ebNE*nQuadraturePoints_elementBoundary+
8656 int nElementBoundaries_element,
8657 int nQuadraturePoints_elementBoundary,
8659 int* exteriorElementBoundaries,
8660 int* elementBoundaryElements,
8661 int* elementBoundaryLocalElementBoundaries,
8671 int ebNE,ebN,eN_global,ebN_element,k,I,J,nSpace2=nSpace*nSpace;
8672 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8674 ebN = exteriorElementBoundaries[ebNE];
8675 eN_global = elementBoundaryElements[ebN*2+0];
8676 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8677 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8679 flux[ebNE*nQuadraturePoints_elementBoundary+
8681 for(I=0;I<nSpace;I++)
8682 for(J=0;J<nSpace;J++)
8684 flux[ebNE*nQuadraturePoints_elementBoundary+
8688 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
8693 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8694 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8698 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
8702 flux[ebNE*nQuadraturePoints_elementBoundary+
8704 penalty[ebNE*nQuadraturePoints_elementBoundary+
8706 (
phi[ebNE*nQuadraturePoints_elementBoundary+
8709 phi_bc[ebNE*nQuadraturePoints_elementBoundary+
8716 int nElementBoundaries_element,
8717 int nQuadraturePoints_elementBoundary,
8721 int* exteriorElementBoundaries,
8722 int* elementBoundaryElements,
8723 int* elementBoundaryLocalElementBoundaries,
8733 int ebNE,ebN,eN_global,ebN_element,k,I,m,
nnz=rowptr[nSpace];
8734 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8736 ebN = exteriorElementBoundaries[ebNE];
8737 eN_global = elementBoundaryElements[ebN*2+0];
8738 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8739 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8741 flux[ebNE*nQuadraturePoints_elementBoundary+
8743 for(I=0;I<nSpace;I++)
8744 for(m=rowptr[I];m<rowptr[I+1];m++)
8746 flux[ebNE*nQuadraturePoints_elementBoundary+
8750 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
8754 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8755 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8759 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
8763 flux[ebNE*nQuadraturePoints_elementBoundary+
8765 penalty[ebNE*nQuadraturePoints_elementBoundary+
8767 (
phi[ebNE*nQuadraturePoints_elementBoundary+
8770 phi_bc[ebNE*nQuadraturePoints_elementBoundary+
8780 int nExteriorElementBoundaries_global,
8781 int nElementBoundaries_element,
8782 int nQuadraturePoints_elementBoundary,
8783 int nDOF_trial_element,
8785 int* exteriorElementBoundaries,
8786 int* elementBoundaryElements,
8787 int* elementBoundaryLocalElementBoundaries,
8797 double* fluxJacobian,
8798 double* fluxJacobian_eb)
8800 int ebNE,ebN,eN_global,ebN_element,eN_ebN_element,k,j,I,J,nSpace2=nSpace*nSpace;
8801 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8803 ebN = exteriorElementBoundaries[ebNE];
8804 eN_global = elementBoundaryElements[ebN*2+0];
8805 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8806 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8808 if(isDiffusiveFluxBoundary[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
8810 for(j=0;j<nDOF_trial_element;j++)
8812 for(I=0;I<nSpace;I++)
8813 for(J=0;J<nSpace;J++)
8815 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8816 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8817 k*nDOF_trial_element+
8821 (a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8822 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8827 DV[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8828 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8829 k*nDOF_trial_element*nSpace+
8833 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8834 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8839 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8840 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8841 k*nDOF_trial_element+
8844 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8845 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8850 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8851 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8854 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8856 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8857 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8858 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8859 k*nDOF_trial_element+
8862 TR_ALPHA_EXT*a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace2+
8863 ebN_element*nQuadraturePoints_elementBoundary*nSpace2+
8868 DV_eb[eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8869 ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8870 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8871 k*nDOF_trial_element*nSpace+
8875 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8876 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8881 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8882 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8883 k*nDOF_trial_element+
8886 penalty[ebN*nQuadraturePoints_elementBoundary +k]
8888 dphi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
8889 ebN_element*nQuadraturePoints_elementBoundary+
8892 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8893 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8894 k*nDOF_trial_element+
8902 int nExteriorElementBoundaries_global,
8903 int nElementBoundaries_element,
8904 int nQuadraturePoints_elementBoundary,
8905 int nDOF_trial_element,
8909 int* exteriorElementBoundaries,
8910 int* elementBoundaryElements,
8911 int* elementBoundaryLocalElementBoundaries,
8921 double* fluxJacobian,
8922 double* fluxJacobian_eb)
8924 int ebNE,ebN,eN_global,ebN_element,eN_ebN_element,k,j,I,m,
nnz=rowptr[nSpace];
8925 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
8927 ebN = exteriorElementBoundaries[ebNE];
8928 eN_global = elementBoundaryElements[ebN*2+0];
8929 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
8930 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
8932 if(isDiffusiveFluxBoundary[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
8934 for(j=0;j<nDOF_trial_element;j++)
8936 for(I=0;I<nSpace;I++)
8937 for(m=rowptr[I];m<rowptr[I+1];m++)
8939 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8940 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8941 k*nDOF_trial_element+
8945 (a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8946 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8950 DV[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8951 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8952 k*nDOF_trial_element*nSpace+
8956 da[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8957 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8961 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8962 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8963 k*nDOF_trial_element+
8966 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8967 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8972 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8973 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
8976 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
8978 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8979 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8980 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
8981 k*nDOF_trial_element+
8984 TR_ALPHA_EXT*a[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz+
8985 ebN_element*nQuadraturePoints_elementBoundary*
nnz+
8989 DV_eb[eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8990 ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8991 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
8992 k*nDOF_trial_element*nSpace+
8996 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
8997 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9002 fluxJacobian[ebN*2*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9003 0*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9004 k*nDOF_trial_element+
9007 penalty[ebN*nQuadraturePoints_elementBoundary +k]
9009 dphi[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
9010 ebN_element*nQuadraturePoints_elementBoundary+
9013 v[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9014 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9015 k*nDOF_trial_element+
9026 int nExteriorElementBoundaries_global,
9027 int nElementBoundaries_element,
9028 int nQuadraturePoints_elementBoundary,
9029 int nDOF_trial_element,
9031 int* exteriorElementBoundaries,
9032 int* elementBoundaryElements,
9033 int* elementBoundaryLocalElementBoundaries,
9043 double* fluxJacobian_exterior,
9044 double* fluxJacobian_eb)
9046 int ebNE,ebN,eN_global,ebN_element,eN_ebN_element,k,j,I,J,nSpace2=nSpace*nSpace;
9047 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
9049 ebN = exteriorElementBoundaries[ebNE];
9050 eN_global = elementBoundaryElements[ebN*2+0];
9051 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
9052 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
9054 if(isDiffusiveFluxBoundary[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
9056 for(j=0;j<nDOF_trial_element;j++)
9058 for(I=0;I<nSpace;I++)
9059 for(J=0;J<nSpace;J++)
9061 fluxJacobian_exterior[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9062 k*nDOF_trial_element+
9066 (a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
9071 DV[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9072 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9073 k*nDOF_trial_element*nSpace+
9077 da[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
9082 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9083 k*nDOF_trial_element+
9086 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9087 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9092 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9095 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
9097 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9098 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9099 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9100 k*nDOF_trial_element+
9103 TR_ALPHA_EXT*a[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
9108 DV_eb[eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9109 ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9110 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9111 k*nDOF_trial_element*nSpace+
9115 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9120 fluxJacobian_exterior[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9121 k*nDOF_trial_element+
9124 penalty[ebNE*nQuadraturePoints_elementBoundary +k]
9126 dphi[ebNE*nQuadraturePoints_elementBoundary+
9129 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9130 k*nDOF_trial_element+
9139 int nExteriorElementBoundaries_global,
9140 int nElementBoundaries_element,
9141 int nQuadraturePoints_elementBoundary,
9142 int nDOF_trial_element,
9146 int* exteriorElementBoundaries,
9147 int* elementBoundaryElements,
9148 int* elementBoundaryLocalElementBoundaries,
9158 double* fluxJacobian_exterior,
9159 double* fluxJacobian_eb)
9161 int ebNE,ebN,eN_global,ebN_element,eN_ebN_element,k,j,I,m,
nnz=rowptr[nSpace];
9162 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
9164 ebN = exteriorElementBoundaries[ebNE];
9165 eN_global = elementBoundaryElements[ebN*2+0];
9166 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
9167 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
9169 if(isDiffusiveFluxBoundary[ebNE*nQuadraturePoints_elementBoundary+k] != 1)
9171 for(j=0;j<nDOF_trial_element;j++)
9173 for(I=0;I<nSpace;I++)
9174 for(m=rowptr[I];m<rowptr[I+1];m++)
9176 fluxJacobian_exterior[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9177 k*nDOF_trial_element+
9181 (a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
9185 DV[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9186 ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9187 k*nDOF_trial_element*nSpace+
9191 da[ebNE*nQuadraturePoints_elementBoundary*
nnz+
9195 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9196 k*nDOF_trial_element+
9199 V[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9200 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9205 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9208 for (eN_ebN_element=0;eN_ebN_element<nElementBoundaries_element;eN_ebN_element++)
9210 fluxJacobian_eb[ebN*2*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9211 0*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9212 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9213 k*nDOF_trial_element+
9220 DV_eb[eN_global*nElementBoundaries_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9221 ebN_element*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9222 eN_ebN_element*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
9223 k*nDOF_trial_element*nSpace+
9227 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9232 fluxJacobian_exterior[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9233 k*nDOF_trial_element+
9236 penalty[ebNE*nQuadraturePoints_elementBoundary +k]
9238 dphi[ebNE*nQuadraturePoints_elementBoundary+
9241 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
9242 k*nDOF_trial_element+
9256 int nElements_global,
9257 int nElementBoundaries_element,
9258 int nQuadraturePoints_element,
9259 int nQuadraturePoints_elementBoundary,
9263 const double * ebq_a,
9270 int eN,ebN,k,I,m,
nnz=rowptr[nSpace];
9274 for (eN = 0; eN < nElements_global; eN++)
9275 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
9276 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
9278 for (I = 0; I < nSpace; I++)
9279 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9282 factor = colind[m] == I ? 1.0 : 0.0;
9287 eb_aHat[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz +
9288 ebN*nQuadraturePoints_elementBoundary*
nnz +
9311 for (eN = 0; eN < nElements_global; eN++)
9312 for (k = 0; k < nQuadraturePoints_element; k++)
9313 for (I = 0; I < nSpace; I++)
9314 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9317 factor = colind[m] == I ? 1.0 : 0.0;
9318 aHat[eN*nQuadraturePoints_element*
nnz +
9323 else if (aSplit == 1)
9325 for (eN = 0; eN < nElements_global; eN++)
9326 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
9327 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
9329 for (I = 0; I < nSpace; I++)
9330 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9333 factor = colind[m] == I ? 1.0 : 0.0;
9334 eb_aTilde[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz +
9335 ebN*nQuadraturePoints_elementBoundary*
nnz +
9358 for (eN = 0; eN < nElements_global; eN++)
9359 for (k = 0; k < nQuadraturePoints_element; k++)
9361 for (I = 0; I < nSpace; I++)
9362 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9365 factor = colind[m] == I ? 1.0 : 0.0;
9366 aTilde[eN*nQuadraturePoints_element*
nnz +
9389 assert(aSplit == 2);
9391 for (eN = 0; eN < nElements_global; eN++)
9392 for (ebN = 0; ebN < nElementBoundaries_element; ebN++)
9393 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
9394 for (I = 0; I < nSpace; I++)
9395 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9398 factor = colind[m] == I ? sqrt(ebq_a[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz +
9399 ebN*nQuadraturePoints_elementBoundary*
nnz +
9402 eb_aTilde[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz +
9403 ebN*nQuadraturePoints_elementBoundary*
nnz +
9406 eb_aHat[eN*nElementBoundaries_element*nQuadraturePoints_elementBoundary*
nnz +
9407 ebN*nQuadraturePoints_elementBoundary*
nnz +
9411 for (eN = 0; eN < nElements_global; eN++)
9412 for (k = 0; k < nQuadraturePoints_element; k++)
9413 for (I = 0; I < nSpace; I++)
9414 for (m=rowptr[I]; m < rowptr[I+1]; m++)
9417 factor = colind[m] == I ? sqrt(q_a[eN*nQuadraturePoints_element*
nnz +
9420 aTilde[eN*nQuadraturePoints_element*
nnz +
9423 aHat[eN*nQuadraturePoints_element*
nnz +
9436 int nElementBoundaries_element,
9437 int nQuadraturePoints_elementBoundary,
9440 int* interiorElementBoundaries,
9441 int* elementBoundaryElements,
9442 int* elementBoundaryLocalElementBoundaries,
9449 double* dflux_right)
9451 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
9452 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,
9456 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
9458 ebN = interiorElementBoundaries[ebNI];
9459 left_eN_global = elementBoundaryElements[ebN*2+0];
9460 right_eN_global = elementBoundaryElements[ebN*2+1];
9461 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
9462 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
9477 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
9486 for(J=0;J<nSpace;J++)
9490 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9491 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9495 dH[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9496 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9501 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9502 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9506 dH[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9507 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9512 left_speed = tmp_left; right_speed = tmp_right;
9513 if (tmp_right < tmp_left)
9515 left_speed = tmp_right; right_speed = tmp_left;
9517 u_left =
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
9518 left_ebN_element*nQuadraturePoints_elementBoundary+
9520 u_right=
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
9521 right_ebN_element*nQuadraturePoints_elementBoundary+
9523 if (left_speed < 0.0)
9525 left_flux = fabs(left_speed)*(u_left-u_right);
9526 flux[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9527 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
9528 dflux_left[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9529 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = fabs(left_speed);
9530 dflux_right[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9531 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] =-fabs(left_speed);
9537 flux[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9538 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
9539 dflux_left[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9540 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
9541 dflux_right[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9542 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
9545 if (right_speed > 0.0)
9547 right_flux = fabs(right_speed)*(u_right-u_left);
9548 flux[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9549 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = right_flux;
9550 dflux_left[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9551 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = -fabs(right_speed);
9552 dflux_right[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9553 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = fabs(right_speed);
9558 flux[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9559 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = right_flux;
9560 dflux_left[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9561 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
9562 dflux_right[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9563 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
9570 int nElementBoundaries_element,
9571 int nQuadraturePoints_elementBoundary,
9574 int* exteriorElementBoundaries,
9575 int* elementBoundaryElements,
9576 int* elementBoundaryLocalElementBoundaries,
9589 int ebNE,ebN,eN_global,ebN_element,k,J;
9590 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,tmp_left,tmp_right;
9593 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
9595 ebN = exteriorElementBoundaries[ebNE];
9596 eN_global = elementBoundaryElements[ebN*2+0];
9597 ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
9613 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
9621 for(J=0;J<nSpace;J++)
9625 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9626 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9630 dH[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9631 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9636 n[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
9637 ebN_element*nQuadraturePoints_elementBoundary*nSpace+
9641 bc_dH[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9646 left_speed = tmp_left; right_speed = tmp_right;
9647 if (tmp_right < tmp_left)
9649 left_speed = tmp_right; right_speed = tmp_left;
9651 u_left =
u[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
9652 ebN_element*nQuadraturePoints_elementBoundary+
9654 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
9656 if (left_speed < 0.0)
9658 left_flux = fabs(left_speed)*(u_left-u_right);
9659 flux[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9660 ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
9661 dflux[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9662 ebN_element*nQuadraturePoints_elementBoundary+ k ] = fabs(left_speed);
9667 flux[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9668 ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
9669 dflux[eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
9670 ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
9676 int nQuadraturePoints_elementBoundary,
9679 int* exteriorElementBoundaries,
9680 int* elementBoundaryElements,
9681 int* elementBoundaryLocalElementBoundaries,
9694 int ebNE,ebN,eN_global,k,J;
9695 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,tmp_left,tmp_right;
9699 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
9701 ebN = exteriorElementBoundaries[ebNE];
9702 eN_global = elementBoundaryElements[ebN*2+0];
9717 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
9725 for(J=0;J<nSpace;J++)
9729 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9733 dH[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9738 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9742 bc_dH[ebNE*nQuadraturePoints_elementBoundary*nSpace+
9747 left_speed = tmp_left; right_speed = tmp_right;
9748 if (tmp_right < tmp_left)
9750 left_speed = tmp_right; right_speed = tmp_left;
9752 u_left =
u[ebNE*nQuadraturePoints_elementBoundary+
9754 u_right= bc_u[ebNE*nQuadraturePoints_elementBoundary+
9757 if (left_speed < 0.0)
9759 left_flux = fabs(left_speed)*(u_left-u_right);
9760 flux[ebNE*nQuadraturePoints_elementBoundary + k ] = left_flux;
9761 dflux[ebNE*nQuadraturePoints_elementBoundary + k ] = fabs(left_speed);
9766 flux[ebNE*nQuadraturePoints_elementBoundary + k ] = left_flux;
9767 dflux[ebNE*nQuadraturePoints_elementBoundary + k ] = 0.0;
9774 int nQuadraturePoints_elementBoundary,
9776 const int* exteriorElementBoundaries,
9777 const int* elementBoundaryElements,
9778 const int* elementBoundaryLocalElementBoundaries,
9779 const int* isDOFBoundary_uw,
9780 const int* isDOFBoundary_um,
9782 const double* bc_f_m,
9783 const double* bc_a_wm,
9784 const double* bc_a_mw,
9785 const double* bc_a_mm,
9786 const double* bc_grad_phi_w,
9787 const double* bc_grad_phi_m,
9788 const double* bc_u_w,
9789 const double* bc_u_m,
9791 const double* df_m_dw,
9795 const double* grad_phi_w,
9796 const double* grad_phi_m,
9799 const double* penalty_w,
9800 const double* penalty_m,
9801 double * advectiveFlux_m,
9802 double * dadvectiveFlux_m_dw,
9803 double * diffusiveFlux_wm,
9804 double * diffusiveFlux_mw,
9805 double * diffusiveFlux_mm)
9807 int ebNE,ebN,I,J,k,nSpace2=nSpace*nSpace;
9808 double diffusiveFlux_I=0.0,penaltyFlux = 0.0;
9810 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
9812 ebN = exteriorElementBoundaries[ebNE];
9813 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
9818 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
9819 advectiveFlux_m[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
9820 diffusiveFlux_mw[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
9821 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
9823 dadvectiveFlux_m_dw[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
9824 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
9827 for (I = 0; I < nSpace; I++)
9829 diffusiveFlux_I = 0.0;
9830 for (J = 0; J < nSpace; J++)
9833 a_wm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
9838 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9842 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary+k] +=
9845 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9851 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
9853 (u_w[ebNE*nQuadraturePoints_elementBoundary + k]
9855 bc_u_w[ebNE*nQuadraturePoints_elementBoundary + k]);
9856 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary +k] +=
9859 if(isDOFBoundary_um[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
9864 for (I = 0; I < nSpace; I++)
9866 advectiveFlux_m[ebNE*nQuadraturePoints_elementBoundary + k] +=
9867 f_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9871 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9883 dadvectiveFlux_m_dw[ebNE*nQuadraturePoints_elementBoundary + k] +=
9884 df_m_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9888 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9894 for (I = 0; I < nSpace; I++)
9896 diffusiveFlux_I = 0.0;
9897 for (J = 0; J < nSpace; J++)
9900 a_mw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
9905 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9909 diffusiveFlux_mw[ebNE*nQuadraturePoints_elementBoundary + k] +=
9912 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9917 for (I = 0; I < nSpace; I++)
9919 diffusiveFlux_I = 0.0;
9920 for (J = 0; J < nSpace; J++)
9923 a_mm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
9928 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9932 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary + k] +=
9935 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
9941 penalty_m[ebNE*nQuadraturePoints_elementBoundary + k]
9943 (u_m[ebNE*nQuadraturePoints_elementBoundary + k]
9945 bc_u_m[ebNE*nQuadraturePoints_elementBoundary + k]);
9946 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary +k] +=
9953 int nQuadraturePoints_elementBoundary,
9961 const int* exteriorElementBoundaries,
9962 const int* elementBoundaryElements,
9963 const int* elementBoundaryLocalElementBoundaries,
9964 const int* isDOFBoundary_uw,
9965 const int* isDOFBoundary_um,
9967 const double* bc_f_m,
9968 const double* bc_a_wm,
9969 const double* bc_a_mw,
9970 const double* bc_a_mm,
9971 const double* bc_grad_phi_w,
9972 const double* bc_grad_phi_m,
9973 const double* bc_u_w,
9974 const double* bc_u_m,
9976 const double* df_m_dw,
9980 const double* grad_phi_w,
9981 const double* grad_phi_m,
9984 const double* penalty_w,
9985 const double* penalty_m,
9986 double * advectiveFlux_m,
9987 double * dadvectiveFlux_m_dw,
9988 double * diffusiveFlux_wm,
9989 double * diffusiveFlux_mw,
9990 double * diffusiveFlux_mm)
9992 int ebNE,ebN,I,k,m,nnz_wm=rowptr_wm[nSpace],nnz_mw=rowptr_mw[nSpace],nnz_mm=rowptr_mm[nSpace];
9993 double diffusiveFlux_I=0.0,penaltyFlux = 0.0;
9995 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
9997 ebN = exteriorElementBoundaries[ebNE];
9998 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
10003 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10004 advectiveFlux_m[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10005 diffusiveFlux_mw[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10006 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10008 dadvectiveFlux_m_dw[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10009 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
10012 for (I = 0; I < nSpace; I++)
10014 diffusiveFlux_I = 0.0;
10015 for(m=rowptr_wm[I];m<rowptr_wm[I+1];m++)
10018 a_wm[ebNE*nQuadraturePoints_elementBoundary*nnz_wm+
10022 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10026 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary+k] +=
10029 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10035 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
10037 (u_w[ebNE*nQuadraturePoints_elementBoundary + k]
10039 bc_u_w[ebNE*nQuadraturePoints_elementBoundary + k]);
10040 diffusiveFlux_wm[ebNE*nQuadraturePoints_elementBoundary +k] +=
10043 if(isDOFBoundary_um[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
10048 for (I = 0; I < nSpace; I++)
10050 advectiveFlux_m[ebNE*nQuadraturePoints_elementBoundary + k] +=
10051 f_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10055 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10067 dadvectiveFlux_m_dw[ebNE*nQuadraturePoints_elementBoundary + k] +=
10068 df_m_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10072 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10078 for (I = 0; I < nSpace; I++)
10080 diffusiveFlux_I = 0.0;
10081 for(m=rowptr_mw[I];m<rowptr_mw[I+1];m++)
10084 a_mw[ebNE*nQuadraturePoints_elementBoundary*nnz_mw+
10088 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10092 diffusiveFlux_mw[ebNE*nQuadraturePoints_elementBoundary + k] +=
10095 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10100 for (I = 0; I < nSpace; I++)
10102 diffusiveFlux_I = 0.0;
10103 for(m=rowptr_mm[I];m<rowptr_mm[I+1];m++)
10106 a_mm[ebNE*nQuadraturePoints_elementBoundary*nnz_mm+
10110 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10114 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary + k] +=
10117 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10123 penalty_m[ebNE*nQuadraturePoints_elementBoundary + k]
10125 (u_m[ebNE*nQuadraturePoints_elementBoundary + k]
10127 bc_u_m[ebNE*nQuadraturePoints_elementBoundary + k]);
10128 diffusiveFlux_mm[ebNE*nQuadraturePoints_elementBoundary +k] +=
10136 int nQuadraturePoints_elementBoundary,
10138 int nDOF_trial_element,
10140 const int* exteriorElementBoundaries,
10141 const int* elementBoundaryElements,
10142 const int* elementBoundaryLocalElementBoundaries,
10143 const int* isDOFBoundary_uw,
10144 const int* isDOFBoundary_um,
10147 const double* df_m_dw,
10148 const double* a_wm,
10149 const double* da_wm_dw,
10150 const double* da_wm_dm,
10151 const double* a_mw,
10152 const double* da_mw_dw,
10153 const double* da_mw_dm,
10154 const double* a_mm,
10155 const double* da_mm_dw,
10156 const double* da_mm_dm,
10157 const double* grad_phi_w,
10158 const double* grad_phi_m,
10159 const double* dphi_w_w,
10160 const double* dphi_w_m,
10161 const double* dphi_m_w,
10162 const double* dphi_m_m,
10166 const double* grad_v,
10167 const double* penalty_w,
10168 const double* penalty_m,
10169 double * fluxJacobian_ww,
10170 double * fluxJacobian_wm,
10171 double * fluxJacobian_mw,
10172 double * fluxJacobian_mm)
10174 int ebNE,ebN,eN_global,j,j_global,I,J,k,nSpace2=nSpace*nSpace;
10175 double Jacobian_w,Jacobian_m,
10176 diffusiveVelocityComponent_I_Jacobian_w,
10177 diffusiveVelocityComponent_I_Jacobian_m,
10178 diffusiveVelocityComponent_I_Jacobian2_wm,
10179 diffusiveVelocityComponent_I_Jacobian2_ww,
10180 diffusiveVelocityComponent_I_Jacobian2_mw,
10181 diffusiveVelocityComponent_I_Jacobian2_mm;
10183 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
10185 ebN = exteriorElementBoundaries[ebNE];
10186 eN_global = elementBoundaryElements[ebN*2 + 0];
10187 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
10194 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
10198 for (j = 0; j < nDOF_trial_element; j++)
10202 j_global = l2g[eN_global*nDOF_trial_element + j];
10203 for (I = 0; I < nSpace; I++)
10205 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
10206 diffusiveVelocityComponent_I_Jacobian_m = 0.0;
10207 diffusiveVelocityComponent_I_Jacobian2_mw = 0.0;
10208 diffusiveVelocityComponent_I_Jacobian2_mm = 0.0;
10209 for (J = 0; J < nSpace; J++)
10212 diffusiveVelocityComponent_I_Jacobian_w -=
10213 da_wm_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10218 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10221 diffusiveVelocityComponent_I_Jacobian_m -=
10222 da_wm_dm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10227 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10231 diffusiveVelocityComponent_I_Jacobian2_mw -=
10232 a_wm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10237 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10238 k*nDOF_trial_element*nSpace+
10242 diffusiveVelocityComponent_I_Jacobian2_mm -=
10243 a_wm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10248 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10249 k*nDOF_trial_element*nSpace+
10255 diffusiveVelocityComponent_I_Jacobian_w
10257 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10258 k*nDOF_trial_element +
10261 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10265 diffusiveVelocityComponent_I_Jacobian2_mw
10269 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10273 diffusiveVelocityComponent_I_Jacobian_m
10275 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10276 k*nDOF_trial_element +
10279 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10283 diffusiveVelocityComponent_I_Jacobian2_mm
10287 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10293 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
10295 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
10296 k*nDOF_trial_element+
10298 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10299 k*nDOF_trial_element +
10302 fluxJacobian_wm[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10303 k*nDOF_trial_element +
10308 if (isDOFBoundary_um[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
10312 for (j = 0; j < nDOF_trial_element; j++)
10316 j_global = l2g[eN_global*nDOF_trial_element + j];
10317 for (I = 0; I < nSpace; I++)
10319 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
10320 diffusiveVelocityComponent_I_Jacobian_m = 0.0;
10321 diffusiveVelocityComponent_I_Jacobian2_wm = 0.0;
10322 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
10323 diffusiveVelocityComponent_I_Jacobian2_mw = 0.0;
10324 diffusiveVelocityComponent_I_Jacobian2_mm = 0.0;
10325 for (J = 0; J < nSpace; J++)
10328 diffusiveVelocityComponent_I_Jacobian_w -=
10329 da_mw_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10334 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10337 diffusiveVelocityComponent_I_Jacobian_m -=
10338 da_mw_dm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10343 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10347 diffusiveVelocityComponent_I_Jacobian_w -=
10348 da_mm_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10353 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10356 diffusiveVelocityComponent_I_Jacobian_m -=
10357 da_mm_dm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10362 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10367 diffusiveVelocityComponent_I_Jacobian2_ww -=
10368 a_mw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10373 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10374 k*nDOF_trial_element*nSpace+
10378 diffusiveVelocityComponent_I_Jacobian2_wm -=
10379 a_mw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10384 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10385 k*nDOF_trial_element*nSpace+
10390 diffusiveVelocityComponent_I_Jacobian2_mw -=
10391 a_mm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10396 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10397 k*nDOF_trial_element*nSpace+
10401 diffusiveVelocityComponent_I_Jacobian2_mm -=
10402 a_mm[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10407 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10408 k*nDOF_trial_element*nSpace+
10414 diffusiveVelocityComponent_I_Jacobian_w
10416 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10417 k*nDOF_trial_element +
10420 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10424 diffusiveVelocityComponent_I_Jacobian2_ww
10428 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10432 diffusiveVelocityComponent_I_Jacobian2_mw
10436 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10441 diffusiveVelocityComponent_I_Jacobian_m
10443 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10444 k*nDOF_trial_element +
10447 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10451 diffusiveVelocityComponent_I_Jacobian2_wm
10455 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10459 diffusiveVelocityComponent_I_Jacobian2_mm
10463 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10469 penalty_m[ebNE*nQuadraturePoints_elementBoundary+k]
10471 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
10472 k*nDOF_trial_element+
10474 fluxJacobian_mw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10475 k*nDOF_trial_element +
10478 fluxJacobian_mm[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10479 k*nDOF_trial_element +
10491 int nQuadraturePoints_elementBoundary,
10493 int nDOF_trial_element,
10501 const int* exteriorElementBoundaries,
10502 const int* elementBoundaryElements,
10503 const int* elementBoundaryLocalElementBoundaries,
10504 const int* isDOFBoundary_uw,
10505 const int* isDOFBoundary_um,
10508 const double* df_m_dw,
10509 const double* a_wm,
10510 const double* da_wm_dw,
10511 const double* da_wm_dm,
10512 const double* a_mw,
10513 const double* da_mw_dw,
10514 const double* da_mw_dm,
10515 const double* a_mm,
10516 const double* da_mm_dw,
10517 const double* da_mm_dm,
10518 const double* grad_phi_w,
10519 const double* grad_phi_m,
10520 const double* dphi_w_w,
10521 const double* dphi_w_m,
10522 const double* dphi_m_w,
10523 const double* dphi_m_m,
10527 const double* grad_v,
10528 const double* penalty_w,
10529 const double* penalty_m,
10530 double * fluxJacobian_ww,
10531 double * fluxJacobian_wm,
10532 double * fluxJacobian_mw,
10533 double * fluxJacobian_mm)
10535 int ebNE,ebN,eN_global,j,j_global,I,k,m,nnz_wm=rowptr_wm[nSpace],nnz_mw=rowptr_mw[nSpace],nnz_mm=rowptr_mm[nSpace];
10536 double Jacobian_w,Jacobian_m,
10537 diffusiveVelocityComponent_I_Jacobian_w,
10538 diffusiveVelocityComponent_I_Jacobian_m,
10539 diffusiveVelocityComponent_I_Jacobian2_wm,
10540 diffusiveVelocityComponent_I_Jacobian2_ww,
10541 diffusiveVelocityComponent_I_Jacobian2_mw,
10542 diffusiveVelocityComponent_I_Jacobian2_mm;
10544 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
10546 ebN = exteriorElementBoundaries[ebNE];
10547 eN_global = elementBoundaryElements[ebN*2 + 0];
10548 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
10555 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
10559 for (j = 0; j < nDOF_trial_element; j++)
10563 j_global = l2g[eN_global*nDOF_trial_element + j];
10564 for (I = 0; I < nSpace; I++)
10566 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
10567 diffusiveVelocityComponent_I_Jacobian_m = 0.0;
10568 diffusiveVelocityComponent_I_Jacobian2_mw = 0.0;
10569 diffusiveVelocityComponent_I_Jacobian2_mm = 0.0;
10570 for(m=rowptr_wm[I];m<rowptr_wm[I+1];m++)
10573 diffusiveVelocityComponent_I_Jacobian_w -=
10574 da_wm_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_wm+
10578 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10581 diffusiveVelocityComponent_I_Jacobian_m -=
10582 da_wm_dm[ebNE*nQuadraturePoints_elementBoundary*nnz_wm+
10586 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10590 diffusiveVelocityComponent_I_Jacobian2_mw -=
10591 a_wm[ebNE*nQuadraturePoints_elementBoundary*nnz_wm+
10595 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10596 k*nDOF_trial_element*nSpace+
10600 diffusiveVelocityComponent_I_Jacobian2_mm -=
10601 a_wm[ebNE*nQuadraturePoints_elementBoundary*nnz_wm+
10605 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10606 k*nDOF_trial_element*nSpace+
10612 diffusiveVelocityComponent_I_Jacobian_w
10614 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10615 k*nDOF_trial_element +
10618 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10622 diffusiveVelocityComponent_I_Jacobian2_mw
10626 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10630 diffusiveVelocityComponent_I_Jacobian_m
10632 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10633 k*nDOF_trial_element +
10636 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10640 diffusiveVelocityComponent_I_Jacobian2_mm
10644 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10650 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
10652 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
10653 k*nDOF_trial_element+
10655 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10656 k*nDOF_trial_element +
10659 fluxJacobian_wm[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10660 k*nDOF_trial_element +
10665 if (isDOFBoundary_um[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
10669 for (j = 0; j < nDOF_trial_element; j++)
10673 j_global = l2g[eN_global*nDOF_trial_element + j];
10674 for (I = 0; I < nSpace; I++)
10676 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
10677 diffusiveVelocityComponent_I_Jacobian_m = 0.0;
10678 diffusiveVelocityComponent_I_Jacobian2_wm = 0.0;
10679 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
10680 diffusiveVelocityComponent_I_Jacobian2_mw = 0.0;
10681 diffusiveVelocityComponent_I_Jacobian2_mm = 0.0;
10682 for (m=rowptr_mw[I];m<rowptr_mw[I+1];m++)
10685 diffusiveVelocityComponent_I_Jacobian_w -=
10686 da_mw_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10690 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10693 diffusiveVelocityComponent_I_Jacobian_m -=
10694 da_mw_dm[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10698 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10702 diffusiveVelocityComponent_I_Jacobian_w -=
10703 da_mm_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10707 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10710 diffusiveVelocityComponent_I_Jacobian_m -=
10711 da_mm_dm[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10715 grad_phi_m[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10720 diffusiveVelocityComponent_I_Jacobian2_ww -=
10721 a_mw[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10725 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10726 k*nDOF_trial_element*nSpace+
10730 diffusiveVelocityComponent_I_Jacobian2_wm -=
10731 a_mw[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10735 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10736 k*nDOF_trial_element*nSpace+
10741 diffusiveVelocityComponent_I_Jacobian2_mw -=
10742 a_mm[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10746 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10747 k*nDOF_trial_element*nSpace+
10751 diffusiveVelocityComponent_I_Jacobian2_mm -=
10752 a_mm[ebNE*nQuadraturePoints_elementBoundary*nnz_mw +
10756 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
10757 k*nDOF_trial_element*nSpace+
10763 diffusiveVelocityComponent_I_Jacobian_w
10765 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10766 k*nDOF_trial_element +
10769 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10773 diffusiveVelocityComponent_I_Jacobian2_ww
10777 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10781 diffusiveVelocityComponent_I_Jacobian2_mw
10785 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10790 diffusiveVelocityComponent_I_Jacobian_m
10792 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10793 k*nDOF_trial_element +
10796 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10800 diffusiveVelocityComponent_I_Jacobian2_wm
10804 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10808 diffusiveVelocityComponent_I_Jacobian2_mm
10812 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10818 penalty_m[ebNE*nQuadraturePoints_elementBoundary+k]
10820 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
10821 k*nDOF_trial_element+
10823 fluxJacobian_mw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10824 k*nDOF_trial_element +
10827 fluxJacobian_mm[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
10828 k*nDOF_trial_element +
10840 int nQuadraturePoints_elementBoundary,
10842 const int* exteriorElementBoundaries,
10843 const int* elementBoundaryElements,
10844 const int* elementBoundaryLocalElementBoundaries,
10845 const int* isDOFBoundary_uw,
10846 const int* isDOFBoundary_un,
10848 int fluxBoundaryFlag_uw,
10849 int fluxBoundaryFlag_un,
10851 const double* bc_a_ww,
10852 const double* bc_a_nn,
10853 const double* bc_grad_phi_w,
10854 const double* bc_grad_phi_n,
10855 const double* bc_s_w,
10856 const double* bc_psi_w,
10857 const double* bc_psi_n,
10858 const double* a_ww,
10859 const double* a_nn,
10860 const double* grad_phi_w,
10861 const double* grad_phi_n,
10863 const double* psi_w,
10864 const double* psi_n,
10865 const double* penalty_w,
10866 const double* penalty_n,
10867 double * diffusiveFlux_ww,
10868 double * diffusiveFlux_nn)
10870 int ebNE,ebN,I,J,k,nSpace2=nSpace*nSpace;
10871 double diffusiveFlux_I=0.0,penaltyFlux = 0.0,potential_gradient_w=0.0,potential_gradient_n=0.0;
10873 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
10875 ebN = exteriorElementBoundaries[ebNE];
10876 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
10881 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10882 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
10885 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
10886 for (I=0; I < nSpace; I++)
10888 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10891 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10894 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10897 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10902 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw == 1))
10905 for (I = 0; I < nSpace; I++)
10907 diffusiveFlux_I = 0.0;
10908 for (J = 0; J < nSpace; J++)
10911 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10916 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10920 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] +=
10923 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10927 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
10931 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
10933 (s_w[ebNE*nQuadraturePoints_elementBoundary + k]
10935 bc_s_w[ebNE*nQuadraturePoints_elementBoundary + k]);
10936 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary +k] +=
10941 if(isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un == 1))
10944 for (I = 0; I < nSpace; I++)
10946 diffusiveFlux_I = 0.0;
10947 for (J = 0; J < nSpace; J++)
10950 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
10955 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10959 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary + k] +=
10962 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
10968 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
10971 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
10973 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
10975 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
10977 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
10980 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
10982 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
10984 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
10987 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary +k] +=
10995 int nQuadraturePoints_elementBoundary,
11001 const int* exteriorElementBoundaries,
11002 const int* elementBoundaryElements,
11003 const int* elementBoundaryLocalElementBoundaries,
11004 const int* isDOFBoundary_uw,
11005 const int* isDOFBoundary_un,
11007 int fluxBoundaryFlag_uw,
11008 int fluxBoundaryFlag_un,
11010 const double* bc_a_ww,
11011 const double* bc_a_nn,
11012 const double* bc_grad_phi_w,
11013 const double* bc_grad_phi_n,
11014 const double* bc_s_w,
11015 const double* bc_psi_w,
11016 const double* bc_psi_n,
11017 const double* a_ww,
11018 const double* a_nn,
11019 const double* grad_phi_w,
11020 const double* grad_phi_n,
11022 const double* psi_w,
11023 const double* psi_n,
11024 const double* penalty_w,
11025 const double* penalty_n,
11026 double * diffusiveFlux_ww,
11027 double * diffusiveFlux_nn)
11029 int ebNE,ebN,I,k,m,nnz_ww=rowptr_ww[nSpace],nnz_nn=rowptr_nn[nSpace];
11030 double diffusiveFlux_I=0.0,penaltyFlux = 0.0,potential_gradient_w=0.0,potential_gradient_n=0.0;
11031 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
11033 ebN = exteriorElementBoundaries[ebNE];
11034 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
11039 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
11040 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
11043 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
11044 for (I=0; I < nSpace; I++)
11046 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11049 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11052 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11055 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11061 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw==1))
11064 for (I = 0; I < nSpace; I++)
11066 diffusiveFlux_I = 0.0;
11067 for(m=rowptr_ww[I];m<rowptr_ww[I+1];m++)
11070 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
11074 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11078 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] +=
11081 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11086 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
11089 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
11091 (s_w[ebNE*nQuadraturePoints_elementBoundary + k]
11093 bc_s_w[ebNE*nQuadraturePoints_elementBoundary + k]);
11094 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary +k] +=
11099 if(isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un==1))
11102 for (I = 0; I < nSpace; I++)
11104 diffusiveFlux_I = 0.0;
11105 for(m=rowptr_nn[I];m<rowptr_nn[I+1];m++)
11108 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
11112 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11116 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary + k] +=
11119 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11125 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
11128 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
11130 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
11132 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
11134 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
11137 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
11139 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
11141 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
11144 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary +k] +=
11152 int nQuadraturePoints_elementBoundary,
11154 int nDOF_trial_element,
11156 const int* exteriorElementBoundaries,
11157 const int* elementBoundaryElements,
11158 const int* elementBoundaryLocalElementBoundaries,
11159 const int* isDOFBoundary_uw,
11160 const int* isDOFBoundary_un,
11162 int fluxBoundaryFlag_uw,
11163 int fluxBoundaryFlag_un,
11165 const double* a_ww,
11166 const double* da_ww_dw,
11167 const double* da_ww_dn,
11168 const double* a_nn,
11169 const double* da_nn_dw,
11170 const double* da_nn_dn,
11171 const double* grad_phi_w,
11172 const double* grad_phi_n,
11173 const double* dphi_w_w,
11174 const double* dphi_w_n,
11175 const double* dphi_n_w,
11176 const double* dphi_n_n,
11178 const double* psi_w,
11179 const double* psi_n,
11180 const double* dpsi_n_dsw,
11181 const double* dpsi_n_dpsiw,
11183 const double* grad_v,
11184 const double* penalty_w,
11185 const double* penalty_n,
11186 double * fluxJacobian_ww,
11187 double * fluxJacobian_wn,
11188 double * fluxJacobian_nw,
11189 double * fluxJacobian_nn)
11191 int ebNE,ebN,eN_global,j,j_global,I,J,k,nSpace2=nSpace*nSpace;
11192 double Jacobian_w,Jacobian_n,
11193 diffusiveVelocityComponent_I_Jacobian_w,
11194 diffusiveVelocityComponent_I_Jacobian_n,
11195 diffusiveVelocityComponent_I_Jacobian2_wn,
11196 diffusiveVelocityComponent_I_Jacobian2_ww,
11197 diffusiveVelocityComponent_I_Jacobian2_nw,
11198 diffusiveVelocityComponent_I_Jacobian2_nn;
11199 double potential_gradient_w=0.0,potential_gradient_n=0.0;
11201 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
11203 ebN = exteriorElementBoundaries[ebNE];
11204 eN_global = elementBoundaryElements[ebN*2 + 0];
11205 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
11213 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
11214 for (I=0; I < nSpace; I++)
11216 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11219 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11222 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11225 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11230 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw==1))
11234 for (j = 0; j < nDOF_trial_element; j++)
11238 j_global = l2g[eN_global*nDOF_trial_element + j];
11239 for (I = 0; I < nSpace; I++)
11241 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
11242 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
11243 diffusiveVelocityComponent_I_Jacobian2_wn = 0.0;
11244 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
11245 for (J = 0; J < nSpace; J++)
11248 diffusiveVelocityComponent_I_Jacobian_w -=
11249 da_ww_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11254 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11257 diffusiveVelocityComponent_I_Jacobian_n -=
11258 da_ww_dn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11263 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11267 diffusiveVelocityComponent_I_Jacobian2_ww -=
11268 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11273 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11274 k*nDOF_trial_element*nSpace+
11278 diffusiveVelocityComponent_I_Jacobian2_wn -=
11279 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11284 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11285 k*nDOF_trial_element*nSpace+
11291 diffusiveVelocityComponent_I_Jacobian_w
11293 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11294 k*nDOF_trial_element +
11297 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11301 diffusiveVelocityComponent_I_Jacobian2_ww
11305 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11309 diffusiveVelocityComponent_I_Jacobian_n
11311 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11312 k*nDOF_trial_element +
11315 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11319 diffusiveVelocityComponent_I_Jacobian2_wn
11323 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11328 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
11331 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
11333 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11334 k*nDOF_trial_element+
11337 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11338 k*nDOF_trial_element +
11341 fluxJacobian_wn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11342 k*nDOF_trial_element +
11348 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un==1))
11352 for (j = 0; j < nDOF_trial_element; j++)
11356 j_global = l2g[eN_global*nDOF_trial_element + j];
11357 for (I = 0; I < nSpace; I++)
11359 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
11360 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
11361 diffusiveVelocityComponent_I_Jacobian2_nw = 0.0;
11362 diffusiveVelocityComponent_I_Jacobian2_nn = 0.0;
11363 for (J = 0; J < nSpace; J++)
11366 diffusiveVelocityComponent_I_Jacobian_w -=
11367 da_nn_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11372 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11375 diffusiveVelocityComponent_I_Jacobian_n -=
11376 da_nn_dn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11381 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11386 diffusiveVelocityComponent_I_Jacobian2_nw -=
11387 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11392 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11393 k*nDOF_trial_element*nSpace+
11397 diffusiveVelocityComponent_I_Jacobian2_nn -=
11398 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
11403 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11404 k*nDOF_trial_element*nSpace+
11410 diffusiveVelocityComponent_I_Jacobian_w
11412 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11413 k*nDOF_trial_element +
11416 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11420 diffusiveVelocityComponent_I_Jacobian2_nw
11424 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11429 diffusiveVelocityComponent_I_Jacobian_n
11431 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11432 k*nDOF_trial_element +
11435 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11439 diffusiveVelocityComponent_I_Jacobian2_nn
11443 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11448 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 2)
11452 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11454 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11455 k*nDOF_trial_element+
11458 dpsi_n_dpsiw[ebNE*nQuadraturePoints_elementBoundary + k];
11461 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11463 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11464 k*nDOF_trial_element+
11467 dpsi_n_dsw[ebNE*nQuadraturePoints_elementBoundary + k];
11469 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
11473 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11475 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11476 k*nDOF_trial_element+
11480 fluxJacobian_nw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11481 k*nDOF_trial_element +
11484 fluxJacobian_nn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11485 k*nDOF_trial_element +
11497 int nQuadraturePoints_elementBoundary,
11499 int nDOF_trial_element,
11505 const int* exteriorElementBoundaries,
11506 const int* elementBoundaryElements,
11507 const int* elementBoundaryLocalElementBoundaries,
11508 const int* isDOFBoundary_uw,
11509 const int* isDOFBoundary_un,
11511 int fluxBoundaryFlag_uw,
11512 int fluxBoundaryFlag_un,
11514 const double* a_ww,
11515 const double* da_ww_dw,
11516 const double* da_ww_dn,
11517 const double* a_nn,
11518 const double* da_nn_dw,
11519 const double* da_nn_dn,
11520 const double* grad_phi_w,
11521 const double* grad_phi_n,
11522 const double* dphi_w_w,
11523 const double* dphi_w_n,
11524 const double* dphi_n_w,
11525 const double* dphi_n_n,
11527 const double* psi_w,
11528 const double* psi_n,
11529 const double* dpsi_n_dsw,
11530 const double* dpsi_n_dpsiw,
11532 const double* grad_v,
11533 const double* penalty_w,
11534 const double* penalty_n,
11535 double * fluxJacobian_ww,
11536 double * fluxJacobian_wn,
11537 double * fluxJacobian_nw,
11538 double * fluxJacobian_nn)
11540 int ebNE,ebN,eN_global,j,j_global,I,k,m,nnz_ww=rowptr_ww[nSpace],nnz_nn=rowptr_nn[nSpace];
11541 double Jacobian_w,Jacobian_n,
11542 diffusiveVelocityComponent_I_Jacobian_w,
11543 diffusiveVelocityComponent_I_Jacobian_n,
11544 diffusiveVelocityComponent_I_Jacobian2_wn,
11545 diffusiveVelocityComponent_I_Jacobian2_ww,
11546 diffusiveVelocityComponent_I_Jacobian2_nw,
11547 diffusiveVelocityComponent_I_Jacobian2_nn;
11548 double potential_gradient_w=0.0,potential_gradient_n=0.0;
11549 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
11551 ebN = exteriorElementBoundaries[ebNE];
11552 eN_global = elementBoundaryElements[ebN*2 + 0];
11554 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
11562 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
11563 for (I=0; I < nSpace; I++)
11565 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11568 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11571 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11574 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11580 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw==1))
11584 for (j = 0; j < nDOF_trial_element; j++)
11588 j_global = l2g[eN_global*nDOF_trial_element + j];
11589 for (I = 0; I < nSpace; I++)
11591 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
11592 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
11593 diffusiveVelocityComponent_I_Jacobian2_wn = 0.0;
11594 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
11595 for (m=rowptr_ww[I];m<rowptr_ww[I+1];m++)
11598 diffusiveVelocityComponent_I_Jacobian_w -=
11599 da_ww_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
11603 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11606 diffusiveVelocityComponent_I_Jacobian_n -=
11607 da_ww_dn[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
11611 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11615 diffusiveVelocityComponent_I_Jacobian2_ww -=
11616 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
11620 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11621 k*nDOF_trial_element*nSpace+
11625 diffusiveVelocityComponent_I_Jacobian2_wn -=
11626 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
11630 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11631 k*nDOF_trial_element*nSpace+
11637 diffusiveVelocityComponent_I_Jacobian_w
11639 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11640 k*nDOF_trial_element +
11643 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11647 diffusiveVelocityComponent_I_Jacobian2_ww
11651 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11655 diffusiveVelocityComponent_I_Jacobian_n
11657 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11658 k*nDOF_trial_element +
11661 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11665 diffusiveVelocityComponent_I_Jacobian2_wn
11669 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11674 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
11677 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
11679 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11680 k*nDOF_trial_element+
11683 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11684 k*nDOF_trial_element +
11687 fluxJacobian_wn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11688 k*nDOF_trial_element +
11694 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un==1))
11698 for (j = 0; j < nDOF_trial_element; j++)
11702 j_global = l2g[eN_global*nDOF_trial_element + j];
11703 for (I = 0; I < nSpace; I++)
11705 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
11706 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
11707 diffusiveVelocityComponent_I_Jacobian2_nw = 0.0;
11708 diffusiveVelocityComponent_I_Jacobian2_nn = 0.0;
11709 for (m=rowptr_nn[I];m<rowptr_nn[I+1];m++)
11712 diffusiveVelocityComponent_I_Jacobian_w -=
11713 da_nn_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
11717 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11720 diffusiveVelocityComponent_I_Jacobian_n -=
11721 da_nn_dn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
11725 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11730 diffusiveVelocityComponent_I_Jacobian2_nw -=
11731 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
11735 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11736 k*nDOF_trial_element*nSpace+
11740 diffusiveVelocityComponent_I_Jacobian2_nn -=
11741 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
11745 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
11746 k*nDOF_trial_element*nSpace+
11752 diffusiveVelocityComponent_I_Jacobian_w
11754 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11755 k*nDOF_trial_element +
11758 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11762 diffusiveVelocityComponent_I_Jacobian2_nw
11766 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11771 diffusiveVelocityComponent_I_Jacobian_n
11773 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11774 k*nDOF_trial_element +
11777 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11781 diffusiveVelocityComponent_I_Jacobian2_nn
11785 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
11790 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 2)
11794 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11796 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11797 k*nDOF_trial_element+
11800 dpsi_n_dpsiw[ebNE*nQuadraturePoints_elementBoundary + k];
11803 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11805 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11806 k*nDOF_trial_element+
11809 dpsi_n_dsw[ebNE*nQuadraturePoints_elementBoundary + k];
11811 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
11815 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
11817 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
11818 k*nDOF_trial_element+
11822 fluxJacobian_nw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11823 k*nDOF_trial_element +
11826 fluxJacobian_nn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
11827 k*nDOF_trial_element +
11843 int nQuadraturePoints_elementBoundary,
11845 int* exteriorElementBoundaries,
11846 int* elementBoundaryElements,
11847 int* elementBoundaryLocalElementBoundaries,
11848 int *isDOFBoundary_sw,
11849 int *isDOFBoundary_psiw,
11854 double* bc_dfw_dsw,
11855 double* bc_dfw_dpsiw,
11857 double* bc_dfn_dsw,
11858 double* bc_dfn_dpsiw,
11868 double* dfluxw_dsw,
11869 double* dfluxw_dpsiw,
11871 double* dfluxn_dsw,
11872 double* dfluxn_dpsiw)
11874 int ebNE,ebN,eN_global,k,J;
11876 double dflux_dsw_left,dflux_dpsiw_left;
11877 int enforceOutflow = 1;
11878 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
11880 ebN = exteriorElementBoundaries[ebNE];
11881 eN_global = elementBoundaryElements[ebN*2+0];
11882 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
11885 dflux_dsw_left=0.0;
11886 dflux_dpsiw_left=0.0;
11887 for(J=0;J<nSpace;J++)
11890 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11894 dfw_dsw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11897 dflux_dpsiw_left +=
11898 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11902 dfw_dpsiw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11908 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11912 fw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11916 if (!enforceOutflow || isDOFBoundary_sw[ebNE*nQuadraturePoints_elementBoundary+k] || left_flux >= 0.0)
11918 fluxw[ebNE*nQuadraturePoints_elementBoundary+
11920 dfluxw_dsw[ebNE*nQuadraturePoints_elementBoundary+
11921 k] = dflux_dsw_left;
11922 dfluxw_dpsiw[ebNE*nQuadraturePoints_elementBoundary+
11923 k] = dflux_dpsiw_left;
11927 fluxw[ebNE*nQuadraturePoints_elementBoundary+
11929 dfluxw_dsw[ebNE*nQuadraturePoints_elementBoundary+
11931 dfluxw_dpsiw[ebNE*nQuadraturePoints_elementBoundary+
11937 dflux_dsw_left=0.0;
11938 dflux_dpsiw_left=0.0;
11939 for(J=0;J<nSpace;J++)
11942 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11946 dfn_dsw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11949 dflux_dpsiw_left +=
11950 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11954 dfn_dpsiw[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11959 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11963 fn[ebNE*nQuadraturePoints_elementBoundary*nSpace+
11967 if (!enforceOutflow || isDOFBoundary_psiw[ebNE*nQuadraturePoints_elementBoundary+k] || left_flux >= 0.0)
11969 fluxn[ebNE*nQuadraturePoints_elementBoundary+
11971 dfluxn_dsw[ebNE*nQuadraturePoints_elementBoundary+
11972 k] = dflux_dsw_left;
11973 dfluxn_dpsiw[ebNE*nQuadraturePoints_elementBoundary+
11974 k] = dflux_dpsiw_left;
11978 fluxn[ebNE*nQuadraturePoints_elementBoundary+
11980 dfluxn_dsw[ebNE*nQuadraturePoints_elementBoundary+
11982 dfluxn_dpsiw[ebNE*nQuadraturePoints_elementBoundary+
11993 int nQuadraturePoints_elementBoundary,
11995 const int* exteriorElementBoundaries,
11996 const int* elementBoundaryElements,
11997 const int* elementBoundaryLocalElementBoundaries,
11998 const int* isDOFBoundary_uw,
11999 const int* isDOFBoundary_un,
12001 int fluxBoundaryFlag_uw,
12002 int fluxBoundaryFlag_un,
12004 const double* bc_a_ww,
12005 const double* bc_a_nn,
12006 const double* bc_grad_phi_w,
12007 const double* bc_grad_phi_n,
12008 const double* bc_psi_w,
12009 const double* bc_psi_c,
12010 const double* bc_psi_n,
12011 const double* a_ww,
12012 const double* a_nn,
12013 const double* grad_phi_w,
12014 const double* grad_phi_n,
12015 const double* psi_w,
12016 const double* psi_c,
12017 const double* psi_n,
12018 const double* penalty_w,
12019 const double* penalty_n,
12020 double * diffusiveFlux_ww,
12021 double * diffusiveFlux_nn)
12023 int ebNE,ebN,I,J,k,nSpace2=nSpace*nSpace;
12024 double diffusiveFlux_I=0.0,penaltyFlux = 0.0;
12025 double potential_gradient_w=0.0,potential_gradient_n=0.0;
12027 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
12029 ebN = exteriorElementBoundaries[ebNE];
12030 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
12035 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
12036 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
12039 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
12040 for (I=0; I < nSpace; I++)
12042 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12045 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12048 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12051 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12057 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw == 1))
12060 for (I = 0; I < nSpace; I++)
12062 diffusiveFlux_I = 0.0;
12063 for (J = 0; J < nSpace; J++)
12066 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12071 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12075 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] +=
12078 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12083 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
12086 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
12088 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
12090 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
12091 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary +k] +=
12096 if(isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un == 1))
12099 for (I = 0; I < nSpace; I++)
12101 diffusiveFlux_I = 0.0;
12102 for (J = 0; J < nSpace; J++)
12105 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12110 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12114 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary + k] +=
12117 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12124 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
12127 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
12129 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
12131 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
12133 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
12136 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
12138 (psi_c[ebNE*nQuadraturePoints_elementBoundary + k]
12140 bc_psi_c[ebNE*nQuadraturePoints_elementBoundary + k]);
12143 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary +k] +=
12151 int nQuadraturePoints_elementBoundary,
12157 const int* exteriorElementBoundaries,
12158 const int* elementBoundaryElements,
12159 const int* elementBoundaryLocalElementBoundaries,
12160 const int* isDOFBoundary_uw,
12161 const int* isDOFBoundary_un,
12163 int fluxBoundaryFlag_uw,
12164 int fluxBoundaryFlag_un,
12166 const double* bc_a_ww,
12167 const double* bc_a_nn,
12168 const double* bc_grad_phi_w,
12169 const double* bc_grad_phi_n,
12170 const double* bc_psi_w,
12171 const double* bc_psi_c,
12172 const double* bc_psi_n,
12173 const double* a_ww,
12174 const double* a_nn,
12175 const double* grad_phi_w,
12176 const double* grad_phi_n,
12177 const double* psi_w,
12178 const double* psi_c,
12179 const double* psi_n,
12180 const double* penalty_w,
12181 const double* penalty_n,
12182 double * diffusiveFlux_ww,
12183 double * diffusiveFlux_nn)
12185 int ebNE,ebN,I,k,m,nnz_ww=rowptr_ww[nSpace],nnz_nn=rowptr_nn[nSpace];
12186 double diffusiveFlux_I=0.0,penaltyFlux = 0.0,potential_gradient_w=0.0,potential_gradient_n=0.0;
12187 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
12189 ebN = exteriorElementBoundaries[ebNE];
12190 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
12195 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
12196 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
12197 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
12198 for (I=0; I < nSpace; I++)
12200 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12203 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12206 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12209 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12217 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw == 1))
12220 for (I = 0; I < nSpace; I++)
12222 diffusiveFlux_I = 0.0;
12223 for(m=rowptr_ww[I];m<rowptr_ww[I+1];m++)
12226 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
12230 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12234 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary+k] +=
12237 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12242 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
12245 penalty_w[ebNE*nQuadraturePoints_elementBoundary + k]
12247 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
12249 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
12250 diffusiveFlux_ww[ebNE*nQuadraturePoints_elementBoundary +k] +=
12255 if(isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un == 1))
12258 for (I = 0; I < nSpace; I++)
12260 diffusiveFlux_I = 0.0;
12261 for(m=rowptr_nn[I];m<rowptr_nn[I+1];m++)
12264 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
12268 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12272 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary + k] +=
12275 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12281 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
12284 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
12286 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
12288 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
12290 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
12293 penalty_n[ebNE*nQuadraturePoints_elementBoundary + k]
12295 (psi_c[ebNE*nQuadraturePoints_elementBoundary + k]
12297 bc_psi_c[ebNE*nQuadraturePoints_elementBoundary + k]);
12300 diffusiveFlux_nn[ebNE*nQuadraturePoints_elementBoundary +k] +=
12308 int nQuadraturePoints_elementBoundary,
12310 int nDOF_trial_element,
12312 const int* exteriorElementBoundaries,
12313 const int* elementBoundaryElements,
12314 const int* elementBoundaryLocalElementBoundaries,
12315 const int* isDOFBoundary_uw,
12316 const int* isDOFBoundary_un,
12318 int fluxBoundaryFlag_uw,
12319 int fluxBoundaryFlag_un,
12321 const double* a_ww,
12322 const double* da_ww_dw,
12323 const double* da_ww_dn,
12324 const double* a_nn,
12325 const double* da_nn_dw,
12326 const double* da_nn_dn,
12327 const double* grad_phi_w,
12328 const double* grad_phi_n,
12329 const double* dphi_w_w,
12330 const double* dphi_w_n,
12331 const double* dphi_n_w,
12332 const double* dphi_n_n,
12333 const double* psi_w,
12334 const double* psi_c,
12335 const double* psi_n,
12336 const double* dpsi_n_dpsiw,
12337 const double* dpsi_n_dpsic,
12339 const double* grad_v,
12340 const double* penalty_w,
12341 const double* penalty_n,
12342 double * fluxJacobian_ww,
12343 double * fluxJacobian_wn,
12344 double * fluxJacobian_nw,
12345 double * fluxJacobian_nn)
12347 int ebNE,ebN,eN_global,j,j_global,I,J,k,nSpace2=nSpace*nSpace;
12348 double Jacobian_w,Jacobian_n,
12349 diffusiveVelocityComponent_I_Jacobian_w,
12350 diffusiveVelocityComponent_I_Jacobian_n,
12351 diffusiveVelocityComponent_I_Jacobian2_wn,
12352 diffusiveVelocityComponent_I_Jacobian2_ww,
12353 diffusiveVelocityComponent_I_Jacobian2_nw,
12354 diffusiveVelocityComponent_I_Jacobian2_nn;
12355 double potential_gradient_w=0.0,potential_gradient_n=0.0;
12356 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
12358 ebN = exteriorElementBoundaries[ebNE];
12359 eN_global = elementBoundaryElements[ebN*2 + 0];
12360 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
12368 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
12369 for (I=0; I < nSpace; I++)
12371 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12374 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12377 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12380 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12385 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw == 1))
12389 for (j = 0; j < nDOF_trial_element; j++)
12393 j_global = l2g[eN_global*nDOF_trial_element + j];
12394 for (I = 0; I < nSpace; I++)
12396 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
12397 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
12398 diffusiveVelocityComponent_I_Jacobian2_wn = 0.0;
12399 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
12400 for (J = 0; J < nSpace; J++)
12403 diffusiveVelocityComponent_I_Jacobian_w -=
12404 da_ww_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12409 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12412 diffusiveVelocityComponent_I_Jacobian_n -=
12413 da_ww_dn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12418 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12422 diffusiveVelocityComponent_I_Jacobian2_ww -=
12423 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12428 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12429 k*nDOF_trial_element*nSpace+
12433 diffusiveVelocityComponent_I_Jacobian2_wn -=
12434 a_ww[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12439 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12440 k*nDOF_trial_element*nSpace+
12446 diffusiveVelocityComponent_I_Jacobian_w
12448 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12449 k*nDOF_trial_element +
12452 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12456 diffusiveVelocityComponent_I_Jacobian2_ww
12460 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12464 diffusiveVelocityComponent_I_Jacobian_n
12466 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12467 k*nDOF_trial_element +
12470 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12474 diffusiveVelocityComponent_I_Jacobian2_wn
12478 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12483 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
12486 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
12488 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12489 k*nDOF_trial_element+
12492 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12493 k*nDOF_trial_element +
12496 fluxJacobian_wn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12497 k*nDOF_trial_element +
12503 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un == 1))
12507 for (j = 0; j < nDOF_trial_element; j++)
12511 j_global = l2g[eN_global*nDOF_trial_element + j];
12512 for (I = 0; I < nSpace; I++)
12514 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
12515 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
12516 diffusiveVelocityComponent_I_Jacobian2_nw = 0.0;
12517 diffusiveVelocityComponent_I_Jacobian2_nn = 0.0;
12518 for (J = 0; J < nSpace; J++)
12521 diffusiveVelocityComponent_I_Jacobian_w -=
12522 da_nn_dw[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12527 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12530 diffusiveVelocityComponent_I_Jacobian_n -=
12531 da_nn_dn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12536 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12541 diffusiveVelocityComponent_I_Jacobian2_nw -=
12542 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12547 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12548 k*nDOF_trial_element*nSpace+
12552 diffusiveVelocityComponent_I_Jacobian2_nn -=
12553 a_nn[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
12558 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12559 k*nDOF_trial_element*nSpace+
12565 diffusiveVelocityComponent_I_Jacobian_w
12567 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12568 k*nDOF_trial_element +
12571 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12575 diffusiveVelocityComponent_I_Jacobian2_nw
12579 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12584 diffusiveVelocityComponent_I_Jacobian_n
12586 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12587 k*nDOF_trial_element +
12590 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12594 diffusiveVelocityComponent_I_Jacobian2_nn
12598 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12603 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 2)
12607 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12609 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12610 k*nDOF_trial_element+
12613 dpsi_n_dpsiw[ebNE*nQuadraturePoints_elementBoundary + k];
12616 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12618 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12619 k*nDOF_trial_element+
12622 dpsi_n_dpsic[ebNE*nQuadraturePoints_elementBoundary + k];
12624 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
12629 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12631 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12632 k*nDOF_trial_element+
12636 fluxJacobian_nw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12637 k*nDOF_trial_element +
12640 fluxJacobian_nn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12641 k*nDOF_trial_element +
12653 int nQuadraturePoints_elementBoundary,
12655 int nDOF_trial_element,
12661 const int* exteriorElementBoundaries,
12662 const int* elementBoundaryElements,
12663 const int* elementBoundaryLocalElementBoundaries,
12664 const int* isDOFBoundary_uw,
12665 const int* isDOFBoundary_un,
12667 int fluxBoundaryFlag_uw,
12668 int fluxBoundaryFlag_un,
12670 const double* a_ww,
12671 const double* da_ww_dw,
12672 const double* da_ww_dn,
12673 const double* a_nn,
12674 const double* da_nn_dw,
12675 const double* da_nn_dn,
12676 const double* grad_phi_w,
12677 const double* grad_phi_n,
12678 const double* dphi_w_w,
12679 const double* dphi_w_n,
12680 const double* dphi_n_w,
12681 const double* dphi_n_n,
12682 const double* psi_w,
12683 const double* psi_c,
12684 const double* psi_n,
12685 const double* dpsi_n_dpsiw,
12686 const double* dpsi_n_dpsic,
12688 const double* grad_v,
12689 const double* penalty_w,
12690 const double* penalty_n,
12691 double * fluxJacobian_ww,
12692 double * fluxJacobian_wn,
12693 double * fluxJacobian_nw,
12694 double * fluxJacobian_nn)
12696 int ebNE,ebN,eN_global,j,j_global,I,k,m,nnz_ww=rowptr_ww[nSpace],nnz_nn=rowptr_nn[nSpace];
12697 double Jacobian_w,Jacobian_n,
12698 diffusiveVelocityComponent_I_Jacobian_w,
12699 diffusiveVelocityComponent_I_Jacobian_n,
12700 diffusiveVelocityComponent_I_Jacobian2_wn,
12701 diffusiveVelocityComponent_I_Jacobian2_ww,
12702 diffusiveVelocityComponent_I_Jacobian2_nw,
12703 diffusiveVelocityComponent_I_Jacobian2_nn;
12704 double potential_gradient_w=0.0,potential_gradient_n=0.0;
12705 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
12707 ebN = exteriorElementBoundaries[ebNE];
12708 eN_global = elementBoundaryElements[ebN*2 + 0];
12710 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
12718 potential_gradient_w = 0.0; potential_gradient_n = 0.0;
12719 for (I=0; I < nSpace; I++)
12721 potential_gradient_w += grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12724 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12727 potential_gradient_n += grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12730 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12738 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1 || (potential_gradient_w > 0.0 && fluxBoundaryFlag_uw == 1))
12742 for (j = 0; j < nDOF_trial_element; j++)
12746 j_global = l2g[eN_global*nDOF_trial_element + j];
12747 for (I = 0; I < nSpace; I++)
12749 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
12750 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
12751 diffusiveVelocityComponent_I_Jacobian2_wn = 0.0;
12752 diffusiveVelocityComponent_I_Jacobian2_ww = 0.0;
12753 for (m=rowptr_ww[I];m<rowptr_ww[I+1];m++)
12756 diffusiveVelocityComponent_I_Jacobian_w -=
12757 da_ww_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
12761 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12764 diffusiveVelocityComponent_I_Jacobian_n -=
12765 da_ww_dn[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
12769 grad_phi_w[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12773 diffusiveVelocityComponent_I_Jacobian2_ww -=
12774 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
12778 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12779 k*nDOF_trial_element*nSpace+
12783 diffusiveVelocityComponent_I_Jacobian2_wn -=
12784 a_ww[ebNE*nQuadraturePoints_elementBoundary*nnz_ww +
12788 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12789 k*nDOF_trial_element*nSpace+
12795 diffusiveVelocityComponent_I_Jacobian_w
12797 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12798 k*nDOF_trial_element +
12801 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12805 diffusiveVelocityComponent_I_Jacobian2_ww
12809 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12813 diffusiveVelocityComponent_I_Jacobian_n
12815 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12816 k*nDOF_trial_element +
12819 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12823 diffusiveVelocityComponent_I_Jacobian2_wn
12827 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12832 if (isDOFBoundary_uw[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
12835 penalty_w[ebNE*nQuadraturePoints_elementBoundary+k]
12837 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12838 k*nDOF_trial_element+
12841 fluxJacobian_ww[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12842 k*nDOF_trial_element +
12845 fluxJacobian_wn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12846 k*nDOF_trial_element +
12852 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] >= 1 || (potential_gradient_n > 0.0 && fluxBoundaryFlag_un == 1))
12856 for (j = 0; j < nDOF_trial_element; j++)
12860 j_global = l2g[eN_global*nDOF_trial_element + j];
12861 for (I = 0; I < nSpace; I++)
12863 diffusiveVelocityComponent_I_Jacobian_w = 0.0;
12864 diffusiveVelocityComponent_I_Jacobian_n = 0.0;
12865 diffusiveVelocityComponent_I_Jacobian2_nw = 0.0;
12866 diffusiveVelocityComponent_I_Jacobian2_nn = 0.0;
12867 for (m=rowptr_nn[I];m<rowptr_nn[I+1];m++)
12870 diffusiveVelocityComponent_I_Jacobian_w -=
12871 da_nn_dw[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
12875 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12878 diffusiveVelocityComponent_I_Jacobian_n -=
12879 da_nn_dn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
12883 grad_phi_n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12888 diffusiveVelocityComponent_I_Jacobian2_nw -=
12889 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
12893 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12894 k*nDOF_trial_element*nSpace+
12898 diffusiveVelocityComponent_I_Jacobian2_nn -=
12899 a_nn[ebNE*nQuadraturePoints_elementBoundary*nnz_nn +
12903 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace +
12904 k*nDOF_trial_element*nSpace+
12910 diffusiveVelocityComponent_I_Jacobian_w
12912 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12913 k*nDOF_trial_element +
12916 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12920 diffusiveVelocityComponent_I_Jacobian2_nw
12924 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12929 diffusiveVelocityComponent_I_Jacobian_n
12931 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12932 k*nDOF_trial_element +
12935 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12939 diffusiveVelocityComponent_I_Jacobian2_nn
12943 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
12948 if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 2)
12952 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12954 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12955 k*nDOF_trial_element+
12958 dpsi_n_dpsiw[ebNE*nQuadraturePoints_elementBoundary + k];
12961 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12963 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12964 k*nDOF_trial_element+
12967 dpsi_n_dpsic[ebNE*nQuadraturePoints_elementBoundary + k];
12969 else if (isDOFBoundary_un[ebNE*nQuadraturePoints_elementBoundary + k] == 1)
12973 penalty_n[ebNE*nQuadraturePoints_elementBoundary+k]
12975 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
12976 k*nDOF_trial_element+
12980 fluxJacobian_nw[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12981 k*nDOF_trial_element +
12984 fluxJacobian_nn[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element +
12985 k*nDOF_trial_element +
12998 int nQuadraturePoints_elementBoundary,
13000 const int* exteriorElementBoundaries,
13001 const int* elementBoundaryElements,
13002 const int* elementBoundaryLocalElementBoundaries,
13003 const int* isDOFBoundary_u,
13006 const double* bc_a,
13007 const double* bc_grad_phi,
13008 const double* bc_psi_w,
13009 const double* bc_psi_n,
13011 const double* grad_phi,
13012 const double* psi_w,
13013 const double* psi_n,
13014 const double* penalty,
13015 double * diffusiveFlux)
13017 int ebNE,ebN,I,J,k,nSpace2=nSpace*nSpace;
13018 double diffusiveFlux_I=0.0,penaltyFlux = 0.0;
13020 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
13022 ebN = exteriorElementBoundaries[ebNE];
13023 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
13025 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
13027 if(isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] >= 1)
13030 for (I = 0; I < nSpace; I++)
13032 diffusiveFlux_I = 0.0;
13033 for (J = 0; J < nSpace; J++)
13036 a[ebNE*nQuadraturePoints_elementBoundary*nSpace2 +
13041 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace +
13045 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary + k] +=
13048 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
13053 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
13056 penalty[ebNE*nQuadraturePoints_elementBoundary + k]
13058 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
13060 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
13064 assert(isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 1);
13066 penalty[ebNE*nQuadraturePoints_elementBoundary + k]
13068 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
13070 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
13073 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary +k] +=
13080 int nQuadraturePoints_elementBoundary,
13084 const int* exteriorElementBoundaries,
13085 const int* elementBoundaryElements,
13086 const int* elementBoundaryLocalElementBoundaries,
13087 const int* isDOFBoundary_u,
13090 const double* bc_a,
13091 const double* bc_grad_phi,
13092 const double* bc_psi_w,
13093 const double* bc_psi_n,
13095 const double* grad_phi,
13096 const double* psi_w,
13097 const double* psi_n,
13098 const double* penalty,
13099 double * diffusiveFlux)
13101 int ebNE,ebN,I,m,k,
nnz = rowptr[nSpace];
13102 double diffusiveFlux_I=0.0,penaltyFlux = 0.0;
13104 for (ebNE = 0; ebNE < nExteriorElementBoundaries_global; ebNE++)
13106 ebN = exteriorElementBoundaries[ebNE];
13107 for (k = 0; k < nQuadraturePoints_elementBoundary; k++)
13109 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
13111 if(isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] >= 1)
13114 for (I = 0; I < nSpace; I++)
13116 diffusiveFlux_I = 0.0;
13117 for (m = rowptr[I]; m < rowptr[I+1]; m++)
13120 a[ebNE*nQuadraturePoints_elementBoundary*
nnz +
13124 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace +
13128 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary + k] +=
13131 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
13136 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 2)
13139 penalty[ebNE*nQuadraturePoints_elementBoundary + k]
13141 (psi_n[ebNE*nQuadraturePoints_elementBoundary + k]
13143 bc_psi_n[ebNE*nQuadraturePoints_elementBoundary + k]);
13147 assert(isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 1);
13149 penalty[ebNE*nQuadraturePoints_elementBoundary + k]
13151 (psi_w[ebNE*nQuadraturePoints_elementBoundary + k]
13153 bc_psi_w[ebNE*nQuadraturePoints_elementBoundary + k]);
13156 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary +k] +=
13164 double h_l,
double h_r,
13165 double u_l,
double u_r,
13166 double c_l,
double c_r,
13168 double*
phi,
double* dphi,
double* u_f,
13169 int* w_1,
int* w_2)
13171 double phi_l,dphi_l,phi_r,dphi_r,
c;
13175 phi_l = u_l + 2.0*(c_l -
c);
13181 phi_l = u_l - (h - h_l)*sqrt(0.5*g*(1.0/h+1.0/h_l));
13182 dphi_l = -sqrt(0.5*g*(1.0/h+1.0/h_l)) - (h - h_l)*(0.5/sqrt(0.5*g*(1.0/h+1.0/h_l)))*(-0.5*g/(h*h));
13187 phi_r = u_r - 2.0*(c_r -
c);
13193 phi_r = u_r + (h - h_r)*sqrt(g*(1.0/h+1.0/h_r)/2.0);
13194 dphi_r = sqrt(0.5*g*(1.0/h+1.0/h_r)) + (h - h_r)*(0.5/sqrt(0.5*g*(1.0/h+1.0/h_r)))*(-0.5*g/(h*h));
13197 *
phi = phi_l - phi_r;
13198 *dphi = dphi_l - dphi_r;
13203 double h_eps,
double tol_u,
13205 double h_l,
double h_r,
13206 double hu_l,
double hu_r,
13207 double* h_G,
double* u_G)
13212 h_m,u_m,c_m,u_ml,u_mr,
13213 phi_m,dphi_m,phi_m0,dh_m,
13215 sl_1,sl_2,sr_1,sr_2;
13236 h_m = (1.0/(16.0*g))*pow(u_l - u_r + 2.0*(c_l + c_r),2);
13237 u_ml = u_l + 2.0*c_l;
13238 u_mr = u_r - 2.0*c_r;
13240 printf(
"%12.5e %12.5e %12.5e\n",h_m,h_l,h_r);
13241 if (h_l < h_eps || h_r < h_eps)
13251 u_m = u_r + u_l - 2.0*(c_r - c_l);
13254 else if (u_ml <= u_mr)
13262 else if (h_m <= h_l && h_m <= h_r)
13265 u_m = u_l + 2.0*(c_l - c_m);
13269 printf(
"picking 2 rarefactions %i %i %12.5e %12.5e \n",w_1,w_2,h_m,u_m);
13273 tol_u=fmin(fabs(u_l),fabs(u_r))*1.0e-8+1.0e-8;
13274 shallowWater_phi(g,h_l,h_r,u_l,u_r,c_l,c_r,h_m,&phi_m,&dphi_m,&u_m,&w_1,&w_2);
13276 while (fabs(phi_m) > tol_u)
13278 dh_m = -phi_m/dphi_m;
13280 shallowWater_phi(g,h_l,h_r,u_l,u_r,c_l,c_r,h_m,&phi_m,&dphi_m,&u_m,&w_1,&w_2);
13283 printf(
"wave types from newton %i %i \n",w_1,w_2);
13298 if (fabs(h_l - h_m) <= 1.0e-10)
13301 s_1 = (h_l * u_l - h_m * u_m)/(h_l - h_m);
13312 if (fabs(h_r - h_m) <= 1.0e-10)
13315 s_2 = (h_r*u_r - h_m*u_m)/(h_r - h_m);
13326 if (sl_1 < 0.0 && sr_1 > 0.0)
13328 *h_G = (1.0/(9.0*g))*pow(u_l + 2.0*c_l,2);
13329 *u_G = u_l - 2.0*(sqrt(g*(*h_G)) - c_l);
13331 printf(
"1-wave transonic rarefaction");
13333 else if (sl_2 < 0.0 && sr_2 > 0.0)
13335 *h_G = (1.0/(9.0*g))*pow(u_r - 2.0*c_r,2);
13336 *u_G = u_r + 2.0*(sqrt(g*(*h_G)) - c_r);
13338 printf(
"2-wave transonic rarefaction");
13340 else if (sl_1 > 0.0)
13343 printf(
"1-wave supersonic");
13347 else if (sr_2 < 0.0)
13350 printf(
"2-wave supersonic");
13357 printf(
"intermediate state");
13362 printf(
"%12.5e %12.5e %12.5e %12.5e\n",sl_1,sr_1,sl_2,sr_2);
13366 int nElementBoundaries_element,
13367 int nQuadraturePoints_elementBoundary,
13371 int* interiorElementBoundaries,
13372 int* elementBoundaryElements,
13373 int* elementBoundaryLocalElementBoundaries,
13380 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,verbose=0;
13381 double h_l,h_r,hu_l,hu_r,h_G,u_G,n_lr;
13382 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
13384 ebN = interiorElementBoundaries[ebNI];
13385 left_eN_global = elementBoundaryElements[ebN*2+0];
13386 right_eN_global = elementBoundaryElements[ebN*2+1];
13387 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
13388 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
13389 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13391 n_lr =
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13392 left_ebN_element*nQuadraturePoints_elementBoundary+
13395 h_l = fmax(0.0,h[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13396 left_ebN_element*nQuadraturePoints_elementBoundary+
13398 h_r = fmax(0.0,h[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13399 right_ebN_element*nQuadraturePoints_elementBoundary+
13401 hu_l = hu[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13402 left_ebN_element*nQuadraturePoints_elementBoundary+
13404 hu_r = hu[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13405 right_ebN_element*nQuadraturePoints_elementBoundary+
13409 flux_h[ebN*nQuadraturePoints_elementBoundary+
13411 flux_hu[ebN*nQuadraturePoints_elementBoundary+
13412 k] = (h_G*u_G*u_G + 0.5*g*h_G*h_G)*n_lr;
13417 int nQuadraturePoints_elementBoundary,
13429 int ebNE,k,verbose=0;
13430 double h_l,h_r,hu_l,hu_r,h_G,u_G,n_lr;
13431 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
13433 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13435 n_lr =
n[ebNE*nQuadraturePoints_elementBoundary+
13438 h_l = h_lv[ebNE*nQuadraturePoints_elementBoundary+
13440 h_r = h_rv[ebNE*nQuadraturePoints_elementBoundary+
13442 hu_l = hu_lv[ebNE*nQuadraturePoints_elementBoundary+
13444 hu_r = hu_rv[ebNE*nQuadraturePoints_elementBoundary+
13448 flux_h[ebNE*nQuadraturePoints_elementBoundary+
13450 flux_hu[ebNE*nQuadraturePoints_elementBoundary+
13451 k] = (h_G*u_G*u_G + 0.5*g*h_G*h_G)*n_lr;
13457 int nElementBoundaries_element,
13458 int nQuadraturePoints_elementBoundary,
13462 int* interiorElementBoundaries,
13463 int* elementBoundaryElements,
13464 int* elementBoundaryLocalElementBoundaries,
13473 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,verbose=0;
13474 double h_l,h_r,hu_l,hu_r,hv_l,hv_r,h_G,u_G,v_G,nx_lr,ny_lr,hVn_l,hVn_r,hVt_l,hVt_r,Vn_G,Vt_G,hVt_G;
13475 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
13477 ebN = interiorElementBoundaries[ebNI];
13478 left_eN_global = elementBoundaryElements[ebN*2+0];
13479 right_eN_global = elementBoundaryElements[ebN*2+1];
13480 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
13481 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
13482 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13484 nx_lr =
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*2+
13485 left_ebN_element*nQuadraturePoints_elementBoundary*2+
13488 ny_lr =
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*2+
13489 left_ebN_element*nQuadraturePoints_elementBoundary*2+
13492 h_l = h[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13493 left_ebN_element*nQuadraturePoints_elementBoundary+
13495 h_r = h[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13496 right_ebN_element*nQuadraturePoints_elementBoundary+
13498 hu_l = hu[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13499 left_ebN_element*nQuadraturePoints_elementBoundary+
13501 hu_r = hu[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13502 right_ebN_element*nQuadraturePoints_elementBoundary+
13504 hv_l = hv[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13505 left_ebN_element*nQuadraturePoints_elementBoundary+
13507 hv_r = hv[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13508 right_ebN_element*nQuadraturePoints_elementBoundary+
13511 hVn_l = nx_lr*hu_l + ny_lr*hv_l;
13512 hVt_l = ny_lr*hu_l - nx_lr*hv_l;
13513 hVn_r = nx_lr*hu_r + ny_lr*hv_r;
13514 hVt_r = ny_lr*hu_r - nx_lr*hv_r;
13528 u_G = Vn_G*nx_lr + Vt_G*ny_lr;
13529 v_G = Vn_G*ny_lr - Vt_G*nx_lr;
13531 flux_h[ebN*nQuadraturePoints_elementBoundary+
13532 k] = h_G*u_G*nx_lr + h_G*v_G*ny_lr;
13533 flux_hu[ebN*nQuadraturePoints_elementBoundary+
13534 k] = (h_G*u_G*u_G + 0.5*g*h_G*h_G)*nx_lr + h_G*u_G*v_G*ny_lr;
13535 flux_hv[ebN*nQuadraturePoints_elementBoundary+
13536 k] = h_G*u_G*v_G*nx_lr + (h_G*v_G*v_G + 0.5*g*h_G*h_G)*ny_lr;
13542 int nQuadraturePoints_elementBoundary,
13557 int ebNE,k,verbose=0;
13558 double h_l,h_r,hu_l,hu_r,hv_l,hv_r,h_G,u_G,v_G,nx_lr,ny_lr,hVn_l,hVn_r,hVt_l,hVt_r,Vn_G,Vt_G,hVt_G;
13559 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
13561 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13563 nx_lr =
n[ebNE*nQuadraturePoints_elementBoundary*2+
13566 ny_lr =
n[ebNE*nQuadraturePoints_elementBoundary*2+
13569 h_l = h_lq[ebNE*nQuadraturePoints_elementBoundary+
13571 h_r = h_rq[ebNE*nQuadraturePoints_elementBoundary+
13573 hu_l = hu_lq[ebNE*nQuadraturePoints_elementBoundary+
13575 hu_r = hu_rq[ebNE*nQuadraturePoints_elementBoundary+
13577 hv_l = hv_lq[ebNE*nQuadraturePoints_elementBoundary+
13579 hv_r = hv_rq[ebNE*nQuadraturePoints_elementBoundary+
13582 hVn_l = nx_lr*hu_l + ny_lr*hv_l;
13583 hVt_l = ny_lr*hu_l - nx_lr*hv_l;
13584 hVn_r = nx_lr*hu_r + ny_lr*hv_r;
13585 hVt_r = ny_lr*hu_r - nx_lr*hv_r;
13599 u_G = Vn_G*nx_lr + Vt_G*ny_lr;
13600 v_G = Vn_G*ny_lr - Vt_G*nx_lr;
13601 flux_h[ebNE*nQuadraturePoints_elementBoundary+
13602 k] = h_G*u_G*nx_lr + h_G*v_G*ny_lr;
13603 flux_hu[ebNE*nQuadraturePoints_elementBoundary+
13604 k] = (h_G*u_G*u_G + 0.5*g*h_G*h_G)*nx_lr + h_G*u_G*v_G*ny_lr;
13605 flux_hv[ebNE*nQuadraturePoints_elementBoundary+
13606 k] = h_G*u_G*v_G*nx_lr + (h_G*v_G*v_G + 0.5*g*h_G*h_G)*ny_lr;
13611 int nElementBoundaries_element,
13612 int nQuadraturePoints_elementBoundary,
13616 int* interiorElementBoundaries,
13617 int* elementBoundaryElements,
13618 int* elementBoundaryLocalElementBoundaries,
13625 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,verbose=0;
13626 double h_l,h_r,hu_l,hu_r,u_l,u_r,n_lr,h_G,u_G;
13628 double h_Roe,u_Roe,
13629 lambda_1L,lambda_2R,
13630 lambda_1Roe,lambda_2Roe,
13631 lambda_min,lambda_max,
13642 double lambda_diff;
13643 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
13645 ebN = interiorElementBoundaries[ebNI];
13646 left_eN_global = elementBoundaryElements[ebN*2+0];
13647 right_eN_global = elementBoundaryElements[ebN*2+1];
13648 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
13649 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
13650 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13652 n_lr =
n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13653 left_ebN_element*nQuadraturePoints_elementBoundary+
13656 h_l = fmax(0.0,h[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13657 left_ebN_element*nQuadraturePoints_elementBoundary+
13659 h_r = fmax(0.0,h[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13660 right_ebN_element*nQuadraturePoints_elementBoundary+
13662 hu_l = hu[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13663 left_ebN_element*nQuadraturePoints_elementBoundary+
13665 hu_r = hu[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
13666 right_ebN_element*nQuadraturePoints_elementBoundary+
13668 u_l = 0.0; u_r =0.0; u_Roe = 0.0;
13670 u_l = n_lr*hu_l/h_l;
13674 u_r = n_lr*hu_r/h_r;
13678 h_Roe = 0.5*(h_l+h_r);
13679 if (h_l + h_r > h_eps)
13680 u_Roe = (sqrt(h_l)*u_l + sqrt(h_r)*u_r)/(sqrt(h_l)+sqrt(h_r));
13682 lambda_1Roe = u_Roe - sqrt(h_Roe*g); lambda_2Roe = u_Roe + sqrt(h_Roe*g);
13684 lambda_1L = u_l - sqrt(g*h_l); lambda_2R = u_r + sqrt(g*h_r);
13686 lambda_min = fmin(lambda_1L,lambda_1Roe);
13687 lambda_max = fmax(lambda_2R,lambda_2Roe);
13694 if (lambda_min >= 0.0)
13697 flux_h[ebN*nQuadraturePoints_elementBoundary+
13699 flux_hu[ebN*nQuadraturePoints_elementBoundary+
13700 k] = (h_l*u_l*u_l + 0.5*g*h_l*h_l)*n_lr;
13717 else if (lambda_max <= 0.0)
13720 flux_h[ebN*nQuadraturePoints_elementBoundary+
13722 flux_hu[ebN*nQuadraturePoints_elementBoundary+
13723 k] = (h_r*u_r*u_r + 0.5*g*h_r*h_r)*n_lr;
13742 lambda_diff = lambda_max-lambda_min;
13743 assert(fabs(lambda_diff) > 0.0);
13748 h_LR = (lambda_max*h_r - lambda_min*h_l
13749 -n_lr*(h_r*u_r-h_l*u_l))/lambda_diff;
13750 assert(h_LR >= 0.0);
13751 hu_LR= (lambda_max*h_r*u_r - lambda_min*h_l*u_l
13752 -n_lr*(h_r*u_r*u_r + 0.5*g*h_r*h_r - h_l*u_l*u_l - 0.5*g*h_l*h_l))/lambda_diff;
13754 flux_h[ebN*nQuadraturePoints_elementBoundary+k] =
13755 (n_lr*(lambda_max*h_l*u_l-lambda_min*h_r*u_r) + (h_r-h_l)*lambda_max*lambda_min)/lambda_diff;
13756 flux_hu[ebN*nQuadraturePoints_elementBoundary+k] =
13757 (n_lr*(lambda_max*(h_l*u_l*u_l + 0.5*g*h_l*h_l)-lambda_min*(h_r*u_r*u_r + 0.5*g*h_r*h_r)) + (h_r*u_r-h_l*u_l)*lambda_max*lambda_min)/lambda_diff;
13805 int nQuadraturePoints_elementBoundary,
13817 int ebNE,k,verbose=0;
13818 double h_l,h_r,hu_l,hu_r,u_l,u_r,n_lr;
13819 double h_Roe,u_Roe,
13820 lambda_1L,lambda_2R,
13821 lambda_1Roe,lambda_2Roe,
13822 lambda_min,lambda_max,
13833 double lambda_min_p,lambda_max_p,lambda_min_m,lambda_max_m,lambda_diff,
pos,
neg,mid;
13834 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
13836 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
13838 n_lr =
n[ebNE*nQuadraturePoints_elementBoundary+
13841 h_l = fmax(0.0,h_lv[ebNE*nQuadraturePoints_elementBoundary+
13843 h_r = fmax(0.0,h_rv[ebNE*nQuadraturePoints_elementBoundary+
13845 hu_l = hu_lv[ebNE*nQuadraturePoints_elementBoundary+
13847 hu_r = hu_rv[ebNE*nQuadraturePoints_elementBoundary+
13850 u_l = 0.0; u_r =0.0; u_Roe = 0.0;
13852 u_l = n_lr*hu_l/h_l;
13856 u_r = n_lr*hu_r/h_r;
13860 h_Roe = 0.5*(h_l+h_r);
13861 if (h_l + h_r > h_eps)
13862 u_Roe = (sqrt(h_l)*u_l + sqrt(h_r)*u_r)/(sqrt(h_l)+sqrt(h_r));
13864 lambda_1Roe = u_Roe - sqrt(h_Roe*g); lambda_2Roe = u_Roe + sqrt(h_Roe*g);
13866 lambda_1L = u_l - sqrt(g*h_l); lambda_2R = u_r + sqrt(g*h_r);
13868 lambda_min = fmin(lambda_1L,lambda_1Roe);
13869 lambda_max = fmax(lambda_2R,lambda_2Roe);
13872 if (lambda_min >= 0.0)
13875 flux_h[ebNE*nQuadraturePoints_elementBoundary+
13877 flux_hu[ebNE*nQuadraturePoints_elementBoundary+
13878 k] = (h_l*u_l*u_l + 0.5*g*h_l*h_l)*n_lr;
13882 else if (lambda_max <= 0.0)
13885 flux_h[ebNE*nQuadraturePoints_elementBoundary+
13886 k] = h_r*u_r*n_lr;;
13887 flux_hu[ebNE*nQuadraturePoints_elementBoundary+
13888 k] = (h_r*u_r*u_r + 0.5*g*h_r*h_r)*n_lr;
13894 lambda_diff = lambda_max-lambda_min;
13895 assert(fabs(lambda_diff) > 0.0);
13900 h_LR = (lambda_max*h_r - lambda_min*h_l
13901 -n_lr*(h_r*u_r-h_l*u_l))/lambda_diff;
13902 hu_LR= (lambda_max*hu_r - lambda_min*hu_l
13903 -n_lr*(h_r*u_r*u_r + 0.5*g*h_r*h_r - h_l*u_l*u_l - 0.5*g*h_l*h_l))/lambda_diff;
13907 h_LR = 0.0; hu_LR = 0.0;
13914 flux_h[ebNE*nQuadraturePoints_elementBoundary+k] =
13915 (n_lr*(lambda_max*hu_l-lambda_min*hu_r) + (h_r-h_l)*lambda_max*lambda_min)/lambda_diff;
13916 flux_hu[ebNE*nQuadraturePoints_elementBoundary+k] =
13917 (n_lr*(lambda_max*(h_l*u_l*u_l + 0.5*g*h_l*h_l)-lambda_min*(h_r*u_r*u_r + 0.5*g*h_r*h_r)) + (hu_r-hu_l)*lambda_max*lambda_min)/lambda_diff;
13938 int nElementBoundaries_element,
13939 int nQuadraturePoints_elementBoundary,
13940 int nQuadraturePoints_element,
13943 int* interiorElementBoundaries,
13944 int* elementBoundaryElements,
13945 int* elementBoundaryLocalElementBoundaries,
13951 double* dH_element,
13953 double* dflux_left,
13954 double* dflux_right)
13956 int ebNI,ebN,left_eN_global,right_eN_global,left_ebN_element,right_ebN_element,k,J;
13957 double left_flux,right_flux,u_left,u_right,left_speed,right_speed,
13958 tmp_left,tmp_right,minSpeed_element,maxSpeed_element,minSpeed,
13962 for(ebNI=0;ebNI<nInteriorElementBoundaries_global;ebNI++)
13964 ebN = interiorElementBoundaries[ebNI];
13965 left_eN_global = elementBoundaryElements[ebN*2+0];
13966 right_eN_global = elementBoundaryElements[ebN*2+1];
13967 left_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+0];
13968 right_ebN_element = elementBoundaryLocalElementBoundaries[ebN*2+1];
13986 minSpeed_element=0.0; maxSpeed_element=0.0;
13987 for(k=0; k < nQuadraturePoints_element; k++)
13989 tmp_left = 0.0; tmp_right = 0.0;
13994 for(J=0;J<nSpace;J++)
13998 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
13999 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14003 dH_element[left_eN_global*nQuadraturePoints_element*nSpace+
14008 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14009 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14013 dH_element[right_eN_global*nQuadraturePoints_element*nSpace+
14017 if (tmp_left < minSpeed_element || k == 0)
14018 minSpeed_element = tmp_left;
14019 if (tmp_right < minSpeed_element)
14020 minSpeed_element = tmp_right;
14021 if (tmp_right > maxSpeed_element || k == 0)
14022 maxSpeed_element = tmp_right;
14023 if (tmp_left > maxSpeed_element)
14024 maxSpeed_element = tmp_left;
14027 minSpeed = minSpeed_element; maxSpeed = maxSpeed_element;
14028 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14033 for(J=0;J<nSpace;J++)
14037 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14038 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14042 dH[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14043 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14048 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14049 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14053 dH[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14054 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14058 if (tmp_left < minSpeed)
14059 minSpeed = tmp_left;
14060 if (tmp_right < minSpeed)
14061 minSpeed = tmp_right;
14062 if (tmp_right > maxSpeed)
14063 maxSpeed = tmp_right;
14064 if (tmp_left > maxSpeed)
14065 maxSpeed = tmp_left;
14068 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14074 for(J=0;J<nSpace;J++)
14078 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14079 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14083 dH[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14084 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14089 n[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14090 left_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14094 dH[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary*nSpace+
14095 right_ebN_element*nQuadraturePoints_elementBoundary*nSpace+
14100 left_speed = minSpeed; right_speed = maxSpeed;
14101 if (speedEvalFlag == 1)
14103 left_speed = 0.5*(tmp_left + minSpeed); right_speed = 0.5*(tmp_right + maxSpeed);
14105 else if (speedEvalFlag == 2)
14107 left_speed = minSpeed_element; right_speed = maxSpeed_element;
14109 left_flux = 0.0; right_flux = 0.0;
14110 u_left =
u[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
14111 left_ebN_element*nQuadraturePoints_elementBoundary+
14113 u_right=
u[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary+
14114 right_ebN_element*nQuadraturePoints_elementBoundary+
14116 if (left_speed < 0.0)
14118 left_flux = fabs(left_speed)*(u_left-u_right);
14119 flux[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14120 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
14121 dflux_left[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14122 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = fabs(left_speed);
14123 dflux_right[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14124 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] =-fabs(left_speed);
14130 flux[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14131 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = left_flux;
14132 dflux_left[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14133 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
14134 dflux_right[left_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14135 left_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
14138 if (right_speed > 0.0)
14140 right_flux = fabs(right_speed)*(u_right-u_left);
14141 flux[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14142 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = right_flux;
14143 dflux_left[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14144 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = -fabs(right_speed);
14145 dflux_right[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14146 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = fabs(right_speed);
14151 flux[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14152 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = right_flux;
14153 dflux_left[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14154 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
14155 dflux_right[right_eN_global*nElementBoundaries_element*nQuadraturePoints_elementBoundary +
14156 right_ebN_element*nQuadraturePoints_elementBoundary+ k ] = 0.0;
14172 else if (
phi < -eps)
14177 H = 0.5*(1.0 +
phi/eps + sin(M_PI*
phi/eps)/M_PI);
14186 HI=
phi - eps + 0.5*(eps + 0.5*eps*eps/eps - eps*cos(M_PI*eps/eps)/(M_PI*M_PI)) - 0.5*((-eps) + 0.5*(-eps)*(-eps)/eps - eps*cos(M_PI*(-eps)/eps)/(M_PI*M_PI));
14188 else if (
phi < -eps)
14194 HI = 0.5*(
phi + 0.5*
phi*
phi/eps - eps*cos(M_PI*
phi/eps)/(M_PI*M_PI)) - 0.5*((-eps) + 0.5*(-eps)*(-eps)/eps - eps*cos(M_PI*(-eps)/eps)/(M_PI*M_PI));
14204 else if (
phi < -eps)
14207 d = 0.5*(1.0 + cos(M_PI*
phi/eps))/eps;
14212 int nQuadraturePoints_elementBoundary,
14214 int* exteriorElementBoundaries,
14215 int* elementBoundaryElements,
14216 int* elementBoundaryLocalElementBoundaries,
14217 int* isSeepageFace,
14218 int* isDOFBoundary,
14220 double* elementDiameters,
14225 double* advectiveFlux,
14226 double* diffusiveFlux)
14228 int ebNE,ebN,eN_global,k,J;
14229 double flow_direction,eps;
14230 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14232 ebN = exteriorElementBoundaries[ebNE];
14233 eN_global = elementBoundaryElements[ebN*2+0];
14234 eps=epsFact*elementDiameters[ebN];
14235 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14237 if (isSeepageFace[ebNE])
14239 flow_direction=0.0;
14240 for(J=0;J<nSpace;J++)
14244 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14248 (g[J]-grad_u[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14252 isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] = 1;
14253 if (flow_direction < 0.0 ||
u[ebNE*nQuadraturePoints_elementBoundary+k] < 0.0)
14255 isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] = 0;
14256 advectiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14258 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14261 else if (
u[ebNE*nQuadraturePoints_elementBoundary+k] < eps)
14263 isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] = 1;
14264 advectiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14266 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14276 int nExteriorElementBoundaries_global,
14277 int nQuadraturePoints_elementBoundary,
14279 int* isSeepageFace,
14280 int* isDOFBoundary,
14288 double* diffusiveFlux)
14290 int ebNE,k,I,m,
nnz=rowptr[nSpace];
14292 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14294 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14296 if (isSeepageFace[ebNE] || isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k])
14299 for(I=0;I<nSpace;I++)
14302 v_I = K_rho_g[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14306 for(m=rowptr[I];m<rowptr[I+1];m++)
14310 K[ebNE*nQuadraturePoints_elementBoundary*
nnz+
14314 grad_psi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14321 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14326 if (isSeepageFace[ebNE])
14327 bc_u[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
14328 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+k] =
14331 penalty[ebNE*nQuadraturePoints_elementBoundary+k]
14333 (
u[ebNE*nQuadraturePoints_elementBoundary+k]
14335 bc_u[ebNE*nQuadraturePoints_elementBoundary+k]);
14343 if (isSeepageFace[ebNE])
14346 if (diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+k] > 0.0)
14352 isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] = 1;
14356 isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] = 0;
14357 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
14367 int nExteriorElementBoundaries_global,
14368 int nQuadraturePoints_elementBoundary,
14369 int nDOF_trial_element,
14371 int* isDOFBoundary,
14382 double* fluxJacobian)
14384 int ebNE,k,j,I,m,
nnz=rowptr[nSpace];
14385 double dFlux_j,dv_I_j;
14386 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14388 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14390 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k])
14392 for (j=0;j<nDOF_trial_element;j++)
14395 for(I=0;I<nSpace;I++)
14398 dv_I_j = dK_rho_g[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14402 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14403 k*nDOF_trial_element+
14406 for(m=rowptr[I];m<rowptr[I+1];m++)
14410 K[ebNE*nQuadraturePoints_elementBoundary*
nnz+
14414 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14415 k*nDOF_trial_element*nSpace+
14419 dK[ebNE*nQuadraturePoints_elementBoundary*
nnz+
14423 grad_psi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14426 *
v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14427 k*nDOF_trial_element+
14433 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14438 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14439 k*nDOF_trial_element+
14444 penalty[ebNE*nQuadraturePoints_elementBoundary+k]
14445 *
v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14446 k*nDOF_trial_element+
14455 int nQuadraturePoints_elementBoundary,
14456 int nDOF_trial_element,
14458 int* exteriorElementBoundaries,
14459 int* elementBoundaryElements,
14460 int* elementBoundaryLocalElementBoundaries,
14461 int* isSeepageFace,
14463 double* elementDiameters,
14468 double* advectiveFlux,
14469 double* diffusiveFlux,
14471 double* fluxJacobian)
14473 int ebNE,ebN,eN_global,k,J,j;
14474 double flow_direction,eps;
14475 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14477 ebN = exteriorElementBoundaries[ebNE];
14478 eN_global = elementBoundaryElements[ebN*2+0];
14479 eps=epsFact*elementDiameters[ebN];
14480 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14482 if (isSeepageFace[ebNE])
14484 flow_direction=0.0;
14485 for(J=0;J<nSpace;J++)
14489 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14493 (g[J]-grad_u[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14497 for(j=0;j<nDOF_trial_element;j++)
14499 if (flow_direction < 0.0 ||
u[ebNE*nQuadraturePoints_elementBoundary+k] < 0.0)
14501 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14502 k*nDOF_trial_element+
14505 else if (
u[ebNE*nQuadraturePoints_elementBoundary+k] < eps)
14507 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14508 k*nDOF_trial_element+
14510 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14511 k*nDOF_trial_element+
14512 j] += (advectiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14514 diffusiveFlux[ebNE*nQuadraturePoints_elementBoundary+
14519 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14520 k*nDOF_trial_element+
14531 int nQuadraturePoints_elementBoundary,
14533 int* exteriorElementBoundaries,
14534 int* elementBoundaryElements,
14535 int* elementBoundaryLocalElementBoundaries,
14536 int *isDOFBoundary_u,
14537 int *isDOFBoundary_v,
14538 int *isDOFBoundary_w,
14548 double* stressFlux_u,
14549 double* stressFlux_v,
14550 double* stressFlux_w)
14552 int ebNE,k,nSpace2=nSpace*nSpace;
14553 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14555 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14558 penalty[ebNE*nQuadraturePoints_elementBoundary+k] = 1.0e5;
14560 double *normal =
n + ebNE*nQuadraturePoints_elementBoundary*nSpace+k*nSpace;
14561 double *stress = sigma + ebNE*nQuadraturePoints_elementBoundary*nSpace2+k*nSpace2;
14562 if (isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14564 double u_jump = -penalty[ebNE*nQuadraturePoints_elementBoundary+k]
14566 (
u[ebNE*nQuadraturePoints_elementBoundary+k]
14567 - bc_u[ebNE*nQuadraturePoints_elementBoundary+k]);
14568 stressFlux_u[ebNE*nQuadraturePoints_elementBoundary+k] = -(stress[0]*normal[0] + stress[1]*normal[1] + stress[2]*normal[2] + u_jump);
14571 if (isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14573 double v_jump = -penalty[ebNE*nQuadraturePoints_elementBoundary+k]*
14574 (
v[ebNE*nQuadraturePoints_elementBoundary+k]
14575 - bc_v[ebNE*nQuadraturePoints_elementBoundary+k]);
14576 stressFlux_v[ebNE*nQuadraturePoints_elementBoundary+k] = -(stress[3]*normal[0] + stress[4]*normal[1] + stress[5]*normal[2] + v_jump);
14579 if (isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14581 double w_jump = -penalty[ebNE*nQuadraturePoints_elementBoundary+k]
14583 (
w[ebNE*nQuadraturePoints_elementBoundary+k]
14584 - bc_w[ebNE*nQuadraturePoints_elementBoundary+k]);
14585 stressFlux_w[ebNE*nQuadraturePoints_elementBoundary+k] = -(stress[6]*normal[0] + stress[7]*normal[1] + stress[8]*normal[2] + w_jump);
14593 int nQuadraturePoints_elementBoundary,
14594 int nDOF_trial_element,
14596 int* exteriorElementBoundaries,
14597 int* elementBoundaryElements,
14598 int* elementBoundaryLocalElementBoundaries,
14599 int* isDOFBoundary_u,
14600 int* isDOFBoundary_v,
14601 int* isDOFBoundary_w,
14602 int* isStressBoundary_u,
14603 int* isStressBoundary_v,
14604 int* isStressBoundary_w,
14606 double* dstress_u_u,
14607 double* dstress_u_v,
14608 double* dstress_u_w,
14609 double* dstress_v_u,
14610 double* dstress_v_v,
14611 double* dstress_v_w,
14612 double* dstress_w_u,
14613 double* dstress_w_v,
14614 double* dstress_w_w,
14618 double* fluxJacobian_u_u,
14619 double* fluxJacobian_u_v,
14620 double* fluxJacobian_u_w,
14621 double* fluxJacobian_v_u,
14622 double* fluxJacobian_v_v,
14623 double* fluxJacobian_v_w,
14624 double* fluxJacobian_w_u,
14625 double* fluxJacobian_w_v,
14626 double* fluxJacobian_w_w)
14629 int ebNE,k,j,I,J,nSpace2=nSpace*nSpace;
14631 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14635 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14637 if(isDOFBoundary_u[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14639 for(j=0;j<nDOF_trial_element;j++)
14641 fluxJacobian_u_u[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14642 k*nDOF_trial_element+
14644 =penalty[ebNE*nQuadraturePoints_elementBoundary+k]
14646 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14647 k*nDOF_trial_element+
14649 for (I=0;I<nSpace;I++)
14650 for (J=0;J<nSpace;J++)
14652 fluxJacobian_u_u[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14653 k*nDOF_trial_element+
14656 dstress_u_u[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14661 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14662 k*nDOF_trial_element*nSpace+
14666 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14669 fluxJacobian_u_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14670 k*nDOF_trial_element+
14673 dstress_u_v[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14678 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14679 k*nDOF_trial_element*nSpace+
14683 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14686 fluxJacobian_u_w[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14687 k*nDOF_trial_element+
14690 dstress_u_w[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14695 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14696 k*nDOF_trial_element*nSpace+
14700 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14706 if(isDOFBoundary_v[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14708 for(j=0;j<nDOF_trial_element;j++)
14710 fluxJacobian_v_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14711 k*nDOF_trial_element+
14713 =penalty[ebNE*nQuadraturePoints_elementBoundary+
14716 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14717 k*nDOF_trial_element+
14719 for (I=0;I<nSpace;I++)
14720 for (J=0;J<nSpace;J++)
14722 fluxJacobian_v_u[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14723 k*nDOF_trial_element+
14726 dstress_v_u[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14731 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14732 k*nDOF_trial_element*nSpace+
14736 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14739 fluxJacobian_v_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14740 k*nDOF_trial_element+
14743 dstress_v_v[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14748 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14749 k*nDOF_trial_element*nSpace+
14753 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14756 fluxJacobian_v_w[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14757 k*nDOF_trial_element+
14760 dstress_v_w[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14765 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14766 k*nDOF_trial_element*nSpace+
14770 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14776 if(isDOFBoundary_w[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
14778 for(j=0;j<nDOF_trial_element;j++)
14780 fluxJacobian_w_w[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14781 k*nDOF_trial_element+
14784 penalty[ebNE*nQuadraturePoints_elementBoundary+
14787 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14788 k*nDOF_trial_element+
14790 for (I=0;I<nSpace;I++)
14791 for (J=0;J<nSpace;J++)
14793 fluxJacobian_w_u[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14794 k*nDOF_trial_element+
14797 dstress_w_u[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14802 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14803 k*nDOF_trial_element*nSpace+
14807 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14810 fluxJacobian_w_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14811 k*nDOF_trial_element+
14814 dstress_w_v[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14819 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14820 k*nDOF_trial_element*nSpace+
14824 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14827 fluxJacobian_w_w[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
14828 k*nDOF_trial_element+
14831 dstress_w_w[ebNE*nQuadraturePoints_elementBoundary*nSpace2+
14836 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
14837 k*nDOF_trial_element*nSpace+
14841 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14856 double penalty_floor,
14857 int nExteriorElementBoundaries_global,
14858 int nQuadraturePoints_elementBoundary,
14862 int* exteriorElementBoundaries,
14863 int* elementBoundaryElements,
14864 int* elementBoundaryLocalElementBoundaries,
14865 int* isDOFBoundary,
14866 int* fluxBoundaryFlag,
14869 double* bc_grad_phi,
14877 int ebNE,k,I,m,
nnz=rowptr[nSpace];
14878 double diffusiveVelocityComponent_I,penaltyFlux,max_a;
14879 double potential_gradient=0.0;
14880 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14882 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14885 potential_gradient=0.;
14886 for (I=0; I < nSpace; I++)
14888 potential_gradient += grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace +
14891 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
14896 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1 || (potential_gradient > 0.0 && fluxBoundaryFlag == 1))
14898 flux[ebNE*nQuadraturePoints_elementBoundary+k] = 0.0;
14900 for(I=0;I<nSpace;I++)
14902 diffusiveVelocityComponent_I=0.0;
14903 for(m=rowptr[I];m<rowptr[I+1];m++)
14905 diffusiveVelocityComponent_I
14907 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
14911 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14912 k*nSpace+colind[m]];
14913 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
14917 flux[ebNE*nQuadraturePoints_elementBoundary+k]
14919 diffusiveVelocityComponent_I
14921 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
14925 max_a = fmax(penalty_floor,max_a);
14926 if (isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k]==1)
14928 penaltyFlux = penalty[ebNE*nQuadraturePoints_elementBoundary+
14931 (
u[ebNE*nQuadraturePoints_elementBoundary+
14934 bc_u[ebNE*nQuadraturePoints_elementBoundary+
14937 if (scale_penalty) penaltyFlux *= max_a;
14938 flux[ebNE*nQuadraturePoints_elementBoundary+k] += penaltyFlux;
14946 double penalty_floor,
14947 int nExteriorElementBoundaries_global,
14948 int nQuadraturePoints_elementBoundary,
14949 int nDOF_trial_element,
14954 int* exteriorElementBoundaries,
14955 int* elementBoundaryElements,
14956 int* elementBoundaryLocalElementBoundaries,
14957 int* isDOFBoundary,
14958 int* fluxBoundaryFlag,
14967 double* fluxJacobian)
14969 int ebNE,ebN,eN_global,k,j,j_global,I,m,
nnz=rowptr[nSpace];
14970 double Jacobian,diffusiveVelocityComponent_I_Jacobian,diffusiveVelocityComponent_I_Jacobian2,max_a;
14971 double potential_gradient=0.;
14972 for(ebNE=0;ebNE<nExteriorElementBoundaries_global;ebNE++)
14974 ebN = exteriorElementBoundaries[ebNE];
14975 eN_global = elementBoundaryElements[ebN*2+0];
14976 for(k=0;k<nQuadraturePoints_elementBoundary;k++)
14979 potential_gradient=0.;
14980 for (I=0; I < nSpace; I++)
14982 potential_gradient += grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace +
14985 n[ebNE*nQuadraturePoints_elementBoundary*nSpace +
14990 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] >= 1 || (potential_gradient > 0.0 && fluxBoundaryFlag == 1))
14992 for(j=0;j<nDOF_trial_element;j++)
14995 j_global = l2g[eN_global*nDOF_trial_element+j];
14997 for(I=0;I<nSpace;I++)
14999 diffusiveVelocityComponent_I_Jacobian=0.0;
15000 diffusiveVelocityComponent_I_Jacobian2=0.0;
15001 for(m=rowptr[I];m<rowptr[I+1];m++)
15003 diffusiveVelocityComponent_I_Jacobian
15005 da[ebNE*nQuadraturePoints_elementBoundary*
nnz+
15009 grad_phi[ebNE*nQuadraturePoints_elementBoundary*nSpace+
15012 diffusiveVelocityComponent_I_Jacobian2
15014 a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
15018 grad_v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element*nSpace+
15019 k*nDOF_trial_element*nSpace+
15022 max_a = fmax(max_a,a[ebNE*nQuadraturePoints_elementBoundary*
nnz+
15029 (diffusiveVelocityComponent_I_Jacobian
15031 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
15032 k*nDOF_trial_element+
15035 diffusiveVelocityComponent_I_Jacobian2*
15038 n[ebNE*nQuadraturePoints_elementBoundary*nSpace+
15042 max_a = fmax(penalty_floor,max_a);
15044 if(isDOFBoundary[ebNE*nQuadraturePoints_elementBoundary+k] == 1)
15046 double penaltyJacobian = penalty[ebNE*nQuadraturePoints_elementBoundary+
15049 v[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
15050 k*nDOF_trial_element+
15052 if (scale_penalty) penaltyJacobian *= max_a;
15054 Jacobian += penaltyJacobian;
15056 fluxJacobian[ebNE*nQuadraturePoints_elementBoundary*nDOF_trial_element+
15057 k*nDOF_trial_element+