# [菜鳥求救] K-omega SST 头几秒就崩溃了

• 我在模𣝅单车行驶的外部流场，主要是想求CdA。湍流模型用了k omega SST，求解器则是用了simpleFoam。我借用了motorBike的范例，稍为修改了一下。我设了初始速度为15m/s，0Pa。以下是log.simpleFoam里的头几个iteration:

Create time

Create mesh for time = 0

[AdminPC:02105] 5 more processes have sent help message help-btl-vader.txt / cma-permission-denied
[AdminPC:02105] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

SIMPLE: Convergence criteria found
U: tolerance 0.0001
p: tolerance 0.0001
"(k|omega)": tolerance 0.0001

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
RAS
{
RASModel        kOmegaSST;
turbulence      on;
printCoeffs     on;
alphaK1         0.85;
alphaK2         1;
alphaOmega1     0.5;
alphaOmega2     0.856;
gamma1          0.555556;
gamma2          0.44;
beta1           0.075;
beta2           0.0828;
betaStar        0.09;
a1              0.31;
b1              1;
c1              10;
F3              false;
}

No MRF models present

No finite volume options present

Starting time loop

streamLine streamLines:
automatic track length specified through number of sub cycles : 5

Reading surface description:
yNormal

forces forceCoeffs1:
Not including porosity effects
forceCoeffs forceCoeffs1:
Not including porosity effects
Time = 1

smoothSolver:  Solving for Ux, Initial residual = 0.176082, Final residual = 0.0175161, No Iterations 8
smoothSolver:  Solving for Uy, Initial residual = 0.0854752, Final residual = 0.0078422, No Iterations 6
smoothSolver:  Solving for Uz, Initial residual = 0.0535574, Final residual = 0.00446781, No Iterations 9
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.00968802, No Iterations 15
time step continuity errors : sum local = 9.19838e-08, global = 1.35003e-09, cumulative = 1.35003e-09
smoothSolver:  Solving for omega, Initial residual = 0.999998, Final residual = 2.29698e-05, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 1, Final residual = 6.96747e-05, No Iterations 1
ExecutionTime = 252.73 s  ClockTime = 563 s

forceCoeffs forceCoeffs1 write:
Cm    = 0.404453
Cd    = 0.754425
Cl    = -0.0101646
Cl(f) = 0.399371
Cl(r) = -0.409535

Time = 2

smoothSolver:  Solving for Ux, Initial residual = 0.114146, Final residual = 0.00945059, No Iterations 8
smoothSolver:  Solving for Uy, Initial residual = 0.03572, Final residual = 0.0033767, No Iterations 7
smoothSolver:  Solving for Uz, Initial residual = 0.268761, Final residual = 0.023381, No Iterations 8
GAMG:  Solving for p, Initial residual = 0.00423399, Final residual = 3.88164e-05, No Iterations 14
time step continuity errors : sum local = 7.09901e-08, global = 1.05225e-09, cumulative = 2.40228e-09
smoothSolver:  Solving for omega, Initial residual = 0.786768, Final residual = 6.02541e-05, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 0.347618, Final residual = 8.09935e-05, No Iterations 1
ExecutionTime = 358.52 s  ClockTime = 941 s

forceCoeffs forceCoeffs1 write:
Cm    = 0.372383
Cd    = 0.710432
Cl    = -0.0032843
Cl(f) = 0.370741
Cl(r) = -0.374025

Time = 3

smoothSolver:  Solving for Ux, Initial residual = 0.134328, Final residual = 0.0118087, No Iterations 8
smoothSolver:  Solving for Uy, Initial residual = 0.116996, Final residual = 0.0105707, No Iterations 7
smoothSolver:  Solving for Uz, Initial residual = 0.0580452, Final residual = 0.00576293, No Iterations 7
GAMG:  Solving for p, Initial residual = 0.00317963, Final residual = 3.03476e-05, No Iterations 18
time step continuity errors : sum local = 7.20084e-08, global = 7.35963e-10, cumulative = 3.13824e-09
smoothSolver:  Solving for omega, Initial residual = 0.373588, Final residual = 9.57613e-05, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 0.103448, Final residual = 8.1809e-05, No Iterations 1
ExecutionTime = 509.1 s  ClockTime = 1274 s

