动网格中定义随时间和位置变化的速度入口



  • 大家好,遇到一个动网格入口速度边界的问题,希望大家帮帮忙。

    简述: 在一个做六自由度运动的网格的一个边界上定义随时间及高度变化的速度入口。

    平台:OpenFOAM 2.4.0, interDyMFoam

    物理背景: 做俯仰运动的明渠中的流动,在左边界施加随深度变化的平行于底床的入流速度,考虑到明渠本身也在做俯仰运动,所以入口边界的绝对速度还应该加上俯仰运动所产生的速度。所以就是一个随时间及高度变化的速度。

    描述:网格的运动通过solidBodyMotionFvMesh 实现,然后通过6DOF的utility来指定运动方式。对于时变或随位置变化的入口边界条件,在论坛里面找到了一些帖子,然后用的codedFixedValue来实现这个,但是在实现的时候遇到错误,自己编程不是很熟悉,想请大家帮忙看看代码的编写上的问题。同时对于在动网格中的入口速度边界的指定,不知道我目前采用的这种方法是否合理?是否还有其他更好的方法?谢谢大家。

        inlet
        {
            type            codedFixedValue;
    	value		$internalField;
    	redirectType	abcde;
    	code
            #{
    
    	const fvPatch& boundaryPatch = this->patch();
    	vectorField v= boundaryPatch.Cf();
    	
    	scalar ymin=min(this->patch().Cf().component(1));
    	Info<<"ymin="<<ymin<<nl;
    
    	scalar thetaamp=0.056119;
    	scalar omegaa=1.4564;
    	scalar pitchphase=2.0125828;
    
    	scalar tt = this->db().time().value();
    
    	scalar udeck=-thetaamp*omegaa*50*cos(omegaa*tt+pitchphase);
    	scalar uslope=0.09769*sin(1.488*tt-2.748)-0.00532;
    	scalar ucut=0.2045*sin(1.692*tt-3.203)-0.0601;
    	scalar theta=thetaamp*sin(omegaa*tt+pitchphase);
    
    	forAll(boundaryPatch,faceI)
    	{
    	scalar y = this->patch().Cf().component(1); 
    	scalar ux=-udeck*sin(theta)+(uslope*(y-ymin)+ucut)*cos(theta);
    	scalar uy=udeck*cos(theta)+(uslope*(y-ymin)+ucut)*sin(theta);
    	v[faceI] = vector(ux,uy,0);
    
    	operator==(v);
    	}
    
            #}
    
        }
    
    

    错误信息如下:

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    Create time
    
    Create mesh for time = 0
    
    Selecting dynamicFvMesh solidBodyMotionFvMesh
    Selecting solid-body motion function tabulated6DoFMotion
    Applying solid body motion to entire mesh
    
    PIMPLE: Operating solver in PISO mode
    
    Reading field p_rgh
    
    Reading field U
    
    Using dynamicCode for patch inlet on field U at line 26 in "/home/min/OpenFOAM/min-2.4.0/run/pitchDamBreak/pitchCases/pitch14-8update3-mapped/0/U.boundaryField.inlet"
    Creating new library in "dynamicCode/pitchdam/platforms/linuxGccDPOpt/lib/libpitchdam_89672c10695eb4de1d809896f609f8e1131d9634.so"
    Invoking "wmake -s libso /home/min/OpenFOAM/min-2.4.0/run/pitchDamBreak/pitchCases/pitch14-8update3-mapped/dynamicCode/pitchdam"
    wmakeLnInclude: linking include files to ./lnInclude
    Making dependency list for source file fixedValueFvPatchFieldTemplate.C
    /home/min/OpenFOAM/min-2.4.0/run/pitchDamBreak/pitchCases/pitch14-8update3-mapped/0/U.boundaryField.inlet: In member function ‘virtual void Foam::pitchdamFixedValueFvPatchVectorField::updateCoeffs()’:
    /home/min/OpenFOAM/min-2.4.0/run/pitchDamBreak/pitchCases/pitch14-8update3-mapped/0/U.boundaryField.inlet:53:43: error: cannot convert ‘Foam::tmp<Foam::Field<double> >’ to ‘Foam::scalar {aka double}’ in initialization
    make: *** [Make/linuxGccDPOpt/fixedValueFvPatchFieldTemplate.o] Error 1
    
    
    --> FOAM FATAL IO ERROR: 
    Failed wmake "dynamicCode/pitchdam/platforms/linuxGccDPOpt/lib/libpitchdam_89672c10695eb4de1d809896f609f8e1131d9634.so"
    
    
    file: /home/min/OpenFOAM/min-2.4.0/run/pitchDamBreak/pitchCases/pitch14-8update3-mapped/0/U.boundaryField.inlet from line 26 to line 68.
    
        From function codedBase::createLibrary(..)
        in file db/dynamicLibrary/codedBase/codedBase.C at line 213.
    
    FOAM exiting
    
    

    谢谢了。


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2