foam-extend3.1 k-epsilon 边界错误

错误如下:

--> FOAM FATAL ERROR: 
Invalid wall function specification
    Patch type for patch down must be wall
    Current patch type is patch



    From function kqRWallFunctionFvPatchField::checkType()
    in file derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C at line 47.

FOAM aborting

Aborted (core dumped)

边界条件如下:
nut:

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

internalField   uniform 0;

boundaryField
{
    down
    {
        type nutWallFunction;
        value uniform 0;
    }
    downX
    {
        type nutWallFunction;
        value uniform 0;
    }

    downY
    {
        type nutWallFunction;
        value uniform 0;
    }

    upX
    {
        type nutWallFunction;
        value uniform 0;
    }

    upY
    {
        type nutWallFunction;
        value uniform 0;
    }    
   
    
    downup
    {
        type nutWallFunction;//movingWallVelocity;
        value uniform 0;
    }
   
    middleside
    {
        type nutWallFunction;//movingWallVelocity;
        value uniform 0;
    }
    
    updown
    {
        type nutWallFunction;//movingWallVelocity;
        value uniform 0;
    }
    wall
    {
        type nutWallFunction;
        value uniform 0;
    }
    up
    {
       type nutWallFunction;
       value uniform 0;
    }
}

U:

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

internalField   uniform (0 0 3);

boundaryField
{
    down
    {
        type fixedValue;
        value uniform (0 0 3);
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type fixedValue;//movingWallVelocity;
        value uniform (0 0 0);
    }
   
    middleside
    {
        type fixedValue;//movingWallVelocity;
        value uniform (0 0 0);
    }
    
    updown
    {
        type fixedValue;//movingWallVelocity;
        value uniform (0 0 0);
    }
    wall
    {
        type movingWallVelocity;
        value uniform (0 0 0);
    }
    up
    {
       type zeroGradient;
    }
}

p:

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

internalField   uniform 0;

boundaryField
{
    down
    {
        type zeroGradient;
        value uniform 0;
    }
    downX
    {
        type symmetryPlane;
        value uniform 0;
    }

    downY
    {
        type symmetryPlane;
        value uniform 0;
    } 

    upX
    {
        type symmetryPlane;
        value uniform 0;
    }

    upY
    {
        type symmetryPlane;
        value uniform 0;
    }

    downup
    {
        type zeroGradient;
        value uniform 0;
    }
    middleside
    {
        type zeroGradient;//extrapolatedPressure;
        value uniform 0;
    }
   
    updown
    {
        type zeroGradient;//extrapolatedPressure;
        value uniform 0;
    }
    wall
    {
        type extrapolatedPressure;
        value uniform 0;
    }
    up
    {
        type fixedValue;
        value uniform 6.428e3;
    }
}

k 的设置如下:

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

internalField   uniform 0.01125;

boundaryField
{
   down
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }
    downX
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }

    downY
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }

    upX
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }

    upY
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }    
   
    
    downup
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
   
    middleside
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
    
    updown
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
    wall
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }
    up
    {
       type kqRWallFunction;
       value uniform 0.01125;
    }
}

epsilon:

dimensions      [0 2 -3 0 0 0 0];

internalField   uniform 0.006583;

boundaryField
{
    down
    {
        type epsilonWallFunction;
        value uniform 0.006583;
    }
    downX
    {
        type epsilonWallFunction;
        value uniform 0.006583;
    }

    downY
    {
        type epsilonWallFunction;
        value uniform 0.006583;
    }

    upX
    {
        type epsilonWallFunction;
        value uniform 0.006583;
    }

    upY
    {
        type epsilonWallFunction;
         value uniform 0.006583;
    }    
   
    
    downup
    {
        type epsilonWallFunction;//movingWallVelocity;
        value uniform 0.006583;
    }
   
    middleside
    {
        type epsilonWallFunction;//movingWallVelocity;
        value uniform 0.006583;
    }
    
    updown
    {
        type epsilonWallFunction;//movingWallVelocity;
        value uniform 0.006583;
    }
    wall
    {
        type epsilonWallFunction;
         value uniform 0.006583;
    }
    up
    {
       type epsilonWallFunction;
        value uniform 0.006583;
    }
}

