Skip to content

Commit 27a7687

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature_expliciteuler_scalarsolver
2 parents f7cfaeb + b140a4d commit 27a7687

13 files changed

Lines changed: 456 additions & 841 deletions

SU2_CFD/include/output/CFlowCompOutput.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ class CVariable;
3838
*/
3939
class CFlowCompOutput final: public CFlowOutput {
4040
private:
41-
4241
TURB_MODEL turb_model; //!< Kind of turbulence model
4342

4443
public:
45-
4644
/*!
4745
* \brief Constructor of the class
4846
* \param[in] config - Definition of the particular problem.
@@ -55,18 +53,6 @@ class CFlowCompOutput final: public CFlowOutput {
5553
*/
5654
void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override;
5755

58-
/*!
59-
* \brief Set the values of the volume output fields for a surface point.
60-
* \param[in] config - Definition of the particular problem.
61-
* \param[in] geometry - Geometrical definition of the problem.
62-
* \param[in] solver - The container holding all solution data.
63-
* \param[in] iPoint - Index of the point.
64-
* \param[in] iMarker - Index of the surface marker.
65-
* \param[in] iVertex - Index of the vertex on the marker.
66-
*/
67-
void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver,
68-
unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override;
69-
7056
/*!
7157
* \brief Set the available volume output fields
7258
* \param[in] config - Definition of the particular problem.

SU2_CFD/include/output/CFlowIncOutput.hpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,25 @@ class CVariable;
3838
*/
3939
class CFlowIncOutput final: public CFlowOutput {
4040
private:
41-
4241
TURB_MODEL turb_model; /*!< \brief The kind of turbulence model*/
4342
bool heat; /*!< \brief Boolean indicating whether have a heat problem*/
4443
bool weakly_coupled_heat; /*!< \brief Boolean indicating whether have a weakly coupled heat equation*/
4544
unsigned short streamwisePeriodic; /*!< \brief Boolean indicating whether it is a streamwise periodic simulation. */
4645
bool streamwisePeriodic_temperature; /*!< \brief Boolean indicating streamwise periodic temperature is used. */
4746

4847
public:
49-
5048
/*!
5149
* \brief Constructor of the class
5250
* \param[in] config - Definition of the particular problem.
5351
*/
5452
CFlowIncOutput(CConfig *config, unsigned short nDim);
5553

56-
/*!
57-
* \brief Destructor of the class.
58-
*/
59-
~CFlowIncOutput(void) override;
60-
6154
/*!
6255
* \brief Load the history output field values
6356
* \param[in] config - Definition of the particular problem.
6457
*/
6558
void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override;
6659

67-
/*!
68-
* \brief Set the values of the volume output fields for a surface point.
69-
* \param[in] config - Definition of the particular problem.
70-
* \param[in] geometry - Geometrical definition of the problem.
71-
* \param[in] solver - The container holding all solution data.
72-
* \param[in] iPoint - Index of the point.
73-
* \param[in] iMarker - Index of the surface marker.
74-
* \param[in] iVertex - Index of the vertex on the marker.
75-
*/
76-
void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver,
77-
unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override;
78-
7960
/*!
8061
* \brief Set the available volume output fields
8162
* \param[in] config - Definition of the particular problem.

SU2_CFD/include/output/CFlowOutput.hpp

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ class CFlowOutput : public CFVMOutput{
4040
*/
4141
CFlowOutput(const CConfig *config, unsigned short nDim, bool femOutput);
4242

43+
/*!
44+
* \brief Set the values of the volume output fields for a surface point.
45+
* \param[in] config - Definition of the particular problem.
46+
* \param[in] geometry - Geometrical definition of the problem.
47+
* \param[in] solver - The container holding all solution data.
48+
* \param[in] iPoint - Index of the point.
49+
* \param[in] iMarker - Index of the surface marker.
50+
* \param[in] iVertex - Index of the vertex on the marker.
51+
*/
52+
void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver,
53+
unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override;
54+
4355
/*!
4456
* \brief Add flow surface output fields
4557
* \param[in] config - Definition of the particular problem.
@@ -55,6 +67,61 @@ class CFlowOutput : public CFVMOutput{
5567
*/
5668
void SetAnalyzeSurface(const CSolver *solver, const CGeometry *geometry, CConfig *config, bool output);
5769

70+
/*!
71+
* \brief Add turbulence history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
72+
*/
73+
void AddHistoryOutputFields_TurbRMS_RES(const CConfig* config);
74+
75+
/*!
76+
* \brief Add turbulence history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
77+
*/
78+
void AddHistoryOutputFields_TurbMAX_RES(const CConfig* config);
79+
80+
/*!
81+
* \brief Add turbulence history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
82+
*/
83+
void AddHistoryOutputFields_TurbBGS_RES(const CConfig* config);
84+
85+
/*!
86+
* \brief Add turbulence history fields for the linear solver (FVMComp, FVMInc, FVMNEMO).
87+
*/
88+
void AddHistoryOutputFields_TurbLinsol(const CConfig* config);
89+
90+
/*!
91+
* \brief Set all turbulence history field values.
92+
*/
93+
void LoadHistoryData_Turb(const CConfig* config, const CSolver* const* solver);
94+
95+
/*!
96+
* \brief Add turbulence volume solution fields for a point (FVMComp, FVMInc, FVMNEMO).
97+
* \note The order of fields in restart files is fixed. Therefore the split-up.
98+
* \param[in] config - Definition of the particular problem.
99+
*/
100+
void SetVolumeOutputFields_TurbSolution(const CConfig* config);
101+
102+
/*!
103+
* \brief Add turbulence volume solution fields for a point (FVMComp, FVMInc, FVMNEMO).
104+
* \note The order of fields in restart files is fixed. Therefore the split-up.
105+
* \param[in] config - Definition of the particular problem.
106+
*/
107+
void SetVolumeOutputFields_TurbResidual(const CConfig* config);
108+
109+
/*!
110+
* \brief Add turbulence volume limiter fields (and more) for a point (FVMComp, FVMInc, FVMNEMO).
111+
* \param[in] config - Definition of the particular problem.
112+
*/
113+
void SetVolumeOutputFields_TurbLimiter(const CConfig* config);
114+
115+
/*!
116+
* \brief Set all turbulence volume field values for a point.
117+
* \param[in] config - Definition of the particular problem.
118+
* \param[in] solver - The container holding all solution data.
119+
* \param[in] geometry - Geometrical definition of the problem.
120+
* \param[in] iPoint - Index of the point.
121+
*/
122+
void LoadVolumeData_Turb(const CConfig* config, const CSolver* const* solver, const CGeometry* geometry,
123+
const unsigned long iPoint);
124+
58125
/*!
59126
* \brief Add aerodynamic coefficients as output fields
60127
* \param[in] config - Definition of the particular problem.
@@ -179,7 +246,7 @@ class CFlowOutput : public CFVMOutput{
179246
* \param iPoint
180247
* \param node_flow
181248
*/
182-
void LoadTimeAveragedData(unsigned long iPoint, CVariable *node_flow);
249+
void LoadTimeAveragedData(unsigned long iPoint, const CVariable *node_flow);
183250

184251
/*!
185252
* \brief Write additional output for fixed CL mode.

SU2_CFD/include/output/CNEMOCompOutput.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ class CVariable;
3737
*/
3838
class CNEMOCompOutput final: public CFlowOutput {
3939
private:
40-
4140
TURB_MODEL turb_model; /*!< \brief Kind of turbulence model */
4241
unsigned short iSpecies, /*!< \brief Species index */
4342
nSpecies; /*!< \brief Number of species */
4443
public:
45-
4644
/*!
4745
* \brief Constructor of the class
4846
* \param[in] config - Definition of the particular problem.
@@ -55,18 +53,6 @@ class CNEMOCompOutput final: public CFlowOutput {
5553
*/
5654
void LoadHistoryData(CConfig *config, CGeometry *geometry, CSolver **solver) override;
5755

58-
/*!
59-
* \brief Set the values of the volume output fields for a surface point.
60-
* \param[in] config - Definition of the particular problem.
61-
* \param[in] geometry - Geometrical definition of the problem.
62-
* \param[in] solver - The container holding all solution data.
63-
* \param[in] iPoint - Index of the point.
64-
* \param[in] iMarker - Index of the surface marker.
65-
* \param[in] iVertex - Index of the vertex on the marker.
66-
*/
67-
void LoadSurfaceData(CConfig *config, CGeometry *geometry, CSolver **solver,
68-
unsigned long iPoint, unsigned short iMarker, unsigned long iVertex) override;
69-
7056
/*!
7157
* \brief Set the available volume output fields
7258
* \param[in] config - Definition of the particular problem.

SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -972,95 +972,8 @@ class CFVMFlowSolverBase : public CSolver {
972972

973973
/*!
974974
* \brief Evaluate the vorticity and strain rate magnitude.
975-
* \tparam VelocityOffset - Index in the primitive variables where the velocity starts.
976975
*/
977-
void ComputeVorticityAndStrainMag(const CConfig& config, unsigned short iMesh,
978-
const size_t VelocityOffset = 1) {
979-
980-
auto& StrainMag = nodes->GetStrainMag();
981-
982-
ompMasterAssignBarrier(StrainMag_Max,0.0, Omega_Max,0.0);
983-
984-
su2double strainMax = 0.0, omegaMax = 0.0;
985-
986-
SU2_OMP_FOR_STAT(omp_chunk_size)
987-
for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) {
988-
989-
const auto VelocityGradient = nodes->GetGradient_Primitive(iPoint, VelocityOffset);
990-
auto Vorticity = nodes->GetVorticity(iPoint);
991-
992-
/*--- Vorticity ---*/
993-
994-
Vorticity[0] = 0.0;
995-
Vorticity[1] = 0.0;
996-
Vorticity[2] = VelocityGradient(1,0)-VelocityGradient(0,1);
997-
998-
if (nDim == 3) {
999-
Vorticity[0] = VelocityGradient(2,1)-VelocityGradient(1,2);
1000-
Vorticity[1] = -(VelocityGradient(2,0)-VelocityGradient(0,2));
1001-
}
1002-
1003-
/*--- Strain Magnitude ---*/
1004-
1005-
AD::StartPreacc();
1006-
AD::SetPreaccIn(VelocityGradient, nDim, nDim);
1007-
1008-
su2double Div = 0.0;
1009-
for (unsigned long iDim = 0; iDim < nDim; iDim++)
1010-
Div += VelocityGradient(iDim, iDim);
1011-
Div /= 3.0;
1012-
1013-
StrainMag(iPoint) = 0.0;
1014-
1015-
/*--- Add diagonal part ---*/
1016-
1017-
for (unsigned long iDim = 0; iDim < nDim; iDim++) {
1018-
StrainMag(iPoint) += pow(VelocityGradient(iDim, iDim) - Div, 2);
1019-
}
1020-
if (nDim == 2) {
1021-
StrainMag(iPoint) += pow(Div, 2);
1022-
}
1023-
1024-
/*--- Add off diagonals ---*/
1025-
1026-
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(0,1) + VelocityGradient(1,0)), 2);
1027-
1028-
if (nDim == 3) {
1029-
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(0,2) + VelocityGradient(2,0)), 2);
1030-
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(1,2) + VelocityGradient(2,1)), 2);
1031-
}
1032-
1033-
StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint));
1034-
AD::SetPreaccOut(StrainMag(iPoint));
1035-
1036-
/*--- Max is not differentiable, so we not register them for preacc. ---*/
1037-
strainMax = max(strainMax, StrainMag(iPoint));
1038-
omegaMax = max(omegaMax, GeometryToolbox::Norm(3, Vorticity));
1039-
1040-
AD::EndPreacc();
1041-
}
1042-
END_SU2_OMP_FOR
1043-
1044-
if ((iMesh == MESH_0) && (config.GetComm_Level() == COMM_FULL)) {
1045-
SU2_OMP_CRITICAL {
1046-
StrainMag_Max = max(StrainMag_Max, strainMax);
1047-
Omega_Max = max(Omega_Max, omegaMax);
1048-
}
1049-
END_SU2_OMP_CRITICAL
1050-
1051-
SU2_OMP_BARRIER
1052-
SU2_OMP_MASTER {
1053-
su2double MyOmega_Max = Omega_Max;
1054-
su2double MyStrainMag_Max = StrainMag_Max;
1055-
1056-
SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm());
1057-
SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm());
1058-
}
1059-
END_SU2_OMP_MASTER
1060-
SU2_OMP_BARRIER
1061-
}
1062-
1063-
}
976+
void ComputeVorticityAndStrainMag(const CConfig& config, unsigned short iMesh);
1064977

