Alphat【翻译】

翻译自:CFD-online

帖子地址:http://www.cfd-online.com/Forums/openfoam-solving/144625-alphat.html

Wien3

早上好

我正在研究一个立方体内有一个球体的OF模型。流体从入口到出口。

当它为不可压缩时,我想我必须将四个壁面设置成这样:

type alphatWallFunction;
value uniform 0;

下面的错误就出现了:

PHP Code:

file/home/jstoeckl/Desktop/grav0/0/alphat.boundaryField.Back from line 26 to line 27.

    From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<TypevolMesh>&, const dictionary&)
    in file /home/opencfd/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/fvPatchFieldNew.at line 143.

FOAM exiting  

我想知道这个参数是怎么运行的。我认为这个参数在壁面处应该为0(壁面和球面),在入口和出口应该有不同的值,我还有其他的疑惑:

—对于不可压缩流,我应该如何计算这个值

—如何设置这两个输入值?设置应该仅仅设置为"fixedValue"

非常感谢你的帮助。

alexeym

你好

你截去了你的错误信息中有意义的部分。

关于alphat是这样计算的:

Code:

alphat = turbulence->nut()/Prt;

湍流普朗特数的值常常在0.750.95之间随机选取

Wien3

你好

我打算再次解释我的困惑:

  1. 非压缩流动都需要普朗特数?
  2. 对于这种流动,我是否应该设置固体单元为"alphatWallFunction""alphatJayatillekeWallFunction"
  3. 对于出口和入口,我是否应该设置为"fixedValue"或者仅仅写为"calculated"?他们不是壁面,我想我不能对他们使用alphatFunctions

现在我的alphat输入值是这样的:

Quote:

dimensions [0 2 -1 0 0 0 0];

internalField uniform 0;

boundaryField
{
Back
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Bottom
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Front
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Icosphere
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
Inlet
{
type calculated;
value uniform 0;
}
Outlet
{
type calculated;
value uniform 0;
}
Top
{
type alphatJayatillekeWallFunction;
Prt 0.85;
value uniform 0;
}
}

如果没有把我的疑惑描述得比以前更清楚,我表示抱歉。

再次感谢。

alexeym

你好

Quote:

Originally Posted by Wien3 

1) Does an incompressible fluid need a Pr number? 

他不是一种流动,是求解器需要普朗特数

Quote:

2) With this kind of fluid, should I assign solid elements as "alphatWallFunction" or "alphatJayatillekeWallFunction"?

在你模拟不可压缩流动的时候(求解器使用nut场,比如方程被密度除),你不能使用alphatWallFunction(当它寻找mut场)。因此它是"alphatJayatillekeWallFunction"(在不可压湍流模型当中仅有的alphat壁面函数)。

Quote:

3) And with inlet and outlet, should I assign a "fixedValue" for them or just write "calculated"?? As they are not Walls, I cannot use the alphatFunctions I guess.

"calculated"应该可以。

Wien3

好的,非常感谢!我想我的文件是正确的!

还有其他问题:我应该用相同的方法设置"epsilon, omega, k and nut"?我的意思是每个入口/出口(inlet/outlet)都是"calculated uniform 0",并且对于k,壁面设置为kqRWallFunction,对于epsilon,壁面设置为epsilonWallFunction,对于omega,壁面设置为omegaWallFunction,和nutWallFunction(所有都为uniform 0)。

谢谢!

alexeym

