Skip to content

Commit 2f2e6f2

Browse files
committed
Put streamwise periodic solver vars in struct.
1 parent 03d11b4 commit 2f2e6f2

7 files changed

Lines changed: 32 additions & 79 deletions

File tree

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,14 +1606,9 @@ class CNumerics {
16061606

16071607
/*!
16081608
* \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow.
1609-
* \param[in] massflow - massflow through periodic marker [kg/s].
1610-
* \param[in] integratedHeat - integrated heatflow over heatflux boundaries [W].
1611-
* \param[in] inletTemp - massflow averaged periodic inlet temperature [K].
1609+
* \param[in] SolverSPvals - Struct holding the values.
16121610
*/
1613-
virtual void SetStreamwisePeriodicValues(const su2double pressureDrop, const su2double massflow,
1614-
const su2double integratedHeat, const su2double inletTemp) {
1615-
1616-
}
1611+
virtual void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) { }
16171612
};
16181613

16191614
/*!

SU2_CFD/include/numerics/flow/flow_sources.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,9 @@ class CSourceBase_Flow : public CNumerics {
5858

5959
/*!
6060
* \brief Set massflow, heatflow & inlet temperature for streamwise periodic flow.
61-
* \param[in] massflow - massflow through periodic marker [kg/s].
62-
* \param[in] integratedHeat - integrated heatflow over heatflux boundaries [W].
63-
* \param[in] inletTemp - massflow averaged periodic inlet temperature [K].
61+
* \param[in] SolverSPvals - Struct holding the values.
6462
*/
65-
void SetStreamwisePeriodicValues(const su2double pressureDrop, const su2double massflow, const su2double integratedHeat, const su2double inletTemp) {
66-
SPvals.Streamwise_Periodic_PressureDrop = pressureDrop;
67-
SPvals.Streamwise_Periodic_MassFlow = massflow;
68-
SPvals.Streamwise_Periodic_IntegratedHeatFlow = integratedHeat;
69-
SPvals.Streamwise_Periodic_InletTemperature = inletTemp;
70-
}
63+
void SetStreamwisePeriodicValues(const StreamwisePeriodicValues SolverSPvals) final { SPvals = SolverSPvals; }
7164

7265
};
7366

SU2_CFD/include/solvers/CIncEulerSolver.hpp

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939
class CIncEulerSolver : public CFVMFlowSolverBase<CIncEulerVariable, INCOMPRESSIBLE> {
4040
protected:
4141
vector<CFluidModel*> FluidModel; /*!< \brief fluid model used in the solver. */
42-
su2double Streamwise_Periodic_PressureDrop; /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
43-
su2double Streamwise_Periodic_MassFlow; /*!< \brief Value of current massflow [kg/s] which results in a delta p and therefore an artificial body force vector. */
44-
su2double Streamwise_Periodic_IntegratedHeatFlow; /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
45-
su2double Streamwise_Periodic_InletTemperature; /*!< \brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
42+
StreamwisePeriodicValues SPvals;
4643

4744
/*!
4845
* \brief Preprocessing actions common to the Euler and NS solvers.
@@ -401,27 +398,8 @@ class CIncEulerSolver : public CFVMFlowSolverBase<CIncEulerVariable, INCOMPRESSI
401398
inline bool GetHasHybridParallel() const final { return true; }
402399

403400
/*!
404-
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
405-
* \return The streamwise periodic donor/outlet massflow.
401+
* \brief Get values for streamwise periodic flow: delta P, m_dot, inlet T, integrated heat.
402+
* \return Struct holding 4 su2doubles.
406403
*/
407-
su2double GetStreamwise_Periodic_PressureDrop() const { return Streamwise_Periodic_PressureDrop; }
408-
409-
/*!
410-
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
411-
* \return The streamwise periodic donor/outlet massflow.
412-
*/
413-
su2double GetStreamwise_Periodic_MassFlow() const { return Streamwise_Periodic_MassFlow; }
414-
415-
/*!
416-
* \brief Get the net sum of the heatflow into the domain.
417-
* \return The net sum of the heatflow into the domain.
418-
*/
419-
su2double GetStreamwise_Periodic_IntegratedHeatFlow() const { return Streamwise_Periodic_IntegratedHeatFlow; }
420-
421-
/*!
422-
* \brief Get the value of the area avg periodic inlet Temperature.
423-
* \return Temperature value.
424-
*/
425-
su2double GetStreamwise_Periodic_InletTemperature(void) const { return Streamwise_Periodic_InletTemperature; }
426-
404+
StreamwisePeriodicValues GetStreamwisePeriodicValues() const final { return SPvals; }
427405
};