1065978
/*!
1066979
* \brief Destructor.

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,94 @@ void CFVMFlowSolverBase<V, R>::ImplicitEuler_Iteration(CGeometry *geometry, CSol
592592
CompleteImplicitIteration(geometry, nullptr, config);
593593
}
594594

595+
template <class V, ENUM_REGIME R>
596+
void CFVMFlowSolverBase<V, R>::ComputeVorticityAndStrainMag(const CConfig& config, unsigned short iMesh) {
597+
598+
auto& StrainMag = nodes->GetStrainMag();
599+
600+
ompMasterAssignBarrier(StrainMag_Max,0.0, Omega_Max,0.0);
601+
602+
su2double strainMax = 0.0, omegaMax = 0.0;
603+
604+
SU2_OMP_FOR_STAT(omp_chunk_size)
605+
for (unsigned long iPoint = 0; iPoint < nPoint; ++iPoint) {
606+
607+
const auto VelocityGradient = nodes->GetVelocityGradient(iPoint);
608+
auto Vorticity = nodes->GetVorticity(iPoint);
609+
610+
/*--- Vorticity ---*/
611+
612+
Vorticity[0] = 0.0;
613+
Vorticity[1] = 0.0;
614+
Vorticity[2] = VelocityGradient(1,0)-VelocityGradient(0,1);
615+
616+
if (nDim == 3) {
617+
Vorticity[0] = VelocityGradient(2,1)-VelocityGradient(1,2);
618+
Vorticity[1] = -(VelocityGradient(2,0)-VelocityGradient(0,2));
619+
}
620+
621+
/*--- Strain Magnitude ---*/
622+
623+
AD::StartPreacc();
624+
AD::SetPreaccIn(VelocityGradient, nDim, nDim);
625+
626+
su2double Div = 0.0;
627+
for (unsigned long iDim = 0; iDim < nDim; iDim++)
628+
Div += VelocityGradient(iDim, iDim);
629+
Div /= 3.0;
630+
631+
StrainMag(iPoint) = 0.0;
632+
633+
/*--- Add diagonal part ---*/
634+
635+
for (unsigned long iDim = 0; iDim < nDim; iDim++) {
636+
StrainMag(iPoint) += pow(VelocityGradient(iDim, iDim) - Div, 2);
637+
}
638+
if (nDim == 2) {
639+
StrainMag(iPoint) += pow(Div, 2);
640+
}
641+
642+
/*--- Add off diagonals ---*/
643+
644+
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(0,1) + VelocityGradient(1,0)), 2);
645+
646+
if (nDim == 3) {
647+
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(0,2) + VelocityGradient(2,0)), 2);
648+
StrainMag(iPoint) += 2.0*pow(0.5*(VelocityGradient(1,2) + VelocityGradient(2,1)), 2);
649+
}
650+
651+
StrainMag(iPoint) = sqrt(2.0*StrainMag(iPoint));
652+
AD::SetPreaccOut(StrainMag(iPoint));
653+
654+
/*--- Max is not differentiable, so we not register them for preacc. ---*/
655+
strainMax = max(strainMax, StrainMag(iPoint));
656+
omegaMax = max(omegaMax, GeometryToolbox::Norm(3, Vorticity));
657+
658+
AD::EndPreacc();
659+
}
660+
END_SU2_OMP_FOR
661+
662+
if ((iMesh == MESH_0) && (config.GetComm_Level() == COMM_FULL)) {
663+
SU2_OMP_CRITICAL {
664+
StrainMag_Max = max(StrainMag_Max, strainMax);
665+
Omega_Max = max(Omega_Max, omegaMax);
666+
}
667+
END_SU2_OMP_CRITICAL
668+
669+
SU2_OMP_BARRIER
670+
SU2_OMP_MASTER {
671+
su2double MyOmega_Max = Omega_Max;
672+
su2double MyStrainMag_Max = StrainMag_Max;
673+
674+
SU2_MPI::Allreduce(&MyStrainMag_Max, &StrainMag_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm());
675+
SU2_MPI::Allreduce(&MyOmega_Max, &Omega_Max, 1, MPI_DOUBLE, MPI_MAX, SU2_MPI::GetComm());
676+
}
677+
END_SU2_OMP_MASTER
678+
SU2_OMP_BARRIER
679+
}
680+
681+
}
682+
595683
template <class V, ENUM_REGIME R>
596684
void CFVMFlowSolverBase<V, R>::SetInletAtVertex(const su2double* val_inlet, unsigned short iMarker,
597685
unsigned long iVertex) {

SU2_CFD/include/variables/CFlowVariable.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ class CFlowVariable : public CVariable {
236236
* \return Vorticity array.
237237
*/
238238
inline su2double* GetVorticity(unsigned long iPoint) final { return Vorticity[iPoint]; }
239+
inline const su2double* GetVorticity(unsigned long iPoint) const final { return Vorticity[iPoint]; }
239240

240241
/*!
241242
* \brief Get the magnitude of rate of strain.

0 commit comments

Comments
 (0)