我常常使用zero gradient作为湍流出口边界条件。对于入口,设置为turbulentIntensityKineticEnergyInlet,我相同的边界类型(看$FOAM_SRC/finiteVolume/fields/fvPatchFields/derived, $FOAM_SRC/turbulenceModels/incompressible/RAS/derivedFvPatchFields文件夹或者你是用fixedValue估算:http://www.cfd-online.com/Wiki/Turbulence_free-stream_boundary_conditions.对于壁面—是的—壁面函数。

Wien3

你好

你的建议非常有帮助!现在我更好的理解了很多事情。我想这个帖子能帮助更多像我一样的人在OF中成熟

看来你对这个程序了解很多,你能看一下我上次在这个论坛发的帖子吗?题目为"pressure and velocity in inlet/outlet definitions"

非常感谢你

alexeym

我已经看过你的信息了,但是我不知道你想模拟什么。

Wien3:

好的,我就尝试解释一下。

相关的模型我已经在论坛上讨论过了(一个立方体内有一个球体。流体从入口到出口)我仅仅尝试分析温度和压力在不同单元的变化。

当我从enGrids导入我的模型,仅仅存在pU文件。于是我决定创建一个T文件并且将simpleFoam求解器转换为buoyantBoussinesqSimpleFoam(当它为不可压缩流动)。

显然,添加这一个文件是不够的,我必须做其他的事情,比如alphat, g, p_rgh等。直到我分析pp_rgh,所有事情才算完成好。并且我注意到了两件事:

—第一件事当我到了终止时间(endTime1000,我点击,它不再继续。直到迭代数为2,它才开始。

—第二件事是它不出现任何的热传递,因此温度场始终和开始时一样。这也是为什么我需要知道我的pp_rgh(我认为TU是正确的)是对的或者对我的模型影响不大:

PHP Code:

p_rgh

dimensions      [-0];

internalField   uniform 0;

boundaryField
{
    Back
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Bottom
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Front
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Icosphere
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Inlet
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Outlet
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
    Top
    {
        type            fixedFluxPressure;
        rho             rhok;
        value           uniform 0;
    }
 

PHP Code:

p
    Back
    {
        type zeroGradient;
    }
    Bottom
    {
        type zeroGradient;
    }
    Front
    {
        type zeroGradient;
    }
    Icosphere
    {
        type zeroGradient;
    }
    Inlet
    {
        type zeroGradient;
    }
    Outlet
    {
        type  fixedValue;
        value uniform 0;
    }
    Top
    {
        type zeroGradient;
  }
    
 

PHP Code:

T

dimensions      [0];

internalField   uniform 300;

boundaryField
{
    Back
    {
        type            fixedValue;
        value           uniform 300;
    }
    Bottom
    {
        type            fixedValue;
        value           uniform 300;
    }
    Front
    {
        type            fixedValue;
        value           uniform 300;
    }
    Icosphere
    {
        type            fixedValue;
        value           uniform 400;
    }
    Inlet
    {
        type            fixedValue;
        value           uniform 250;
    }
    Outlet
    {
        type            zeroGradient;
    }
    Top
    {
        type            fixedValue;
        value           uniform 300;
    }
 

PHP Code:

U
dimensions      [-0];

internalField   uniform (0);

boundaryField
{
    Back
    {
        type  fixedValue;
        value uniform (0);
    }
    Bottom
    {
        type  fixedValue;
        value uniform (0);
    }
    Front
    {
        type  fixedValue;
        value uniform (0);
    }
    Icosphere
    {
        type  fixedValue;
        value uniform (0);
    }
    Inlet
    {
        type  fixedValue;
        value uniform (0.535 0);
    }
    Outlet
    {
        type zeroGradient;
    }
    Top
    {
        type  fixedValue;
        value uniform (0);
    }

 

我希望我更好的解释了我的问题!

先谢过

alexeym

直到现在我也不知道你想干什么。p_rgh, U, T似乎是合理的。压力p在求解器中被计算:

Code:

...

volScalarField p

(

IOobject

(

"p",

runTime.timeName(),

mesh,

IOobject::NO_READ,

IOobject::AUTO_WRITE

),

p_rgh + rhok*gh

);

...

好的,你的p_rhg需要被计算(没有固定值的边界),因此如下的代码

Code:

if (p_rgh.needReference())

{

p += dimensionedScalar

(

"p",

p.dimensions(),

pRefValue - getRefCellValue(p, pRefCell)

);

p_rgh = p - rhok*gh;

}

将被执行。但是求解器不会从你的0文件夹下读取你的p文件

这个部分是高深莫测的:

Quote:

- The first one is that when I click play it doesn't continue until my endTime (defined in controlDict) which is 1000. It does it just until 2, which is the numbers of iterations.
- The second one is it doesn't appear any heat transference, so temperature fields stay the same that at the beginning.

执行?你点击哪里执行?

如果你想要讨论你的controlDict, fvSolutionfvSchemes,请附上你的文件(和模拟的输出结果)

Wien3

你好!

好的,这些文件都没问题。你告诉我p文件是被程序计算出来的。这是否意味着我可以将它从0文件夹删除或者我必须将所有的单元设置为uniform 0

首先,为了简化模型,为了避免被重力影响,我设置重力为0。用初始条件初始化之后,出现了如下信息:

PHP Code:

--> FOAM FATAL ERROR
Continuity error cannot be removed by adjusting the outflow.
Please check the velocity boundary conditions and/or run potentialFoam to initialise the outflow.
Total flux              10.4374
Specified mass inflow   2.14
Specified mass outflow  0
Adjustable mass outflow 0


    From function adjustPhi(surfaceScalarField&, const volVectorField&,volScalarField&)
    in file cfdTools/general/adjustPhi/adjustPhi.at line 118.

FOAM exiting  

为了解决它,我拷贝文件夹将fvSolution下的"SIMPLE"改为

"potentialFlow"并且运行potentialFoam求解器初始化这些值。然后,我拷贝主文件夹下的0/U文件并且再次运行buoyantBoussinesqSimpleFoam求解器。

我已经将controlDict, fvSolutionfvSchemes文件放到附件并且附上了模拟结果的图片。

当我说"按下运行",我是指OpenFOAM,因为你可以看到模拟停在了第2步(也是迭代的步数)。正如你在温度图片中看到的,没有任何温度变化。

我不知道哪个文件错了

先谢过。

alexeym

你好

  1. 这个,松弛收敛判据:

Code:

residualControl

{

"(p|T|U|k|epsilon|omega)" 0.5; //*(7)

}

这个是你模拟迭代2次的可能原因。

  1. 从你的边界温度截图值(你选择边界没有内部网格)。你的边界除了出口都是fixedValue。因此你在你的屏幕上得到这些固定值。如果你想看到温度变化—选择内部网格,用截面切开它。

Wien3

早上好

  1. 关注p文件,我已经理解了可以不管它的输入因为求解器会计算这个值而不是从0文件夹下读取。不管怎样,我不会从0文件夹下删除p文件。
  2. 关于减少残差,我可以轻易的减少它到0.31(仅迭代3次)如果我进一步减少残差,它就发散了(比如0.3)。

    因此我猜测这不是残差的问题。

  3. 你谈到温度相关的建议,这是非常有用的。但是我的问题是我的理论没有完全模拟确认。我在附件中有图片。第一个当中你可以看到边界温度,第二个右侧部分似乎有一些热传递(尽管似乎已经停止了)并且球一直是800K,没有任何换热器。

谢谢你。

alexeym

你好

  1. 是这样的,求解器在开始不会读取p文件。它只读p_rgh文件。
  2. 一般来说,残差的值应该低于1e-4
  3. 看了一下附件,你的模拟结果似乎发散了。是否在你的帖子中缺少一些信息?你是否能贴出你的算例?(当然,我可以自己复制它但是会花更多的时间)。

Wien3

你好

我已经附上了我的文件。我已经改变了controlDict的时间,它只提升了一点点。因为OF论坛不接受如此大的文件夹,我只能将0system文件传上来。这带来了持续的问题,因此导入0/U(使用potentialFoam求解器)的先前文件夹,我能上传后面的这些图片。注意一下给定的值,这个算例中的压力和速度值是巨大的。

alexeym

好的,没有网格,这些都是没有意义的。当然我可以构建网格并且让这个算例跑起来。但是这是我的网格并且你在运行你的网格算例时出现的问题。将网格上传到其他地方,有许多其他地方可以存储你的大文件。

Wien3

你好

我找到方法了。我贴出了两个链接:第一个是带有初始条件的模型和第二个从运行potentialFoam求解器的算例中拷贝出来的,因为它存在连续问题。

http://www.filedropper.com/test00
http://freakshare.com/files/th1rvk69/test01.zip.html

alexeym

不明白为什么我需要第二个存档但是...

  1. 使用你自己的心的网格。几何没有那么复杂。
  2. 对于你的配置

2.1.

Code:

residualControl

{

"(p|T|U|k|epsilon|omega)" 0.3; //*(7)

}

应该像这样

Code:

residualControl

{

"(p_rgh|T|U|k|epsilon|omega)" 1e-2;

}

2.2.

Code:

ddtSchemes

{

default Euler;

}

应该是

Code:

ddtSchemes

{

default steadyState;

}

2.3.

Code:

gradSchemes

{

default Gauss linear;

grad(p) Gauss linear;

grad(U) Gauss linear;

}

应该为

Code:

gradSchemes

{

default leastSquares;

}

  1. 对于开始

Code:

divSchemes

{

default none;

div(phi,T) Gauss linearUpwind Gauss; //*(16)

div(phi,U) Gauss linearUpwind Gauss;

div(phi,k) Gauss upwind;

div(phi,epsilon) Gauss upwind;

div(phi,omega) Gauss upwind;

div((nuEff*dev(T(grad(U))))) Gauss linear; //*(6)

}

变为

Code:

divSchemes

{

default none;

div(phi,T) bounded Gauss upwind;

div(phi,U) bounded Gauss upwind;

div(phi,k) bounded Gauss upwind;

div(phi,epsilon) bounded Gauss upwind;

div(phi,omega) bounded Gauss upwind;

div((nuEff*dev(T(grad(U))))) Gauss linear; //*(6)

}

2.5设置你的"relTol"0.010.5,如果你想用你的"网格"。

2.6p_rgh的求解器改为GAMG,这将会加速收敛的速度。

3、你怎么计算普朗特数?似乎它是随机的。

我才这是我应该结束的时候了,你至少应该读读用户手册。

Naresh yathuru

大恩不言谢,Alexey。你做出了重大贡献。我打算模拟一个类似的算例,你几乎解决了我大部分的疑问。

致敬!!!

祝好

Naresh

posted @ 2016-07-18 17:47  硫酸亚铜  阅读(1206)  评论(0编辑  收藏  举报