Skip to content

Commit 64f3623

Browse files
committed
add diffusion coefficients as volume output
1 parent 6173011 commit 64f3623

File tree

6 files changed

+51
-1
lines changed

6 files changed

+51
-1
lines changed

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ class CNumerics {
190190

191191
bool bounded_scalar = false; /*!< \brief Flag for bounded scalar problem */
192192

193+
su2double DiffCoeff_kw[2]; /*!< \brief Storage for diffusion coefficient*/
194+
193195
public:
194196
/*!
195197
* \brief Return type used in some "ComputeResidual" overloads to give a
@@ -706,6 +708,7 @@ class CNumerics {
706708
* \param[in] val_CDkw_i - Value of the cross diffusion at point i.
707709
*/
708710
virtual void SetCrossDiff(su2double val_CDkw_i) {/* empty */};
711+
inline su2double GetDiffCoeff_kw(int index) const {return DiffCoeff_kw[index];}
709712

710713
/*!
711714
* \brief Set the value of the effective intermittency for the LM model.

SU2_CFD/include/variables/CTurbVariable.hpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class CTurbVariable : public CScalarVariable {
4343
static constexpr size_t MAXNVAR = 2;
4444
VectorType turb_index;
4545
VectorType intermittency; /*!< \brief Value of the intermittency for the trans. model. */
46-
46+
VectorType DC_TKE; /*!< \brief TKE Diffusion Coefficient. */
47+
VectorType DC_Omega; /*!< \brief Omega Diffusion Coefficient. */
4748
/*!
4849
* \brief Constructor of the class.
4950
* \param[in] npoint - Number of points/nodes/vertices in the domain.
@@ -100,6 +101,31 @@ class CTurbVariable : public CScalarVariable {
100101
*/
101102
inline void SetIntermittency(unsigned long iPoint, su2double val_intermittency) final { intermittency(iPoint) = val_intermittency; }
102103

104+
/*!
105+
* \brief Set the Diffusion Coefficients of TKE and omega equations.
106+
* \param[in] iPoint - Point index.
107+
* \param[in] val_DC_kw - diffusion coefficient value
108+
*/
109+
inline void SetDiffCoeff_kw(unsigned long iPoint, su2double* val_DC_kw) {
110+
DC_TKE(iPoint) = val_DC_kw[0];
111+
DC_Omega(iPoint) = val_DC_kw[1];
112+
}
113+
114+
/*!
115+
* \brief Get the diffusion coefficient value of TKE.
116+
* \param[in] iPoint - Point index.
117+
*/
118+
inline su2double GetTKE_DC(unsigned long iPoint) const final {
119+
return DC_TKE(iPoint);
120+
}
121+
/*!
122+
* \brief Get the diffusion coefficient value of omega.
123+
* \param[in] iPoint - Point index.
124+
*/
125+
inline su2double GetOmega_DC(unsigned long iPoint) const final {
126+
return DC_Omega(iPoint);
127+
}
128+
103129
/*!
104130
* \brief Register eddy viscosity (muT) as Input or Output of an AD recording.
105131
* \param[in] input - Boolean whether In- or Output should be registered.

SU2_CFD/include/variables/CVariable.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,15 @@ class CVariable {
16641664
*/
16651665
inline virtual su2double GetCrossDiff(unsigned long iPoint) const { return 0.0; }
16661666

1667+
/*!
1668+
* \brief Get the value of the diffusion coefficient of tke and omega equations.
1669+
* \param[in] ipoint
1670+
* \param[in] val_diff_coeff
1671+
*/
1672+
inline virtual void SetDiffCoeff_kw(unsigned long iPoint, su2double* val_DiffCoeff) const { }
1673+
inline virtual su2double GetTKE_DC(unsigned long iPoint) const {return 0.0; }
1674+
inline virtual su2double GetOmega_DC(unsigned long iPoint) const {return 0.0; }
1675+
16671676
/*!
16681677
* \brief Get the value of the eddy viscosity.
16691678
* \return the value of the eddy viscosity.

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,8 @@ void CFlowOutput::SetVolumeOutputFieldsScalarSolution(const CConfig* config){
12561256
case TURB_FAMILY::KW:
12571257
AddVolumeOutput("TKE", "Turb_Kin_Energy", "SOLUTION", "Turbulent kinetic energy");
12581258
AddVolumeOutput("DISSIPATION", "Omega", "SOLUTION", "Rate of dissipation");
1259+
AddVolumeOutput("DIFF_COEFF_TKE", "TKE_Diff_Coeff", "SOLUTION", "Diffusion Coefficient for TKE equation");
1260+
AddVolumeOutput("DIFF_COEFF_Omega", "Omega_Diff_Coeff", "SOLUTION", "Diffusion Coefficient for Omega equation");
12591261
break;
12601262

12611263
case TURB_FAMILY::NONE:
@@ -1536,6 +1538,8 @@ void CFlowOutput::LoadVolumeDataScalar(const CConfig* config, const CSolver* con
15361538
case TURB_FAMILY::KW:
15371539
SetVolumeOutputValue("TKE", iPoint, Node_Turb->GetSolution(iPoint, 0));
15381540
SetVolumeOutputValue("DISSIPATION", iPoint, Node_Turb->GetSolution(iPoint, 1));
1541+
SetVolumeOutputValue("DIFF_COEFF_TKE", iPoint, Node_Turb->GetTKE_DC(iPoint));
1542+
SetVolumeOutputValue("DIFF_COEFF_Omega", iPoint, Node_Turb->GetOmega_DC(iPoint));
15391543
SetVolumeOutputValue("RES_TKE", iPoint, turb_solver->LinSysRes(iPoint, 0));
15401544
SetVolumeOutputValue("RES_DISSIPATION", iPoint, turb_solver->LinSysRes(iPoint, 1));
15411545
if (limiter) {

SU2_CFD/src/solvers/CTurbSSTSolver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ void CTurbSSTSolver::Viscous_Residual(const unsigned long iEdge, const CGeometry
386386
}
387387
}
388388
}
389+
su2double DC_kw[2];
390+
DC_kw[0] = numerics->GetDiffCoeff_kw(0);
391+
DC_kw[1] = numerics->GetDiffCoeff_kw(1);
392+
nodes->SetDiffCoeff_kw(iPoint, DC_kw);
389393
}
390394

391395
void CTurbSSTSolver::Source_Residual(CGeometry *geometry, CSolver **solver_container,

SU2_CFD/src/variables/CTurbVariable.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ CTurbVariable::CTurbVariable(unsigned long npoint, unsigned long ndim, unsigned
3535
turb_index.resize(nPoint) = su2double(1.0);
3636
intermittency.resize(nPoint) = su2double(1.0);
3737

38+
if (TurbModelFamily(config->GetKind_Turb_Model()) == TURB_FAMILY::KW) {
39+
DC_TKE.resize(nPoint) = su2double(1.0);
40+
DC_Omega.resize(nPoint) = su2double(1.0);
41+
}
3842
}
3943

4044
void CTurbVariable::RegisterEddyViscosity(bool input) {

0 commit comments

Comments
 (0)