两相流动的部分滑移边界如何设定



  • 各位老师好,在边界条件partial slip中只有一个给定的 valueFraction值来决定滑移长度,看到这篇文章在两相流动中设滑移长度 λ=αλ1 + (1-α)λ2 + αs λs , 也是用OF做的,请问这是如何实现的?

    图片.png


  • 管理员

    $\p u/\p n$是什么?文章里面没有说,看起来像是法向梯度,你试试fixedGradient边界



  • @东岳 老师,∂u/∂n是速度在法向的梯度,如果λ是一常数的话,可以用partial slip边界,可这是两相流动,不知道如何去实现λ和α的关系:141:


  • 管理员

    我看了一下,确实发现了这个partialSlip边界,这个边界挺有意思,我整理整理背后的算法。你需要做的是去partialSlipFvPatch.C这个文件中,植入下面那段话中的方程,不是特别复杂。



  • @东岳 老师,我也去过partialSlipFvPatch.C这个文件看过,valueFraction是直接读取的,而那个式子里α的值在每个网格又不同,初学OF不知道怎么去写,老师可以详细指点一下吗?


  • 管理员

    $\alpha$应该是壁面一层的网格相分数,可以参考 http://www.cfd-china.com/topic/3499 中的 更改壁面一层网格值代码,获取壁面一层的网格相分数,其他类似


  • 管理员

    我看了一下,更简单的方法是你去看一下reactingTwoPhaseFoam下的JohnsonJacksonParticleSlip.C边界条件,里面的valueFraction通过this->valueFraction() = c/(c + patch().deltaCoeffs());计算乐,你将其简化并适配更容易。否则你得自己加代码,更难。



  • @东岳 感谢东岳老师,我在这里看到一个更为简单的particleSlip边界代码,在这个代码里看起来修改valueFraction的计算更简单。但是这个边界条件我复制到自己文件夹后(还未修改代码)wmake libso不成功有很多问题,麻烦老师可以看一下吗?

    g++ -std=c++11 -m32 -Dlinux -DWM_ARCH_OPTION=32 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3  -DNoRepository -ftemplate-depth-100 -I/home/cfd/OpenFOAM/OpenFOAM-6/src/finiteVolume/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-6/src/triSurface/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-6/src/meshTools/lnInclude  -IlnInclude -I. -I/home/cfd/OpenFOAM/OpenFOAM-6/src/OpenFOAM/lnInclude -I/home/cfd/OpenFOAM/OpenFOAM-6/src/OSspecific/POSIX/lnInclude   -fPIC -c particleSlipFvPatchVectorField.C -o /home/cfd/OpenFOAM/OpenFOAM-6/platforms/linuxGccDPInt32Opt/run/particleSlip/particleSlipFvPatchVectorField.o
    particleSlipFvPatchVectorField.C: In constructor ‘Foam::particleSlipFvPatchVectorField::particleSlipFvPatchVectorField(const Foam::fvPatch&, const vectorField&)’:
    particleSlipFvPatchVectorField.C:39:40: error: no matching function for call to ‘Foam::partialSlipFvPatchField<Foam::Vector<double> >::partialSlipFvPatchField(const Foam::fvPatch&, const vectorField&)’
         partialSlipFvPatchVectorField(p, iF)
                                            ^
    particleSlipFvPatchVectorField.C:39:40: note: candidates are:
    In file included from partialSlipFvPatchField.H:238:0,
                     from partialSlipFvPatchFields.H:29,
                     from particleSlipFvPatchVectorField.H:33,
                     from particleSlipFvPatchVectorField.C:22:
    partialSlipFvPatchField.C:84:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:84:1: note:   no known conversion for argument 1 from ‘const Foam::fvPatch’ to ‘const Foam::partialSlipFvPatchField<Foam::Vector<double> >&’
    partialSlipFvPatchField.C:73:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:73:1: note:   candidate expects 1 argument, 2 provided
    partialSlipFvPatchField.C:44:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:44:1: note:   candidate expects 4 arguments, 2 provided
    partialSlipFvPatchField.C:58:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:58:1: note:   candidate expects 3 arguments, 2 provided
    partialSlipFvPatchField.C:32:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:32:1: note:   no known conversion for argument 2 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
    particleSlipFvPatchVectorField.C: In constructor ‘Foam::particleSlipFvPatchVectorField::particleSlipFvPatchVectorField(const Foam::particleSlipFvPatchVectorField&, const Foam::fvPatch&, const vectorField&, const Foam::fvPatchFieldMapper&)’:
    particleSlipFvPatchVectorField.C:51:55: error: no matching function for call to ‘Foam::partialSlipFvPatchField<Foam::Vector<double> >::partialSlipFvPatchField(const Foam::particleSlipFvPatchVectorField&, const Foam::fvPatch&, const vectorField&, const Foam::fvPatchFieldMapper&)’
         partialSlipFvPatchVectorField(tdpvf, p, iF, mapper)
                                                           ^
    particleSlipFvPatchVectorField.C:51:55: note: candidates are:
    In file included from partialSlipFvPatchField.H:238:0,
                     from partialSlipFvPatchFields.H:29,
                     from particleSlipFvPatchVectorField.H:33,
                     from particleSlipFvPatchVectorField.C:22:
    partialSlipFvPatchField.C:84:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:84:1: note:   candidate expects 2 arguments, 4 provided
    partialSlipFvPatchField.C:73:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:73:1: note:   candidate expects 1 argument, 4 provided
    partialSlipFvPatchField.C:44:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:44:1: note:   no known conversion for argument 3 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
    partialSlipFvPatchField.C:58:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:58:1: note:   candidate expects 3 arguments, 4 provided
    partialSlipFvPatchField.C:32:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:32:1: note:   candidate expects 2 arguments, 4 provided
    particleSlipFvPatchVectorField.C: In constructor ‘Foam::particleSlipFvPatchVectorField::particleSlipFvPatchVectorField(const Foam::fvPatch&, const vectorField&, const Foam::dictionary&)’:
    particleSlipFvPatchVectorField.C:62:40: error: no matching function for call to ‘Foam::partialSlipFvPatchField<Foam::Vector<double> >::partialSlipFvPatchField(const Foam::fvPatch&, const vectorField&)’
         partialSlipFvPatchVectorField(p, iF)
                                            ^
    particleSlipFvPatchVectorField.C:62:40: note: candidates are:
    In file included from partialSlipFvPatchField.H:238:0,
                     from partialSlipFvPatchFields.H:29,
                     from particleSlipFvPatchVectorField.H:33,
                     from particleSlipFvPatchVectorField.C:22:
    partialSlipFvPatchField.C:84:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:84:1: note:   no known conversion for argument 1 from ‘const Foam::fvPatch’ to ‘const Foam::partialSlipFvPatchField<Foam::Vector<double> >&’
    partialSlipFvPatchField.C:73:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:73:1: note:   candidate expects 1 argument, 2 provided
    partialSlipFvPatchField.C:44:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:44:1: note:   candidate expects 4 arguments, 2 provided
    partialSlipFvPatchField.C:58:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:58:1: note:   candidate expects 3 arguments, 2 provided
    partialSlipFvPatchField.C:32:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:32:1: note:   no known conversion for argument 2 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
    particleSlipFvPatchVectorField.C: In constructor ‘Foam::particleSlipFvPatchVectorField::particleSlipFvPatchVectorField(const Foam::particleSlipFvPatchVectorField&, const vectorField&)’:
    particleSlipFvPatchVectorField.C:84:44: error: no matching function for call to ‘Foam::partialSlipFvPatchField<Foam::Vector<double> >::partialSlipFvPatchField(const Foam::particleSlipFvPatchVectorField&, const vectorField&)’
         partialSlipFvPatchVectorField(tdpvf, iF)
                                                ^
    particleSlipFvPatchVectorField.C:84:44: note: candidates are:
    In file included from partialSlipFvPatchField.H:238:0,
                     from partialSlipFvPatchFields.H:29,
                     from particleSlipFvPatchVectorField.H:33,
                     from particleSlipFvPatchVectorField.C:22:
    partialSlipFvPatchField.C:84:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:84:1: note:   no known conversion for argument 2 from ‘const vectorField {aka const Foam::Field<Foam::Vector<double> >}’ to ‘const Foam::DimensionedField<Foam::Vector<double>, Foam::volMesh>&’
    partialSlipFvPatchField.C:73:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:73:1: note:   candidate expects 1 argument, 2 provided
    partialSlipFvPatchField.C:44:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::partialSlipFvPatchField<Type>&, const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::fvPatchFieldMapper&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:44:1: note:   candidate expects 4 arguments, 2 provided
    partialSlipFvPatchField.C:58:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:58:1: note:   candidate expects 3 arguments, 2 provided
    partialSlipFvPatchField.C:32:1: note: Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&) [with Type = Foam::Vector<double>]
     Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
     ^
    partialSlipFvPatchField.C:32:1: note:   no known conversion for argument 1 from ‘const Foam::particleSlipFvPatchVectorField’ to ‘const Foam::fvPatch&’
    particleSlipFvPatchVectorField.C: In member function ‘virtual void Foam::particleSlipFvPatchVectorField::updateCoeffs()’:
    particleSlipFvPatchVectorField.C:106:41: error: ‘lookupPatchField’ was not declared in this scope
         const fvPatchField<scalar>& alpha = lookupPatchField<volScalarField, scalar>
                                             ^
    particleSlipFvPatchVectorField.C:106:72: error: expected primary-expression before ‘,’ token
         const fvPatchField<scalar>& alpha = lookupPatchField<volScalarField, scalar>
                                                                            ^
    make: *** [/home/cfd/OpenFOAM/OpenFOAM-6/platforms/linuxGccDPInt32Opt/run/particleSlip/particleSlipFvPatchVectorField.o] Error 1
    
    


  • 补充一下,出现上述编译错误前,我修改了make文件夹中的files和option:

    • files
    particleSlipFvPatchVectorField.C
    
    LIB = $(FOAM_USER_LIBBIN)/mylibparticleSlip
    
    • option
    EXE_INC = \
        -I$(LIB_SRC)/finiteVolume/lnInclude \    
        -I$(LIB_SRC)/triSurface/lnInclude \ 
        -I$(LIB_SRC)/meshTools/lnInclude \ 
    
    LIB_LIBS = \
        -lfiniteVolume \
        -lOpenFOAM \
        -ltriSurface \
        -lmeshTools  \
        -lparticleSlip
    

  • 管理员

    那是一个特别老的代码,很明显会出现问题。这些代码在新版本里基本上是不能用的。你最好先学OpenFOAM编程后再做这个工作,急不得



  • @东岳 感谢东岳老师指点:xiexie: ,我以particleSlip边界这个老代码为基础,参照JohnsonJacksonParticleSlip边界,发现确实有一些新老代码语句上的表达不同。我对其进行语句上的修改,然后编译成功了,希望这些能对和我有类似问题的同学有一丝帮助。


  • 管理员

    很厉害很厉害!!


Log in to reply
 


CFD中文网 | 东岳流体学术 | 东岳流体商业 | 吉ICP备20003622号-1