forceCoeffs forceCoeffs1 write:
Cm    = 0.28686
Cd    = 0.550375
Cl    = 0.0178247
Cl(f) = 0.295772
Cl(r) = -0.277947

Time = 4

smoothSolver:  Solving for Ux, Initial residual = 0.581453, Final residual = 0.0506933, No Iterations 7
smoothSolver:  Solving for Uy, Initial residual = 0.438063, Final residual = 0.0375534, No Iterations 14
smoothSolver:  Solving for Uz, Initial residual = 0.28364, Final residual = 0.0228554, No Iterations 19
GAMG:  Solving for p, Initial residual = 0.100663, Final residual = 0.000964993, No Iterations 24
time step continuity errors : sum local = 2.71584e-06, global = -6.86095e-08, cumulative = -6.54713e-08
smoothSolver:  Solving for omega, Initial residual = 0.156237, Final residual = 0.000151387, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 0.0248487, Final residual = 9.03384e-05, No Iterations 1
ExecutionTime = 625.86 s  ClockTime = 1558 s

forceCoeffs forceCoeffs1 write:
Cm    = -2.36372
Cd    = 5.23947
Cl    = -45.4406
Cl(f) = -25.084
Cl(r) = -20.3566

Time = 5

smoothSolver:  Solving for Ux, Initial residual = 0.748694, Final residual = 0.0654467, No Iterations 6
smoothSolver:  Solving for Uy, Initial residual = 0.707975, Final residual = 0.0671149, No Iterations 10
smoothSolver:  Solving for Uz, Initial residual = 0.645301, Final residual = 0.0580618, No Iterations 11
GAMG:  Solving for p, Initial residual = 0.331992, Final residual = 0.00325251, No Iterations 29
time step continuity errors : sum local = 4.57856e-05, global = 1.35323e-06, cumulative = 1.28776e-06
smoothSolver:  Solving for omega, Initial residual = 0.0619606, Final residual = 0.000791318, No Iterations 1
smoothSolver:  Solving for k, Initial residual = 0.00576973, Final residual = 0.000313824, No Iterations 2
ExecutionTime = 753.75 s  ClockTime = 1825 s

forceCoeffs forceCoeffs1 write:
Cm    = 48393.6
Cd    = 355643
Cl    = -193536
Cl(f) = -48374.2
Cl(r) = -145161

Time = 6

smoothSolver:  Solving for Ux, Initial residual = 0.77583, Final residual = 0.0469625, No Iterations 11
smoothSolver:  Solving for Uy, Initial residual = 0.647136, Final residual = 0.0587523, No Iterations 9
smoothSolver:  Solving for Uz, Initial residual = 0.801675, Final residual = 0.0450629, No Iterations 11
GAMG:  Solving for p, Initial residual = 2.42318e-05, Final residual = 2.34325e-07, No Iterations 43
time step continuity errors : sum local = 0.000116095, global = 5.64454e-06, cumulative = 6.9323e-06
smoothSolver:  Solving for omega, Initial residual = 0.0295412, Final residual = 0.00216916, No Iterations 2
smoothSolver:  Solving for k, Initial residual = 0.00243104, Final residual = 0.000230323, No Iterations 3
ExecutionTime = 908.36 s  ClockTime = 2133 s

forceCoeffs forceCoeffs1 write:
Cm    = -735398
Cd    = -1.66962e+06
Cl    = -1.74826e+07
Cl(f) = -9.47672e+06
Cl(r) = -8.00593e+06

Time = 7

smoothSolver:  Solving for Ux, Initial residual = 0.577761, Final residual = 0.0517967, No Iterations 47
smoothSolver:  Solving for Uy, Initial residual = 0.570563, Final residual = 0.0531017, No Iterations 47
smoothSolver:  Solving for Uz, Initial residual = 0.546372, Final residual = 0.0538754, No Iterations 36
GAMG:  Solving for p, Initial residual = 0.0134, Final residual = 0.0431707, No Iterations 1000
time step continuity errors : sum local = 500.302, global = -256.052, cumulative = -256.052
smoothSolver:  Solving for omega, Initial residual = 0.726855, Final residual = 0.0688681, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.053017, Final residual = 0.00485332, No Iterations 4
ExecutionTime = 2723 s  ClockTime = 4119 s