你的 nut 在边界条件设置上有些问题,比如:down 这个边界明明是入口,但是你在 nut 里面却给了 nutWallFunction 的边界,nutWallFunction 是一个抽象类,无法直接使用这个类型。

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

internalField   uniform 0;

boundaryField
{
    down
    {
        type            calculated;
        value           uniform 0;
    }
    downX
    {
        type            calculated;
        value           uniform 0;
    }

    downY
    {
        type            calculated;
        value           uniform 0;
    }

    upX
    {
        type            calculated;
        value           uniform 0;
    }

    upY
    {
        type            calculated;
        value           uniform 0;
    }    
   
    
    downup
    {
        type            calculated;
        value           uniform 0;
    }
   
    middleside
    {
        type            calculated;
        value           uniform 0;
    }
    
    updown
    {
        type            calculated;
        value           uniform 0;
    }
    wall
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    up
    {
        type            calculated;
        value           uniform 0;
    }
}

k 和 epsilon 也有设置错误。kqRWallFunction 指定 wall 的边界。
以下为 k:

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

internalField   uniform 0.01125;

boundaryField
{
   down
    {
        type         fixedValue;
        value        uniform 0.01125;
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
   
    middleside
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
    
    updown
    {
        type kqRWallFunction;//movingWallVelocity;
        value uniform 0.01125;
    }
    wall
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }
    up
    {
        type            zeroGradient;
    }
}

epsilon 应该如下:

dimensions      [0 2 -3 0 0 0 0];

internalField   uniform 0.006583;

boundaryField
{
    down
    {
        type      fixedValue;
        value     uniform 0.006583;
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type  epsilonWallFunction;//movingWallVelocity;
        value uniform 0.006583;
    }
   
    middleside
    {
        type  epsilonWallFunction;//movingWallVelocity;
        value uniform 0.006583;
    }
    
    updown
    {
         type  epsilonWallFunction;//movingWallVelocity;
        value  uniform 0.006583;
    }
    wall
    {
         type  epsilonWallFunction;
         value uniform 0.006583;
    }
    up
    {
        type            zeroGradient;
    }
}

可以参考
http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2016/FangqingLiu/openfoamFinal.pdf

1 Like
--> FOAM FATAL IO ERROR: 
inconsistent patch and patchField types for field nut
    patch type symmetryPlane and patchField type calculated

file: /run/media/xye/MyFiles/turbulence/fluid/0/nut::boundaryField::downY from line 37 to line 38.

    From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&)
    in file /home/xye/foam/foam-extend-3.1/src/finiteVolume/lnInclude/newFvPatchField.C at line 140.

FOAM exiting

改过以后,报错说边界条件不一致,一个是对称边界一个是计算

这个你做下调整就行了,把 nut 里面的对称边界 (downX, downY, upX, upY) 的类型改成 symmetryPlane 就可以了。

可以使可以算了,但是无法收敛,边界条件,时间步长,k,epsilon都考虑到了,就是无法收敛,算出来的速度 库朗数都很大

在 nut、k、epsilon 中,我把 downup 、updown、middleside 改成了 0 梯度,边界为wall的依然为wallfunction。比之前的速度要降了许多,但依然报错。例如:

Evolving flow model
Courant Number mean: 0.3952959 max: 175.13348 velocity magnitude: 2767.5311
DILUPBiCG:  Solving for Ux, Initial residual = 0.64967429, Final residual = 0.06005503, No Iterations 1000
DILUPBiCG:  Solving for Uy, Initial residual = 0.65510927, Final residual = 0.057826146, No Iterations 1000
DILUPBiCG:  Solving for Uz, Initial residual = 0.45660827, Final residual = 0.19803852, No Iterations 1000
Floating point exception (core dumped)

设置例如:

 down
    {
        type      fixedValue;
        value     uniform 0.006583;
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type  zeroGradient;//movingWallVelocity;
    }
   
    middleside
    {
        type  zeroGradient;//movingWallVelocity;
    }
    
    updown
    {
         type  zeroGradient;//movingWallVelocity;
    }
    wall
    {
         type  epsilonWallFunction;
         value uniform 0.006583;
    }
    up
    {
        type            zeroGradient;
    }

