找回密码
 注册
查看: 3164|回复: 0

SU2+DES97源代码

[复制链接]
发表于 2014-9-18 20:56:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
我将我之前简单写的SU2+DES97的代码贴在这里,实际我也在su2的官方论坛贴了,欢迎指正,或者验证
The extension on open source SU2 (v3.2) with capability of DES is presented here in detail.
In the frame of the SU 2, thanks to the usage of Object-Oriented language C++,
this extension is very simple. We only change ten files and add very limited rows of
statements, which will be shown in following.
1. In the file of config structure.hpp, add two data members in class CConfig:
double Const_DES; bool With_DES;
/*Const_DES is constant for DES, which should be equal to 0.65 for
SA model*/
In the same file, give two declarations of member function:
double GetConst_DES(void);
bool GetWith_DES(void);
2. In the file of config structure.inl, add two definitions of inline function:
inline double CConfig::GetConst_DES(void) { return Const_DES; }
inline bool CConfig::GetWith_DES(void) { return With_DES; }
3. In the file of dual grid structure.hpp, add three members in class CPoint:
double Turb_Len_Scale_DES; /*!< \brief DES turbulent length scale
* \brief DES turbulent length scale. JamesLiu Oct12

* \param[in] val_distance - Value of the distance.
*/
void SetTurb_Len_Scale_DES(double val_distance);
/*!
* \brief Get the value of the DES turbulent length scale.
* \return Value of the DES turbulent length scale.
*/
double GetTurb_Len_Scale_DES(void);
4. In dual grid structure.inl, add two definitions of inline function:
inline void CPoint::SetTurb_Len_Scale_DES(double val_distance) {
Turb_Len_Scale_DES = val_distance; }
inline double CPoint::GetTurb_Len_Scale_DES(void) { return
Turb_Len_Scale_DES; }
5. In the file of geometry structure.hpp, add a virtual function declaration in
class CGeometry:
virtual void ComputeTurb_Len_Scale_DES(CConfig *config);
In class CPhysicalGeometry, add
void ComputeTurb_Len_Scale_DES(CConfig *config);
6. In the file of geometry structure.inl, add a definition of inline function:
inline void CGeometry::ComputeTurb_Len_Scale_DES(CConfig *config) { }
7. In the file of config structure.cpp, add a statement in the member function
SetConfig Options of class CConfig:
addDoubleOption("CONST_DES", Const_DES, 0.65);
8. In the file of geometry structure.cpp, add a definition of member function:
void CPhysicalGeometry::ComputeTurb_Len_Scale_DES(CConfig *config) {
double *coord, dist00, dist;
unsigned short iDim, nNeigh,iNeigh;
unsigned long iPoint;
unsigned long No_neigh;
double xCoord_neigh;
double cdesljm;
/*!<\brief Loop over all interior mesh nodes and compute the
DES length.*/
cdesljm=config->GetConst_DES();
for (iPoint = 0; iPoint < GetnPoint(); iPoint++) {
nNeigh = node[iPoint]->GetnPoint();
coord = node[iPoint]->GetCoord();
dist = 1E-20;
for (iNeigh = 0; iNeigh < nNeigh; iNeigh++){
No_neigh = node[iPoint]->GetPoint(iNeigh);
dist00=0.0;
for (iDim = 0; iDim < nDim; iDim++) {
xCoord_neigh =
node[No_neigh]->GetCoord(iDim);
dist00 += (coord[iDim]-xCoord_neigh)
*(coord[iDim]-xCoord_neigh);
}
dist00=sqrt(dist00)/1.73205080757;
/* sqrt(3) for unstructured grid */
if(dist00>dist)
dist=dist00;
}
node[iPoint]->SetTurb_Len_Scale_DES(dist*cdesljm);
}
}

9. In the file of SU2 CFD.cpp, add a statement to calculate DES turbulent length
scale:
if ( (config_container[iZone]->GetKind_Solver() == RANS)
&& config_container[iZone]->GetWith_DES() )
geometry_container[iZone][MESH_0]
->ComputeTurb_Len_Scale_DES(config_container[iZone]);
10. In the file of solver direct turbulent.cpp, change the definition of function
CTurbSASolver::Source_Residual(CGeometry *geometry, CSolver
**solver_container, CNumerics *numerics, CNumerics
*second_numerics, CConfig *config, unsigned short iMesh)
and use Turb Len Scale DES to replace the distance of d. At first, give def-
initions for two double variables (dist00,dist00DES), then you should change
the distance to the wall like following.
dist00=geometry->node[iPoint]->GetWall_Distance();
if(config->GetWith_DES()) {
dist00DES=geometry->node[iPoint]->GetTurb_Len_Scale_DES();
if(dist00<dist00DES) dist00DES=dist00;
numerics->SetDistance(dist00DES, 0.0);
}
else
numerics->SetDistance(dist00, 0.0);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表