LES直流槽道边界层模拟,如何得到正则化速度u+以及正则化坐标y+?
-
看到 cfd online 的后处理代码:compressibleyPlusLES,感觉修改下作为后处理工具,不失为一个更简单直接的方法。
volScalarField yPlusTemp ( IOobject ( "yPlusTemp", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("yPlusTemp", dimless, 0.0) ); volVectorField uPlus ( IOobject ( "uPlus", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedVector("uPlus", dimless, vector::zero) ); volScalarField uTau ( IOobject ( "uTau", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("uTau", dimVelocity, 0.0) ); volScalarField yPlus ( IOobject ( "yPlus", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("yPlus", dimless, 0.0) ); Info<< "Reading field UMean\n" << endl; volVectorField UMean ( IOobject ( "UMean", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Info<< "Reading field U\n" << endl; volVectorField U ( IOobject ( "U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); Info<< "Reading field rho\n" << endl; volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ), mesh ); # include "compressibleCreatePhi.H" Info<< "successs1\n" << endl; autoPtr<basicThermo> pThermo ( basicThermo::New(mesh) ); basicThermo& thermo = pThermo(); Info<< "successs2\n" << endl; autoPtr<compressible::LESModel> sgsModel ( compressible::LESModel::New(rho, UMean, phi, thermo) );
/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application yPlusLES Description Calculates and reports yPlus and uPlus for all wall patches, for the specified times, for compressible LES. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" //#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" //aali #include "compressible/LES/LESModel/LESModel.H" #include "basicThermo.H" //ali #include "wallFvPatch.H" #include "LESModel.H" #include "nearWallDist.H" #include "wallDist.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); # include "createMesh.H" forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Info<< "Time = " << runTime.timeName() << endl; fvMesh::readUpdateState state = mesh.readUpdate(); // Wall distance wallDist y(mesh, true); if (timeI == 0 || state != fvMesh::UNCHANGED) { Info<< "Calculating wall distance\n" << endl; Info<< "Writing wall distance to field " << y.name() << nl << endl; y.write(); } #include "createFields.H" volScalarField::GeometricBoundaryField d = nearWallDist(mesh).y(); volScalarField muEff(sgsModel->muEff()); const fvPatchList& patches = mesh.boundary(); dimensionedScalar uTauAvg("uTauAvg", dimVelocity, 0); const volScalarField muLam(sgsModel->mu()); scalar nPatch = 0; Info<< "Summary: " << nl << endl; forAll(patches, patchi) { const fvPatch& currPatch = patches[patchi]; if (typeid(currPatch) == typeid(wallFvPatch))//isA<wallFvPatch>(currPatch)) { yPlusTemp.boundaryField()[patchi] = d[patchi] *sqrt ( muEff.boundaryField()[patchi]/rho.boundaryField()[patchi] *mag(UMean.boundaryField()[patchi].snGrad()) ) /muLam.boundaryField()[patchi]/rho.boundaryField()[patchi]; const scalarField& YpTemp = yPlusTemp.boundaryField()[patchi]; //effective viscosity used in the calculation of u* uTau.boundaryField()[patchi] = sqrt ( sgsModel->muEff() *mag(UMean.boundaryField()[patchi].snGrad()) /sgsModel->rho() ); const fvPatchScalarField& uTauWall = uTau.boundaryField()[patchi]; dimensionedScalar uTauTmp("uTauTmp", dimVelocity, average(uTauWall)); uTauAvg += uTauTmp; nPatch ++; Info<< "Patch " << patchi << " named " << currPatch.name() << " y+ : min: " << min(YpTemp) << " max: " << max(YpTemp) << " average: " << average(YpTemp) << " avgUGradWall: " << average(mag(U.boundaryField()[patchi].snGrad())) << nl << endl; } } uTauAvg /= nPatch; Info << " avg. friction velocity uTau is: " << uTauAvg.value() << " (averaged over " << nPatch << " wall(s))" << nl <<endl; //yPlus is = u* x y/nu yPlus = y.y() * uTauAvg / ((sgsModel->mu()) / (sgsModel->rho())); uPlus = UMean / uTauAvg; Info << "Writing yPlus and uPlus to corresponding fields." << nl <<endl; yPlus.write(); uPlus.write(); // Info<< "Writing yPlus to field " // << yPlus.name() << nl << endl; // // yPlus.write(); } Info<< "End\n" << endl; return 0; } // ************************************************************************* //
-
-
用q-DNS算过一个
时间衰减均匀各向同性盒子湍流
,类似of2112自带这个算例Decay of homogeneous isotropic turbulence,只是初始湍流场用自己的方法生成。目前湍流生成方法大多能比较好的生成均匀各向同性湍流。q-DNS用的网格256×256×256,采用laminar。同样网格也算过LES模型,结果没太大区别。 -
时间衰减均匀各向同性盒子湍流主要是验证湍流生成方法的性能,与实验对比指标主要包括:湍动能衰减曲线,不同时刻的三维能谱和空间相关性。具体可参考以下2篇论文结果:
[1] Chen L, Li C, Wang J, et al. A coherence-improved and mass-balanced inflow turbulence generation method for large eddy simulation[J]. Journal of Computational Physics, 2024,498:112706.
[2] Li C, Chen L, Wang J, et al. A novel vector potential random flow generation method for synthesizing divergence-free homogeneous isotropic turbulence with arbitrary spectra[J]. Physics of Fluids, 2024,36(3).
-
-
- 我算的是均匀衰减湍流,没有额外的force,最后湍动能衰减到0。以下是书上关于均匀湍流的阐述:
引自《张兆顺, 崔桂香, 许春晓. 湍流理论与模拟[M]. 北京: 清华大学出版社, 2005》31页
- dnsfoam我没用过,没了解过是怎么加的,是否类似of自带算例
channel395
,施加了一个梯度源项?我理解湍流能够自保持,NS方程右边是合力,如果没有施加外力,耗散项不等于0,使得湍流不断衰减。channel395
算例加了梯度源项,这个力刚好抵消耗散项,等到充分发展状态时候,NS方程右边合力等于0,这个时候就能保持不变发展。根据充分发展时候合力等于0,施加的力大小不同,那么耗散项的大小也不同,耗散项与速度梯度有关,也就对应了那几个平均速度剖面,雷诺应力剖面的不同。