现在我考虑吧k或epsilon改小一点试试

nut 应该如下

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

internalField   uniform 0;

boundaryField
{
    down
    {
        type            fixedValue;
        value           uniform 0;
    }
    downX
    {
        type            symmetryPlane;
    }

    downY
    {
        type            symmetryPlane;
        value           uniform 0;
    }

    upX
    {
        type            symmetryPlane;
        value           uniform 0;
    }

    upY
    {
        type            symmetryPlane;
        value           uniform 0;
    }    
   
    
    downup
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
   
    middleside
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    
    updown
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    wall
    {
        type            nutkWallFunction;
        value           uniform 0;
    }
    up
    {
        type            inletOutlet;
        InletValue    uniform 0;
        value           uniform 0;
    }
}

以下为 k:

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

internalField   uniform 0.01125;

boundaryField
{
   down
    {
        type         fixedValue;
        value        uniform 0.01125;
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type kqRWallFunction; //movingWallVelocity;
        value uniform 0.01125;
    }
   
    middleside
    {
        type kqRWallFunction; //movingWallVelocity;
        value uniform 0.01125;
    }
    
    updown
    {
        type kqRWallFunction; //movingWallVelocity;
        value uniform 0.01125;
    }
    wall
    {
        type kqRWallFunction;
        value uniform 0.01125;
    }
    up
    {
        type            inletOutlet;
        InletValue    uniform 0.01125;
        value           uniform 0;
    }
}

epsilon 应该如下:

dimensions      [0 2 -3 0 0 0 0];

internalField   uniform 0.006583;

boundaryField
{
    down
    {
        type      fixedValue;
        value     uniform 0.006583;
    }
    downX
    {
        type symmetryPlane;
    }

    downY
    {
        type symmetryPlane;
    }

    upX
    {
        type symmetryPlane;
    }

    upY
    {
        type symmetryPlane;
    }    
   
    
    downup
    {
        type  epsilonWallFunction; //movingWallVelocity;
        value uniform 0.006583;
    }
   
    middleside
    {
        type  epsilonWallFunction; //movingWallVelocity;
        value uniform 0.006583;
    }
    
    updown
    {
         type  epsilonWallFunction; //movingWallVelocity;
        value  uniform 0.006583;
    }
    wall
    {
         type  epsilonWallFunction;
         value uniform 0.006583;
    }
    up
    {
        type            inletOutlet;
        InletValue    uniform 0.006583;
        value           uniform 0;
    }
}

可以参考
http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2016/FangqingLiu/openfoamFinal.pdf

在壁面上,要看你的 y^+ 是什么值,然后决定是否使用壁面函数。

一般情况, 对于较粗的边界层网格 (30<y^+<100) ,对数律区)应采用壁面函数。而足够细的边界层网格 (y^+<1 且有 4-5 个节点在 y^+=5 以下,粘性子区)并不需要壁面函数

Evolving flow model
Courant Number mean: 0.23236441 max: 11224.78 velocity magnitude: 1026814.6
DILUPBiCG:  Solving for Ux, Initial residual = 0.69017907, Final residual = 8.6725077e-07, No Iterations 218
DILUPBiCG:  Solving for Uy, Initial residual = 0.85205715, Final residual = 7.703678e-07, No Iterations 140
DILUPBiCG:  Solving for Uz, Initial residual = 0.89198453, Final residual = 9.0960307e-07, No Iterations 214
Floating point exception (core dumped)

开始的时候算得还行,后来就不行了

在我这个算例力我觉得,网格还是比较细的,也就是说可以不用壁面函数吧

    From function void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
    in file derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C at line 174
    Cannot access RASModel::G field for patch wall.  Evaluating as zeroGradient

    From function void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
    in file derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C at line 174
    Cannot access RASModel::G field for patch wall.  Evaluating as zeroGradient

    From function void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
    in file derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C at line 174

这样设置之后,在计算过程中,会有以上的警告内容

这个你需要算一下 y^+,你的 y^+=?

你考虑下这样的边界呢?

boundary U p k epsilon nut
inlet(down) fixedValue zeroGradient inletOutlet inletOutlet calculated
outlet(up) zeroGradient fixedValue inletOutlet inletOutlet calculated
walls(…) fixedValue/movingWallVelocity zeroGradient kqWallFunction epsilonWallFunction nutkWallFunction

