@@ -105,7 +105,7 @@ CIncEulerSolver::CIncEulerSolver(CGeometry *geometry, CConfig *config, unsigned
105105 nDim = geometry->GetnDim ();
106106
107107 /* --- Make sure to align the sizes with the constructor of CIncEulerVariable. ---*/
108- nVar = nDim+2 ; nPrimVar = nDim+9 ; nPrimVarGrad = nDim+6 ;
108+ nVar = nDim+2 ; nPrimVar = nDim+9 ; nPrimVarGrad = nDim+4 ;
109109
110110 /* --- Initialize nVarGrad for deallocation ---*/
111111
@@ -1263,6 +1263,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
12631263 const bool viscous = config->GetViscous ();
12641264 const bool radiation = config->AddRadiation ();
12651265 const bool vol_heat = config->GetHeatSource ();
1266+ const bool turbulent = (config->GetKind_Turb_Model () != NONE);
12661267 const bool energy = config->GetEnergy_Equation ();
12671268 const bool streamwise_periodic = config->GetKind_Streamwise_Periodic ();
12681269 const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature ();
@@ -1382,7 +1383,7 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
13821383 if (yCoord > EPS)
13831384 AuxVar = Total_Viscosity*yVelocity/yCoord;
13841385
1385- /* --- Set the auxilairy variable for this node. ---*/
1386+ /* --- Set the auxiliary variable for this node. ---*/
13861387
13871388 nodes->SetAuxVar (iPoint, 0 , AuxVar);
13881389
@@ -1497,6 +1498,25 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
14971498
14981499 if (streamwise_periodic) {
14991500
1501+ /* --- For turbulent streamwise periodic problems w/ energy eq, we need an additional gradient of Eddy viscosity. ---*/
1502+ if (streamwise_periodic_temperature && turbulent) {
1503+
1504+ SU2_OMP_FOR_STAT (omp_chunk_size)
1505+ for (iPoint = 0 ; iPoint < nPoint; iPoint++) {
1506+ /* --- Set the auxiliary variable, Eddy viscosity mu_t, for this node. ---*/
1507+ nodes->SetAuxVar (iPoint, 0 , nodes->GetEddyViscosity (iPoint));
1508+ }
1509+
1510+ /* --- Compute the auxiliary variable gradient with GG or WLS. ---*/
1511+ if (config->GetKind_Gradient_Method () == GREEN_GAUSS) {
1512+ SetAuxVar_Gradient_GG (geometry, config);
1513+ }
1514+ if (config->GetKind_Gradient_Method () == WEIGHTED_LEAST_SQUARES) {
1515+ SetAuxVar_Gradient_LS (geometry, config);
1516+ }
1517+
1518+ } // if turbulent
1519+
15001520 /* --- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
15011521 numerics->SetStreamwisePeriodicValues (SPvals);
15021522
@@ -1513,11 +1533,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
15131533 /* --- Load the volume of the dual mesh cell ---*/
15141534 numerics->SetVolume (geometry->nodes ->GetVolume (iPoint));
15151535
1516- /* --- If viscous, we need gradients for extra terms. ---*/
1517- if (viscous) {
1518- /* --- Gradient of the primitive variables ---*/
1519- numerics->SetPrimVarGradient (nodes->GetGradient_Primitive (iPoint), nullptr );
1520- }
1536+ /* --- Load the aux variable gradient that we already computed. ---*/
1537+ if (streamwise_periodic_temperature && turbulent)
1538+ numerics->SetAuxVarGrad (nodes->GetAuxVarGradient (iPoint), nullptr );
15211539
15221540 /* --- Compute the streamwise periodic source residual and add to the total ---*/
15231541 auto residual = numerics->ComputeResidual (config);
@@ -1526,9 +1544,10 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
15261544 /* --- Add the implicit Jacobian contribution ---*/
15271545 if (implicit) Jacobian.AddBlock2Diag (iPoint, residual.jacobian_i );
15281546
1529- }// for iPoint
1547+ } // for iPoint
15301548
15311549 if (!streamwise_periodic_temperature && energy) {
1550+
15321551 CNumerics* second_numerics = numerics_container[SOURCE_SECOND_TERM + omp_get_thread_num ()*MAX_TERMS];
15331552
15341553 /* --- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
@@ -2908,11 +2927,8 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
29082927
29092928 auto FaceArea = GeometryToolbox::Norm (nDim, AreaNormal);
29102929
2911- // One could add a CVariable method to return a pointer to the first Vel element to directly plug into GeomToolbox
2912- su2double Velocity[MAXNDIM] = {0.0 };
2913- for (unsigned short iDim = 0 ; iDim < nDim; iDim++) { Velocity[iDim] = nodes->GetVelocity (iPoint, iDim); }
29142930 /* --- m_dot = dot_prod(n*v) * A * rho, with n beeing unit normal. ---*/
2915- MassFlow_Local += GeometryToolbox::DotProduct (nDim , AreaNormal, Velocity ) * nodes->GetDensity (iPoint);
2931+ MassFlow_Local += nodes-> GetProjVel (iPoint , AreaNormal) * nodes->GetDensity (iPoint);
29162932
29172933 Area_Local += FaceArea;
29182934
0 commit comments