63 mTerm(1,
"Negative Jacobian found! Check first if code can cope this!");
94 if(
FQ->neededFQVariables[
FQ->UTAU]) {
118 m_log <<
"Using VAN ALBADA limiter!" << endl;
123 stringstream errorMessage;
124 errorMessage <<
"Limiter function " <<
m_limiterMethod <<
" not implemented!" << endl;
125 mTerm(1, AT_, errorMessage.str());
130 m_log <<
"Using unlimited MUSCL! (standard Formulation)" << endl;
132 switch(
CV->noVariables) {
146 stringstream errorMessage;
147 errorMessage <<
"Number of Variables " <<
CV->noVariables <<
" not implemented in template AUSM!" << endl;
152 switch(
CV->noVariables) {
166 stringstream errorMessage;
167 errorMessage <<
"Number of Variables " <<
CV->noVariables <<
" not implemented in template AUSM!" << endl;
172 switch(
CV->noVariables) {
186 stringstream errorMessage;
187 errorMessage <<
"Number of Variables " <<
CV->noVariables <<
" not implemented in template AUSM!" << endl;
193 m_log <<
"Using unlimited MUSCL (streched Grids)";
197 switch(
CV->noVariables) {
211 stringstream errorMessage;
212 errorMessage <<
"Number of Variables " <<
CV->noVariables <<
" not implemented in template AUSM!" << endl;
217 switch(
CV->noVariables) {
231 stringstream errorMessage;
232 errorMessage <<
"Number of Variables " <<
CV->noVariables <<
" not implemented in template AUSM!" << endl;
269 const MFloat f1x = F1B2 * (
m_grid->m_coordinates[0][P1] +
m_grid->m_coordinates[0][P4]);
270 const MFloat f1y = F1B2 * (
m_grid->m_coordinates[1][P1] +
m_grid->m_coordinates[1][P4]);
272 const MFloat f2x = F1B2 * (
m_grid->m_coordinates[0][P2] +
m_grid->m_coordinates[0][P3]);
273 const MFloat f2y = F1B2 * (
m_grid->m_coordinates[1][P2] +
m_grid->m_coordinates[1][P3]);
277 const MFloat f3x = F1B2 * (
m_grid->m_coordinates[0][P1] +
m_grid->m_coordinates[0][P2]);
278 const MFloat f3y = F1B2 * (
m_grid->m_coordinates[1][P1] +
m_grid->m_coordinates[1][P2]);
280 const MFloat f4x = F1B4 * (
m_grid->m_coordinates[0][P3] +
m_grid->m_coordinates[0][P4]);
281 const MFloat f4y = F1B4 * (
m_grid->m_coordinates[1][P3] +
m_grid->m_coordinates[1][P4]);
346 MBool restartFromSA =
false;
347 restartFromSA = Context::getSolverProperty<MBool>(
"restartFromSA",
m_solverId, AT_, &restartFromSA);
348 if(!restartFromSA)
return;
350 if(
domainId() == 0) cout <<
"\033[1;31m !!!Converting SA turbulence quantities to k & epsilon!!!\033[0m\n" << endl;
359 const MFloat nuLaminar = SUTHERLANDLAW(T) / rho[i];
360 const MFloat chi = nuTilde[i] / (nuLaminar);
362 const MFloat nuTurb = fv1 * nuTilde[i];
389 const MFloat dudxi = 0.5 * (u[IPJ] - u[IMJ]);
390 const MFloat dudet = 0.5 * (u[IJP] - u[IJM]);
391 const MFloat dvdxi = 0.5 * (v[IPJ] - v[IMJ]);
392 const MFloat dvdet = 0.5 * (v[IJP] - v[IJM]);
403 const MFloat P_ = (rRe0 /
POW2(fac_nonDim) * invCellJac * muTurb[IJ]
404 * (2.0 *
POW2(dudx) + 2.0 *
POW2(dvdy) +
POW2(dudy + dvdx)))
406 const MFloat rhoEps = P_ / fac_nonDim;
414 const MFloat yp = utau[IJ] * wallDist[IJ];
440 PV->TInfinity = 1.0 / (1.0 + F1B2 * gammaMinusOne *
POW2(
m_Ma));
441 UT =
m_Ma * sqrt(
PV->TInfinity);
444 PV->VVInfinity[0] =
PV->UInfinity;
445 PV->VVInfinity[1] =
PV->VInfinity;
449 CV->rhoInfinity = pow(
PV->TInfinity, (1.0 / gammaMinusOne));
450 CV->rhoUInfinity =
CV->rhoInfinity *
PV->UInfinity;
451 CV->rhoVInfinity =
CV->rhoInfinity *
PV->VInfinity;
452 CV->rhoVVInfinity[0] =
CV->rhoUInfinity;
453 CV->rhoVVInfinity[1] =
CV->rhoVInfinity;
454 CV->rhoEInfinity =
PV->PInfinity / gammaMinusOne +
CV->rhoInfinity * (F1B2 *
POW2(UT));
457 m_Re0 =
m_Re * SUTHERLANDLAW(
PV->TInfinity) / (
CV->rhoInfinity *
m_Ma * sqrt(
PV->TInfinity));
475 const MFloat lamVisc = SUTHERLANDLAW(
PV->TInfinity);
477 PV->ransInfinity[0] = k8;
486 CV->ransInfinity[0] =
CV->rhoInfinity *
PV->ransInfinity[0];
487 CV->ransInfinity[1] =
CV->rhoInfinity *
PV->ransInfinity[1];
490 chi = Context::getSolverProperty<MFloat>(
"chi",
m_solverId, AT_, &chi);
491 const MFloat lamVisc = SUTHERLANDLAW(
PV->TInfinity);
492 CV->ransInfinity[0] = chi * (lamVisc);
493 PV->ransInfinity[0] = chi * (lamVisc /
CV->rhoInfinity);
497 m_log <<
"**************************" << endl;
498 m_log <<
"Initial Condition summary" << endl;
499 m_log <<
"**************************" << endl;
503 m_log <<
"TInfinity = " <<
PV->TInfinity << endl;
504 m_log <<
"UInfinity = " <<
PV->UInfinity << endl;
505 m_log <<
"VInfinity = " <<
PV->VInfinity << endl;
506 m_log <<
"PInfinity = " <<
PV->PInfinity << endl;
507 m_log <<
"rhoInfinity = " <<
CV->rhoInfinity << endl;
508 m_log <<
"rhoEInfinity = " <<
CV->rhoEInfinity << endl;
510 m_log <<
"Rans" << ransVarId <<
"Infinity = " <<
PV->ransInfinity[ransVarId] * 1e8 <<
"e-8" << endl;
514 cout <<
"**************************" << endl;
515 cout <<
"Initial Condition summary" << endl;
516 cout <<
"**************************" << endl;
517 cout <<
"Re = " <<
m_Re << endl;
518 cout <<
"Re0 = " <<
m_Re0 << endl;
519 cout <<
"Ma = " <<
m_Ma << endl;
520 cout <<
"TInfinity = " <<
PV->TInfinity << endl;
521 cout <<
"UInfinity = " <<
PV->UInfinity << endl;
522 cout <<
"VInfinity = " <<
PV->VInfinity << endl;
523 cout <<
"PInfinity = " <<
PV->PInfinity << endl;
524 cout <<
"rhoInfinity = " <<
CV->rhoInfinity << endl;
525 cout <<
"rhoEInfinity = " <<
CV->rhoEInfinity << endl;
527 cout <<
"Rans" << ransVarId <<
"Infinity = " <<
PV->ransInfinity[ransVarId] * 1e8 <<
"e-8" << endl;
528 cout <<
"referenceTime = " <<
m_timeRef << endl;
542 u_infty[0] =
PV->VVInfinity[0];
543 u_infty[1] =
PV->VVInfinity[1];
579 MFloat pressureSignal = sin(radius / 0.05 * PI) * pAmp +
PV->PInfinity;
595 cout <<
"I.C. stagnating flow field was applied! " << endl;
613 MFloat pressureSignal = sin(xCoordinate / 0.1 * PI) * pAmp +
PV->PInfinity;
621 const MFloat epss = 1e-10;
622 const MFloat reTheta = 1000.0;
624 const MFloat delta0 = 72.0 / 7.0 * theta;
626 const MFloat C1 = 3.573244189003983;
628 const MFloat cf = 0.024 / pow(reTheta, 0.25);
633 const MFloat mu = SUTHERLANDLAW(
PV->TInfinity);
634 const MFloat utau = sqrt(cf / 2.0) *
m_Ma * sqrt(
PV->TInfinity);
642 }
else if(yplus < 10) {
646 utau * ((1. / K) * log(max(yplus, epss)) + C1 + 2 * PI1 / K * (3 * eta * eta - 2 * eta * eta * eta)),
666 m_log <<
"Blasius initial condition (incompressible)" << endl;
667 if(!
m_useBlasius)
mTerm(1,
"property Blasius not set. Refer to the description of the property");
671 blasiusf.open(
"velocity_x0.dat", ios::trunc);
673 blasiusf <<
"#y eta u v" << endl;
686 for(
MInt dim = 0; dim <
nDim; dim++)
687 blasiusf <<
" " << vel[dim] /
PV->UInfinity;
690 if(!d0Set && vel[0] >= 0.99 *
PV->UInfinity) {
696 d1 += (1 - vel[0] /
PV->UInfinity) * 0.05;
697 d2 += vel[0] /
PV->UInfinity * (1 - vel[0] /
PV->UInfinity) * 0.05;
703 cout <<
"d0: " << d0 <<
" d1: " << d1 <<
" d2: " << d2 << endl;
723 m_log <<
"No (correct) initial Condition is given! Used initial Condtion of parallel inflow!!!!!" << endl;
741 m_grid->m_initCoordinates[isd][pointId] =
m_grid->m_coordinates[isd][pointId];
877 m_log <<
"/////////////////// TRAVELING WAVE /////////////////////////////" << endl;
880 m_log <<
"Max up/down speed: " << speedAmplitude << endl;
882 m_log <<
"////////////////////////////////////////////////////////////////" << endl;
920 mTerm(1, AT_,
"Property waveLength not specified in property file");
940 mTerm(1, AT_,
"Property waveAmplitude not specified in property file");
959 mTerm(1, AT_,
"Property waveTime not specified in property file");
1085 m_log <<
"/////////////////// TRAVELING WAVE /////////////////////////////" << endl;
1088 m_log <<
"Speed amplitude: " << speedAmplitude << endl;
1090 m_log <<
"////////////////////////////////////////////////////////////////" << endl;
1119 freqFactor = Context::getSolverProperty<MFloat>(
"oscFreqFactor",
m_solverId, AT_, &freqFactor);
1126 stringstream errorMessage;
1127 errorMessage <<
"Grid moving method " <<
m_gridMovingMethod <<
" not implemented!" << endl;
1128 mTerm(1, AT_, errorMessage.str());
1159 m_log <<
"Initializing moving grid methods... DONE!" << endl;
1165 const MFloat pi = 4.0 * atan(1);
1171 const MFloat beta = 16.0l;
1174 const MFloat y_max = 1.0l;
1177 const MFloat x2 = y_max * (ver + 0.1l);
1178 const MFloat x3 = y_max * (ver + 0.5l);
1179 const MFloat x4 = y_max * (ver + 0.5l);
1180 const MFloat x5 = y_max * (ver + 0.9l);
1182 const MFloat omega =
m_Ma * sqrt(
PV->TInfinity) * StrNum * 2.0l * pi / y_max;
1183 const MFloat h = F1B2 * 0.35l * (F1 - cos(omega * t));
1184 const MFloat hvel = F1B2 * 0.35l * (omega * sin(omega * t));
1190 const MFloat x =
m_grid->m_initCoordinates[0][pointId];
1194 if(
y > x2 && y < x5 && x > x2 && x < x5) {
1195 g = ((
y < x3) ? (1.0l + tanhl(beta * (
y - (x2 + x3) / 2.0l) / y_max)) / 2.0l
1196 : ((
y < x4) ? 1.0l : (1.0l - tanhl(beta * (
y - (x4 + x5) / 2.0l) / y_max)) / 2.0l));
1198 m_grid->m_coordinates[0][pointId] = x * (F1 - h * g * (F1 - x));
1199 m_grid->m_velocity[0][pointId] = x * (-hvel * g * (F1 - x));
1202 if(x > x2 && x < x5 && y > x2 &&
y < x5) {
1203 g = ((x < x3) ? (1.0l + tanhl(beta * (x - (x2 + x3) / 2.0l) / y_max)) / 2.0l
1204 : ((x < x4) ? 1.0l : (1.0l - tanhl(beta * (x - (x4 + x5) / 2.0l) / y_max)) / 2.0l));
1206 m_grid->m_coordinates[1][pointId] =
y * (F1 - h * g * (F1 -
y));
1207 m_grid->m_velocity[1][pointId] =
y * (-hvel * g * (F1 -
y));
1222 MFloat fadeInFactor = 0.0;
1223 MFloat fadeInFactorPrime = 0.0;
1224 MFloat fadeInFactorPrimePrime = 0.0;
1228 fadeInFactorPrimePrime =
1232 fadeInFactorPrime = 0.0;
1233 fadeInFactorPrimePrime = 0.0;
1243 const MFloat xInit =
m_grid->m_initCoordinates[0][pointId];
1244 const MFloat yInit =
m_grid->m_initCoordinates[1][pointId];
1248 MFloat ytransitionFactor = F0;
1250 ytransitionFactor = F1;
1254 ytransitionFactor = F0;
1275 m_grid->m_coordinates[1][pointId] = func * fadeInFactor + yInit;
1276 m_grid->m_velocity[1][pointId] = func * fadeInFactorPrime + funcPrime * fadeInFactor;
1277 m_grid->m_acceleration[1][pointId] =
1278 funcPrimePrime * fadeInFactor + 2 * funcPrime * fadeInFactorPrime + func * fadeInFactorPrimePrime;
1294 MFloat fadeInFactor = 0.0;
1295 MFloat fadeInFactorPrime = 0.0;
1296 MFloat fadeInFactorPrimePrime = 0.0;
1300 fadeInFactorPrimePrime =
1304 fadeInFactorPrime = 0.0;
1305 fadeInFactorPrimePrime = 0.0;
1316 const MFloat xInit =
m_grid->m_initCoordinates[0][pointId];
1317 const MFloat yInit =
m_grid->m_initCoordinates[1][pointId];
1319 MFloat transitionFactor = F0;
1321 transitionFactor = F0;
1325 transitionFactor = F1;
1329 transitionFactor = F0;
1332 MFloat yTransitionFactor = F1;
1334 yTransitionFactor = F1;
1338 yTransitionFactor = F0;
1341 const MFloat func = transitionFactor * yTransitionFactor
1345 const MFloat funcPrimePrime = -transitionFactor * yTransitionFactor
1349 m_grid->m_coordinates[1][pointId] = func * fadeInFactor + yInit;
1350 m_grid->m_velocity[1][pointId] = func * fadeInFactorPrime + funcPrime * fadeInFactor;
1351 m_grid->m_acceleration[1][pointId] =
1352 funcPrimePrime * fadeInFactor + 2 * funcPrime * fadeInFactorPrime + func * fadeInFactorPrimePrime;
1366 const MFloat timeRelaxation = 1.0;
1368 if(t_offset < timeRelaxation) {
1369 fadeInFactor = (1.0 - cos(t_offset / timeRelaxation * pi)) * F1B2;
1386 MFloat spaceTransition = F1;
1389 spaceTransition = F0;
1390 }
else if(r >= 1.0 && r <= 41.0) {
1391 spaceTransition = fabs(r - 1.0) / 40.0;
1393 spaceTransition = F1;
1396 m_grid->m_coordinates[1][pIJ] =
1399 m_grid->m_velocity[1][pIJ] =
1400 (1.0 - spaceTransition)
1402 m_grid->m_acceleration[1][pIJ] =
1403 (1.0 - spaceTransition)
1411 mTerm(1, AT_,
"Grid Moving Method not implemented!");
1419 m_grid->extrapolateGhostPointCoordinates();
1432 m_grid->computeCellCenterCoordinates();
1436 m_grid->computeMetrics();
1440 m_grid->computeJacobian();
1472 for(
MInt dim = 0; dim <
nDim; dim++) {
1475 * (
m_grid->m_coordinates[dim][IJ] +
m_grid->m_coordinates[dim][IP1J]
1476 +
m_grid->m_coordinates[dim][IJP1] +
m_grid->m_coordinates[dim][IP1JP1]);
1486 MFloat epsilon = pow(10.0, -10.0);
1490 MFloat maxResidual1 = F0;
1491 MInt maxResIndex[3];
1493 MFloat maxResidualOrg = F0;
1494 MFloat localMaxResidual = F0;
1495 MFloat localAvrgResidual = F0;
1496 MFloat accumAvrgResidual = F0;
1497 MFloat globalMaxResidual = F0;
1499 for(
MInt dim = 0; dim <
nDim; dim++) {
1500 maxResIndex[dim] = F0;
1509 if(tmpResidual > maxResidual1) {
1512 maxResidual1 = tmpResidual;
1523 if(tmpResidual > maxResidual1) {
1526 maxResidual1 = tmpResidual;
1533 localMaxResidual = maxResidual1;
1539 "localAvrgResidual",
"accumAvrgResidual");
1541 "localMaxResidual",
"globalMaxResidual");
1543 maxResidualOrg = globalMaxResidual;
1550 if(
approx(localMaxResidual, maxResidualOrg,
m_eps)) {
1553 f_residual = fopen(
"./Residual",
"a+");
1556 fprintf(f_residual,
"#iter, physTime, time, dT, wLoad, avrgRes, maxRes, blockId, i, j");
1566 cerr <<
"Solution diverged, average residual is nan " << endl;
1567 m_log <<
"Solution diverged, average residual is nan " << endl;
1572 mTerm(1, AT_,
"Solution diverged, average residual is nan ");
1582 if(
approx(localMaxResidual, maxResidualOrg,
1586 f_residual = fopen(
"./Residual",
"a+");
1589 fprintf(f_residual,
" %f",
m_time);
1593 fprintf(f_residual,
" %1.10e", globalMaxResidual);
1597 fprintf(f_residual,
"\n");
1617 return origin + incI + incJ *
m_nPoints[1];
1621 return origin + incI + incJ *
m_nCells[1];
1644 m_grid->extrapolateGhostPointCoordinates();
1664 m_grid->writePartitionedGrid();
1684 MInt pos[2], fix[2], mirror[2], ij[2], extendij[2];
1685 MInt pointId, FixPointId, MirrorPointId;
1689 extendij[index] = 0;
1691 for(ij[1] = start[1]; ij[1] < end[1] + extendij[1]; ++ij[1]) {
1692 for(ij[0] = start[0]; ij[0] < end[0] + extendij[0]; ++ij[0]) {
1693 for(
MInt m = 0; m < 2; ++m) {
1698 mirror[m] = 2 * fix[m] - pos[m];
1702 mirror[m] = 2 * fix[m] - pos[m];
1713 MirrorPointId =
pointIndex(mirror[0], mirror[1]);
1715 for(
MInt dim = 0; dim <
nDim; dim++) {
1716 m_grid->m_coordinates[dim][pointId] =
1717 (2 *
m_grid->m_coordinates[dim][FixPointId] -
m_grid->m_coordinates[dim][MirrorPointId]);
1734 m_grid->saveCellJacobian();
1760 MInt cellId = 0, IP1 = 0, IM1 = 0, IP2 = 0;
1762 MFloat DS = F0, DSP1 = F0, DSM1 = F0, DSP = F0, DSM = F0;
1777 MFloat pIM2 = F0, pIM1 = F0, pIP1 = F0, pIP2 = F0;
1778 for(
MInt i = 0; i <
CV->noVariables; i++) {
1787 MFloat phi = F0, psi = F0, vel = F0;
1793 for(
MInt dim = 0; dim <
nDim; ++dim) {
1799 IP1 = cellId + IJ[dim];
1800 IM1 = cellId - IJ[dim];
1801 IP2 = cellId + 2 * IJ[dim];
1804 DS = sqrt(
POW2(x[IP1] - x[cellId]) +
POW2(
y[IP1] -
y[cellId]));
1806 DSM1 = sqrt(
POW2(x[cellId] - x[IM1]) +
POW2(
y[cellId] -
y[IM1]));
1807 DSP1 = sqrt(
POW2(x[IP2] - x[IP1]) +
POW2(
y[IP2] -
y[IP1]));
1813 DSP = DS /
POW2(DSP1 + DS);
1814 DSM = DS /
POW2(DSM1 + DS);
1817 for(
MInt var = 0; var <
CV->noVariables; ++var) {
1826 for(
MInt dim1 = 0; dim1 <
nDim; ++dim1) {
1831 for(
MInt dim1 = 0; dim1 <
nDim; ++dim1) {
1837 for(
MInt dim1 = 0; dim1 <
nDim; ++dim1) {
1842 for(
MInt dim1 = 0; dim1 <
nDim; ++dim1) {
1849 dummy = fabs(pIM2 - F2 * pIM1 + pIP1) / (pIM2 + F2 * pIM1 + pIP1);
1850 dummy1 = fabs(pIM1 - F2 * pIP1 + pIP2) / (pIM1 + F2 * pIP1 + pIP2);
1853 epsLim =
mMax(
m_eps, pow(F1B2 * smps, F5));
1856 for(
MInt var = 0; var <
CV->noVariables; ++var) {
1859 -
mMax(F0, (DQP1[var] * DQM1[var] * smps + F1B2 * epsLim)
1860 / (
POW2(DQP1[var] * DS) +
POW2(DQM1[var] * DSP1) + epsLim)))
1877 for(
MInt v = 0; v <
CV->noVariables; ++v) {
1891template <FvStructuredSolver2D::fluxmethod ausm, MInt noVars>
1907 for(
MInt dim = 0; dim <
nDim; dim++) {
1911 const MInt IP1 = I + IJK[dim];
1912 const MInt IM1 = I - IJK[dim];
1913 const MInt IP2 = I + 2 * IJK[dim];
1923 for(
MUint v = 0; v < noVars; ++v) {
1924 const MUint offset = v * noCells;
1925 const MFloat*
const RESTRICT vars = ALIGNED_F(cellVariables + offset);
1926 const MFloat DQ = vars[IP1] - vars[I];
1927 const MFloat DQP1 = vars[IP2] - vars[IP1];
1928 const MFloat DQM1 = vars[I] - vars[IM1];
1929 qleft[v] = vars[I] + DSM * (DSM1 * DQ + DS * DQM1);
1930 qright[v] = vars[IP1] - DSP * (DS * DQP1 + DSP1 * DQ);
1938 for(
MUint v = 0; v < noVars; v++) {
1942 const MInt IM1 = I - IJK[dim];
1943 const MUint offset = v * noCells;
1944 MFloat*
const RESTRICT
rhs = ALIGNED_F(cellRhs + offset);
1945 rhs[I] += flux[v][IM1] - flux[v][I];
1953template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES, 5>();
1954template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES, 6>();
1955template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES, 7>();
1957template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES_PTHRC, 5>();
1958template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES_PTHRC, 6>();
1959template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmLES_PTHRC, 7>();
1961template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmDV, 5>();
1962template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmDV, 6>();
1963template void FvStructuredSolver2D::Muscl_<&FvStructuredSolver2D::AusmDV, 7>();
1966template <FvStructuredSolver2D::fluxmethod ausm, MInt noVars>
1982 for(
MInt dim = 0; dim <
nDim; dim++) {
1984 const MFloat*
const RESTRICT length = ALIGNED_F(cellLength + dimOffset);
1989 const MInt IP1 = I + IJK[dim];
1990 const MInt IM1 = I - IJK[dim];
1991 const MInt IP2 = I + 2 * IJK[dim];
1993 const MFloat rp = (length[I] + length[IP1]) / (F2 * length[I]);
1994 const MFloat rm = (length[I] + length[IM1]) / (F2 * length[I]);
1995 const MFloat f = phi / (F2 * (rp + rm));
1996 const MFloat f1 = (rm + kappa * phi) / rp;
1997 const MFloat f2 = (rp - kappa * phi) / rm;
1999 const MFloat rp1 = (length[IP1] + length[IP2]) / (F2 * length[IP1]);
2000 const MFloat rm1 = (length[IP1] + length[I]) / (F2 * length[IP1]);
2001 const MFloat fa = phi / (F2 * (rp1 + rm1));
2002 const MFloat fb = (rm1 - kappa * phi) / rp1;
2003 const MFloat fc = (rp1 + kappa * phi) / rm1;
2005 for(
MUint v = 0; v < noVars; v++) {
2007 const MFloat*
const RESTRICT vars = ALIGNED_F(cellVariables + offset);
2009 const MFloat DQ = (vars[IP1] - vars[I]);
2010 const MFloat DQM1 = (vars[I] - vars[IM1]);
2011 qleft[v] = vars[I] + f * (f1 * DQ + f2 * DQM1);
2014 const MFloat DQP1 = (vars[IP2] - vars[IP1]);
2015 const MFloat DQ1 = (vars[IP1] - vars[I]);
2016 qright[v] = vars[IP1] - fa * (fb * DQP1 + fc * DQ1);
2024 for(
MUint v = 0; v < noVars; v++) {
2028 const MInt IM1 = I - IJK[dim];
2030 MFloat*
const RESTRICT
rhs = ALIGNED_F(cellRhs + offset);
2031 rhs[I] += flux[v][IM1] - flux[v][I];
2038template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES, 5>();
2039template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES, 6>();
2040template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES, 7>();
2042template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES_PTHRC, 5>();
2043template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES_PTHRC, 6>();
2044template void FvStructuredSolver2D::MusclStretched_<&FvStructuredSolver2D::AusmLES_PTHRC, 7>();
2060 const MFloat gammaMinusOne = gamma - 1.0;
2061 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
2072 const MFloat RHOL = QLeft[
PV->RHO];
2077 const MFloat RHOR = QRight[
PV->RHO];
2081 const MFloat fMetricLength = F1 / metricLength;
2084 const MFloat UUL = ((UL * surf0 + VL * surf1) - dxdtau) * fMetricLength;
2087 const MFloat UUR = ((UR * surf0 + VR * surf1) - dxdtau) * fMetricLength;
2094 const MFloat MAL = UUL / AL;
2095 const MFloat MAR = UUR / AR;
2097 const MFloat MALR = F1B2 * (MAL + MAR);
2098 const MFloat PLR = F1B2 * (PL + PR);
2100 const MFloat RHO_AL = RHOL * AL;
2101 const MFloat RHO_AR = RHOR * AR;
2103 const MFloat PLfRHOL = PL / RHOL;
2104 const MFloat PRfRHOR = PR / RHOR;
2106 const MFloat e0 = PLfRHOL * FgammaMinusOne + 0.5 * (
POW2(UL) +
POW2(VL)) + PLfRHOL;
2107 const MFloat e1 = PRfRHOR * FgammaMinusOne + 0.5 * (
POW2(UR) +
POW2(VR)) + PRfRHOR;
2109 const MFloat RHOU = F1B2 * (MALR * (RHO_AL + RHO_AR) + fabs(MALR) * (RHO_AL - RHO_AR)) * metricLength;
2110 const MFloat RHOU2 = F1B2 * RHOU;
2112 const MFloat AbsRHO_U2 = fabs(RHOU2);
2116 flux[
CV->RHO_U][I] = RHOU2 * (UL + UR) + AbsRHO_U2 * (UL - UR) + PLR * surf0;
2117 flux[
CV->RHO_V][I] = RHOU2 * (VL + VR) + AbsRHO_U2 * (VL - VR) + PLR * surf1;
2118 flux[
CV->RHO_E][I] = RHOU2 * (e0 + e1) + AbsRHO_U2 * (e0 - e1) + PLR * dxdtau;
2119 flux[
CV->RHO][I] = RHOU;
2131 const MFloat gammaMinusOne = gamma - 1.0;
2132 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
2145 const MFloat RHOL = QLeft[
PV->RHO];
2150 const MFloat RHOR = QRight[
PV->RHO];
2154 const MFloat fMetricLength = F1 / metricLength;
2157 const MFloat UUL = ((UL * surf0 + VL * surf1) - dxdtau) * fMetricLength;
2160 const MFloat UUR = ((UR * surf0 + VR * surf1) - dxdtau) * fMetricLength;
2167 const MFloat MAL = UUL / AL;
2168 const MFloat MAR = UUR / AR;
2170 const MFloat MALR = F1B2 * (MAL + MAR);
2183 const MFloat p4I4 = F4 * (p[IPJK] + p[IMJK]) - F6 * (p[I]) - p[IP2JK] - p[IM2JK];
2184 const MFloat p4J4 = F4 * (p[IJPK] + p[IJMK]) - F6 * (p[I]) - p[IJP2K] - p[IJM2K];
2186 const MFloat cfac = 1.0 / 1.3;
2187 const MFloat pfac = fabs(p4I4) + fabs(p4J4);
2188 MFloat fac = cfac * pfac;
2189 fac = min(1 / 64.0, fac * 5.0);
2191 const MFloat PLR = PL * (F1B2 + fac * MAL) + PR * (F1B2 - fac * MAR);
2193 const MFloat RHO_AL = RHOL * AL;
2194 const MFloat RHO_AR = RHOR * AR;
2196 const MFloat PLfRHOL = PL / RHOL;
2197 const MFloat PRfRHOR = PR / RHOR;
2199 const MFloat e0 = PLfRHOL * FgammaMinusOne + 0.5 * (
POW2(UL) +
POW2(VL)) + PLfRHOL;
2200 const MFloat e1 = PRfRHOR * FgammaMinusOne + 0.5 * (
POW2(UR) +
POW2(VR)) + PRfRHOR;
2202 const MFloat RHOU = F1B2 * (MALR * (RHO_AL + RHO_AR) + fabs(MALR) * (RHO_AL - RHO_AR)) * metricLength;
2203 const MFloat RHOU2 = F1B2 * RHOU;
2205 const MFloat AbsRHO_U2 = fabs(RHOU2);
2209 flux[
CV->RHO_U][I] = RHOU2 * (UL + UR) + AbsRHO_U2 * (UL - UR) + PLR * surf0;
2210 flux[
CV->RHO_V][I] = RHOU2 * (VL + VR) + AbsRHO_U2 * (VL - VR) + PLR * surf1;
2211 flux[
CV->RHO_E][I] = RHOU2 * (e0 + e1) + AbsRHO_U2 * (e0 - e1) + PLR * dxdtau;
2212 flux[
CV->RHO][I] = RHOU;
2217 const MFloat gammaMinusOne = gamma - 1.0;
2218 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
2224 const MFloat RHOL = QLeft[
PV->RHO];
2225 const MFloat FRHOL = F1 / RHOL;
2231 const MFloat RHOR = QRight[
PV->RHO];
2232 const MFloat FRHOR = F1 / RHOR;
2237 const MFloat PLfRHOL = PL / RHOL;
2238 const MFloat PRfRHOR = PR / RHOR;
2239 const MFloat e0 = PLfRHOL * FgammaMinusOne + 0.5 * (
POW2(UL) +
POW2(VL)) + PLfRHOL;
2240 const MFloat e1 = PRfRHOR * FgammaMinusOne + 0.5 * (
POW2(UR) +
POW2(VR)) + PRfRHOR;
2245 const MFloat FDGRAD = F1 / DGRAD;
2248 const MFloat UUL = ((UL * surf0 + VL * surf1)) * FDGRAD;
2251 const MFloat UUR = ((UR * surf0 + VR * surf1)) * FDGRAD;
2256 const MFloat FALR = 2.0 / (AL + AR);
2257 const MFloat ALPHAL = AL * FALR;
2258 const MFloat ALPHAR = AR * FALR;
2260 AL = sqrt(gamma * AL);
2261 AR = sqrt(gamma * AR);
2265 const MFloat XMAL = UUL / AL;
2266 const MFloat XMAR = UUR / AR;
2271 const MFloat RHOAL = AL * RHOL;
2272 const MFloat RHOAR = AR * RHOR;
2275 const MInt IP1 = I + IJK[dim];
2281 const MFloat SV1 = SV * DXDXEZ;
2282 const MFloat SV2 = SV * DYDXEZ;
2287 MFloat FXMA = F1B2 * (XMAL1 + fabs(XMAL1));
2288 const MFloat XMALP = ALPHAL * (F1B4 *
POW2(XMAL1 + F1) - FXMA) + FXMA + (
mMax(F1, XMAL) - F1);
2289 FXMA = F1B2 * (XMAR1 - fabs(XMAR1));
2290 const MFloat XMARM = ALPHAR * (-F1B4 *
POW2(XMAR1 - F1) - FXMA) + FXMA + (
mMin(-F1, XMAR) + F1);
2292 const MFloat FLP = PL * ((F2 - XMAL1) *
POW2(F1 + XMAL1));
2293 const MFloat FRP = PR * ((F2 + XMAR1) *
POW2(F1 - XMAR1));
2294 const MFloat PLR = F1B4 * (FLP + FRP);
2296 const MFloat RHOUL = XMALP * RHOAL;
2297 const MFloat RHOUR = XMARM * RHOAR;
2298 const MFloat RHOU = RHOUL + RHOUR;
2299 const MFloat RHOU2 = F1B2 * RHOU;
2300 const MFloat ARHOU2 = fabs(RHOU2);
2302 const MFloat UUL2 = SV1 * UUL;
2303 const MFloat UUR2 = SV1 * UUR;
2306 const MFloat UUL3 = SV2 * UUL;
2307 const MFloat UUR3 = SV2 * UUR;
2314 flux[
CV->RHO_U][I] = RHOU2 * (UL + UR) + ARHOU2 * (UL - UR) + PLR * surf0 + RHOUL * UUL2 + RHOUR * UUR2;
2315 flux[
CV->RHO_V][I] = RHOU2 * (VL + VR) + ARHOU2 * (VL - VR) + PLR * surf1 + RHOUL * UUL3 + RHOUR * UUR3;
2316 flux[
CV->RHO_E][I] = RHOU2 * (e0 + e1) + ARHOU2 * (e0 - e1);
2317 flux[
CV->RHO][I] = RHOU;
2337 const MFloat lenXi = sqrt(
POW2(metric[0][cellId]) +
POW2(metric[1][cellId]));
2339 const MFloat lenEt = sqrt(
POW2(metric[2][cellId]) +
POW2(metric[3][cellId]));
2351 U_c -= dxtx[cellId];
2352 V_c -= dxty[cellId];
2358 const MFloat eigenvalue = U_c + V_c + speedOfSound * (lenXi + lenEt);
2382 const MInt noVars =
CV->noVariables;
2387#ifdef MAIA_EXTRA_DEBUG
2399 for(
MInt v = 0; v < noVars; v++) {
2400 const MUint offset = v * noCells;
2401 MFloat*
const RESTRICT oldCellVars = ALIGNED_F(oldVars + offset);
2402 const MFloat*
const RESTRICT cellVars = ALIGNED_F(vars + offset);
2404 oldCellVars[cellId] = cellVars[cellId];
2413 for(
MInt v = 0; v < noVars; v++) {
2414 const MUint cellOffset = v * noCells;
2415 MFloat*
const RESTRICT cellVars = vars + cellOffset;
2416 const MFloat*
const RESTRICT oldCellVars = oldVars + cellOffset;
2417 const MFloat*
const RESTRICT cellRhs =
rhs + cellOffset;
2423 cellVars[cellId] = oldCellVars[cellId] + factor * cellRhs[cellId];
2428 for(
MInt v = 0; v < noVars; v++) {
2429 const MUint cellOffset = v * noCells;
2430 MFloat*
const RESTRICT cellVars = vars + cellOffset;
2431 const MFloat*
const RESTRICT oldCellVars = oldVars + cellOffset;
2432 const MFloat*
const RESTRICT cellRhs =
rhs + cellOffset;
2438 (oldCellVars[cellId] * oldCellJac[cellId] + rkFactor * cellRhs[cellId]) / cellJac[cellId];
2443 for(
MInt v = 0; v < noVars; v++) {
2444 const MUint cellOffset = v * noCells;
2445 MFloat*
const RESTRICT cellVars = vars + cellOffset;
2446 const MFloat*
const RESTRICT oldCellVars = oldVars + cellOffset;
2447 const MFloat*
const RESTRICT cellRhs =
rhs + cellOffset;
2453 cellVars[cellId] = oldCellVars[cellId] + factor * cellRhs[cellId];
2461 for(
MInt v = 0; v < noVars; v++) {
2462 const MUint cellOffset = v * noCells;
2463 MFloat*
const RESTRICT cellVars = vars + cellOffset;
2464 const MFloat*
const RESTRICT oldCellVars = oldVars + cellOffset;
2465 const MFloat*
const RESTRICT cellRhs =
rhs + cellOffset;
2472 rkAlpha * cellVars[cellId] + (F1 - rkAlpha) * oldCellVars[cellId] - factor * cellRhs[cellId];
2479 stringstream errorMessage;
2480 errorMessage <<
"Given RungeKutta Order " <<
m_rungeKuttaOrder <<
" not implemented! " << endl;
2481 mTerm(1, AT_, errorMessage.str());
2504template <MBool twoEqRans>
2508 const MFloat rPrTurb = F1 / 0.9;
2511 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
2532 T[I] =
m_gamma * p[I] / rho[I];
2533 muLam[I] = SUTHERLANDLAW(T[I]);
2548 const MFloat dudxi = F1B2 * (u[IPJP] + u[IPJ] - u[IJP] - u[IJ]);
2549 const MFloat dudet = F1B2 * (u[IPJP] + u[IJP] - u[IPJ] - u[IJ]);
2551 const MFloat dvdxi = F1B2 * (v[IPJP] + v[IPJ] - v[IJP] - v[IJ]);
2552 const MFloat dvdet = F1B2 * (v[IPJP] + v[IJP] - v[IPJ] - v[IJ]);
2554 const MFloat dTdxi = F1B2 * (T[IPJP] + T[IPJ] - T[IJP] - T[IJ]);
2555 const MFloat dTdet = F1B2 * (T[IPJP] + T[IJP] - T[IPJ] - T[IJ]);
2557 const MFloat uAvg = F1B4 * (u[IJP] + u[IPJP] + u[IJ] + u[IPJ]);
2558 const MFloat vAvg = F1B4 * (v[IJP] + v[IPJP] + v[IJ] + v[IPJ]);
2560 const MFloat muLamAvg = F1B4 * (muLam[IJP] + muLam[IPJP] + muLam[IJ] + muLam[IPJ]);
2561 const MFloat muTurbAvg = F1B4 * (muTurb[IJP] + muTurb[IPJP] + muTurb[IJ] + muTurb[IPJ]);
2566 -2 / 3 * F1B4 * (rho[IJP] * TKE[IJP] + rho[IPJP] * TKE[IPJP] + rho[IJ] * TKE[IJ] + rho[IPJ] * TKE[IPJ]);
2577 tau1 = F4B3 * (dudxi * cornerMetrics[
xsd * 2 +
xsd] + dudet * cornerMetrics[
ysd * 2 +
xsd]) -
2579 F2B3 * (dvdxi * cornerMetrics[
xsd * 2 +
ysd] + dvdet * cornerMetrics[
ysd * 2 +
ysd]);
2585 tau2 = dudxi * cornerMetrics[
xsd * 2 +
ysd] + dudet * cornerMetrics[
ysd * 2 +
ysd] +
2587 dvdxi * cornerMetrics[
xsd * 2 +
xsd] + dvdet * cornerMetrics[
ysd * 2 +
xsd];
2594 tau4 = F4B3 * (dvdxi * cornerMetrics[
xsd * 2 +
ysd] + dvdet * cornerMetrics[
ysd * 2 +
ysd]) -
2596 F2B3 * (dudxi * cornerMetrics[
xsd * 2 +
xsd] + dudet * cornerMetrics[
ysd * 2 +
xsd]);
2599 dTdx = dTdxi * cornerMetrics[
xsd * 2 +
xsd] + dTdet * cornerMetrics[
ysd * 2 +
xsd];
2601 dTdy = dTdxi * cornerMetrics[
xsd * 2 +
ysd] + dTdet * cornerMetrics[
ysd * 2 +
ysd];
2604 const MFloat mueOverRe = rRe * fJac * (muLamAvg + muTurbAvg);
2605 tau1 = mueOverRe * tau1 + TKEcorner;
2607 tau4 = mueOverRe * tau4 + TKEcorner;
2609 const MFloat muCombined = FgammaMinusOne * rRe * fJac * (rPrLam * muLamAvg + rPrTurb * muTurbAvg);
2610 const MFloat qx = muCombined * dTdx + uAvg * tau1 + vAvg * tau2;
2611 const MFloat qy = muCombined * dTdy + uAvg * tau2 + vAvg * tau4;
2614 eflux[0][IJ] = tau1 * cornerMetrics[
xsd * 2 +
xsd] + tau2 * cornerMetrics[
xsd * 2 +
ysd];
2616 eflux[1][IJ] = tau2 * cornerMetrics[
xsd * 2 +
xsd] + tau4 * cornerMetrics[
xsd * 2 +
ysd];
2618 eflux[2][IJ] = qx * cornerMetrics[
xsd * 2 +
xsd] + qy * cornerMetrics[
xsd * 2 +
ysd];
2621 fflux[0][IJ] = tau1 * cornerMetrics[
ysd * 2 +
xsd] + tau2 * cornerMetrics[
ysd * 2 +
ysd];
2623 fflux[1][IJ] = tau2 * cornerMetrics[
ysd * 2 +
xsd] + tau4 * cornerMetrics[
ysd * 2 +
ysd];
2625 fflux[2][IJ] = qx * cornerMetrics[
ysd * 2 +
xsd] + qy * cornerMetrics[
ysd * 2 +
ysd];
2636 for(
MInt var = 0; var < 3; ++var) {
2642 vflux[0][IJ] = F1B2 * (eflux[var][IJ] + eflux[var][IJM]);
2651 vflux[1][IJ] = F1B2 * (fflux[var][IJ] + fflux[var][IMJ]);
2660 m_cells->
rightHandSide[var][IJ] += (vflux[0][IJ] - vflux[0][IMJ] + vflux[1][IJ] - vflux[1][IJM]);
2665template void FvStructuredSolver2D::viscousFluxLES<true>();
2919template <MBool twoEqRans>
2923 const MFloat rPrTurb = F1 / 0.9;
2926 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
2947 T[I] =
m_gamma * p[I] / rho[I];
2948 muLam[I] = SUTHERLANDLAW(T[I]);
2965 const MFloat dudxi = F1B2 * (u[IPJP] + u[IPJ] - u[IJP] - u[IJ]);
2966 const MFloat dudet = F1B2 * (u[IPJP] + u[IJP] - u[IPJ] - u[IJ]);
2968 const MFloat dvdxi = F1B2 * (v[IPJP] + v[IPJ] - v[IJP] - v[IJ]);
2969 const MFloat dvdet = F1B2 * (v[IPJP] + v[IJP] - v[IPJ] - v[IJ]);
2971 const MFloat dTdxi = F1B2 * (T[IPJP] + T[IPJ] - T[IJP] - T[IJ]);
2972 const MFloat dTdet = F1B2 * (T[IPJP] + T[IJP] - T[IPJ] - T[IJ]);
2974 eflux[0][IJ] = dudet * cornerMetrics[
ysd * 2 +
ysd] + dvdet * cornerMetrics[
ysd * 2 +
xsd];
2975 eflux[1][IJ] = dudet * cornerMetrics[
ysd * 2 +
xsd];
2976 eflux[2][IJ] = dvdet * cornerMetrics[
ysd * 2 +
ysd];
2978 fflux[0][IJ] = dudxi * cornerMetrics[
xsd * 2 +
ysd] + dvdxi * cornerMetrics[
xsd * 2 +
xsd];
2979 fflux[1][IJ] = dudxi * cornerMetrics[
xsd * 2 +
xsd];
2980 fflux[2][IJ] = dvdxi * cornerMetrics[
xsd * 2 +
ysd];
2982 dT[0][IJ] = dTdet * cornerMetrics[
ysd * 2 +
xsd];
2983 dT[1][IJ] = dTdet * cornerMetrics[
ysd * 2 +
ysd];
2984 dT[2][IJ] = dTdxi * cornerMetrics[
xsd * 2 +
xsd];
2985 dT[3][IJ] = dTdxi * cornerMetrics[
xsd * 2 +
ysd];
3002 const MFloat invSurfJac =
3005 const MFloat dudxi = (u[IPJ] - u[IJ]) * invSurfJac;
3006 const MFloat dvdxi = (v[IPJ] - v[IJ]) * invSurfJac;
3007 const MFloat dTdxi = (T[IPJ] - T[IJ]) * invSurfJac;
3009 const MFloat uAvg = F1B2 * (u[IJ] + u[IPJ]);
3010 const MFloat vAvg = F1B2 * (v[IJ] + v[IPJ]);
3012 const MFloat muLamAvg = F1B2 * (muLam[IJ] + muLam[IPJ]);
3013 const MFloat muTurbAvg = F1B2 * (muTurb[IJ] + muTurb[IPJ]);
3017 const MFloat dudx_ = F1B2 * (eflux[1][IJ] + eflux[1][IJM]);
3018 const MFloat dvdy_ = F1B2 * (eflux[2][IJ] + eflux[2][IJM]);
3019 const MFloat S12_ = F1B2 * (eflux[0][IJ] + eflux[0][IJM]);
3020 const MFloat dTdx_ = F1B2 * (dT[0][IJ] + dT[0][IJM]);
3021 const MFloat dTdy_ = F1B2 * (dT[1][IJ] + dT[1][IJM]);
3024 if(
m_rans2eq_mode ==
"production") TKEcorner = -2 / 3 * F1B2 * (rho[IJ] * TKE[IJ] + rho[IPJ] * TKE[IPJ]);
3032 MFloat tau1 = F4B3 * (dudxi * surf0 + dudx_) - F2B3 * (dvdxi * surf1 + dvdy_);
3038 MFloat tau2 = dudxi * surf1 + dvdxi * surf0 + S12_;
3045 MFloat tau4 = F4B3 * (dvdxi * surf1 + dvdy_) - F2B3 * (dudxi * surf0 + dudx_);
3047 const MFloat dTdx = dTdxi * surf0 + dTdx_;
3048 const MFloat dTdy = dTdxi * surf1 + dTdy_;
3050 const MFloat mueOverRe = rRe * (muLamAvg + muTurbAvg);
3051 tau1 = mueOverRe * tau1 + TKEcorner;
3053 tau4 = mueOverRe * tau4 + TKEcorner;
3055 const MFloat muCombined = FgammaMinusOne * rRe * (rPrLam * muLamAvg + rPrTurb * muTurbAvg);
3056 const MFloat qx = muCombined * dTdx + uAvg * tau1 + vAvg * tau2;
3057 const MFloat qy = muCombined * dTdy + uAvg * tau2 + vAvg * tau4;
3059 MFloat limiterVisc = 1.0;
3063 limiterVisc = std::min(1.0, mu_ref / std::abs(mueOverRe));
3067 eflux[0][IJM] = (tau1 * surf0 + tau2 * surf1) * limiterVisc;
3068 eflux[1][IJM] = (tau2 * surf0 + tau4 * surf1) * limiterVisc;
3069 eflux[2][IJM] = (qx * surf0 + qy * surf1) * limiterVisc;
3082 const MFloat invSurfJac =
3085 const MFloat dudet = (u[IJP] - u[IJ]) * invSurfJac;
3086 const MFloat dvdet = (v[IJP] - v[IJ]) * invSurfJac;
3087 const MFloat dTdet = (T[IJP] - T[IJ]) * invSurfJac;
3089 const MFloat uAvg = F1B2 * (u[IJ] + u[IJP]);
3090 const MFloat vAvg = F1B2 * (v[IJ] + v[IJP]);
3092 const MFloat muLamAvg = F1B2 * (muLam[IJ] + muLam[IJP]);
3093 const MFloat muTurbAvg = F1B2 * (muTurb[IJ] + muTurb[IJP]);
3097 const MFloat dudx_ = F1B2 * (fflux[1][IJ] + fflux[1][IMJ]);
3098 const MFloat dvdy_ = F1B2 * (fflux[2][IJ] + fflux[2][IMJ]);
3099 const MFloat S12_ = F1B2 * (fflux[0][IJ] + fflux[0][IMJ]);
3100 const MFloat dTdx_ = F1B2 * (dT[2][IJ] + dT[2][IMJ]);
3101 const MFloat dTdy_ = F1B2 * (dT[3][IJ] + dT[3][IMJ]);
3104 if(
m_rans2eq_mode ==
"production") TKEcorner = -2 / 3 * F1B2 * (rho[IJ] * TKE[IJ] + rho[IJP] * TKE[IJP]);
3112 MFloat tau1 = F4B3 * (dudx_ + dudet * surf0) - F2B3 * (dvdy_ + dvdet * surf1);
3118 MFloat tau2 = dudet * surf1 + dvdet * surf0 + S12_;
3125 MFloat tau4 = F4B3 * (dvdy_ + dvdet * surf1) - F2B3 * (dudx_ + dudet * surf0);
3127 const MFloat dTdx = dTdet * surf0 + dTdx_;
3128 const MFloat dTdy = dTdet * surf1 + dTdy_;
3130 const MFloat mueOverRe = rRe * (muLamAvg + muTurbAvg);
3131 tau1 = mueOverRe * tau1 + TKEcorner;
3133 tau4 = mueOverRe * tau4 + TKEcorner;
3135 const MFloat muCombined = FgammaMinusOne * rRe * (rPrLam * muLamAvg + rPrTurb * muTurbAvg);
3136 const MFloat qx = muCombined * dTdx + uAvg * tau1 + vAvg * tau2;
3137 const MFloat qy = muCombined * dTdy + uAvg * tau2 + vAvg * tau4;
3139 MFloat limiterVisc = 1.0;
3143 limiterVisc = std::min(1.0, mu_ref / std::abs(mueOverRe));
3147 fflux[0][IMJ] = (tau1 * surf0 + tau2 * surf1) * limiterVisc;
3148 fflux[1][IMJ] = (tau2 * surf0 + tau4 * surf1) * limiterVisc;
3149 fflux[2][IMJ] = (qx * surf0 + qy * surf1) * limiterVisc;
3153 for(
MInt var = 0; var < 3; ++var) {
3161 MFloat limiterVisc = 1.0;
3169 (eflux[var][IJM] - eflux[var][IMJM] + (fflux[var][IMJ] - fflux[var][IMJM])) * limiterVisc;
3174template void FvStructuredSolver2D::viscousFluxLESCompact<true>();
3177template <MBool twoEqRans>
3179 mTerm(1,
"I don't think that this correction is ok, becuase of the cornerMetrics at the singular point!");
3181 const MFloat rPrTurb = F1 / 0.9;
3184 const MFloat FgammaMinusOne = F1 / gammaMinusOne;
3214 mTerm(1,
"In 2D not possible!");
3225 MFloat u[10], v[10], T[10], muTurb[10], TKE[10];
3226 MFloat U, V, t, muTurb_corner, TKEcorner, dudx, dudy, dvdx, dvdy, dTdx, dTdy;
3228 MFloat mueOverRe, mue, mueH;
3229 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
3230 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
3244 nghbr[count++] =
cellIndex(ii + change[0], jj + change[1]);
3249 cout <<
"what the hell! it is wrong!!! count=" << count <<
" Nstar=" <<
m_singularity[i].
Nstar << endl;
3253 u[m] = u_[nghbr[m]];
3254 v[m] = v_[nghbr[m]];
3256 T[m] =
m_gamma * p_[nghbr[m]] / rho_[nghbr[m]];
3257 muTurb[m] = muTurb_[nghbr[m]];
3258 if(twoEqRans &&
m_rans2eq_mode ==
"production") TKE[m] = rho_[nghbr[m]] * TKE_[nghbr[m]];
3273 MInt id2 = ii - start[0] + (jj - start[1]) * len1[0];
3275 for(
MInt n = 0; n < count; n++) {
3276 MInt ID = id2 * count + n;
3300 tau1 = 2 * dudx - 2 / 3 * (dudx + dvdy);
3302 tau4 = 2 * dvdy - 2 / 3 * (dudx + dvdy);
3304 mue = SUTHERLANDLAW(t);
3305 TKEcorner *= -2 / 3;
3306 mueOverRe = (mue + muTurb_corner) * rRe;
3307 tau1 = mueOverRe * tau1 + TKEcorner;
3309 tau4 = mueOverRe * tau4 + TKEcorner;
3310 mueH = FgammaMinusOne * rRe * (rPr * mue + rPrTurb * muTurb_corner);
3312 const MFloat qx = mueH * dTdx + U * tau1 + V * tau2;
3313 const MFloat qy = mueH * dTdy + U * tau2 + V * tau4;
3316 eflux[0][IJK] = tau1 * cornerMetrics[
xsd * 2 +
xsd] + tau2 * cornerMetrics[
xsd * 2 +
ysd];
3317 eflux[1][IJK] = tau2 * cornerMetrics[
xsd * 2 +
xsd] + tau4 * cornerMetrics[
xsd * 2 +
ysd];
3318 eflux[2][IJK] = qx * cornerMetrics[
xsd * 2 +
xsd] + qy * cornerMetrics[
xsd * 2 +
ysd];
3321 fflux[0][IJK] = tau1 * cornerMetrics[
ysd * 2 +
xsd] + tau2 * cornerMetrics[
ysd * 2 +
ysd];
3322 fflux[1][IJK] = tau2 * cornerMetrics[
ysd * 2 +
xsd] + tau4 * cornerMetrics[
ysd * 2 +
ysd];
3323 fflux[2][IJK] = qx * cornerMetrics[
ysd * 2 +
xsd] + qy * cornerMetrics[
ysd * 2 +
ysd];
3331template <MBool twoEqRans>
3358 mTerm(1,
"In 2D not possible!");
3369 MFloat u[10], v[10], T[10];
3371 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
3372 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
3384 nghbr[count++] = IJ;
3389 nghbr[count++] =
cellIndex(ii + change[0], jj + change[1]);
3394 cout <<
"what the hell! it is wrong!!! count=" << count <<
" Nstar=" <<
m_singularity[i].
Nstar << endl;
3398 u[m] = u_[nghbr[m]];
3399 v[m] = v_[nghbr[m]];
3401 T[m] =
m_gamma * p_[nghbr[m]] / rho_[nghbr[m]];
3408 MInt id2 = ii - start[0] + (jj - start[1]) * len1[0];
3410 for(
MInt n = 0; n < count; n++) {
3411 MInt ID = id2 * count + n;
3428 const MFloat dudet = sign_eta * 0.5 * (U - 0.5 * (u[0] + u_[IPMJ]));
3429 const MFloat dvdet = sign_eta * 0.5 * (V - 0.5 * (v[0] + v_[IPMJ]));
3431 const MFloat dTdet = sign_eta * 0.5 * (t - 0.5 * (T[0] + T1));
3433 const MFloat dudxi = sign_xi * 0.5 * (U - 0.5 * (u[0] + u_[IJPM]));
3434 const MFloat dvdxi = sign_xi * 0.5 * (V - 0.5 * (v[0] + v_[IJPM]));
3436 const MFloat dTdxi = sign_xi * 0.5 * (t - 0.5 * (T[0] + T2));
3438 eflux[0][IJ_] = dudet * surfaceMetrics[
ysd * 2 +
ysd] + dvdet * surfaceMetrics[
ysd * 2 +
xsd];
3439 eflux[1][IJ_] = dudet * surfaceMetrics[
ysd * 2 +
xsd];
3440 eflux[2][IJ_] = dvdet * surfaceMetrics[
ysd * 2 +
ysd];
3442 fflux[0][IJ_] = dudxi * surfaceMetrics[
xsd * 2 +
ysd] + dvdxi * surfaceMetrics[
xsd * 2 +
xsd];
3443 fflux[1][IJ_] = dudxi * surfaceMetrics[
xsd * 2 +
xsd];
3444 fflux[2][IJ_] = dvdxi * surfaceMetrics[
xsd * 2 +
ysd];
3446 dT[0][IJ_] = dTdet * surfaceMetrics[
ysd * 2 +
xsd];
3447 dT[1][IJ_] = dTdet * surfaceMetrics[
ysd * 2 +
ysd];
3448 dT[2][IJ_] = dTdxi * surfaceMetrics[
xsd * 2 +
xsd];
3449 dT[3][IJ_] = dTdxi * surfaceMetrics[
xsd * 2 +
ysd];
3460 static constexpr MFloat minMFloat =
3473 const MFloat*
const RESTRICT u_ = &pvars[
PV->U][0];
3474 const MFloat*
const RESTRICT v_ = &pvars[
PV->V][0];
3475 const MFloat*
const RESTRICT rho = &pvars[
PV->RHO][0];
3476 const MFloat*
const RESTRICT p = &pvars[
PV->P][0];
3477 const MFloat*
const RESTRICT TKE = &pvars[
PV->RANS_VAR[0]][0];
3478 const MFloat*
const RESTRICT eps = &pvars[
PV->RANS_VAR[1]][0];
3496 const MFloat dudxi = F1B2 * (u_[IPJP] + u_[IPJ] - u_[IJP] - u_[IJ]);
3497 const MFloat dudet = F1B2 * (u_[IPJP] + u_[IJP] - u_[IPJ] - u_[IJ]);
3499 const MFloat dvdxi = F1B2 * (v_[IPJP] + v_[IPJ] - v_[IJP] - v_[IJ]);
3500 const MFloat dvdet = F1B2 * (v_[IPJP] + v_[IJP] - v_[IPJ] - v_[IJ]);
3502 const MFloat rhoAvg = F1B4 * (rho[IJP] + rho[IPJP] + rho[IJ] + rho[IPJ]);
3503 const MFloat muTurbAvg = F1B4 * (muTurb[IJP] + muTurb[IPJP] + muTurb[IJ] + muTurb[IPJ]);
3504 const MFloat nuTurbAvg = muTurbAvg / rhoAvg;
3507 (
m_rans2eq_mode ==
"production") ? -2 / 3 * F1B4 * (TKE[IJP] + TKE[IPJP] + TKE[IJ] + TKE[IPJ]) : 0.0;
3517 MFloat tau1 = F4B3 * (dudxi * cornerMetrics[
xsd * 2 +
xsd] + dudet * cornerMetrics[
ysd * 2 +
xsd]) -
3519 F2B3 * (dvdxi * cornerMetrics[
xsd * 2 +
ysd] + dvdet * cornerMetrics[
ysd * 2 +
ysd]);
3525 MFloat tau2 = dudxi * cornerMetrics[
xsd * 2 +
ysd] + dudet * cornerMetrics[
ysd * 2 +
ysd] +
3527 dvdxi * cornerMetrics[
xsd * 2 +
xsd] + dvdet * cornerMetrics[
ysd * 2 +
xsd];
3534 MFloat tau4 = F4B3 * (dvdxi * cornerMetrics[
xsd * 2 +
ysd] + dvdet * cornerMetrics[
ysd * 2 +
ysd]) -
3536 F2B3 * (dudxi * cornerMetrics[
xsd * 2 +
xsd] + dudet * cornerMetrics[
ysd * 2 +
xsd]);
3539 const MFloat mueOverRe = rRe0 * fJac * nuTurbAvg;
3540 tau1 = mueOverRe * tau1 + TKEcorner;
3542 tau4 = mueOverRe * tau4 + TKEcorner;
3544 vflux[0][IJ] = -tau1;
3545 vflux[1][IJ] = -tau2;
3546 vflux[2][IJ] = -tau4;
3549 const MFloat dTKEdxi = F1B2 * (TKE[IPJP] + TKE[IPJ] - TKE[IJP] - TKE[IJ]);
3550 const MFloat dTKEdet = F1B2 * (TKE[IPJP] + TKE[IJP] - TKE[IPJ] - TKE[IJ]);
3552 const MFloat depsdxi = F1B2 * (eps[IPJP] + eps[IPJ] - eps[IJP] - eps[IJ]);
3553 const MFloat depsdet = F1B2 * (eps[IPJP] + eps[IJP] - eps[IPJ] - eps[IJ]);
3559 const MFloat dTKEdx = dTKEdxi * cornerMetrics[
xsd * 2 +
xsd] + dTKEdet * cornerMetrics[
ysd * 2 +
xsd];
3561 const MFloat dTKEdy = dTKEdxi * cornerMetrics[
xsd * 2 +
ysd] + dTKEdet * cornerMetrics[
ysd * 2 +
ysd];
3563 const MFloat depsdx = depsdxi * cornerMetrics[
xsd * 2 +
xsd] + depsdet * cornerMetrics[
ysd * 2 +
xsd];
3565 const MFloat depsdy = depsdxi * cornerMetrics[
xsd * 2 +
ysd] + depsdet * cornerMetrics[
ysd * 2 +
ysd];
3568 const MFloat dpdxi = F1B2 * (p[IPJP] + p[IPJ] - p[IJP] - p[IJ]);
3569 const MFloat dpdet = F1B2 * (p[IPJP] + p[IJP] - p[IPJ] - p[IJ]);
3571 const MFloat dpdx = dpdxi * cornerMetrics[
xsd * 2 +
xsd] + dpdet * cornerMetrics[
ysd * 2 +
xsd];
3573 const MFloat dpdy = dpdxi * cornerMetrics[
xsd * 2 +
ysd] + dpdet * cornerMetrics[
ysd * 2 +
ysd];
3575 const MFloat uAvg = F1B4 * (u_[IJP] + u_[IPJP] + u_[IJ] + u_[IPJ]);
3576 const MFloat vAvg = F1B4 * (v_[IJP] + v_[IPJP] + v_[IJ] + v_[IPJ]);
3578 const MFloat muLamAvg = F1B4 * (muLam[IJP] + muLam[IPJP] + muLam[IJ] + muLam[IPJ]);
3579 const MFloat porAvg = F1B4 * (por[IJP] + por[IPJP] + por[IJ] + por[IPJ]);
3582 const MFloat rDaAvg = 1.0 / Da[IJ];
3583 const MFloat cfAvg = cf[IJ];
3584 const MFloat indicator = (dpdx * uAvg + dpdy * vAvg)
3585 / std::max(
POW2(velAbs)
3586 * (rRe0 * porAvg * muLamAvg * rDaAvg
3587 + rhoAvg *
POW2(porAvg) * cfAvg * sqrt(rDaAvg) * velAbs),
3589 const MFloat c_Dp_eff =
m_c_Dp * (-0.5 * tanh(indicator - 5.0) + 0.5);
3590 const MFloat c_Dp_eps_eff =
m_c_Dp_eps * (-0.5 * tanh(indicator - 5.0) + 0.5);
3592 (-0.5 * tanh(indicator - 5.0) + 0.5);
3595 const MFloat nuLaminarAvg = muLamAvg / rhoAvg;
3596 const MFloat utauAvg = F1B4 * (utau[IJP] + utau[IPJP] + utau[IJ] + utau[IPJ]);
3597 const MFloat wallDistAvg = F1B4 * (wallDist[IJP] + wallDist[IPJP] + wallDist[IJ] + wallDist[IPJ]);
3598 const MFloat yp = utauAvg * wallDistAvg / nuLaminarAvg;
3601 MFloat limiterVisc1 = 1.0;
3602 MFloat limiterVisc2 = 1.0;
3605 const MFloat mu_ref = F1B4
3610 limiterVisc1 = std::min(1.0,
3614 limiterVisc2 = std::min(1.0, mu_ref / std::abs(rRe0 * c_Dp_eps_eff *
RM_KEPS::rsigma_eps * muTurbAvg));
3617 const MFloat Frj = rRe0 * fJac;
3620 * (dTKEdx * cornerMetrics[
xsd * 2 +
xsd] + dTKEdy * cornerMetrics[
xsd * 2 +
ysd]);
3622 * (dTKEdx * cornerMetrics[
ysd * 2 +
xsd] + dTKEdy * cornerMetrics[
ysd * 2 +
ysd]);
3625 * (depsdx * cornerMetrics[
xsd * 2 +
xsd] + depsdy * cornerMetrics[
xsd * 2 +
ysd]);
3627 * (depsdx * cornerMetrics[
ysd * 2 +
xsd] + depsdy * cornerMetrics[
ysd * 2 +
ysd]);
3637 sa_1flux[0][IJ] = sax1;
3638 sa_1flux[1][IJ] = say1;
3639 sa_2flux[0][IJ] = sax2;
3640 sa_2flux[1][IJ] = say2;
3651 sa_1flux[0][IJM] = F1B2 * (sa_1flux[0][IJ] + sa_1flux[0][IJM]);
3652 sa_2flux[0][IJM] = F1B2 * (sa_2flux[0][IJ] + sa_2flux[0][IJM]);
3660 sa_1flux[1][IMJ] = F1B2 * (sa_1flux[1][IJ] + sa_1flux[1][IMJ]);
3661 sa_2flux[1][IMJ] = F1B2 * (sa_2flux[1][IJ] + sa_2flux[1][IMJ]);
3665 for(
MInt var = 0; var < 3; ++var) {
3672 eflux[var][IJ] = 0.5 * (vflux[var][IJ] + vflux[var][IJM]);
3680 fflux[var][IJ] = 0.5 * (vflux[var][IJ] + vflux[var][IMJ]);
3691 vflux[0][IJ] = sqrt(
POW2(u_[IJ]) +
POW2(v_[IJ]));
3692 vflux[1][IJ] = 1.0 / std::max(vflux[0][IJ], minMFloat);
3704 const MFloat velAbs = vflux[0][IJ];
3705 const MFloat rDa = 1.0 / Da[IJ];
3711 const MFloat tau1 = 0.25 * (eflux[0][IJ] + eflux[0][IMJ] + fflux[0][IJ] + fflux[0][IJM]);
3712 const MFloat tau2 = 0.25 * (eflux[1][IJ] + eflux[1][IMJ] + fflux[1][IJ] + fflux[1][IJM]);
3713 const MFloat tau4 = 0.25 * (eflux[2][IJ] + eflux[2][IMJ] + fflux[2][IJ] + fflux[2][IJM]);
3715 const MFloat dtau1dxi = eflux[0][IJ] - eflux[0][IMJ];
3716 const MFloat dtau2dxi = eflux[1][IJ] - eflux[1][IMJ];
3717 const MFloat dtau4dxi = eflux[2][IJ] - eflux[2][IMJ];
3718 const MFloat dtau1det = fflux[0][IJ] - fflux[0][IJM];
3719 const MFloat dtau2det = fflux[1][IJ] - fflux[1][IJM];
3720 const MFloat dtau4det = fflux[2][IJ] - fflux[2][IJM];
3742 const MFloat dTKEdxi = 0.5 * (TKE[IPJ] - TKE[IMJ]);
3743 const MFloat dTKEdet = 0.5 * (TKE[IJP] - TKE[IJM]);
3744 const MFloat depsdxi = 0.5 * (eps[IPJ] - eps[IMJ]);
3745 const MFloat depsdet = 0.5 * (eps[IJP] - eps[IJM]);
3760 const MFloat dvelAbsdxi = 0.5 * (vflux[0][IPJ] - vflux[0][IMJ]);
3761 const MFloat dvelAbsdet = 0.5 * (vflux[0][IJP] - vflux[0][IJM]);
3770 const MFloat dvel11dxi = 0.5 * (u_[IPJ] * u_[IPJ] * vflux[1][IPJ] - u_[IMJ] * u_[IMJ] * vflux[1][IMJ]);
3771 const MFloat dvel11det = 0.5 * (u_[IJP] * u_[IJP] * vflux[1][IJP] - u_[IJM] * u_[IJM] * vflux[1][IJM]);
3772 const MFloat dvel12dxi = 0.5 * (u_[IPJ] * v_[IPJ] * vflux[1][IPJ] - u_[IMJ] * v_[IMJ] * vflux[1][IMJ]);
3773 const MFloat dvel12det = 0.5 * (u_[IJP] * v_[IJP] * vflux[1][IJP] - u_[IJM] * v_[IJM] * vflux[1][IJM]);
3774 const MFloat dvel22dxi = 0.5 * (v_[IPJ] * v_[IPJ] * vflux[1][IPJ] - v_[IMJ] * v_[IMJ] * vflux[1][IMJ]);
3775 const MFloat dvel22det = 0.5 * (v_[IJP] * v_[IJP] * vflux[1][IJP] - v_[IJM] * v_[IJM] * vflux[1][IJM]);
3798 const MFloat temp = u * u * tau1 + 2.0 * u * v * tau2 + v * v * tau4;
3799 const MFloat kovereps = TKE[IJ] / std::max(eps[IJ], minMFloat);
3800 const MFloat velAbsInv = vflux[1][IJ];
3801 const MFloat tau111 = 3.0 * (tau1 * dtau1dx + tau2 * dtau1dy);
3802 const MFloat tau112 = 2.0 * (tau1 * dtau2dx + tau2 * dtau2dy) + tau2 * dtau1dx + tau4 * dtau1dy;
3803 const MFloat tau122 = tau1 * dtau4dx + tau2 * dtau4dy + 2 * (tau2 * dtau2dx + tau4 * dtau2dy);
3804 const MFloat tau222 = 3.0 * (tau2 * dtau4dx + tau4 * dtau4dy);
3814 const MFloat diffusion_TKE =
3815 ((sa_1flux[0][IJM] - sa_1flux[0][IMJM]) + (sa_1flux[1][IMJ] - sa_1flux[1][IMJM]));
3816 const MFloat diffusion_eps =
3817 ((sa_2flux[0][IJM] - sa_2flux[0][IMJM]) + (sa_2flux[1][IMJ] - sa_2flux[1][IMJM]));
3827 (-rRe0 * rDa * por[IJ] * muLam[IJ] * u
3828 - sqrt(rDa) * porPOW2 * cf[IJ] * rho[IJ]
3829 * ((velAbs + TKE[IJ] * velAbsInv - 0.5 * pow(velAbsInv, 3) * temp) * u
3830 + velAbsInv * (u * tau1 + v * tau2)))
3833 (-rRe0 * rDa * por[IJ] * muLam[IJ] * v
3834 - sqrt(rDa) * porPOW2 * cf[IJ] * rho[IJ]
3835 * ((velAbs + TKE[IJ] * velAbsInv - 0.5 * pow(velAbsInv, 3) * temp) * v
3836 + velAbsInv * (u * tau2 + v * tau4)))
3840 + (-2.0 * rRe0 * rDa * por[IJ] * muLam[IJ] * TKE[IJ]
3841 - 0.5 * sqrt(rDa) * porPOW2 * cf[IJ] * rho[IJ]
3842 * (4.0 * TKE[IJ] * velAbs + 2.0 * velAbsInv * temp
3843 + 3.0 * velAbsInv *
m_c_t * kovereps * (u * tau111 + u * tau122 + v * tau112 + v * tau222)
3844 - pow(velAbsInv, 3) *
m_c_t * kovereps
3845 * (u * u * u * tau111 + 3.0 * u * u * v * tau112 + 3.0 * u * v * v * tau122
3846 + v * v * v * tau222)))
3850 + (-2.0 * rRe0 * rDa * por[IJ] * muLam[IJ] * eps[IJ]
3851 - sqrt(rDa) * porPOW2 * cf[IJ] * rho[IJ]
3852 * (F8B3 * velAbs * eps[IJ]
3853 + 2.0 * rRe0 * (muLam[IJ] / rho[IJ]) * (dvelAbsdx * dTKEdx + dvelAbsdy * dTKEdy)
3854 - 2.0 *
m_c_eps * kovereps * velAbsInv
3855 * (u * tau1 * depsdx + v * tau2 * depsdx + u * tau2 * depsdy + v * tau4 * depsdy)
3856 + rRe0 * (muLam[IJ] / rho[IJ])
3857 * (dvel11dx * dtau1dx + dvel11dy * dtau1dy + 2.0 * dvel12dx * dtau2dx
3858 + 2.0 * dvel12dy * dtau2dy + dvel22dx * dtau4dx + dvel22dy * dtau4dy)))
3895 for(
MInt dim = 0; dim <
nDim; ++dim) {
3896 velAbs +=
POW2(pvars[
PV->VV[dim]][IJK]);
3898 velAbs = sqrt(velAbs);
3899 const MFloat rDa = 1.0 / Da[IJK];
3901 for(
MInt dim = 0; dim <
nDim; ++dim) {
3903 -(rRe0 * rDa * por[IJK] * muLam[IJK] + porPOW2 * sqrt(rDa) * cf[IJK] * velAbs * pvars[
PV->RHO][IJK])
3913 static constexpr MFloat minMFloat =
3949 mTerm(1,
"In 2D not possible!");
3960 MFloat u[6], v[6], p[6], rho[6], muTurb[6], muLam[6], TKE[6], EPS[6], POR[6];
3961 MFloat U, V, RHO, muTurb_corner, muLam_corner, TKEcorner, EPScorner, PORcorner, dudx, dudy, dvdx, dvdy, dTKEdx,
3962 dTKEdy, depsdx, depsdy, dpdx, dpdy;
3965 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
3966 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
3973 nghbr[count++] = IJ;
3985 nghbr[count++] =
cellIndex(ii + change[0], jj + change[1]);
3990 cout <<
"what the hell! it is wrong!!! count=" << count <<
" Nstar=" <<
m_singularity[i].
Nstar << endl;
3994 u[m] = u_[nghbr[m]];
3995 v[m] = v_[nghbr[m]];
3996 muTurb[m] = muTurb_[nghbr[m]] / rho_[nghbr[m]];
3997 muLam[m] = muLam_[nghbr[m]];
3998 TKE[m] = TKE_[nghbr[m]];
3999 EPS[m] = EPS_[nghbr[m]];
4000 p[m] = p_[nghbr[m]];
4001 rho[m] = rho_[nghbr[m]];
4002 POR[m] = por_[nghbr[m]];
4010 TKEcorner = F0, EPScorner = F0, PORcorner = F0;
4022 MInt id2 = ii - start[0] + (jj - start[1]) * len1[0];
4024 for(
MInt n = 0; n < count; n++) {
4025 MInt ID = id2 * count + n;
4058 tau1 = 2 * dudx - 2 / 3 * (dudx + dvdy);
4060 tau4 = 2 * dvdy - 2 / 3 * (dudx + dvdy);
4062 TKEcorner *= -2 / 3;
4063 mueOverRe = muTurb_corner * rRe0;
4064 tau1 = mueOverRe * tau1 + TKEcorner;
4066 tau4 = mueOverRe * tau4 + TKEcorner;
4068 vflux[0][IJ_] = -tau1;
4069 vflux[1][IJ_] = -tau2;
4070 vflux[2][IJ_] = -tau4;
4073 const MFloat temp =
POW2(TKEcorner) / std::max(EPScorner, minMFloat);
4077 const MFloat rDaAvg = 1.0 / Da[IJ];
4078 const MFloat cfAvg = cf[IJ];
4079 const MFloat indicator = (dpdx * U + dpdy * V)
4080 / std::max(
POW2(velAbs)
4081 * (rRe0 * PORcorner * muLam_corner * rDaAvg
4082 + RHO *
POW2(PORcorner) * cfAvg * sqrt(rDaAvg) * velAbs),
4084 const MFloat c_Dp_eff =
m_c_Dp * (-0.5 * tanh(indicator - 5.0) + 0.5);
4085 const MFloat c_Dp_eps_eff =
m_c_Dp_eps * (-0.5 * tanh(indicator - 5.0) + 0.5);
4087 (-0.5 * tanh(indicator - 5.0) + 0.5);
4091 * (dTKEdx * surfaceMetrics[
xsd * 2 +
xsd] + dTKEdy * surfaceMetrics[
xsd * 2 +
ysd]);
4093 * (dTKEdx * surfaceMetrics[
ysd * 2 +
xsd] + dTKEdy * surfaceMetrics[
ysd * 2 +
ysd]);
4095 * (depsdx * surfaceMetrics[
xsd * 2 +
xsd] + depsdy * surfaceMetrics[
xsd * 2 +
ysd]);
4097 * (depsdx * surfaceMetrics[
ysd * 2 +
xsd] + depsdy * surfaceMetrics[
ysd * 2 +
ysd]);
4100 sa_1flux[0][IJ_] = sax1;
4101 sa_1flux[1][IJ_] = say1;
4102 sa_2flux[0][IJ_] = sax2;
4103 sa_2flux[1][IJ_] = say2;
4114 cout <<
"Loading BC2600 values..." << endl;
4118 MInt noCellsBC = bcCells[0] * bcCells[1];
4119 ParallelIo::size_type bcOffset[2] = {0, 0};
4123 stringstream restartFileName;
4128 stringstream pathStr;
4129 pathStr <<
"/block" <<
m_blockId <<
"/bc2600" << endl;
4130 std::string path = pathStr.str();
4132 for(
MInt var = 0; var <
CV->noVariables; var++) {
4133 cout <<
"Loading " <<
m_variableNames[var] <<
" offset: " << var * noCellsBC << endl;
4140 "tmpRestartVars[0]");
4143 cout <<
"Loading BC2600 values... SUCCESSFUL!" << endl;
4147 MInt startGC[2] = {0, 0};
4148 MInt endGC[2] = {0, 0};
4157 MInt startI = 0, endI = 0;
4166 for(
MInt i = startI; i < endI; i++) {
4171 MInt cellIdBC = globalI + globalJ * bcCells[1];
4174 for(
MInt var = 0; var <
CV->noVariables; var++) {
4175 m_cells->
variables[var][cellId] = tmpRestartVars[var * noCellsBC + cellIdBC];
4183 for(
MInt i = startI; i < endI; i++) {
4187 for(
MInt var = 0; var <
CV->noVariables; var++) {
4201template <MFloat (FvStructuredSolver<2>::*pressure_func)(MInt) const>
4211 const MFloat fRho = F1 / cvars[
CV->RHO][cellId];
4213 for(
MInt vel = 0; vel <
nDim; ++vel) {
4214 pvars[vel][cellId] = cvars[vel][cellId] * fRho;
4215 velPOW2 +=
POW2(pvars[vel][cellId]);
4219 pvars[
PV->RHO][cellId] = cvars[
CV->RHO][cellId];
4220 pvars[
PV->P][cellId] =
4222 * (cvars[
CV->RHO_E][cellId] - F1B2 * pvars[
PV->RHO][cellId] * velPOW2 + (this->*pressure_func)(cellId));
4225 cvars[
CV->RANS_VAR[ransVar]][cellId] =
4226 mMax(cvars[
CV->RANS_VAR[ransVar]][cellId], 1e-16 );
4227 pvars[
PV->RANS_VAR[ransVar]][cellId] = cvars[
CV->RANS_VAR[ransVar]][cellId] * fRho;
4236 computePrimitiveVariables_<&FvStructuredSolver::pressure_twoEqRans>();
4258 "ReconstructionConstants", 0.0, AT_);
4265 for(
auto& snd : sndComm) {
4270 for(
MInt var = 0; var < snd->noVars; var++) {
4271 for(
MInt j = snd->startInfoCells[1]; j < snd->endInfoCells[1]; j++) {
4272 for(
MInt i = snd->startInfoCells[0]; i < snd->endInfoCells[0]; i++) {
4274 snd->cellBuffer[pos] = snd->variables[var][cellId];
4289 for(
auto& rcv : rcvComm) {
4298 MInt totalCells = 1;
4302 len1[j] = rcv->endInfoCells[j] - rcv->startInfoCells[j];
4303 if(len1[j] != 0) totalCells *= len1[j];
4304 step2[rcv->orderInfo[j]] = rcv->stepInfo[j];
4309 end2[j] = len1[j] - 1;
4310 len2[rcv->orderInfo[j]] = len1[j];
4313 start2[j] = end2[j];
4319 for(
MInt var = 0; var < rcv->noVars; var++) {
4320 MInt j2 = start2[1];
4321 for(
MInt j = rcv->startInfoCells[1]; j < rcv->endInfoCells[1]; j++) {
4322 MInt i2 = start2[0];
4323 for(
MInt i = rcv->startInfoCells[0]; i < rcv->endInfoCells[0]; i++) {
4324 start1[rcv->orderInfo[0]] = i2;
4325 start1[rcv->orderInfo[1]] = j2;
4327 const MInt id2 = var * totalCells + start1[0] + (start1[1]) * len2[0];
4329 rcv->variables[var][cellId] = rcv->cellBuffer[id2];
4346 MInt maxNoSingularityRecNghbrIds = 7;
4360 for(
MInt n = 0; n <
nDim + 1; ++n) {
4369 ASSERT(len1[j] == 1,
"");
4384 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
4385 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
4399 nghbr[count++] =
cellIndex(ii + change[0], jj + change[1]);
4404 cerr <<
"Something wrong with the singularities in the LS coeffiecient computation" << endl;
4411 for(
MInt n = 0; n < count; n++) {
4412 MInt nghbrId = nghbr[n];
4418 weights[n] = 1 / dxdx;
4421 MInt id2 = ii - start[0] + (jj - start[1]) * len1[0];
4422 ASSERT(id2 == 0,
"");
4427 maxc =
mMax(maxc, condNum);
4429 if(condNum < F0 || condNum > 1e7 || std::isnan(condNum)) {
4430 cerr <<
domainId() <<
" SVD decomposition for pointId " << ijk
4431 <<
" with large condition number: " << condNum <<
" num of neighbor" << count <<
"x" << recDim <<
" "
4432 <<
" coords " <<
m_grid->m_coordinates[0][ijk] <<
", " <<
m_grid->m_coordinates[1][ijk] << endl;
4463 const MInt pp[2][4] = {{0, 0, 0, 1}, {0, 0, 1, 0}};
4467 const MInt normalDir = face / 2;
4468 const MInt firstTangentialDir = (normalDir + 1) %
nDim;
4469 const MInt normalDirStart = start[normalDir];
4470 const MInt firstTangentialStart = start[firstTangentialDir];
4471 const MInt firstTangentialEnd = end[firstTangentialDir];
4472 const MInt incp[
nDim] = {IJKP[normalDir], IJKP[firstTangentialDir]};
4473 const MInt inc[
nDim] = {IJ[normalDir], IJ[firstTangentialDir]};
4475 const MInt n = (face % 2) * 2 - 1;
4476 const MInt g1p = normalDirStart + 2 * ((
MInt)(0.5 - (0.5 * (
MFloat)n)));
4477 const MInt g1 = normalDirStart + (
MInt)(0.5 - (0.5 * (
MFloat)n));
4479 for(
MInt t1 = firstTangentialStart; t1 < firstTangentialEnd; t1++) {
4480 const MInt cellIdG1 = g1 * inc[0] + t1 * inc[1];
4483 const MInt ij = g1p * incp[0] + t1 * incp[1];
4492 for(
MInt dim = 0; dim <
nDim; dim++) {
4493 firstVec[dim] =
m_grid->m_coordinates[dim][pp2] -
m_grid->m_coordinates[dim][pp1];
4494 normalVec_[dim] =
m_grid->m_coordinates[dim][pp3] -
m_grid->m_coordinates[dim][pp1];
4498 normalVec[0] = -firstVec[1];
4499 normalVec[1] = firstVec[0];
4500 const MFloat normalLength = sqrt(
POW2(normalVec[0]) +
POW2(normalVec[1]));
4502 MFloat sgn = (std::inner_product(&normalVec[0], &normalVec[0] +
nDim, &normalVec_[0], 0.0) < 0.0) ? -1 : 1;
4505 for(
MInt dim = 0; dim <
nDim; dim++) {
4506 normalVec[dim] /= normalLength;
4507 m_cells->
fq[
FQ->NORMAL[dim]][cellIdG1] = sgn * normalVec[dim];
4517 if(singularity.BC == -6000) {
4518 MBool takeIt =
false;
4519 for(
MInt n = 0; n < singularity.Nstar; ++n) {
4520 if(singularity.BCsingular[n] == -6002) takeIt =
true;
4526 if(singularity.end[n] - singularity.start[n] > 1) {
4527 mTerm(1,
"In 2D not possible!");
4530 start[n] = singularity.start[n] + 1;
4531 end[n] = singularity.end[n] - 1;
4533 start[n] = singularity.start[n];
4534 end[n] = singularity.end[n];
4538 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
4539 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
4542 for(
MInt m = 0; m < 2; ++m) {
4543 const MInt* change = singularity.displacement[m];
4544 const MInt nghbr =
cellIndex(ii + change[0], jj + change[1]);
4560 std::vector<MInt> receiveSizes;
4563 if(snd->bcId == -6000 || snd->bcId == -6002) {
4567 for(
MInt dim = 0; dim <
nDim; ++dim)
4568 size *= snd->endInfoCells[dim] - snd->startInfoCells[dim];
4573 for(
MInt j = snd->startInfoCells[1]; j < snd->endInfoCells[1]; j++) {
4574 for(
MInt i = snd->startInfoCells[0]; i < snd->endInfoCells[0]; i++) {
4580 snd->cellBuffer[pos] =
m_cells->
fq[
FQ->POROSITY][cellId];
4582 snd->cellBuffer[(1 + d) * size + pos] =
m_cells->
fq[
FQ->NORMAL[d]][cellId];
4590 MInt err =
MPI_Isend((
void*)&snd->cellBuffer[0], size * (
nDim + 1), MPI_DOUBLE, snd->nghbrId, tag,
4592 if(err) cout <<
"rank " <<
domainId() <<
" sending throws error " << endl;
4598 for(
MInt dim = 0; dim <
nDim; ++dim)
4599 size *= snd->endInfoCells[dim] - snd->startInfoCells[dim];
4600 receiveSizes.push_back(size);
4607 std::vector<MFloat> bufferRcv(std::accumulate(receiveSizes.begin(), receiveSizes.end(), 0) * (
nDim + 1));
4612 if(rcv->bcId == -6002 || rcv->bcId == -6000) {
4613 const MInt rcvSize = receiveSizes[cnt];
4616 &rcv->mpi_request, AT_,
"(void*)&rcvSize");
4617 if(err) cout <<
"rank " <<
domainId() <<
" sending throws error " << endl;
4619 offset += rcvSize * (1 +
nDim);
4628 if(snd->bcId == -6002 || snd->bcId == -6000) {
4629 MPI_Wait(&(snd->mpi_request), &(snd->mpi_status), AT_);
4635 if(rcv->bcId == -6002 || rcv->bcId == -6000) {
4636 MPI_Wait(&(rcv->mpi_request), &(rcv->mpi_status), AT_);
4648 if(rcv->bcId == -6002 || rcv->bcId == -6000) {
4657 MInt totalCells = 1;
4661 len1[j] = rcv->endInfoCells[j] - rcv->startInfoCells[j];
4662 if(len1[j] != 0) totalCells *= len1[j];
4664 step2[rcv->orderInfo[j]] = rcv->stepInfo[j];
4668 ASSERT(totalCells == receiveSizes[cnt],
"");
4672 end2[j] = len1[j] - 1;
4673 len2[rcv->orderInfo[j]] = len1[j];
4676 start2[j] = end2[j];
4683 for(
MInt j = rcv->startInfoCells[1]; j < rcv->endInfoCells[1]; j++) {
4685 for(
MInt i = rcv->startInfoCells[0]; i < rcv->endInfoCells[0]; i++) {
4686 start1[rcv->orderInfo[0]] = i2;
4687 start1[rcv->orderInfo[1]] = j2;
4689 id2 = start1[0] + start1[1] * len2[0];
4691 m_cells->
fq[
FQ->POROSITY][cellId] = bufferRcv[offset * (
nDim + 1) + id2];
4693 normals_temp[
m_noCells * d + cellId] = bufferRcv[offset * (
nDim + 1) + (d + 1) * totalCells + id2];
4703 offset += totalCells;
4712 if(singularity.BC == -6000) {
4713 MBool takeIt =
false;
4714 for(
MInt n = 0; n < singularity.Nstar; ++n) {
4715 if(singularity.BCsingular[n] == -6002) takeIt =
true;
4721 if(singularity.end[n] - singularity.start[n] > 1) {
4722 mTerm(1,
"In 2D not possible!");
4725 start[n] = singularity.start[n] + 1;
4726 end[n] = singularity.end[n] - 1;
4728 start[n] = singularity.start[n];
4729 end[n] = singularity.end[n];
4733 const MInt nstar = singularity.Nstar;
4735 for(
MInt jj = start[1]; jj < end[1]; ++jj) {
4736 for(
MInt ii = start[0]; ii < end[0]; ++ii) {
4742 for(
MInt m = 0; m < nstar - 1; ++m) {
4743 const MInt* change = singularity.displacement[m];
4744 const MInt nghbr =
cellIndex(ii + change[0], jj + change[1]);
4746 temp[d] += normals_temp[
m_noCells * d + nghbr];
4751 m_cells->
fq[
FQ->NORMAL[d]][IJ] = temp[d] / (2 * nstar);
4759 for(
MInt m = 0; m < nstar - 1; ++m) {
4760 const MInt* change = singularity.displacement[m];
4761 const MInt nghbr =
cellIndex(ii + change[0], jj + change[1]);
4774 std::vector<MFloat> sendBuffer;
4775 std::vector<MInt> sendcounts;
4776 std::vector<MInt> snghbrs;
4777 std::vector<MInt> tags;
4779 if (snd->bcId==-6002) {
4780 snghbrs.push_back(snd->nghbrId);
4781 tags.push_back(
domainId()+(snd->tagHelper)*m_solver->noDomains());
4784 for (
MInt dim = 0; dim <
nDim; ++dim)
4785 size *= snd->endInfoCells[dim] - snd->startInfoCells[dim];
4786 sendcounts.push_back(size);
4788 sendBuffer.resize(pos+size);
4789 for(
MInt j=snd->startInfoCells[1]; j<snd->endInfoCells[1]; j++) {
4790 for(
MInt i=snd->startInfoCells[0]; i<snd->endInfoCells[0]; i++) {
4796 sendBuffer[pos++] =
m_cells->
fq[
FQ->POROSITY][cellId];
4802 const MInt noNeighborDomains = snghbrs.size();
4805 std::vector<MInt> recvcounts(noNeighborDomains);
4806 std::vector<MInt> rdispls(noNeighborDomains);
4814 m_solver->domainId(),
4819 std::vector<MInt> sendcounts2(noNeighborDomains, 1);
4827 m_solver->domainId(),
4832 if (rcv->bcId==-6002) {
4833 const MInt tag = rcv->nghbrId+rcv->tagHelper*m_solver->noDomains();
4835 for (n = 0; n < noNeighborDomains; ++n) {
4836 if (tag==recvTags[n])
4839 if (n==noNeighborDomains)
mTerm(1,
"n == noNeighborDomains");
4841 const MFloat*
const recvBuffer_ = &recvBuffer[rdispls[n]];
4842 const MInt noReceivedElements = recvcounts[n];
4855 len1[j]=rcv->endInfoCells[j] - rcv->startInfoCells[j];
4856 if(len1[j]!=0) totalCells*=len1[j];
4858 step2[rcv->orderInfo[j]]=rcv->stepInfo[j];
4862 ASSERT(noReceivedElements==totalCells,
"noReceivedElements==totalCells");
4867 len2[rcv->orderInfo[j]]=len1[j];
4875 MInt* startInfo=rcv->startInfoCells;
4876 MInt* endInfo=rcv->endInfoCells;
4880 for(
MInt j=startInfo[1]; j<endInfo[1]; j++) {
4882 for(
MInt i=startInfo[0]; i<endInfo[0]; i++) {
4883 start1[rcv->orderInfo[0]]=i2;
4884 start1[rcv->orderInfo[1]]=j2;
4886 id2=start1[0]+start1[1]*len2[0];
4888 m_cells->
fq[
FQ->POROSITY][cellId]= recvBuffer_[id2];
4905 const MInt IP1 = I + IJK[dim];
4906 const MInt IM1 = I - IJK[dim];
4907 const MInt IP2 = I + 2 * IJK[dim];
4916 *
mMax(
mMax(fabs((PIM2 - PIM1) /
mMin(PIM2, PIM1)), fabs((PIM1 - PIP1) /
mMin(PIM1, PIP1))),
4917 fabs((PIP1 - PIP2) /
mMin(PIP1, PIP2))));
MLong allocatedBytes()
Return the number of allocated bytes.
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
FvStructuredSolver2D(MInt, StructuredGrid< 2 > *, MBool *, const MPI_Comm comm)
Constructor for the 2D structured solver.
void addGhostPointCoordinateValues()
void applyBoundaryCondition()
void AusmDV(MFloat *QLeft, MFloat *QRight, const MInt dim, const MInt cellId)
void AusmLES_PTHRC(MFloat *QLeft, MFloat *QRight, MInt dim, MInt cellId)
Same AUSM scheme as AusmLES with additional damping controlled by the 4th order pressure derivative....
void gather(const MBool, std::vector< std::unique_ptr< StructuredComm< 2 > > > &) override
void viscousFluxCorrection()
void computeCellCentreCoordinates()
void allocateSingularities()
void computePorousRHSCorrection()
void moveGrid(const MBool isRestart, const MBool zeroPos) override
MInt getPointIdFromPoint(MInt origin, MInt incI, MInt incJ)
MInt cellIndex(MInt i, MInt j)
void AusmLES(MFloat *QLeft, MFloat *QRight, const MInt dim, const MInt cellId)
AUSM Central.
void computeReconstructionConstantsSVD()
virtual void initialCondition()
Computation of infinity values for the conservative and primitive variables Initialization ot the ent...
void scatter(const MBool, std::vector< std::unique_ptr< StructuredComm< 2 > > > &) override
MFloat pressure(MInt cellId)
void viscousFluxCompactCorrection()
MFloat getPSI(MInt, MInt)
StructuredBndryCnd< 2 > * m_structuredBndryCnd
virtual void initSolutionStep(MInt mode)
initalize the solution step
MInt pointIndex(MInt i, MInt j)
virtual void computePorousRHS(MBool) override
static constexpr const MInt nDim
void viscousFluxLESCompact()
FvStructuredSolver2DRans * m_ransSolver
MInt getPointIdFromCell(MInt i, MInt j)
MInt getCellIdFromCell(MInt origin, MInt incI, MInt incJ)
void computePrimitiveVariables() override
void(FvStructuredSolver2D::* viscFluxMethod)()
MFloat crossProduct(MFloat vec1[2], MFloat vec2[2])
friend class FvStructuredSolver2DRans
void computePrimitiveVariables_()
void extrapolateGhostPointCoordinatesBC()
void Muscl(MInt timerId=-1) override
void(FvStructuredSolver2D::* reconstructSurfaceData)()
virtual void computeTimeStep()
void Muscl(MInt timerId=-1)
Base class of the structured solver.
MFloat m_waveEndTransition
MFloat m_firstAvrgResidual
virtual MFloat getBlasiusEta(MFloat coordX, MFloat coordY)
MBool isPeriodicComm(std::unique_ptr< StructuredComm< nDim > > &)
std::unique_ptr< StructuredFQVariables > FQ
void checkNans()
Checks whole domain for NaNs and adds the number of NaNs globally.
MFloat m_waveYBeginTransition
MInt m_waveCellsPerWaveLength
MBool m_streamwiseTravelingWave
MFloat m_convergenceCriterion
MBool m_mgExchangeCoordinates
void saveSolverSolution(MBool=false, const MBool=false) override
MInt * m_bc2600noOffsetCells
MInt * m_bc2600noActiveCells
MFloat m_waveBeginTransition
void loadRestartFile()
Load Restart File (primitive and conservative output) general formulation.
MString * m_variableNames
MFloat computeRecConstSVD(const MInt ijk, const MInt noNghbrIds, MInt *nghbr, MInt ID, MInt sID, MFloatScratchSpace &tmpA, MFloatScratchSpace &tmpC, MFloatScratchSpace &weights, const MInt recDim)
AUX DATA ENDS /////////////////////////////////////////////////////////////.
MBool m_savePartitionOutput
MBool skipPeriodicDirection(std::unique_ptr< StructuredComm< nDim > > &)
MInt m_waveTimeStepComputed
MFloat m_waveTemporalTransition
std::array< MInt, Timers::_count > m_timers
std::vector< std::unique_ptr< StructuredComm< nDim > > > m_sndComm
StructuredGrid< nDim > * m_grid
virtual void computeConservativeVariables()
MBool m_setLocalWallDistance
void fixTimeStepTravelingWave()
MFloat m_firstMaxResidual
SingularInformation * m_singularity
void savePartitions()
Saves the partitioned grid into an HDF5 file. Not used in production use but useful for debugging.
virtual void getBlasiusVelocity(MInt cellId, MFloat *const vel)
Load variables for the specified timeStep.
MFloat m_waveOutEndTransition
std::unique_ptr< MPrimitiveVariables< nDim > > PV
MFloat m_movingGridTimeOffset
std::unique_ptr< MConservativeVariables< nDim > > CV
MPI_Comm m_StructuredComm
MFloat m_waveYEndTransition
void initializeFQField()
Counts the number of necessary FQ fields, allocates them and corrects the indexes of the FQ variable ...
void exchange()
SVD STUFF ENDS /////////////////////////////////////////////////////////////.
MInt m_waveNoStepsPerCell
MFloat m_waveOutBeginTransition
MInt m_orderOfReconstruction
std::vector< std::unique_ptr< StructuredComm< nDim > > > m_rcvComm
MBool m_movingGridInitialStart
MBool m_bc2600InitialStartup
MFloat m_waveAmplitudePlus
void allocateAuxDataMaps()
AUX DATA //////////////////////////////////////////////////////////////////.
void readArray(T *array, const MString &name, size_type memoryStride=-1, size_type diskStride=-1)
Read array data from file. [MPI]
This class is a ScratchSpace.
void fill(T val)
fill the scratch with a given value
MString outputDir() const
Return the directory for output files.
virtual MInt domainId() const
Return the domainId (rank)
MInt m_residualInterval
The number of timesteps before writing the next residual.
const MInt m_solverId
a unique solver identifier
virtual MInt noDomains() const
MFloat m_Re
the Reynolds number
MFloat m_Ma
the Mach number
Class for the 2D stuctured boundary conditions.
virtual void computeLocalExtendedDistancesAndSetComm()
virtual void computeFrictionCoef()
virtual void updateSpongeLayer()
virtual void distributeWallAndFPProperties()
std::vector< std::unique_ptr< StructuredWindowMap< nDim > > > & m_physicalBCMap
virtual void computeWallDistances()
void applyDirichletNeumannBC()
virtual void correctBndryCndIndices()
MFloat ** surfaceMetricsSingularity
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)
MBool approx(const T &, const U &, const T)
constexpr T mMin(const T &x, const T &y)
constexpr T mMax(const T &x, const T &y)
MInt noRansEquations(RansMethod ransMethod)
void printAllocatedMemory(const MLong oldAllocatedBytes, const MString &solverName, const MPI_Comm comm)
Prints currently allocated memory.
constexpr MLong IPOW2(MInt x)
std::basic_string< char > MString
int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Isend
int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Irecv
int MPI_Wait(MPI_Request *request, MPI_Status *status, const MString &name)
same as MPI_Wait
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Bcast
std::vector< T > mpiExchangePointToPoint(const T *const sendBuffer, const MInt *const snghbrs, const MInt nosnghbrs, const MInt *const sendcounts, const MInt *const rnghbrs, const MInt nornghbrs, const MPI_Comm &mpi_comm, const MInt domainId, const MInt dataBlockSize, MInt *const recvcounts_=nullptr, MInt *const rdispls_=nullptr)
static constexpr MFloat C3
static constexpr MFloat rsigma_eps
static constexpr MFloat C_mu
static constexpr MFloat rsigma_k
static constexpr MFloat cv1to3
@ MGCellCenterCoordinates