Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    如何在区域内设置一个碰口

    OpenFOAM
    2
    6
    220
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Prometheus10 last edited by

      各位大佬Cfders大家好!
      前些日子看资料,如图中在边界处有一个喷水口,在0~0.2s内以固定流速向盒子内送水。
      fillBox_BC.png

      :xinxin: 图1 边界送水图:xinxin:
      这个喷水口是通过设置0文件夹下phase.water的boundaryField指定其左壁面的正方形区域内(z:0.4~0.6;y:0.5~0.7),在某时间内完成送水过程的(0s~0.2s)。代码如下:

      internalField   uniform 0;
      boundaryField
      {
          leftWall
          {
              //type            zeroGradient;
      
         	type            codedFixedValue;
          	value           uniform 0;
      
          	name    inletProfile2;
          	//redirectType    inletProfile2;	//OF7 <
      
      	code
          	#{
                  const fvPatch& boundaryPatch = patch(); 
                  const vectorField& Cf = boundaryPatch.Cf(); 
                  scalarField& field = *this; 
      
                  field = patchInternalField(); 	//take value from initialization at the given boundary surface
      
                  scalar minz = 0.4;  
                  scalar maxz = 0.6; 
                  scalar miny = 0.5;  
                  scalar maxy = 0.7; 
      
      	    scalar t = this->db().time().value();
      
       	    forAll(Cf, faceI)
                  {
                      if ( 
                         (Cf[faceI].z() > minz) &&
                         (Cf[faceI].z() < maxz) &&
                         (Cf[faceI].y() > miny) &&
                         (Cf[faceI].y() < maxy) 
                         )
                  	   {
      
      		       if ( t < 1.)
      		       {
                                 field[faceI] = 1.;
      		       }
      		       else
      		       {
      		           field[faceI] = 0.;
      		       }
      
      	    	       //field[faceI] = 1;
      	           }
      	    }
         	#};         
          }
      

      我现在想在区域内有一个假想面或者是假想点达到类似的功能(我想这应该是在internalField中完成)如图2,而不是像上述图1提到的在boundaryField边界上给定面。
      fig2 (2).png
      :xinxin: 图2 区域内假想的送水口图 :xinxin:

      尝试了在0文件下的phase.water的internalField做调整,但只能给定高度的初始流体如图3。
      fig3.png
      :xinxin: 图3 通过internalField只做到了给定高度的水形成自由面 :xinxin:

      还是不太明白如何做到设定送水面和引入时间来控制送水,求大佬降临,救救菜鸟!
      :chouchou:

      1 Reply Last reply Reply Quote
      • P
        Prometheus10 last edited by

        尴尬...标题应该是喷口...:wocao: 请各位大佬原谅我的小学拼音

        Z 1 Reply Last reply Reply Quote
        • Z
          zhouxu @Prometheus10 last edited by

          @prometheus10 应该在boundaryField中,还需要指定速度吧,现在只是确定了相体积分数

          P 1 Reply Last reply Reply Quote
          • P
            Prometheus10 @zhouxu last edited by

            @zhouxu 您好!大佬,谢谢您的回复:xinxin:
            我之前看boundaryField是需要在指定的边界上给定相体积分数和速度,但是我现在想要的入口是在区域内部,这个时候没有确切的边界可以指定 ,所以我就想是不是在internalFields里来达成。

            Z 1 Reply Last reply Reply Quote
            • Z
              zhouxu @Prometheus10 last edited by

              @prometheus10 不是大佬,互相学习。我没有做过,但是感觉可以用createBafflesDict将内部面转化为边界

              P 1 Reply Last reply Reply Quote
              • P
                Prometheus10 @zhouxu last edited by

                @zhouxu 好的,我马上去看一下!:142: 那就~谢谢前辈!:xinxin:

                1 Reply Last reply Reply Quote
                • First post
                  Last post

                CFD中文网 | 东岳流体 | 京ICP备15017992号-2