Smagorinsky模型不输出k_sgs场
-
可以做如下改动进行输出,至少适用于OpenFOAM-8
- 打开Smagorinsky.H,添加
k_
:
// Protected data dimensionedScalar Ck_; volScalarField k_;//这是添加的一行 // Protected Member Functions
- 打开Smagorinsky.C,添加下面代码:
: LESeddyViscosity<BasicMomentumTransportModel> ( type, alpha, rho, U, alphaRhoPhi, phi, transport ), Ck_ ( dimensioned<scalar>::lookupOrAddToDict ( "Ck", this->coeffDict_, 0.094 ) ),//这里加个逗号 //下面是添加的 k_ ( IOobject ( IOobject::groupName("k", this->alphaRhoPhi_.group()), this->runTime_.timeName(), this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), this->mesh_ ) { if (type == typeName) { this->printCoeffs(type); } }
correctnut()
函数通过下面代码替换:void Smagorinsky<BasicMomentumTransportModel>::correctNut() { k_ = (this->k(fvc::grad(this->U_))); this->nut_ = Ck_*this->delta()*sqrt(k_); this->nut_.correctBoundaryConditions(); fv::options::New(this->mesh_).correct(this->nut_); }
- 打开Smagorinsky.H,添加
-
@李东岳 李老师,请问为什么做了这些改变之后会编译错误呢?
-
156-167行删掉,用下面的替换:
void Smagorinsky<BasicMomentumTransportModel>::correctNut() { k_ = (this->k(fvc::grad(this->U_))); this->nut_ = Ck_*this->delta()*sqrt(k_); this->nut_.correctBoundaryConditions(); fv::options::New(this->mesh_).correct(this->nut_); }
-
@李东岳这里提示重复定义,在59行有定义,而且和这个函数一样。
-
李东岳
-
更简单的方法就是不用动求解器了,在算例文件下面的controlDict下面把这个放进去:
cacheTemporaryObjects ( k ); functions { #includeFunc writeObjects("k") }
然后直接跑就行
-
李东岳
论坛登录问题反馈可联系 li.dy@dyfluid.com