9 int nQuadraturePoints_element,
11 double shockCapturingDiffusion,
12 double* elementDiameter,
13 double* strong_residual,
21 n_grad_u[nQuadraturePoints_element],
24 for(eN=0;eN<nElements_global;eN++)
26 h = elementDiameter[eN];
28 for (k=0;k<nQuadraturePoints_element;k++)
31 for (I=0;I<nSpace;I++)
33 n_grad_u[k] += grad_u[eN*nQuadraturePoints_element*nSpace+k*nSpace+I]*grad_u[eN*nQuadraturePoints_element*nSpace+k*nSpace+I];
35 n_grad_u[k] = sqrt(n_grad_u[k]);
36 num = shockCapturingDiffusion*0.5*h*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
39 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
41 numDiff[eN*nQuadraturePoints_element+k]=0.0;
42 n_R_eN=fmax(n_R_eN,fabs(strong_residual[eN*nQuadraturePoints_element+k]));
45 for (k=0;k<nQuadraturePoints_element;k++)
47 num = shockCapturingDiffusion*0.5*h*n_R_eN;
50 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
52 numDiff[eN*nQuadraturePoints_element+k]=0.0;
53 maxNumDiff = fmax(maxNumDiff,numDiff[eN*nQuadraturePoints_element+k]);
55 for (k=0;k<nQuadraturePoints_element;k++)
56 numDiff[eN*nQuadraturePoints_element+k] = maxNumDiff;
61 int nQuadraturePoints_element,
63 double shockCapturingDiffusion,
64 double* elementDiameter,
65 double* strong_residual,
74 for(eN=0;eN<nElements_global;eN++)
76 h = elementDiameter[eN];
77 for (k=0;k<nQuadraturePoints_element;k++)
80 for (I=0;I<nSpace;I++)
82 n_grad_u += grad_u[eN*nQuadraturePoints_element*nSpace+k*nSpace+I]*grad_u[eN*nQuadraturePoints_element*nSpace+k*nSpace+I];
84 num = shockCapturingDiffusion*0.5*h*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
85 den = sqrt(n_grad_u) + 1.0e-8;
86 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
92 int nQuadraturePoints_element,
93 double shockCapturingDiffusion,
94 double* elementDiameter,
95 double* strong_residual,
100 for(eN=0;eN<nElements_global;eN++)
102 h = elementDiameter[eN];
103 for (k=0;k<nQuadraturePoints_element;k++)
105 numDiff[eN*nQuadraturePoints_element+k] = shockCapturingDiffusion*0.5*h*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
115 int nQuadraturePoints_element,
117 double shockCapturingDiffusion,
118 double* elementDiameter,
119 double* strong_residual,
130 for(eN=0;eN<nElements_global;eN++)
132 h = elementDiameter[eN];
134 for (k=0;k<nQuadraturePoints_element;k++)
136 num = shockCapturingDiffusion*0.5*h*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
137 den = fabs(
H[eN*nQuadraturePoints_element+k]) +
138 fabs(mt[eN*nQuadraturePoints_element+k]);
139 if (den >
num*1.0e-8)
140 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
142 numDiff[eN*nQuadraturePoints_element+k]=0.0;
143 n_R_eN=fmax(n_R_eN,fabs(strong_residual[eN*nQuadraturePoints_element+k]));
167 int nQuadraturePoints_element,
169 double shockCapturingDiffusion,
170 double* elementDiameter,
171 double* strong_residual,
177 double h,
num,den=0.0,enorm_h;
178 for(eN=0;eN<nElements_global;eN++)
180 h = elementDiameter[eN];
181 for (k=0;k<nQuadraturePoints_element;k++)
183 num = shockCapturingDiffusion*h*fabs(strong_residual[eN*nQuadraturePoints_element+
185 enorm_h = fabs(
H[eN*nQuadraturePoints_element + k]);
186 if(shockCapturing ==
'1')
188 den = (fabs(mt[eN*nQuadraturePoints_element+
192 else if(shockCapturing ==
'2')
194 den = sqrt(mt[eN*nQuadraturePoints_element+
197 mt[eN*nQuadraturePoints_element+
200 enorm_h*enorm_h) +
num*1.0e-8;
202 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
208 int nQuadraturePoints_element,
210 double shockCapturingFactor,
211 double* elementDiameter,
212 double* strong_residual,
218 double h,
num,den,enorm_df;
219 for(eN=0;eN<nElements_global;eN++)
221 h = elementDiameter[eN];
222 for (k=0;k<nQuadraturePoints_element;k++)
224 num = shockCapturingFactor*h*fabs(strong_residual[eN*nQuadraturePoints_element+
227 for(I=0;I<nSpace;I++)
231 df[eN*nQuadraturePoints_element*nSpace+
235 df[eN*nQuadraturePoints_element*nSpace+
239 enorm_df = sqrt(enorm_df);
240 den = (fabs(mt[eN*nQuadraturePoints_element+
243 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
250 int nQuadraturePoints_element,
252 double shockCapturingDiffusion,
254 double* elementDiameter,
255 double* strong_residual,
265 for(eN=0;eN<nElements_global;eN++)
267 h = elementDiameter[eN];
269 for (k=0;k<nQuadraturePoints_element;k++)
271 num = shockCapturingDiffusion*0.5*h*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
273 if (den >
num*1.0e-8)
274 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
276 numDiff[eN*nQuadraturePoints_element+k]=0.0;
277 n_R_eN=fmax(n_R_eN,fabs(strong_residual[eN*nQuadraturePoints_element+k]));
280 for (k=0;k<nQuadraturePoints_element;k++)
282 num = shockCapturingDiffusion*0.5*h*n_R_eN;
284 if (den >
num*1.0e-8)
285 numDiff[eN*nQuadraturePoints_element+k] =
num/den;
287 numDiff[eN*nQuadraturePoints_element+k]=0.0;
288 maxNumDiff = fmax(maxNumDiff,numDiff[eN*nQuadraturePoints_element+k]);
290 for (k=0;k<nQuadraturePoints_element;k++)
291 numDiff[eN*nQuadraturePoints_element+k] = maxNumDiff;
300 int nQuadraturePoints_element,
302 double shockCapturingDiffusion,
304 double* elementDiameter,
305 double* strong_residual,
313 n_grad_u[nQuadraturePoints_element],
317 for(eN=0;eN<nElements_global;eN++)
319 h = elementDiameter[eN];
320 hfactor = pow(h,2.0-beta);
321 for (k=0;k<nQuadraturePoints_element;k++)
323 num = shockCapturingDiffusion*hfactor*fabs(strong_residual[eN*nQuadraturePoints_element+k]);
324 numDiff[eN*nQuadraturePoints_element+k] =
num;
328 for (k=0;k<nQuadraturePoints_element;k++)
330 maxNumDiff = fmax(maxNumDiff,numDiff[eN*nQuadraturePoints_element+k]);
332 for (k=0;k<nQuadraturePoints_element;k++)
333 numDiff[eN*nQuadraturePoints_element+k] = maxNumDiff;