forceCoeffs forceCoeffs1 write:
Cm    = 1.42517e+06
Cd    = 7.85747e+06
Cl    = -2.46218e+07
Cl(f) = -1.08857e+07
Cl(r) = -1.37361e+07

Time = 8

smoothSolver:  Solving for Ux, Initial residual = 0.612081, Final residual = 0.0499664, No Iterations 29
smoothSolver:  Solving for Uy, Initial residual = 0.562296, Final residual = 0.0483684, No Iterations 28
smoothSolver:  Solving for Uz, Initial residual = 0.628358, Final residual = 0.0614706, No Iterations 14
GAMG:  Solving for p, Initial residual = 0.999964, Final residual = 0.0500564, No Iterations 1000
time step continuity errors : sum local = 1.61271e+08, global = -40286.8, cumulative = -40542.9
smoothSolver:  Solving for omega, Initial residual = 0.00412419, Final residual = 0.000290188, No Iterations 4
smoothSolver:  Solving for k, Initial residual = 0.00274375, Final residual = 0.000233623, No Iterations 5
ExecutionTime = 4529.61 s  ClockTime = 6088 s

forceCoeffs forceCoeffs1 write:
Cm    = -6.60893e+13
Cd    = -5.13466e+14
Cl    = 1.211e+14
Cl(f) = -5.53934e+12
Cl(r) = 1.26639e+14

Time = 9

smoothSolver:  Solving for Ux, Initial residual = 0.804576, Final residual = 13.5575, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 0.785135, Final residual = 82.7634, No Iterations 1000
smoothSolver:  Solving for Uz, Initial residual = 0.874744, Final residual = 9.53614, No Iterations 1000
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:

Process name: [[12118,1],0]
Exit code:    145
--------------------------------------------------------------------------


可见在第四秒就崩溃了。Boundary Condition我都是参考motorbike的, 只改了velocity, k和omega:

• flowVelocity (0 0 15);
• pressure 0;
• turbulentKE 0.00135;
• turbulentOmega 900;

k和omega的值是我参考了其他文章,用了turbulence intensity level = 0.2%, 和eddy viscousity ratio = 0.1，从而算出來的。

以下是snappyHexMeshDict, fvScheme 和 fvSolution，求求大佬指点一下问题出在哪,谢谢

snappyHexMesh:

castellatedMesh true;
snap            true;
addLayers       true;

{
figure
{
type triSurfaceMesh;
file "figure.stl";
}

refinementBox
{
type searchableBox;
min ( -750 0 -1000);
max ( 1830 2685 2640);
}

};

castellatedMeshControls
{
maxLocalCells 1000000;
maxGlobalCells 30000000;
minRefinementCells 15;
maxLoadUnbalance 0.15;
nCellsBetweenLevels 3;
features
(
{
file "figure.eMesh";
level 7;
}
);
refinementSurfaces
{
figure
{
level (7 7);
patchInfo
{
type wall;
inGroups (figureGroup);
}
}
}
resolveFeatureAngle 20;
refinementRegions
{
refinementBox
{
mode inside;
levels ((1E15 4));
}

figure
{
mode distance;
levels
(
(2 8)
(10 6)
);
}
}
locationInMesh (402.1 1802 1002.7) ;
allowFreeStandingZoneFaces true;
}

snapControls
{
nSmoothPatch 5;
tolerance 2.25;
nSolveIter 30;
nRelaxIter 5;
nFeatureSnapIter 10;
implicitFeatureSnap false;
explicitFeatureSnap true;
multiRegionFeatureSnap false;
}

addLayersControls
{
relativeSizes true;
layers
{
"(lowerWall|figure).*"
{
nSurfaceLayers 10;
}
}
expansionRatio 1.2;
thickness 0.8;
minThickness 0.0001;
nGrow 0;
featureAngle 180;
slipFeatureAngle 30;
nRelaxIter 5;
nSmoothSurfaceNormals 1;
nSmoothNormals 3;
nSmoothThickness 10;
maxFaceThicknessRatio 0.6;
maxThicknessToMedialRatio 0.3;
minMedianAxisAngle 90;
nBufferCellsNoExtrude 0;
nLayerIter 15;
}

