Skip to content
  • 最新
  • Categories
  • 东岳流体
  • 随机看[请狂点我]
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 分区网格的一小段代码

分区网格的一小段代码

Scheduled Pinned Locked Moved OpenFOAM
2 Posts 2 Posters 2.4k Views
  • 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.
  • 李东岳李 Online
    李东岳李 Online
    李东岳 管理员
    wrote on last edited by
    #1
    codedSource
    {
        type            vectorCodedSource;
        selectionMode   cellZone;
        cellZone        BANANA;
    
        fields          (U);
        name            codedSource;
    	
        codeAddSup
        #{  
        	        const label cellZoneID = mesh().cellZones().findZoneID("BANANA"); // find ID for the cellZone "BANANA"
    		const cellZone& zone = mesh().cellZones()[cellZoneID];
    		const cellZoneMesh& zoneMesh = zone.zoneMesh();
    		const labelList& cellsZone = zoneMesh[cellZoneID]; //list of all cellZone cell ID's  
                    
                    const scalarField& V = mesh_.V(); // Cell volume
                     
                    Foam::Field<Foam::Vector<double> >& USource = eqn.source(); // get source from fvMatrix
    		//scalarField & Udiag = eqn.diag(); // get diagonal of fvMatrix
                    
                    const scalarField& rho = mesh().lookupObject<scalarField>("rho"); // get density field
                  
                    const vector g (0,-9.81,0)      // gravitational vector
    
    
                    forAll(cellsZone,i)
    			{
            		const label celli = cellsZone[i];
    			
    			USource[celli] -= rho[celli]*g/V[celli];
    			}
        #};
        
        codeCorrect
        #{
        Pout<< "**codeCorrect**" << endl;
        
        #};
        codeSetValue
        #{
        Pout<< "**codeSetValue**" << endl;
        #};  
        code
        #{
                $codeInclude
                $codeCorrect
                $codeAddSup
                $codeSetValue
        #};
    

    9月CFD算法编程课: http://dyfluid.com/class.html

    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 Reply Last reply
  • S Offline
    S Offline
    shiyu
    wrote on last edited by
    #2

    Hi,东岳大佬,请教下openfoam里可以实现分区网格计算,比如两个分区,并设置interface boundary condition来coupling这两个区域吗?如果可以,麻烦给点思路,谢谢。
    我暂时想到的只有fluid-solid interaction,即FSI toolbox in Foam-extend,改写solid domain为fluid-fluid interaction,来实现,不过有些繁琐了。

    BR,
    Shiyu

    1 Reply Last reply

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • 最新
  • Categories
  • 东岳流体
  • 随机看[请狂点我]