Skip to content

Commit ba33dee

Browse files
committed
Move vars from config to solver and geometry.
1 parent a8ff3a2 commit ba33dee

13 files changed

Lines changed: 89 additions & 89 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -998,11 +998,7 @@ class CConfig {
998998
bool Streamwise_Periodic_Temperature; /*!< \brief Use real periodicity for Energy equation or oterwise outlet source term. */
999999
su2double Streamwise_Periodic_PressureDrop, /*!< \brief Value of prescribed pressure drop [Pa] which results in an artificial body force vector. */
10001000
Streamwise_Periodic_TargetMassFlow, /*!< \brief Value of prescribed massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */
1001-
Streamwise_Periodic_MassFlow, /*!< \brief Value of current massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */
1002-
Streamwise_Periodic_IntegratedHeatFlow, /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
1003-
Streamwise_Periodic_OutletHeat, /*!< /brief Heatflux boundary [W/m^2] imposed at streamwise periodic outlet. */
1004-
Streamwise_Periodic_InletTemperature; /*!< /brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
1005-
vector<su2double> Streamwise_Periodic_RefNode; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure computation only. Size nDim.*/
1001+
Streamwise_Periodic_OutletHeat; /*!< /brief Heatflux boundary [W/m^2] imposed at streamwise periodic outlet. */
10061002

10071003
su2double *FreeStreamTurboNormal; /*!< \brief Direction to initialize the flow in turbomachinery computation */
10081004
su2double Restart_Bandwidth_Agg; /*!< \brief The aggregate of the bandwidth for writing binary restarts (to be averaged later). */
@@ -5754,18 +5750,6 @@ class CConfig {
57545750
*/
57555751
su2double GetStreamwise_Periodic_OutletHeat(void) const { return Streamwise_Periodic_OutletHeat; }
57565752

5757-
/*!
5758-
* \brief Set the value of the area avg periodic inlet Temperature.
5759-
* \param[in] Temp - area avg periodic inlet Temperature.
5760-
*/
5761-
void SetStreamwise_Periodic_InletTemperature(su2double Temp) { Streamwise_Periodic_InletTemperature = Temp; }
5762-
5763-
/*!
5764-
* \brief Get the value of the area avg periodic inlet Temperature.
5765-
* \return Temperature value.
5766-
*/
5767-
su2double GetStreamwise_Periodic_InletTemperature(void) const { return Streamwise_Periodic_InletTemperature; }
5768-
57695753
/*!
57705754
* \brief Get the value of the pressure delta from which body force vector is computed.
57715755
* \return Delta Pressure for body force computation.
@@ -5784,42 +5768,6 @@ class CConfig {
57845768
*/
57855769
su2double GetStreamwise_Periodic_TargetMassFlow(void) const { return Streamwise_Periodic_TargetMassFlow; }
57865770

5787-
/*!
5788-
* \brief Get a pointer to the reference node coordinate vector.
5789-
* \return A pointer to the reference node coordinate vector.
5790-
*/
5791-
vector<su2double> GetStreamwise_Periodic_RefNode(void) { return Streamwise_Periodic_RefNode; }
5792-
5793-
/*!
5794-
* \brief Get a pointer to the reference node coordinate vector.
5795-
* \return A pointer to the reference node coordinate vector.
5796-
*/
5797-
void SetStreamwise_Periodic_RefNode(vector<su2double> RefNode) { Streamwise_Periodic_RefNode = RefNode; }
5798-
5799-
/*!
5800-
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
5801-
* \return The streamwise periodic donor/outlet massflow.
5802-
*/
5803-
su2double GetStreamwise_Periodic_MassFlow() const { return Streamwise_Periodic_MassFlow; }
5804-
5805-
/*!
5806-
* \brief Set the massflow at the streamwise periodic donor/outlet boundary.
5807-
* \param[in] val_massflow - Massflow at the streamwise periodic donor marker.
5808-
*/
5809-
void SetStreamwise_Periodic_MassFlow(su2double val_massflow) { Streamwise_Periodic_MassFlow = val_massflow; }
5810-
5811-
/*!
5812-
* \brief Get the net sum of the heatflow into the domain.
5813-
* \return The net sum of the heatflow into the domain.
5814-
*/
5815-
su2double GetStreamwise_Periodic_IntegratedHeatFlow() const { return Streamwise_Periodic_IntegratedHeatFlow; }
5816-
5817-
/*!
5818-
* \brief Set the net sum of the heatflow into the domain.
5819-
* \param[in] val_heatflow - Net sum of the heatflow into the domain.
5820-
*/
5821-
void SetStreamwise_Periodic_IntegratedHeatFlow(su2double val_heatflow) { Streamwise_Periodic_IntegratedHeatFlow = val_heatflow; }
5822-
58235771
/*!
58245772
* \brief Get information about the volumetric heat source.
58255773
* \return <code>TRUE</code> if it uses a volumetric heat source; otherwise <code>FALSE</code>.

Common/include/geometry/CGeometry.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,5 +1717,11 @@ class CGeometry {
17171717
* \param[out] nNonconvexElements- amount of nonconvex elements in the mesh
17181718
*/
17191719
unsigned long GetnNonconvexElements() const {return nNonconvexElements;}
1720+
1721+
/*!
1722+
* \brief Get a pointer to the reference node coordinate vector.
1723+
* \return A pointer to the reference node coordinate vector.
1724+
*/
1725+
inline virtual const su2double* GetStreamwise_Periodic_RefNode(void) const { return nullptr; }
17201726
};
17211727

Common/include/geometry/CPhysicalGeometry.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ class CPhysicalGeometry final : public CGeometry {
107107
vector<int> GlobalMarkerStorageDispl;
108108
vector<su2double> GlobalRoughness_Height;
109109

110+
su2double Streamwise_Periodic_RefNode[MAXNDIM] = {0}; /*!< \brief Coordinates of the reference node [m] on the receiving periodic marker, for recovered pressure computation only. Size nDim.*/
111+
110112
public:
111113
/*--- This is to suppress Woverloaded-virtual, omitting it has no negative impact. ---*/
112114
using CGeometry::SetVertex;
@@ -790,4 +792,9 @@ class CPhysicalGeometry final : public CGeometry {
790792
*/
791793
void SetGlobalMarkerRoughness(const CConfig* config);
792794

795+
/*!
796+
* \brief Get a pointer to the reference node coordinate vector.
797+
* \return A pointer to the reference node coordinate vector.
798+
*/
799+
inline const su2double* GetStreamwise_Periodic_RefNode(void) const final { return Streamwise_Periodic_RefNode;}
793800
};

Common/src/CConfig.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4602,9 +4602,6 @@ void CConfig::SetPostprocessing(unsigned short val_software, unsigned short val_
46024602
SU2_MPI::Error("Streamwise Periodicity only works with \"INC_NONDIM= DIMENSIONAL\"", CURRENT_FUNCTION);
46034603
if (Axisymmetric)
46044604
SU2_MPI::Error("Streamwise Periodicity terms does not not have axisymmetric corrections.", CURRENT_FUNCTION);
4605-
4606-
/*--- Allocate Memory for Reference Node for recovered pressure computation ---*/
4607-
Streamwise_Periodic_RefNode.resize(val_nDim);
46084605
} else {
46094606
/*--- Safety measure ---*/
46104607
Streamwise_Periodic_Temperature = false;

Common/src/geometry/CPhysicalGeometry.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7531,19 +7531,16 @@ void CPhysicalGeometry::FindUniqueNode_PeriodicBound(CConfig *config) {
75317531
if (norm < min_norm || iRank == 0) {
75327532
min_norm = norm;
75337533
for (unsigned short iDim = 0; iDim < nDim; iDim++)
7534-
Buffer_Send_RefNode[iDim] = Buffer_Recv_RefNode[iRank*nDim + iDim];
7534+
Streamwise_Periodic_RefNode[iDim] = Buffer_Recv_RefNode[iRank*nDim + iDim];
75357535
}
75367536
/*--- The theoretical case, that multiple inlet points with the same distance to the origin exists, remains. ---*/
75377537
}
75387538

7539-
/*--- Store the final reference node. ---*/
7540-
config->SetStreamwise_Periodic_RefNode(Buffer_Send_RefNode);
7541-
75427539
/*--- Print the reference node to screen. ---*/
75437540
if (rank == MASTER_NODE) {
75447541
cout << "Streamwise Periodic Reference Node: [";
75457542
for (unsigned short iDim = 0; iDim < nDim; iDim++)
7546-
cout << " " << Buffer_Send_RefNode[iDim];
7543+
cout << " " << Streamwise_Periodic_RefNode[iDim];
75477544
cout << " ]" << endl;
75487545
}
75497546

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,7 @@ class CNumerics {
16041604
*/
16051605
virtual inline void SetGamma(su2double val_Gamma_i, su2double val_Gamma_j) { }
16061606

1607+
virtual inline void SetStreamwise_Periodic_Values(const su2double massflow, const su2double integratedHeat, const su2double inletTemp) { }
16071608
};
16081609

16091610
/*!

SU2_CFD/include/numerics/flow/flow_sources.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class CSourceBase_Flow : public CNumerics {
4040
protected:
4141
su2double* residual = nullptr;
4242
su2double** jacobian = nullptr;
43+
su2double
44+
Streamwise_Periodic_MassFlow, /*!< \brief Value of current massflow [kg/s] which results in an delta p and therefore an artificial body force vector. */
45+
Streamwise_Periodic_IntegratedHeatFlow, /*!< \brief Value of of the net sum of heatflow [W] into the domain. */
46+
Streamwise_Periodic_InletTemperature; /*!< /brief Area avg static Temp [K] at the periodic inlet. Used for adaptive outlet heatsink. */
4347

4448
/*!
4549
* \brief Constructor of the class.
@@ -55,6 +59,18 @@ class CSourceBase_Flow : public CNumerics {
5559
*/
5660
~CSourceBase_Flow() override;
5761

62+
/*!
63+
* \brief Constructor of the class.
64+
* \param[in] val_nDim - Number of dimensions of the problem.
65+
* \param[in] val_nVar - Number of variables of the problem.
66+
* \param[in] config - Definition of the particular problem.
67+
*/
68+
void SetStreamwise_Periodic_Values(const su2double massflow, const su2double integratedHeat, const su2double inletTemp) {
69+
Streamwise_Periodic_MassFlow = massflow;
70+
Streamwise_Periodic_IntegratedHeatFlow = integratedHeat;
71+
Streamwise_Periodic_InletTemperature = inletTemp;
72+
}
73+
5874
};
5975

6076
/*!

SU2_CFD/include/solvers/CIncEulerSolver.hpp

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

4347
/*!
4448
* \brief Preprocessing actions common to the Euler and NS solvers.
@@ -392,4 +396,22 @@ class CIncEulerSolver : public CFVMFlowSolverBase<CIncEulerVariable, INCOMPRESSI
392396
*/
393397
inline bool GetHasHybridParallel() const final { return true; }
394398

399+
/*!
400+
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
401+
* \return The streamwise periodic donor/outlet massflow.
402+
*/
403+
su2double GetStreamwise_Periodic_MassFlow() const { return Streamwise_Periodic_MassFlow; }
404+
405+
/*!
406+
* \brief Get the net sum of the heatflow into the domain.
407+
* \return The net sum of the heatflow into the domain.
408+
*/
409+
su2double GetStreamwise_Periodic_IntegratedHeatFlow() const { return Streamwise_Periodic_IntegratedHeatFlow; }
410+
411+
/*!
412+
* \brief Get the value of the area avg periodic inlet Temperature.
413+
* \return Temperature value.
414+
*/
415+
su2double GetStreamwise_Periodic_InletTemperature(void) const { return Streamwise_Periodic_InletTemperature; }
416+
395417
};

SU2_CFD/include/solvers/CSolver.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4398,6 +4398,24 @@ class CSolver {
43984398
*/
43994399
inline virtual bool GetHasHybridParallel() const { return false; }
44004400

4401+
/*!
4402+
* \brief Get the massflow of the streamwise periodic donor/outlet boundary.
4403+
* \return The streamwise periodic donor/outlet massflow.
4404+
*/
4405+
virtual su2double GetStreamwise_Periodic_MassFlow() const { return 0.0; }
4406+
4407+
/*!
4408+
* \brief Get the net sum of the heatflow into the domain.
4409+
* \return The net sum of the heatflow into the domain.
4410+
*/
4411+
virtual su2double GetStreamwise_Periodic_IntegratedHeatFlow() const { return 0.0; }
4412+
4413+
/*!
4414+
* \brief Get the value of the area avg periodic inlet Temperature.
4415+
* \return Temperature value.
4416+
*/
4417+
virtual su2double GetStreamwise_Periodic_InletTemperature(void) const { return 0.0; }
4418+
44014419
protected:
44024420
/*!
44034421
* \brief Allocate the memory for the verification solution, if necessary.

SU2_CFD/src/numerics/flow/flow_sources.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ CSourceIncStreamwise_Periodic::CSourceIncStreamwise_Periodic(unsigned short val_
693693
CNumerics::ResidualType<> CSourceIncStreamwise_Periodic::ComputeResidual(const CConfig *config) {
694694

695695
const su2double delta_p = config->GetStreamwise_Periodic_PressureDrop() / config->GetPressure_Ref(); /*!< \brief Value of prescribed pressure drop which results in an artificial body force vector. */
696-
const su2double massflow = config->GetStreamwise_Periodic_MassFlow(); /*!< \brief Massflow through streamwise periodic 'outlet' marker. */
697-
const su2double integrated_heatflow = config->GetStreamwise_Periodic_IntegratedHeatFlow(); /*!< \brief Total heat added into the domain via heatflux marker. */
698696

699697
for (unsigned short iVar = 0; iVar < nVar; iVar++) residual[iVar] = 0.0;
700698

@@ -707,7 +705,7 @@ CNumerics::ResidualType<> CSourceIncStreamwise_Periodic::ComputeResidual(const C
707705
/*--- Compute the periodic temperature contribution to the energy equation, if energy equation is considered ---*/
708706
if (energy && streamwisePeriodic_temperature) {
709707

710-
scalar_factor = integrated_heatflow * DensityInc_i / (massflow * norm2_translation);
708+
scalar_factor = Streamwise_Periodic_IntegratedHeatFlow * DensityInc_i / (Streamwise_Periodic_MassFlow * norm2_translation);
711709

712710
/*--- Compute scalar-product dot_prod(v*t) ---*/
713711
dot_product = GeometryToolbox::DotProduct(nDim, Streamwise_Coord_Vector, &V_i[1]);
@@ -719,7 +717,7 @@ CNumerics::ResidualType<> CSourceIncStreamwise_Periodic::ComputeResidual(const C
719717
if(turbulent) {
720718

721719
/*--- Compute the scalar factor ---*/
722-
scalar_factor = integrated_heatflow / (massflow * sqrt(norm2_translation) * Prandtl_Turb);
720+
scalar_factor = Streamwise_Periodic_IntegratedHeatFlow / (Streamwise_Periodic_MassFlow * sqrt(norm2_translation) * Prandtl_Turb);
723721

724722
/*--- Compute scalar product between periodic translation vector and eddy viscosity gradient. ---*/
725723
dot_product = GeometryToolbox::DotProduct(nDim, Streamwise_Coord_Vector, PrimVar_Grad_i[nDim+5]);
@@ -749,14 +747,14 @@ CNumerics::ResidualType<> CSourceIncStreamwisePeriodic_Outlet::ComputeResidual(c
749747
// b) a user provided quantity, especially the case for CHT cases
750748
su2double factor;
751749
if (config->GetStreamwise_Periodic_OutletHeat() == 0.0)
752-
factor = config->GetStreamwise_Periodic_IntegratedHeatFlow();
750+
factor = Streamwise_Periodic_IntegratedHeatFlow;
753751
else
754752
factor = config->GetStreamwise_Periodic_OutletHeat() / config->GetHeat_Flux_Ref();
755753

756-
residual[nDim+1] -= abs(local_Massflow/config->GetStreamwise_Periodic_MassFlow()) * factor;
754+
residual[nDim+1] -= abs(local_Massflow/Streamwise_Periodic_MassFlow) * factor;
757755

758756
/*--- Force the area avg inlet Temp to match the Inc_Temperature_Init with additional residual condtribution ---*/
759-
const su2double delta_T = config->GetStreamwise_Periodic_InletTemperature() - config->GetInc_Temperature_Init()/config->GetTemperature_Ref();
757+
const su2double delta_T = Streamwise_Periodic_InletTemperature - config->GetInc_Temperature_Init()/config->GetTemperature_Ref();
760758
residual[nDim+1] += 0.5 * abs(local_Massflow) * SpecificHeat_i * delta_T;
761759

762760
return ResidualType<>(residual, jacobian, nullptr);

0 commit comments

Comments
 (0)