symmetryPlane 不变。

现在算了1/4了,还在算 不知道会不会收敛

用的什么边界?能用上面那样的表给出来么?

我就是把k的值加大了,边界还是用的之前的

再复制一个出来,修改下边界条件再测试下呗

算了一小半又错了,我试试

使用这样的边界条件 成功算完了,但是最后出现了一下警告:不明白什么

*** Error in `fsiFoam': corrupted double-linked list: 0x0000000001e47530 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7bfc7)[0x7fdfee29bfc7]
/lib64/libc.so.6(+0x7d774)[0x7fdfee29d774]
/lib64/libc.so.6(+0x39240)[0x7fdfee259240]
/lib64/libc.so.6(+0x39265)[0x7fdfee259265]
/lib64/libc.so.6(__libc_start_main+0xfc)[0x7fdfee241afc]
fsiFoam[0x402ce9]
======= Memory map: ========
00400000-00404000 r-xp 00000000 fd:01 72382904                           /home/xye/foam/xye-3.1/applications/bin/linux64GccDPOpt/fsiFoam
00603000-00604000 r--p 00003000 fd:01 72382904                           /home/xye/foam/xye-3.1/applications/bin/linux64GccDPOpt/fsiFoam
00604000-00605000 rw-p 00004000 fd:01 72382904                           /home/xye/foam/xye-3.1/applications/bin/linux64GccDPOpt/fsiFoam
01d04000-18645000 rw-p 00000000 00:00 0                                  [heap]
7fdfe78af000-7fdfe7c4d000 r-xp 00000000 fd:01 105003662                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libfiniteArea.so
7fdfe7c4d000-7fdfe7e4d000 ---p 0039e000 fd:01 105003662                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libfiniteArea.so
7fdfe7e4d000-7fdfe7e63000 r--p 0039e000 fd:01 105003662                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libfiniteArea.so
7fdfe7e63000-7fdfe7e67000 rw-p 003b4000 fd:01 105003662                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libfiniteArea.so
7fdfe7e67000-7fdfe7e69000 rw-p 00000000 00:00 0 
7fdfe9dd9000-7fdfe9de4000 r-xp 00000000 fd:01 74272743                   /home/xye/foam/xye-3.1/lib/linux64GccDPOpt/libpointHistory.so
7fdfe9de4000-7fdfe9fe3000 ---p 0000b000 fd:01 74272743                   /home/xye/foam/xye-3.1/lib/linux64GccDPOpt/libpointHistory.so
7fdfe9fe3000-7fdfe9fe4000 r--p 0000a000 fd:01 74272743                   /home/xye/foam/xye-3.1/lib/linux64GccDPOpt/libpointHistory.so
7fdfe9fe4000-7fdfe9fe5000 rw-p 0000b000 fd:01 74272743                   /home/xye/foam/xye-3.1/lib/linux64GccDPOpt/libpointHistory.so
7fdfeb089000-7fdfeb231000 r-xp 00000000 fd:01 54927256                   /home/xye/foam/foam-extend-3.1/ThirdParty/packages/mesquite-2.1.2/platforms/linux64GccDPOpt/lib/libmesquite.so.0.0.0
7fdfeb231000-7fdfeb430000 ---p 001a8000 fd:01 54927256                   /home/xye/foam/foam-extend-3.1/ThirdParty/packages/mesquite-2.1.2/platforms/linux64GccDPOpt/lib/libmesquite.so.0.0.0
7fdfeb430000-7fdfeb438000 r--p 001a7000 fd:01 54927256                   /home/xye/foam/foam-extend-3.1/ThirdParty/packages/mesquite-2.1.2/platforms/linux64GccDPOpt/lib/libmesquite.so.0.0.0
7fdfeb438000-7fdfeb43a000 rw-p 001af000 fd:01 54927256                   /home/xye/foam/foam-extend-3.1/ThirdParty/packages/mesquite-2.1.2/platforms/linux64GccDPOpt/lib/libmesquite.so.0.0.0
7fdfeb43a000-7fdfeb43c000 rw-p 00000000 00:00 0 
7fdfeb43c000-7fdfeb478000 r-xp 00000000 fd:01 106458519                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libmesquiteMotionSolver.so
7fdfeb478000-7fdfeb677000 ---p 0003c000 fd:01 106458519                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libmesquiteMotionSolver.so
7fdfeb677000-7fdfeb678000 r--p 0003b000 fd:01 106458519                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libmesquiteMotionSolver.so
7fdfeb678000-7fdfeb679000 rw-p 0003c000 fd:01 106458519                  /home/xye/foam/foam-extend-3.1/lib/linux64GccDPOpt/libmesquiteMotionSolver.so
7fdfeb679000-7fdfeb684000 r-xp 00000000 fd:01 67170766                   /usr/lib64/libnss_files-2.17.so
7fdfeb684000-7fdfeb883000 ---p 0000b000 fd:01 67170766                   /usr/lib64/libnss_files-2.17.so
7fdfeb883000-7fdfeb884000 r--p 0000a000 fd:01 67170766                   /usr/lib64/libnss_files-2.17.so
7fdfeb884000-7fdfeb885000 rw-p 0000b000 fd:01 67170766                   /usr/lib64/libnss_files-2.17.so
7fdfeb885000-7fdfeb887000 r-xp 00000000 fd:01 67170782                   /usr/lib64/libutil-2.17.so
7fdfeb887000-7fdfeba86000 ---p 00002000 fd:01 67170782                   /usr/lib64/libutil-2.17.so
7fdfeba86000-7fdfeba87000 r--p 00001000 fd:01 67170782                   /usr/lib64/libutil-2.17.so
7fdfeba87000-7fdfeba88000 rw-p 00002000 fd:01 67170782                   /usr/lib64/libutil-2.17.so
7fdfeba88000-7fdfeba9e000 r-xp 00000000 fd:01 67170758                   /usr/lib64/libnsl-2.17.so
7fdfeba9e000-7fdfebc9d000 ---p 00016000 fd:01 67170758                   /usr/lib64/libnsl-2.17.so
7fdfebc9d000-7fdfebc9e000 r--p 00015000 fd:01 67170758                   /usr/lib64/libnsl-2.17.so
7fdfebc9e000-7fdfebc9f000 rw-p 00016000 fd:01 67170758                   /usr/lib64/libnsl-2.17.so
7fdfebc9f000-7fdfebca1000 rw-p 00000000 00:00 0 
7fdfebca1000-7fdfebe1b000 r-xp 00000000 fd:01 104777250                  /home/xye/foam/foam-extend-3.1/ThirdParty/packages/openmpi-1.6.5/platforms/linux64GccDPOpt/lib/libmpi.so.1.0.8
7fdfebe1b000-7fdfec01a000 ---p 0017a000 fd:01 104777250                  /home/xye/foam/foam-extend-3.1/ThirdParty/packages/openmpi-1.6.5/platforms/linux64GccDPOpt/lib/libmpi.so.1.0.8
7fdfec01a000-7fdfec01f000 r--p 00179000 fd:01 104777250                  /home/xye/foam/foam-extend-3.1/ThirdParty/packages/openmpi-1.6.5/platforms/linux64GccDPOpt/lib/libmpi.so.1.0.8
7fdfec01f000-7fdfec031000 rw-p 0017e000 fd:01 104777250                  /home/xye/foam/foam-extend-3.1/ThirdParty/packages/openmpi-1.6.5/platforms/linux64GccDPOpt/lib/libmpi.so.1.0.8
7fdfec031000-7fdfec049000 rw-p 00000000 00:00 0 
7fdfec049000-7fdfec05f000 r-xp 00000000 fd:01 67170774                   /usr/lib64/libpthread-2.17.so
7fdfec05f000-7fdfec25f000 ---p 00016000 fd:01 67170774                   /usr/lib64/libpthread-2.17.so
7fdfec25f000-7fdfec260000 r--p 00016000 fd:01 67170774                   /usr/lib64/libpthread-2.17.soAborted (core dumped)

如果结果比较好的话,说明算法和设置上没有什么问题。出现 double-linked list 可能的原因是函数的指针或 list 的指针出了问题。