最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

OpenFOAM手動網(wǎng)格分塊

2021-05-08 10:21 作者:線代制霸  | 我要投稿

1.?通過OpenFOAM的格式自編程來對各個cell命名,確定他們所屬的processor

/*---------------------------------------------------------------------------*\

??========= ????????????????|

??\\ ?????/ ?F ield ????????| OpenFOAM: The Open Source CFD Toolbox

???\\ ???/ ??O peration ????|

????\\ ?/ ???A nd ??????????| Copyright (C) 2011-2013 OpenFOAM Foundation

?????\\/ ????M anipulation ?|

-------------------------------------------------------------------------------

License

????This file is part of OpenFOAM.

?

????OpenFOAM is free software: you can redistribute it and/or modify it

????under the terms of the GNU General Public License as published by

????the Free Software Foundation, either version 3 of the License, or

????(at your option) any later version.

?

????OpenFOAM is distributed in the hope that it will be useful, but WITHOUT

????ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

????FITNESS FOR A PARTICULAR PURPOSE. ?See the GNU General Public License

????for more details.

?

????You should have received a copy of the GNU General Public License

????along with OpenFOAM. ?If not, see <http://www.gnu.org/licenses/>.

?

Application

????scalar2Label

????codeBy CloudBird, HIT,cloudbird7@foxmail.com

?

\*---------------------------------------------------------------------------*/

?

#include?"fvCFD.H"

?

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

?

?

int?main(int?argc, char?*argv[])

{

????#include?"setRootCase.H"

????#include?"createTime.H"

????#include?"createMesh.H"

?

????const?volVectorField& center = mesh.C();

?

????labelIOList finalDecomp

????(

????????IOobject

????????(

????????????"manualDecomposition",

????????????mesh.facesInstance(),

????????????mesh,

????????????IOobject::NO_READ,

????????????IOobject::AUTO_WRITE,

????????????false

????????),

????????labelList (center.size())

????);

?

????Info<< "Making manualDecomposition file\n"?<< endl;

????scalar x_=0,y_=0;

label num0 = 0, num1 = 0, num2 = 0, num3 = 0;

//這里是將網(wǎng)格分為四塊,分塊的依據(jù)是下邊if的判斷語句,也就是先挖一個小方框出來,然后對剩下的部分分成三塊,并輸出分塊之后每一塊的cell的數(shù)量。

forAll(center, cellID)

????{

x_ = center[cellID].x();

y_ = center[cellID].y();

if?(x_ > -0.75 && x_ < 0.75 &&y_>-0.75&&y_ < 0.75)

{

finalDecomp[cellID] = 0;

num0++;

}

else

{

if?(x_ < 0)

{

finalDecomp[cellID] = 1;

num1++;

}

else?if?(x_ < 3)

{

finalDecomp[cellID] = 2;

num2++;

}

?

else

{

finalDecomp[cellID] = 3;

num3++;

}

}

?

????}

Info << "num0 = "?<< num0 << nl << "num1 = "?<< num1 << nl << "num2 = "?<< num2 << nl << "num3 = "?<< num3 << nl;

????finalDecomp.write();

?

????Info<< "Done\n"?<< endl;

?

????return?0;

}

?

?

// ************************************************************************* //

這樣會在constant文件夾下邊生成一個名為manualDecomposition的文件,這個文件本質(zhì)上是一個標(biāo)量文件,用于標(biāo)記各個cell所屬的processor。

?

2.?在system文件夾下的decomposeParDict中修改分割方式

numberOfSubdomains 4;

?

method ??????????manual;

?

manualCoeffs

{

????dataFile ???????"manualDecomposition";

}

其中dataFile的名字要改成我們生成的文件的名字,也就是maualDecomposition,還需要注意的一點是numberOfSubdomains的數(shù)量要和你在maulDecomposition中定義的數(shù)量一致。

?

3.之后直接decomposePar就是按照手動分割網(wǎng)格的方式對你定義的網(wǎng)格進(jìn)行分割。

processor0
processor1
processor2
processor3

文件的編譯按照一般OpenFOAM文件編譯的方式進(jìn)行,參考http://dyfluid.com/docs/book/_book/


參考文章:

https://blog.csdn.net/CloudBird07/article/details/105349031

https://www.dazhuanlan.com/2019/08/16/5d55fc7975c16/

OpenFOAM手動網(wǎng)格分塊的評論 (共 條)

分享到微博請遵守國家法律
湘阴县| 定结县| 永寿县| 大同市| 江都市| 多伦县| 峨边| 长泰县| 交城县| 阳曲县| 古交市| 泰州市| 扬中市| 五莲县| 都江堰市| 九龙坡区| 吐鲁番市| 新巴尔虎右旗| 竹溪县| 镇坪县| 阳西县| 聂拉木县| 兴文县| 孙吴县| 酒泉市| 印江| 紫云| 茂名市| 江北区| 合阳县| 砚山县| 新郑市| 新源县| 武威市| 桑日县| 辉南县| 山东| 泸西县| 团风县| 彭阳县| 桂平市|