13#if not defined(MAIA_MS_COMPILER)
23 : m_StructuredComm(solver->m_StructuredComm),
24 m_solverId(solver->m_solverId),
25 m_nCells(solver->m_nCells),
26 m_nPoints(solver->m_nPoints),
27 m_noCells(solver->m_noCells),
28 m_cells(solver->m_cells),
32 m_noGhostLayers(solver->m_noGhostLayers),
35 m_sutherlandConstant(solver->m_sutherlandConstant),
36 m_sutherlandPlusOne(solver->m_sutherlandPlusOne) {
84 stringstream errorMessage;
85 errorMessage <<
"Number of Variables " <<
m_solver->
CV->noVariables
86 <<
" not implemented! in temlate Rans AUSM " << endl;
87 mTerm(1, AT_, errorMessage.str());
99 cout <<
"Using RANS with Fares-Schroeder model and limited AusmDV" << endl;
114 stringstream errorMessage;
115 errorMessage <<
"Number of Variables " <<
m_solver->
CV->noVariables
116 <<
" not implemented! in temlate Rans AUSM " << endl;
117 mTerm(1, AT_, errorMessage.str());
121 cout <<
"Using RANS with Fares-Schroeder model and AusmDV" << endl;
136 stringstream errorMessage;
137 errorMessage <<
"Number of Variables " <<
m_solver->
CV->noVariables
138 <<
" not implemented! in temlate Rans AUSM " << endl;
139 mTerm(1, AT_, errorMessage.str());
146 mTerm(1, AT_,
"RANS METHOD wsa not specified in properties");
198 const MFloat cornerMetrics[9] = {
204 const MFloat dnutldxi = F1B4
205 * (nuTilde[IPJPKP] + nuTilde[IPJPK] + nuTilde[IPJKP] + nuTilde[IPJK] - nuTilde[IJPKP]
206 - nuTilde[IJPK] - nuTilde[IJKP] - nuTilde[IJK]);
207 const MFloat dnutldet = F1B4
208 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IPJPK] + nuTilde[IJPK] - nuTilde[IPJKP]
209 - nuTilde[IJKP] - nuTilde[IPJK] - nuTilde[IJK]);
210 const MFloat dnutldze = F1B4
211 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IPJKP] + nuTilde[IJKP] - nuTilde[IPJPK]
212 - nuTilde[IJPK] - nuTilde[IPJK] - nuTilde[IJK]);
215 const MFloat nutldAvg = F1B8
216 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IJPK] + nuTilde[IPJPK] + nuTilde[IPJKP]
217 + nuTilde[IJKP] + nuTilde[IJK] + nuTilde[IPJK]);
219 const MFloat nuLamAvg = F1B8
220 * (muLam[IPJPKP] / rho[IPJPKP] + muLam[IJPKP] / rho[IJPKP] + muLam[IJPK] / rho[IJPK]
221 + muLam[IPJPK] / rho[IPJPK] + muLam[IPJKP] / rho[IPJKP] + muLam[IJKP] / rho[IJKP]
222 + muLam[IJK] / rho[IJK] + muLam[IPJK] / rho[IPJK]);
224 const MFloat dnutldx = dnutldxi * cornerMetrics[
xsd * 3 +
xsd] + dnutldet * cornerMetrics[
ysd * 3 +
xsd]
225 + dnutldze * cornerMetrics[
zsd * 3 +
xsd];
227 const MFloat dnutldy = dnutldxi * cornerMetrics[
xsd * 3 +
ysd] + dnutldet * cornerMetrics[
ysd * 3 +
ysd]
228 + dnutldze * cornerMetrics[
zsd * 3 +
ysd];
230 const MFloat dnutldz = dnutldxi * cornerMetrics[
xsd * 3 +
zsd] + dnutldet * cornerMetrics[
ysd * 3 +
zsd]
231 + dnutldze * cornerMetrics[
zsd * 3 +
zsd];
236 * (dnutldx * cornerMetrics[
xsd * 3 +
xsd] + dnutldy * cornerMetrics[
xsd * 3 +
ysd]
237 + dnutldz * cornerMetrics[
xsd * 3 +
zsd]);
240 * (dnutldx * cornerMetrics[
ysd * 3 +
xsd] + dnutldy * cornerMetrics[
ysd * 3 +
ysd]
241 + dnutldz * cornerMetrics[
ysd * 3 +
zsd]);
244 * (dnutldx * cornerMetrics[
zsd * 3 +
xsd] + dnutldy * cornerMetrics[
zsd * 3 +
ysd]
245 + dnutldz * cornerMetrics[
zsd * 3 +
zsd]);
248 * (dnutldx * cornerMetrics[
xsd * 3 +
xsd] + dnutldy * cornerMetrics[
xsd * 3 +
ysd]
249 + dnutldz * cornerMetrics[
xsd * 3 +
zsd]);
251 * (dnutldx * cornerMetrics[
ysd * 3 +
xsd] + dnutldy * cornerMetrics[
ysd * 3 +
ysd]
252 + dnutldz * cornerMetrics[
ysd * 3 +
zsd]);
255 * (dnutldx * cornerMetrics[
zsd * 3 +
xsd] + dnutldy * cornerMetrics[
zsd * 3 +
ysd]
256 + dnutldz * cornerMetrics[
zsd * 3 +
zsd]);
259 const MFloat dw1 = w[IPJK] - w[IMJK];
260 const MFloat dw2 = w[IJPK] - w[IJMK];
261 const MFloat dw3 = w[IJKP] - w[IJKM];
264 const MFloat dv1 = v[IPJK] - v[IMJK];
265 const MFloat dv2 = v[IJPK] - v[IJMK];
266 const MFloat dv3 = v[IJKP] - v[IJKM];
269 const MFloat du1 = u[IPJK] - u[IMJK];
270 const MFloat du2 = u[IJPK] - u[IJMK];
271 const MFloat du3 = u[IJKP] - u[IJKM];
294 MFloat s = (vorti * vorti) + (vortj * vortj) + (vortk * vortk);
299 const MFloat Fdist2 = 1.0 / (distance * distance);
300 const MFloat chi = nuTilde[IJK] * rho[IJK] / (SUTHERLANDLAW(T[IJK]) / rho[IJK]);
301 const MFloat chip3 = chi * chi * chi;
303 const MFloat Fv2 = F1 - (chi / (F1 + chi * Fv1));
306 const MFloat stilde = s + term * Fv2 * rRe;
307 const MFloat r = min(10.0, rRe * term / stilde);
311 const MFloat Fw = g * pow(Fwterm, (1.0 / 6.0));
314 * pow(nuTilde[IJK], 2.0) * Fdist2;
318 eflux[0][IJK] = sax1;
319 eflux[1][IJK] = sax2;
321 fflux[0][IJK] = say1;
322 fflux[1][IJK] = say2;
324 gflux[0][IJK] = saz1;
325 gflux[1][IJK] = saz2;
338 sa_1flux[0][IJK] = F1B4 * (eflux[0][IJK] + eflux[0][IJKM] + eflux[0][IJMK] + eflux[0][IJMKM]);
339 sa_2flux[0][IJK] = F1B4 * (eflux[1][IJK] + eflux[1][IJKM] + eflux[1][IJMK] + eflux[1][IJMKM]);
353 sa_1flux[1][IJK] = F1B4 * (fflux[0][IJK] + fflux[0][IJKM] + fflux[0][IMJK] + fflux[0][IMJKM]);
354 sa_2flux[1][IJK] = F1B4 * (fflux[1][IJK] + fflux[1][IJKM] + fflux[1][IMJK] + fflux[1][IMJKM]);
367 sa_1flux[2][IJK] = F1B4 * (gflux[0][IJK] + gflux[0][IMJK] + gflux[0][IJMK] + gflux[0][IMJMK]);
368 sa_2flux[2][IJK] = F1B4 * (gflux[1][IJK] + gflux[1][IMJK] + gflux[1][IJMK] + gflux[1][IMJMK]);
381 const MFloat dissipation_term =
382 (((sa_1flux[0][IJK] - sa_1flux[0][IMJK]) + ((sa_2flux[0][IJK] - sa_2flux[0][IMJK]) * nuTilde[IJK]))
384 + ((sa_1flux[1][IJK] - sa_1flux[1][IJMK]) + ((sa_2flux[1][IJK] - sa_2flux[1][IJMK]) * nuTilde[IJK]))
386 + ((sa_1flux[2][IJK] - sa_1flux[2][IJKM]) + ((sa_2flux[2][IJK] - sa_2flux[2][IJKM]) * nuTilde[IJK]))
399 const MFloat epss = 1e-34;
436 const MFloat cellMetrics[9] = {
443 const MFloat dudxi = fjac * (u[IPJK] - u[IMJK]);
444 const MFloat dudet = fjac * (u[IJPK] - u[IJMK]);
445 const MFloat dudze = fjac * (u[IJKP] - u[IJKM]);
447 const MFloat dvdxi = fjac * (v[IPJK] - v[IMJK]);
448 const MFloat dvdet = fjac * (v[IJPK] - v[IJMK]);
449 const MFloat dvdze = fjac * (v[IJKP] - v[IJKM]);
451 const MFloat dwdxi = fjac * (w[IPJK] - w[IMJK]);
452 const MFloat dwdet = fjac * (w[IJPK] - w[IJMK]);
453 const MFloat dwdze = fjac * (w[IJKP] - w[IJKM]);
455 const MFloat dnutdxi = fjac * (nuTilde[IPJK] - nuTilde[IMJK]);
456 const MFloat dnutdet = fjac * (nuTilde[IJPK] - nuTilde[IJMK]);
457 const MFloat dnutdze = fjac * (nuTilde[IJKP] - nuTilde[IJKM]);
460 uvwn(IJK, 0, 0) = cellMetrics[0] * dudxi + cellMetrics[3] * dudet + cellMetrics[6] * dudze;
461 uvwn(IJK, 0, 1) = cellMetrics[1] * dudxi + cellMetrics[4] * dudet + cellMetrics[7] * dudze;
462 uvwn(IJK, 0, 2) = cellMetrics[2] * dudxi + cellMetrics[5] * dudet + cellMetrics[8] * dudze;
464 uvwn(IJK, 1, 0) = cellMetrics[0] * dvdxi + cellMetrics[3] * dvdet + cellMetrics[6] * dvdze;
465 uvwn(IJK, 1, 1) = cellMetrics[1] * dvdxi + cellMetrics[4] * dvdet + cellMetrics[7] * dvdze;
466 uvwn(IJK, 1, 2) = cellMetrics[2] * dvdxi + cellMetrics[5] * dvdet + cellMetrics[8] * dvdze;
468 uvwn(IJK, 2, 0) = cellMetrics[0] * dwdxi + cellMetrics[3] * dwdet + cellMetrics[6] * dwdze;
469 uvwn(IJK, 2, 1) = cellMetrics[1] * dwdxi + cellMetrics[4] * dwdet + cellMetrics[7] * dwdze;
470 uvwn(IJK, 2, 2) = cellMetrics[2] * dwdxi + cellMetrics[5] * dwdet + cellMetrics[8] * dwdze;
472 uvwn(IJK, 3, 0) = cellMetrics[0] * dnutdxi + cellMetrics[3] * dnutdet + cellMetrics[6] * dnutdze;
473 uvwn(IJK, 3, 1) = cellMetrics[1] * dnutdxi + cellMetrics[4] * dnutdet + cellMetrics[7] * dnutdze;
474 uvwn(IJK, 3, 2) = cellMetrics[2] * dnutdxi + cellMetrics[5] * dnutdet + cellMetrics[8] * dnutdze;
480 for(
MInt var = 0; var < 4; var++) {
488 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
489 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
490 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
501 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
502 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
503 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
514 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
515 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
516 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
527 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
528 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
529 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
541 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
542 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
543 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
554 uvwn(II1, var, 0) = 2.0 * uvwn(II2, var, 0) - uvwn(II3, var, 0);
555 uvwn(II1, var, 1) = 2.0 * uvwn(II2, var, 1) - uvwn(II3, var, 1);
556 uvwn(II1, var, 2) = 2.0 * uvwn(II2, var, 2) - uvwn(II3, var, 2);
572 const MFloat Sij = F1B2 * (uvwn(IJK, i, j) + uvwn(IJK, j, i));
573 dumm(IJK) += Sij * Sij;
586 omega(IJK) =
mMax(eps, fac * sqrt(2.0 * dumm(IJK)));
600 const MFloat Oij = 0.5 * (uvwn(IJK, i, j) - uvwn(IJK, j, i));
601 const MFloat Ojk = 0.5 * (uvwn(IJK, j, k) - uvwn(IJK, k, j));
602 const MFloat Ski = 0.5 * (uvwn(IJK, k, i) + uvwn(IJK, i, k));
603 dumm(IJK) += Oij * Ojk * Ski;
627 const MFloat cellMetrics[9] = {
632 const MFloat ddxi = fjac * (omega(IPJK) - omega(IMJK));
633 const MFloat ddeta = fjac * (omega(IJPK) - omega(IJMK));
634 const MFloat ddzeta = fjac * (omega(IJKP) - omega(IJKM));
636 const MFloat domdx = cellMetrics[0] * ddxi + cellMetrics[3] * ddeta + cellMetrics[6] * ddzeta;
637 const MFloat domdy = cellMetrics[1] * ddxi + cellMetrics[4] * ddeta + cellMetrics[7] * ddzeta;
638 const MFloat domdz = cellMetrics[2] * ddxi + cellMetrics[5] * ddeta + cellMetrics[8] * ddzeta;
641 const MFloat dudx = uvwn(IJK, 0, 0);
642 const MFloat dudy = uvwn(IJK, 0, 1);
643 const MFloat dudz = uvwn(IJK, 0, 2);
645 const MFloat dvdx = uvwn(IJK, 1, 0);
646 const MFloat dvdy = uvwn(IJK, 1, 1);
647 const MFloat dvdz = uvwn(IJK, 1, 2);
649 const MFloat dwdx = uvwn(IJK, 2, 0);
650 const MFloat dwdy = uvwn(IJK, 2, 1);
651 const MFloat dwdz = uvwn(IJK, 2, 2);
653 const MFloat dndx = uvwn(IJK, 3, 0);
654 const MFloat dndy = uvwn(IJK, 3, 1);
655 const MFloat dndz = uvwn(IJK, 3, 2);
657 const MFloat CDNOM = dndx * domdx + dndy * domdy + dndz * domdz;
665 (dudy * (dudy + dvdx) + dudz * (dudz + dwdx) + dvdx * (dvdx + dudy) + dvdz * (dvdz + dwdy)
666 + dwdx * (dwdx + dudz) + dwdy * (dwdy + dvdz) + 2.0 * dudx * dudx + 2.0 * dvdy * dvdy + 2.0 * dwdz * dwdz);
670 MFloat prod = prod1 - (1.0 -
RM_FS::faalpha * fv2t) * F2B3 * nuTilde[IJK] * (dudx + dvdy + dwdz) * rho[IJK];
671 const MFloat dest = (betas - beta) * nuTilde[IJK] * omega(IJK) * rho[IJK] + rho[IJK] * crdif * 0.125;
673 0.0, 2.0 * rRe * rho[IJK] / omega(IJK) * (muLam[IJK] / rho[IJK] +
RM_FS::fasigma * nuTilde[IJK]) * CDNOM);
695 const MFloat cornerMetrics[9] = {
700 const MFloat nutldAvg = F1B8
701 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IJPK] + nuTilde[IPJPK] + nuTilde[IPJKP]
702 + nuTilde[IJKP] + nuTilde[IJK] + nuTilde[IPJK]);
704 const MFloat nuLamAvg = F1B8
705 * (muLam[IPJPKP] / rho[IPJPKP] + muLam[IJPKP] / rho[IJPKP] + muLam[IJPK] / rho[IJPK]
706 + muLam[IPJPK] / rho[IPJPK] + muLam[IPJKP] / rho[IPJKP] + muLam[IJKP] / rho[IJKP]
707 + muLam[IJK] / rho[IJK] + muLam[IPJK] / rho[IPJK]);
709 const MFloat dnutldxi = F1B4
710 * (nuTilde[IPJPKP] + nuTilde[IPJPK] + nuTilde[IPJKP] + nuTilde[IPJK] - nuTilde[IJPKP]
711 - nuTilde[IJPK] - nuTilde[IJKP] - nuTilde[IJK]);
712 const MFloat dnutldet = F1B4
713 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IPJPK] + nuTilde[IJPK] - nuTilde[IPJKP]
714 - nuTilde[IJKP] - nuTilde[IPJK] - nuTilde[IJK]);
715 const MFloat dnutldze = F1B4
716 * (nuTilde[IPJPKP] + nuTilde[IJPKP] + nuTilde[IPJKP] + nuTilde[IJKP] - nuTilde[IPJPK]
717 - nuTilde[IJPK] - nuTilde[IPJK] - nuTilde[IJK]);
719 const MFloat dnutldx = (dnutldxi * cornerMetrics[
xsd * 3 +
xsd] + dnutldet * cornerMetrics[
ysd * 3 +
xsd]
720 + dnutldze * cornerMetrics[
zsd * 3 +
xsd]);
722 const MFloat dnutldy = (dnutldxi * cornerMetrics[
xsd * 3 +
ysd] + dnutldet * cornerMetrics[
ysd * 3 +
ysd]
723 + dnutldze * cornerMetrics[
zsd * 3 +
ysd]);
725 const MFloat dnutldz = (dnutldxi * cornerMetrics[
xsd * 3 +
zsd] + dnutldet * cornerMetrics[
ysd * 3 +
zsd]
726 + dnutldze * cornerMetrics[
zsd * 3 +
zsd]);
731 * (dnutldx * cornerMetrics[
xsd * 3 +
xsd] + dnutldy * cornerMetrics[
xsd * 3 +
ysd]
732 + dnutldz * cornerMetrics[
xsd * 3 +
zsd]));
735 * (dnutldx * cornerMetrics[
ysd * 3 +
xsd] + dnutldy * cornerMetrics[
ysd * 3 +
ysd]
736 + dnutldz * cornerMetrics[
ysd * 3 +
zsd]));
739 * (dnutldx * cornerMetrics[
zsd * 3 +
xsd] + dnutldy * cornerMetrics[
zsd * 3 +
ysd]
740 + dnutldz * cornerMetrics[
zsd * 3 +
zsd]));
753 eflux[3][IJK] = F1B4 * (eflux[6][IJK] + eflux[6][IJKM] + eflux[6][IJMK] + eflux[6][IJMKM]);
767 fflux[3][IJK] = F1B4 * (fflux[6][IJK] + fflux[6][IJKM] + fflux[6][IMJK] + fflux[6][IMJKM]);
780 gflux[3][IJK] = F1B4 * (gflux[6][IJK] + gflux[6][IMJK] + gflux[6][IJMK] + gflux[6][IMJMK]);
793 const MFloat dissipation_term =
794 ((eflux[3][IJK] - eflux[3][IMJK]) + (fflux[3][IJK] - fflux[3][IJMK]) + (gflux[3][IJK] - gflux[3][IJKM]));
817 nuTilde[i] =
mMin(nuTilde[i], 3000.0);
821 const MFloat nuLaminar = SUTHERLANDLAW(T[i]) / rho[i];
822 const MFloat chi = nuTilde[i] / (nuLaminar);
824 const MFloat nuTurb = fv1 * nuTilde[i];
842 nuTilde[i] =
mMin(nuTilde[i], 1200.0);
845 const MFloat nuLaminar = SUTHERLANDLAW(T[i]) / rho[i];
846 const MFloat chi = nuTilde[i] / nuLaminar;
853template <MInt noVars>
870 const MFloat gammaMinusOne = gamma - 1.0;
871 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
883 for(
MInt dim = 0; dim <
nDim; dim++) {
885#pragma omp parallel for
887 for(
MInt k = 0; k < noCellsKP1; k++) {
888 for(
MInt j = 0; j < noCellsJP1; j++) {
889 for(
MInt i = 0; i < noCellsIP1; i++) {
891 const MInt IP1 = I + IJK[dim];
892 dss[dim][I] = sqrt(
POW2(x[IP1] - x[I]) +
POW2(
y[IP1] -
y[I]) +
POW2(z[IP1] - z[I]));
901 for(
MInt dim = 0; dim <
nDim; dim++) {
903#pragma omp parallel for
905 for(
MInt k = 1; k < noCellsK; k++) {
906 for(
MInt j = 1; j < noCellsJ; j++) {
907#if defined(MAIA_INTEL_COMPILER)
911 for(
MInt i = 1; i < noCellsI; i++) {
913 const MInt IP1 = I + IJK[dim];
914 const MInt IM1 = I - IJK[dim];
915 const MInt IP2 = I + 2 * IJK[dim];
917 const MFloat DS = dss[dim][I];
918 const MFloat DSM1 = dss[dim][IM1];
919 const MFloat DSP1 = dss[dim][IP1];
926 const MFloat DQU = vars[
PV->U][IP1] - vars[
PV->U][I];
927 const MFloat DQPU = vars[
PV->U][IP2] - vars[
PV->U][IP1];
928 const MFloat DQMU = vars[
PV->U][I] - vars[
PV->U][IM1];
929 MFloat UL = vars[
PV->U][I] + DSM * (DSM1 * DQU + DS * DQMU);
930 MFloat UR = vars[
PV->U][IP1] - DSP * (DS * DQPU + DSP1 * DQU);
932 const MFloat DQV = vars[
PV->V][IP1] - vars[
PV->V][I];
933 const MFloat DQPV = vars[
PV->V][IP2] - vars[
PV->V][IP1];
934 const MFloat DQMV = vars[
PV->V][I] - vars[
PV->V][IM1];
935 MFloat VL = vars[
PV->V][I] + DSM * (DSM1 * DQV + DS * DQMV);
936 MFloat VR = vars[
PV->V][IP1] - DSP * (DS * DQPV + DSP1 * DQV);
938 const MFloat DQW = vars[
PV->W][IP1] - vars[
PV->W][I];
939 const MFloat DQPW = vars[
PV->W][IP2] - vars[
PV->W][IP1];
940 const MFloat DQMW = vars[
PV->W][I] - vars[
PV->W][IM1];
941 MFloat WL = vars[
PV->W][I] + DSM * (DSM1 * DQW + DS * DQMW);
942 MFloat WR = vars[
PV->W][IP1] - DSP * (DS * DQPW + DSP1 * DQW);
944 const MFloat DQP = vars[
PV->P][IP1] - vars[
PV->P][I];
945 const MFloat DQPP = vars[
PV->P][IP2] - vars[
PV->P][IP1];
946 const MFloat DQMP = vars[
PV->P][I] - vars[
PV->P][IM1];
947 const MFloat PL = vars[
PV->P][I] + DSM * (DSM1 * DQP + DS * DQMP);
948 const MFloat PR = vars[
PV->P][IP1] - DSP * (DS * DQPP + DSP1 * DQP);
950 const MFloat DQRHO = vars[
PV->RHO][IP1] - vars[
PV->RHO][I];
951 const MFloat DQPRHO = vars[
PV->RHO][IP2] - vars[
PV->RHO][IP1];
952 const MFloat DQMRHO = vars[
PV->RHO][I] - vars[
PV->RHO][IM1];
953 const MFloat RHOL = vars[
PV->RHO][I] + DSM * (DSM1 * DQRHO + DS * DQMRHO);
954 const MFloat RHOR = vars[
PV->RHO][IP1] - DSP * (DS * DQPRHO + DSP1 * DQRHO);
956 const MFloat DQNUTILDE = vars[
PV->RANS_VAR[0]][IP1] - vars[
PV->RANS_VAR[0]][I];
957 const MFloat DQPNUTILDE = vars[
PV->RANS_VAR[0]][IP2] - vars[
PV->RANS_VAR[0]][IP1];
958 const MFloat DQMNUTILDE = vars[
PV->RANS_VAR[0]][I] - vars[
PV->RANS_VAR[0]][IM1];
959 const MFloat NUTILDEL = vars[
PV->RANS_VAR[0]][I] + DSM * (DSM1 * DQNUTILDE + DS * DQMNUTILDE);
960 const MFloat NUTILDER = vars[
PV->RANS_VAR[0]][IP1] - DSP * (DS * DQPNUTILDE + DSP1 * DQNUTILDE);
966 const MFloat FRHOL = F1 / RHOL;
967 const MFloat FRHOR = F1 / RHOR;
969 const MFloat PLfRHOL = PL / RHOL;
970 const MFloat PRfRHOR = PR / RHOR;
971 const MFloat e0 = PLfRHOL * FgammaMinusOne + 0.5 * (
POW2(UL) +
POW2(VL) +
POW2(WL)) + PLfRHOL;
972 const MFloat e1 = PRfRHOR * FgammaMinusOne + 0.5 * (
POW2(UR) +
POW2(VR) +
POW2(WR)) + PRfRHOR;
977 const MFloat FDGRAD = F1 / DGRAD;
980 const MFloat UUL = ((UL * surf0 + VL * surf1 + WL * surf2) - dxdtau) * FDGRAD;
983 const MFloat UUR = ((UR * surf0 + VR * surf1 + WR * surf2) - dxdtau) * FDGRAD;
988 const MFloat FALR = 2.0 / (AL + AR);
989 const MFloat ALPHAL = AL * FALR;
990 const MFloat ALPHAR = AR * FALR;
992 AL = sqrt(gamma * AL);
993 AR = sqrt(gamma * AR);
997 const MFloat XMAL = UUL / AL;
998 const MFloat XMAR = UUR / AR;
1003 const MFloat RHOAL = AL * RHOL;
1004 const MFloat RHOAR = AR * RHOR;
1011 const MFloat SV1 = F1 * SV * DXDXEZ;
1012 const MFloat SV2 = F1 * SV * DYDXEZ;
1013 const MFloat SV3 = F1 * SV * DZDXEZ;
1018 MFloat FXMA = F1B2 * (XMAL1 + fabs(XMAL1));
1019 const MFloat XMALP = ALPHAL * (F1B4 *
POW2(XMAL1 + F1) - FXMA) + FXMA + (
mMax(F1, XMAL) - F1);
1020 FXMA = F1B2 * (XMAR1 - fabs(XMAR1));
1021 const MFloat XMARM = ALPHAR * (-F1B4 *
POW2(XMAR1 - F1) - FXMA) + FXMA + (
mMin(-F1, XMAR) + F1);
1023 const MFloat FLP = PL * ((F2 - XMAL1) *
POW2(F1 + XMAL1));
1024 const MFloat FRP = PR * ((F2 + XMAR1) *
POW2(F1 - XMAR1));
1025 const MFloat PLR = F1B4 * (FLP + FRP);
1027 const MFloat RHOUL = XMALP * RHOAL;
1028 const MFloat RHOUR = XMARM * RHOAR;
1029 const MFloat RHOU = RHOUL + RHOUR;
1030 const MFloat RHOU2 = F1B2 * RHOU;
1031 const MFloat ARHOU2 = fabs(RHOU2);
1033 const MFloat UUL2 = SV1 * UUL;
1034 const MFloat UUR2 = SV1 * UUR;
1037 const MFloat UUL3 = SV2 * UUL;
1038 const MFloat UUR3 = SV2 * UUR;
1041 const MFloat UUL4 = SV3 * UUL;
1042 const MFloat UUR4 = SV3 * UUR;
1046 flux[
CV->RHO_U][I] = RHOU2 * (UL + UR) + ARHOU2 * (UL - UR) + PLR * surf0 + RHOUL * UUL2 + RHOUR * UUR2;
1047 flux[
CV->RHO_V][I] = RHOU2 * (VL + VR) + ARHOU2 * (VL - VR) + PLR * surf1 + RHOUL * UUL3 + RHOUR * UUR3;
1048 flux[
CV->RHO_W][I] = RHOU2 * (WL + WR) + ARHOU2 * (WL - WR) + PLR * surf2 + RHOUL * UUL4 + RHOUR * UUR4;
1049 flux[
CV->RHO_E][I] = RHOU2 * (e0 + e1) + ARHOU2 * (e0 - e1) + PLR * dxdtau;
1050 flux[
CV->RHO][I] = RHOU;
1051 flux[
CV->RANS_VAR[0]][I] = RHOU2 * (NUTILDEL + NUTILDER) + ARHOU2 * (NUTILDEL - NUTILDER);
1057 for(
MUint v = 0; v < noVars; v++) {
1059#pragma omp parallel for
1063#if defined(MAIA_INTEL_COMPILER)
1065#pragma vector always
1069 const MInt IM1 = I - IJK[dim];
1070 const MUint offset = v * noCells;
1071 MFloat*
const RESTRICT rhs = ALIGNED_F(cellRhs + offset);
1072 rhs[I] += flux[v][IM1] - flux[v][I];
1080template void FvStructuredSolver3DRans::Muscl_AusmDV<5>();
1081template void FvStructuredSolver3DRans::Muscl_AusmDV<6>();
1082template void FvStructuredSolver3DRans::Muscl_AusmDV<7>();
1085template <MInt noVars>
1103 const MFloat EPSLIM = 1e-14;
1104 const MFloat EPSS = 1e-34;
1107 const MFloat gammaMinusOne = gamma - 1.0;
1108 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
1119 for(
MInt dim = 0; dim <
nDim; dim++) {
1121#pragma omp parallel for
1123 for(
MInt k = 0; k < noCellsKP1; k++) {
1124 for(
MInt j = 0; j < noCellsJP1; j++) {
1125 for(
MInt i = 0; i < noCellsIP1; i++) {
1127 const MInt IP1 = I + IJK[dim];
1128 dss[dim][I] = sqrt(
POW2(x[IP1] - x[I]) +
POW2(
y[IP1] -
y[I]) +
POW2(z[IP1] - z[I]));
1137 for(
MInt dim = 0; dim <
nDim; dim++) {
1139#pragma omp parallel for
1141 for(
MInt k = 1; k < noCellsKP1; k++) {
1142 for(
MInt j = 1; j < noCellsJP1; j++) {
1143 for(
MInt i = 1; i < noCellsIP1; i++) {
1145 const MInt IP1 = I + IJK[dim];
1146 const MInt IM1 = I - IJK[dim];
1148 const MFloat DS = dss[dim][I];
1149 const MFloat DSL = dss[dim][IM1];
1150 const MFloat DSR = dss[dim][I];
1151 const MFloat FDS = DS /
POW2(DSL + DSR) * 2.0;
1155 const MFloat DQLU = DSL * (vars[
PV->U][IP1] - vars[
PV->U][I]);
1156 const MFloat DQRU = DSR * (vars[
PV->U][I] - vars[
PV->U][IM1]);
1158 ql[
PV->U][I] = vars[
PV->U][I] + FDS * (DQLU + DQRU) * PHIU;
1159 qr[
PV->U][IM1] = vars[
PV->U][I] - FDS * (DQLU + DQRU) * PHIU;
1161 const MFloat DQLV = DSL * (vars[
PV->V][IP1] - vars[
PV->V][I]);
1162 const MFloat DQRV = DSR * (vars[
PV->V][I] - vars[
PV->V][IM1]);
1164 ql[
PV->V][I] = vars[
PV->V][I] + FDS * (DQLV + DQRV) * PHIV;
1165 qr[
PV->V][IM1] = vars[
PV->V][I] - FDS * (DQLV + DQRV) * PHIV;
1167 const MFloat DQLW = DSL * (vars[
PV->W][IP1] - vars[
PV->W][I]);
1168 const MFloat DQRW = DSR * (vars[
PV->W][I] - vars[
PV->W][IM1]);
1170 ql[
PV->W][I] = vars[
PV->W][I] + FDS * (DQLW + DQRW) * PHIW;
1171 qr[
PV->W][IM1] = vars[
PV->W][I] - FDS * (DQLW + DQRW) * PHIW;
1173 const MFloat DQLP = DSL * (vars[
PV->P][IP1] - vars[
PV->P][I]);
1174 const MFloat DQRP = DSR * (vars[
PV->P][I] - vars[
PV->P][IM1]);
1176 ql[
PV->P][I] = vars[
PV->P][I] + FDS * (DQLP + DQRP) * PHIP;
1177 qr[
PV->P][IM1] = vars[
PV->P][I] - FDS * (DQLP + DQRP) * PHIP;
1179 const MFloat DQLRHO = DSL * (vars[
PV->RHO][IP1] - vars[
PV->RHO][I]);
1180 const MFloat DQRRHO = DSR * (vars[
PV->RHO][I] - vars[
PV->RHO][IM1]);
1182 mMax(F0, DQLRHO * DQRRHO / (
POW2(DQLRHO) +
POW2(DQRRHO) + EPSLIM *
mMax(EPSS, DSL * DSR)));
1183 ql[
PV->RHO][I] = vars[
PV->RHO][I] + FDS * (DQLRHO + DQRRHO) * PHIRHO;
1184 qr[
PV->RHO][IM1] = vars[
PV->RHO][I] - FDS * (DQLRHO + DQRRHO) * PHIRHO;
1186 const MFloat DQLNUTILDE = DSL * (vars[
PV->RANS_VAR[0]][IP1] - vars[
PV->RANS_VAR[0]][I]);
1187 const MFloat DQRNUTILDE = DSR * (vars[
PV->RANS_VAR[0]][I] - vars[
PV->RANS_VAR[0]][IM1]);
1189 F0, DQLNUTILDE * DQRNUTILDE / (
POW2(DQLNUTILDE) +
POW2(DQRNUTILDE) + EPSLIM *
mMax(EPSS, DSL * DSR)));
1190 ql[
PV->RANS_VAR[0]][I] = vars[
PV->RANS_VAR[0]][I] + FDS * (DQLNUTILDE + DQRNUTILDE) * PHINUTILDE;
1191 qr[
PV->RANS_VAR[0]][IM1] = vars[
PV->RANS_VAR[0]][I] - FDS * (DQLNUTILDE + DQRNUTILDE) * PHINUTILDE;
1197 for(
MInt k = 1; k < noCellsK; k++) {
1198 for(
MInt j = 1; j < noCellsJ; j++) {
1199 for(
MInt i = 1; i < noCellsI; i++) {
1201 const MInt IP1 = I + IJK[dim];
1215 const MFloat RHOL = ql[
PV->RHO][I];
1216 const MFloat RHOR = qr[
PV->RHO][I];
1218 const MFloat NUTILDEL = ql[
PV->RANS_VAR[0]][I];
1219 const MFloat NUTILDER = qr[
PV->RANS_VAR[0]][I];
1226 const MFloat FRHOL = F1 / RHOL;
1227 const MFloat FRHOR = F1 / RHOR;
1229 const MFloat PLfRHOL = PL / RHOL;
1230 const MFloat PRfRHOR = PR / RHOR;
1231 const MFloat e0 = PLfRHOL * FgammaMinusOne + 0.5 * (
POW2(UL) +
POW2(VL) +
POW2(WL)) + PLfRHOL;
1232 const MFloat e1 = PRfRHOR * FgammaMinusOne + 0.5 * (
POW2(UR) +
POW2(VR) +
POW2(WR)) + PRfRHOR;
1237 const MFloat FDGRAD = F1 / DGRAD;
1240 const MFloat UUL = ((UL * surf0 + VL * surf1 + WL * surf2) - dxdtau) * FDGRAD;
1243 const MFloat UUR = ((UR * surf0 + VR * surf1 + WR * surf2) - dxdtau) * FDGRAD;
1248 const MFloat FALR = 2.0 / (AL + AR);
1249 const MFloat ALPHAL = AL * FALR;
1250 const MFloat ALPHAR = AR * FALR;
1252 AL = sqrt(gamma * AL);
1253 AR = sqrt(gamma * AR);
1257 const MFloat XMAL = UUL / AL;
1258 const MFloat XMAR = UUR / AR;
1263 const MFloat RHOAL = AL * RHOL;
1264 const MFloat RHOAR = AR * RHOR;
1271 const MFloat SV1 = F1 * SV * DXDXEZ;
1272 const MFloat SV2 = F1 * SV * DYDXEZ;
1273 const MFloat SV3 = F1 * SV * DZDXEZ;
1278 MFloat FXMA = F1B2 * (XMAL1 + fabs(XMAL1));
1279 const MFloat XMALP = ALPHAL * (F1B4 *
POW2(XMAL1 + F1) - FXMA) + FXMA + (
mMax(F1, XMAL) - F1);
1280 FXMA = F1B2 * (XMAR1 - fabs(XMAR1));
1281 const MFloat XMARM = ALPHAR * (-F1B4 *
POW2(XMAR1 - F1) - FXMA) + FXMA + (
mMin(-F1, XMAR) + F1);
1283 const MFloat FLP = PL * ((F2 - XMAL1) *
POW2(F1 + XMAL1));
1284 const MFloat FRP = PR * ((F2 + XMAR1) *
POW2(F1 - XMAR1));
1285 const MFloat PLR = F1B4 * (FLP + FRP);
1287 const MFloat RHOUL = XMALP * RHOAL;
1288 const MFloat RHOUR = XMARM * RHOAR;
1289 const MFloat RHOU = RHOUL + RHOUR;
1290 const MFloat RHOU2 = F1B2 * RHOU;
1291 const MFloat ARHOU2 = fabs(RHOU2);
1293 const MFloat UUL2 = SV1 * UUL;
1294 const MFloat UUR2 = SV1 * UUR;
1297 const MFloat UUL3 = SV2 * UUL;
1298 const MFloat UUR3 = SV2 * UUR;
1301 const MFloat UUL4 = SV3 * UUL;
1302 const MFloat UUR4 = SV3 * UUR;
1306 flux[
CV->RHO_U][I] = RHOU2 * (UL + UR) + ARHOU2 * (UL - UR) + PLR * surf0 + RHOUL * UUL2 + RHOUR * UUR2;
1307 flux[
CV->RHO_V][I] = RHOU2 * (VL + VR) + ARHOU2 * (VL - VR) + PLR * surf1 + RHOUL * UUL3 + RHOUR * UUR3;
1308 flux[
CV->RHO_W][I] = RHOU2 * (WL + WR) + ARHOU2 * (WL - WR) + PLR * surf2 + RHOUL * UUL4 + RHOUR * UUR4;
1309 flux[
CV->RHO_E][I] = RHOU2 * (e0 + e1) + ARHOU2 * (e0 - e1) + PLR * dxdtau;
1310 flux[
CV->RHO][I] = RHOU;
1311 flux[
CV->RANS_VAR[0]][I] = RHOU2 * (NUTILDEL + NUTILDER) + ARHOU2 * (NUTILDEL - NUTILDER);
1317 for(
MUint v = 0; v < noVars; v++) {
1319#pragma omp parallel for
1323#if defined(MAIA_INTEL_COMPILER)
1325#pragma vector always
1329 const MInt IM1 = I - IJK[dim];
1330 const MUint offset = v * noCells;
1331 MFloat*
const RESTRICT rhs = ALIGNED_F(cellRhs + offset);
1332 rhs[I] += flux[v][IM1] - flux[v][I];
1340template void FvStructuredSolver3DRans::Muscl_AusmDV_Limited<5>();
1341template void FvStructuredSolver3DRans::Muscl_AusmDV_Limited<6>();
1342template void FvStructuredSolver3DRans::Muscl_AusmDV_Limited<7>();
1355 const MInt IP1 = I + IJK[dim];
1356 const MInt IM1 = I - IJK[dim];
1357 const MInt IP2 = I + 2 * IJK[dim];
1367 *
mMax(
mMax(fabs((PIM2 - PIM1) /
mMin(PIM2, PIM1)), fabs((PIM1 - PIP1) /
mMin(PIM1, PIP1))),
1368 fabs((PIP1 - PIP2) /
mMin(PIP1, PIP2))));
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
3D structured solver class
void viscousFluxLES()
Viscous flux computation.
FvStructuredSolver3D * m_solver
void(FvStructuredSolver3DRans::* reconstructSurfaceData)()
~FvStructuredSolver3DRans()
std::unique_ptr< StructuredFQVariables > & FQ
FvStructuredSolver3DRans(FvStructuredSolver3D *solver)
void computeTurbViscosity()
MInt getCellIdfromCell(MInt origin, MInt incI, MInt incJ, MInt incK)
void computeTurbViscosity_FS()
MInt cellIndex(MInt i, MInt j, MInt k)
static constexpr const MInt nDim
void(FvStructuredSolver3DRans::* viscFluxMethod)()
void computeTurbViscosity_SA()
void(FvStructuredSolver3DRans::* compTurbVisc)()
std::unique_ptr< MConservativeVariables< 3 > > & CV
std::unique_ptr< MPrimitiveVariables< 3 > > & PV
MFloat getPSI(MInt, MInt)
void Muscl(MInt timerId=-1)
void Muscl_AusmDV_Limited()
std::unique_ptr< MConservativeVariables< nDim > > CV
This class is a ScratchSpace.
void fill(T val)
fill the scratch with a given value
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
void mTerm(const MInt errorCode, const MString &location, const MString &message)
constexpr Real POW2(const Real x)
constexpr T mMin(const T &x, const T &y)
constexpr T mMax(const T &x, const T &y)
static constexpr MFloat faalpha
static constexpr MFloat fapsik2
static constexpr MFloat fabetcs
static constexpr MFloat fapsik1
static constexpr MFloat fasigma
static constexpr MFloat facv1to3
static constexpr MFloat fabetc
static constexpr MFloat cw1
static constexpr MFloat Fsigma
static constexpr MFloat cv1to3
static constexpr MFloat cw3to6
static constexpr MFloat Ft2
static constexpr MFloat cb2
static constexpr MFloat Fkap2
static constexpr MFloat cw2
static constexpr MFloat cb1