meshQualityControls
{
#include "meshQualityDict"
}

writeFlags
(
scalarLevels
layerSets
layerFields
);

mergeTolerance 1e-6;


fvSchemes:

ddtSchemes
{
default         steadyState;
}

gradSchemes
{
default         Gauss linear;
grad(U)         cellLimited Gauss linear 1;
}

divSchemes
{
default         none;
div(phi,U)      bounded Gauss linearUpwindV grad(U);
div(phi,k)      bounded Gauss upwind;
div(phi,omega)  bounded Gauss upwind;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
default         Gauss linear corrected;
}

interpolationSchemes
{
default         linear;
}

snGradSchemes
{
default         corrected;
}

wallDist
{
method meshWave;
}


fvSolution:

solvers
{
p
{
solver          GAMG;
smoother        GaussSeidel;
tolerance       1e-7;
relTol          0.01;
}

Phi
{
$p; } U { solver smoothSolver; smoother GaussSeidel; tolerance 1e-8; relTol 0.1; nSweeps 1; } k { solver smoothSolver; smoother GaussSeidel; tolerance 1e-8; relTol 0.1; nSweeps 1; } omega { solver smoothSolver; smoother GaussSeidel; tolerance 1e-8; relTol 0.1; nSweeps 1; } } SIMPLE { nNonOrthogonalCorrectors 0; consistent yes; residualControl { U 1e-4; p 1e-4; "(k|omega)" 1e-4; } } potentialFlow { nNonOrthogonalCorrectors 10; } relaxationFactors { equations { U 0.9; k 0.7; omega 0.7; } } cache { grad(U); }  • 排版满分。 你用自带的摩托车网格试试？ 你这个只能看出是发散了原因有很多不好判断 • 排版满分。 你用自带的摩托车网格试试？ 你这个只能看出是发散了原因有很多不好判断 谢谢老师的指教 我降低了网格refinement level, 也尝试了把松弛因子调低，结果还是发散。 有其么其他的建议吗? • CFD发散并没有一阵见血的解决办法。目前很难判断哦，但我觉得你一定会搞定的 • CFD发散并没有一阵见血的解决办法。目前很难判断哦，但我觉得你一定会搞定的 老师你太高估我了 我只是个新手渣渣 光凭我自己一个始终有点吃力 其实我在怀疑这会不会是k和omega的初始值所造成的问题，毕竟这都是估算的，没有实验根据，而且听说k omega对初始值很敏感。请问老师有没有方法可以验证初始值是否合适？ • @jinjolee k和omega可以用fluent里面初始化的值做参考 • 听说k omega对初始值很敏感 是的，kOmega模型是这样的。不过Omega可以从epsilon计算出来：$\Omega=\frac{\varepsilon}{0.09 k} $你这个我感觉完全是边界条件设置的问题，因为不涉及到算法，你会会搞定的 • simpleFoam是稳态求解器，你这个问题是不是用瞬态比较好？如果你模拟的流场达不到稳态可能会这样。建议用pimpleFoam试试。 而且，k-omega SST稳定性很好，对初值没有k-omega模型这么敏感吧。 • @jinjolee k和omega可以用fluent里面初始化的值做参考 我的模型放进Ansys后貌似有点问题，无法顺利生成enclosure，要把其中一个部件去除才行，而且每次生成boundary later都会报错，无法生成。因此ansys fluent对我来说可能不是最佳方案 ～～～～～～～～～～ @tidedrinker[菜鳥求救] K-omega SST 头几秒就崩溃了 中说： simpleFoam是稳态求解器，你这个问题是不是用瞬态比较好？如果你模拟的流场达不到稳态可能会这样。建议用pimpleFoam试试。 而且，k-omega SST稳定性很好，对初值没有k-omega模型这么敏感吧。 我试过用pimpleFoam，但貌似设置有点问题，发散问题更严重。所以想先用simpleFoam试试看。 ～～～～～～～～～～ @东岳[菜鳥求救] K-omega SST 头几秒就崩溃了 中说： 听说k omega对初始值很敏感 是的，kOmega模型是这样的。不过Omega可以从epsilon计算出来：$\Omega=\frac{\varepsilon}{0.09 k} \$