SU2_CFD/include/solvers/CSolver.hpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4412,28 +4412,11 @@ class CSolver {
44124412
inline virtual bool GetHasHybridParallel() const { return false; }
44134413

44144414
/*!
4415-
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
4416-
* \return The streamwise periodic donor/outlet massflow.
4415+
* \brief Get values for streamwise periodc flow: delta P, m_dot, inlet T, integrated heat.
4416+
* \return Struct holding 4 su2doubles.
44174417
*/
4418-
virtual su2double GetStreamwise_Periodic_PressureDrop() const { return 0.0; }
4418+
virtual StreamwisePeriodicValues GetStreamwisePeriodicValues() const { StreamwisePeriodicValues SPvals; return SPvals; }
44194419

4420-
/*!
4421-
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
4422-
* \return The streamwise periodic donor/outlet massflow.
4423-
*/
4424-
virtual su2double GetStreamwise_Periodic_MassFlow() const { return 0.0; }
4425-
4426-
/*!
4427-
* \brief Get the net sum of the heatflow into the domain.
4428-
* \return The net sum of the heatflow into the domain.
4429-
*/
4430-
virtual su2double GetStreamwise_Periodic_IntegratedHeatFlow() const { return 0.0; }
4431-
4432-
/*!
4433-
* \brief Get the value of the area avg periodic inlet Temperature.
4434-
* \return Temperature value.
4435-
*/
4436-
virtual su2double GetStreamwise_Periodic_InletTemperature(void) const { return 0.0; }
44374420

44384421
protected:
44394422
/*!

SU2_CFD/src/output/CFlowIncOutput.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ void CFlowIncOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSolv
342342
SetHistoryOutputValue("AVG_CFL", flow_solver->GetAvg_CFL_Local());
343343

344344
if(streamwisePeriodic) {
345-
SetHistoryOutputValue("STREAMWISE_MASSFLOW", flow_solver->GetStreamwise_Periodic_MassFlow());
346-
SetHistoryOutputValue("STREAMWISE_DP", flow_solver->GetStreamwise_Periodic_PressureDrop());
347-
SetHistoryOutputValue("STREAMWISE_HEAT", flow_solver->GetStreamwise_Periodic_IntegratedHeatFlow());
345+
SetHistoryOutputValue("STREAMWISE_MASSFLOW", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_MassFlow);
346+
SetHistoryOutputValue("STREAMWISE_DP", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_PressureDrop);
347+
SetHistoryOutputValue("STREAMWISE_HEAT", flow_solver->GetStreamwisePeriodicValues().Streamwise_Periodic_IntegratedHeatFlow);
348348
}
349349

350350
/*--- Set the analyse surface history values --- */

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,8 +1496,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
14961496
}
14971497