你这个我感觉完全是边界条件设置的问题，因为不涉及到算法，你会会搞定的

可是我怎么算怎么试，结果还是发散。
有方法可以分辨出k和omega的初始值是太大或太小吗？

• 我指的是fluent选择k omega初始化的时候，就可以看到fluent里面的初始值。可以拿来和你现在的初始值对照下。

• 我指的是fluent选择k omega初始化的时候，就可以看到fluent里面的初始值。可以拿来和你现在的初始值对照下。
能请教一下怎么查看吗? 我没怎用ANSYS，不太清楚。
是不是要先汇入模型，生成网格，然后进了setup才可以看到omega的初始值?

• 我指的是fluent选择k omega初始化的时候，就可以看到fluent里面的初始值。可以拿来和你现在的初始值对照下。

我上面的留言格式弄错了， 我再发一次。

能请教一下怎么查看吗? 我没怎用ANSYS，不太清楚。
是不是要先汇入模型，生成网格，然后进了setup才可以看到omega的初始值?

• @jinjolee 你拿个最简单的模型导入fluent就可以了，只是借用一下fluent的初始化k和omega值。其实k和omega的值与速度的关系是有理论公式的，fluent也是用这个理论公式算出来的，看一下fluent的帮助手册。或者看这个网址湍流边界条件

• @jinjolee 你拿个最简单的模型导入fluent就可以了，只是借用一下fluent的初始化k和omega值。其实k和omega的值与速度的关系是有理论公式的，fluent也是用这个理论公式算出来的，看一下fluent的帮助手册。或者看这个网址湍流边界条件

我就是用你给的那个网址里的论坛的工具去算的。只是我摸拟的是外部流场，turbulence length scale比较难预测，只能用eddy viscosity ratio去算，而那论坛里好像也没有相关的资料（例如在什么情况下，eddy viscosity ratio大约是多少之类的）。
至于ansys fluent，可能是我还没弄清楚设置，试了一下还是发散了。看来得再研究一下。
话说在一个普通的室外环境里（零风速），eddy viscosity ratio大约是多少？有参考值吗？

• @jinjolee eddy viscosity ratio一般设大于1小于10，给个10应该就行。另外，你这个不一定是湍流模型导致的发散，直接用层流先试试，逐个排除原因。

• 感谢大家畅所欲言，看起来正在往正确的方向走，祝收敛！

• @jinjolee eddy viscosity ratio一般设大于1小于10，给个10应该就行。另外，你这个不一定是湍流模型导致的发散，直接用层流先试试，逐个排除原因。

可是奇怪的是我之前用k-epsilon模型来算，当时用了:

turbulentKE=0.17557;
turbulentEpsilon=0.05677;


这样来算，反而结果有收敛，另外reynold number也得出为1638000，所以我认为基本上得用湍流模型。不过这个CdA比正常的低(我的结果只有0.26左右，而从其他的实验结果得来是0.46左右)。我当时用的是:

flowVelocity=12.5;


,而k是用turbulence intensity level = 2.73%。至于这个2.73%和epsilon的值是怎得来的，老实说我忘了...

我之后从不同文献中看到湍流的k和epsilon初始值应该要以模拟的环境在现实中的特征来作基础(例如我在模拟单车在行驶，虽然在CFD中我给了个15m/s的风速，但turbulence intensity level的初始应该不是以这个15m /s的速度来算，而是以真实环境(0风速)来算，所以turbulence intensity level应该很低，大约0.2~0.02%左右)。然而我换了turbulence intensity level=0.2%后，结果就一直发散。

快烦死了

• @jinjolee openFOam里的湍流模型有些时候确实不好用。（1）用你现在的条件计算出k、omega和nut的值，保证初始场initialValue也等于计算出的值；（2）检查壁面函数是否合适；（3）检查空间离散格式fvSchemes。