14981498
if (streamwise_periodic) {
1499-
numerics->SetStreamwisePeriodicValues(Streamwise_Periodic_PressureDrop, Streamwise_Periodic_MassFlow,
1500-
Streamwise_Periodic_IntegratedHeatFlow, Streamwise_Periodic_InletTemperature);
1499+
1500+
/*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
1501+
numerics->SetStreamwisePeriodicValues(SPvals);
15011502

15021503
/*--- Loop over all points ---*/
15031504
SU2_OMP_FOR_STAT(omp_chunk_size)
@@ -1529,8 +1530,9 @@ void CIncEulerSolver::Source_Residual(CGeometry *geometry, CSolver **solver_cont
15291530

15301531
if(!streamwise_periodic_temperature && energy) {
15311532
CNumerics* second_numerics = numerics_container[SOURCE_SECOND_TERM + omp_get_thread_num()*MAX_TERMS];
1532-
second_numerics->SetStreamwisePeriodicValues(Streamwise_Periodic_PressureDrop, Streamwise_Periodic_MassFlow,
1533-
Streamwise_Periodic_IntegratedHeatFlow, Streamwise_Periodic_InletTemperature);
1533+
1534+
/*--- Set delta_p, m_dot, inlet_T, integrated_heat ---*/
1535+
second_numerics->SetStreamwisePeriodicValues(SPvals);
15341536

15351537
/*--- This bit acts as a boundary condition rather than a source term. But logically it fits better here. ---*/
15361538
for (auto iMarker = 0ul; iMarker < config->GetnMarker_All(); iMarker++) {
@@ -2916,7 +2918,7 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
29162918

29172919
Average_Density_Local += FaceArea * nodes->GetDensity(iPoint);
29182920

2919-
/*--- Due to periodicty temperature are euqual one the inlet(1) and outlet(2) ---*/
2921+
/*--- Due to periodicty, temperatures are equal one the inlet(1) and outlet(2) ---*/
29202922
Temperature_Local += FaceArea * nodes->GetTemperature(iPoint);
29212923

29222924
} // if domain
@@ -2935,13 +2937,13 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
29352937
Temperature_Global /= Area_Global;
29362938

29372939
/*--- Set solver variables ---*/
2938-
Streamwise_Periodic_MassFlow = MassFlow_Global;
2939-
Streamwise_Periodic_InletTemperature = Temperature_Global;
2940+
SPvals.Streamwise_Periodic_MassFlow = MassFlow_Global;
2941+
SPvals.Streamwise_Periodic_InletTemperature = Temperature_Global;
29402942

29412943
/*--- As deltaP changes with prescribed massflow the const config value should only be used once. ---*/
29422944
if((nZone==1 && InnerIter==0) ||
29432945
(nZone>1 && OuterIter==0 && InnerIter==0)) {
2944-
Streamwise_Periodic_PressureDrop = config->GetStreamwise_Periodic_PressureDrop() / config->GetPressure_Ref();
2946+
SPvals.Streamwise_Periodic_PressureDrop = config->GetStreamwise_Periodic_PressureDrop() / config->GetPressure_Ref();
29452947
}
29462948

29472949
if (config->GetKind_Streamwise_Periodic() == STREAMWISE_MASSFLOW) {
@@ -2959,7 +2961,7 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
29592961
ddP = 0.5 / ( Average_Density_Global * pow(Area_Global, 2)) * (pow(TargetMassFlow, 2) - pow(MassFlow_Global, 2));
29602962

29612963
/*--- Store updated pressure difference ---*/
2962-
Pressure_Drop_new = Streamwise_Periodic_PressureDrop + damping_factor*ddP;
2964+
Pressure_Drop_new = SPvals.Streamwise_Periodic_PressureDrop + damping_factor*ddP;
29632965
/*--- During restarts, this routine GetStreamwise_Periodic_Properties can get called multiple times
29642966
(e.g. 4x for INC_RANS restart). Each time, the pressure drop gets updated. For INC_RANS restarts
29652967
it gets called 2x before the restart files are read such that the current massflow is
@@ -2970,7 +2972,7 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
29702972
best ---*/
29712973
if((nZone==1 && InnerIter>0) ||
29722974
(nZone>1 && OuterIter>0)) {
2973-
Streamwise_Periodic_PressureDrop = Pressure_Drop_new;
2975+
SPvals.Streamwise_Periodic_PressureDrop = Pressure_Drop_new;
29742976
}
29752977

29762978
} // if massflow
@@ -3013,7 +3015,7 @@ void CIncEulerSolver::GetStreamwise_Periodic_Properties(const CGeometry *ge
30133015
SU2_MPI::Allreduce(&HeatFlow_Local, &HeatFlow_Global, 1, MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
30143016

30153017
/*--- Set the solver variable Integrated Heatflux ---*/
3016-
Streamwise_Periodic_IntegratedHeatFlow = HeatFlow_Global;
3018+
SPvals.Streamwise_Periodic_IntegratedHeatFlow = HeatFlow_Global;
30173019
} // if energy
30183020
}
30193021

SU2_CFD/src/solvers/CIncNSSolver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,15 @@ void CIncNSSolver::Compute_Streamwise_Periodic_Recovered_Values(CConfig *config,
124124
dot_product += fabs( (geometry->nodes->GetCoord(iPoint,iDim) - ReferenceNode[iDim]) * config->GetPeriodic_Translation(0)[iDim]);
125125

126126
/*--- Second, substract/add correction from reduced pressure/temperature to get recoverd pressure/temperature ---*/
127-
const su2double Pressure_Recovered = nodes->GetPressure(iPoint) - Streamwise_Periodic_PressureDrop / norm2_translation * dot_product;
127+
const su2double Pressure_Recovered = nodes->GetPressure(iPoint) - SPvals.Streamwise_Periodic_PressureDrop /
128+
norm2_translation * dot_product;
128129
nodes->SetStreamwise_Periodic_RecoveredPressure(iPoint, Pressure_Recovered);
129130

130131
/*--- InnerIter > 0 as otherwise MassFlow in the denominator would be zero ---*/
131132
if (energy && InnerIter > 0) {
132133
su2double Temperature_Recovered = nodes->GetTemperature(iPoint);
133-
Temperature_Recovered += Streamwise_Periodic_IntegratedHeatFlow / (Streamwise_Periodic_MassFlow * nodes->GetSpecificHeatCp(iPoint) * norm2_translation) * dot_product;
134+
Temperature_Recovered += SPvals.Streamwise_Periodic_IntegratedHeatFlow /
135+
(SPvals.Streamwise_Periodic_MassFlow * nodes->GetSpecificHeatCp(iPoint) * norm2_translation) * dot_product;
134136
nodes->SetStreamwise_Periodic_RecoveredTemperature(iPoint, Temperature_Recovered);
135137
}
136138
} // for iPoint
@@ -276,7 +278,7 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con
276278

277279
/*--- Scalar factor of the residual contribution ---*/
278280
const su2double norm2_translation = GeometryToolbox::SquaredNorm(nDim, config->GetPeriodic_Translation(0));
279-
scalar_factor = Streamwise_Periodic_IntegratedHeatFlow*thermal_conductivity / (Streamwise_Periodic_MassFlow * Cp * norm2_translation);
281+
scalar_factor = SPvals.Streamwise_Periodic_IntegratedHeatFlow*thermal_conductivity / (SPvals.Streamwise_Periodic_MassFlow * Cp * norm2_translation);
280282

281283
/*--- Dot product ---*/
282284
dot_product = GeometryToolbox::DotProduct(nDim, config->GetPeriodic_Translation(0), Normal);

0 commit comments

Comments
 (0)