資源簡(jiǎn)介
LBM 方程的D2Q9實(shí)驗(yàn)。打包好的程序。期望大家能共同努力

代碼片段和文件信息
//?minimal?LBM?D3Q19?solver?by?Nils?Thuerey
//?see?http://www.ntoken.com?and?http://www.matthiasmueller.info/realtimephysics/?for?further?info
//?this?code?is?released(發(fā)布、發(fā)表)?under?the?GPL?see?LICENSE.txt?for?details
#include?
#include?
#include?
//?global?parameters
const?int?SIZE?=?64;
//?for?a?more?turbulent?simulation
//?try:?SMAGORINSKY=true?omega=2?LDC_VELOCITY=0.166
void?BuildImage(int);
//?single?/?double?precision?
typedef?float?Real;
//?use?the?turbulence?model?
//const?bool?SMAGORINSKY?=?false;
//?different?types?of?cells????這個(gè)是在flag里面限定到底格子是邊界格子,還是在一般的格子還是有初始速度的格子?noslip?:無(wú)滑動(dòng)?? VELOCITY:速度
const?int?FLUID??=?0?NOSLIP?=?1?VELOCITY??=?2;
//?velocity?for?the?lid-driven-cavity?setup
const?Real?LDC_VELOCITY?=?0.10;?????//?有初始速度的格子的初始速度統(tǒng)一定為0.10
//?Declare?some?constants?and?globals?...
const?Real???omega?=?1.90;?????//?viscosity?of?the?fluid?0..2??單弛豫時(shí)間的倒數(shù):1.908287693452664923763906646566
const?int????STEPS?=?50000;?????//?max?no.?of?steps?to?simulate
const?int????IMAGESTEPS?=?1000;??//?write?image?every???steps
//int ?????????current?=?0?other?=?1;?//?which?grid?is?the?current?and?the?old?one?
//?main?arrays?(note?-?for?simplicity?these?are?allocated?here?for?larger?
//??????????????simulations?better?use?malloc?and?a?manual?offset?calculation手動(dòng)的偏移量計(jì)算)
//Real???cells[2][SIZE][SIZE][SIZE][19];?//?the?two?grids?of?LBM?cells?with?19?distribution?functions,lattice?vectors
//char???flags[SIZE][SIZE][SIZE];????????//?flags?for?each?cell?either?FLUID?NOSLIP?or?VELOCITY
char?flags[SIZE?*?SIZE?];?????????????????????//用來(lái)標(biāo)記格子的狀態(tài)的,是一般的格子?有初始速度的格子?還是邊界的格子
Real*???cellsO;//[SIZE][SIZE][SIZE][19];????????????//定義一個(gè)浮點(diǎn)型的指針,表示相應(yīng)的格子點(diǎn)以及上面的19個(gè)方向向量
Real*???cellsN;//[SIZE][SIZE][SIZE][19];
//?the?weight?for?the?equilibrium?distribution?????格子19個(gè)方向上的均衡分布的權(quán)重,也就是一個(gè)比例,也就是我們w的取值(在19個(gè)方向上)
Real?w[9]?=?{?(4./9.)?
(1./9.)(1./9.)(1./9.)(1./9.)
(1./36.)(1./36.)(1./36.)(1./36.)?};
//?convenience?variables?for?handling?the?distribution?functions?in?a?loop
//?the?19?lattice?vectors?????D3Q19模型的速度值在坐標(biāo)軸上的分布,其中i=0e=0;?i=1->6e=1?;i=?7->18e=sqrt(2);
int?e_x[9]?=?{?0?1?0?-1??0?1-1-11?};
int?e_y[9]?=?{?0?0?1??0?-1?11-1-1?};
//?the?index?of?the?inverse?for?each?lattice?vector?晶格向量的逆指數(shù),也就是邊界碰撞之后反彈回去的方向,例如:若是2方向來(lái)的速度讀下標(biāo)是2的值——現(xiàn)在是1
int?dfInv[9]?=?{?0???2??1??4??3??6??5??8??7?};
//?helper?functions?for?turbulence?model
//#include?“smagorinksy.h“
void?writeImage(int?s);????//前向聲明
//?run?the?solver...
int?main(int?argc?char?*argv[])
{
printf(“Init\n“);
//if(SMAGORINSKY)?initSmagoArrays();
cellsO?=?new?Real[SIZE?*?SIZE??*?9];
cellsN?=?new?Real[SIZE?*?SIZE??*?9];
Real*?tmp;
//?initialize?grid??初始化格子,給每個(gè)格子的flag置數(shù),然后給最上面的第一行一個(gè)穩(wěn)定的流動(dòng)速度
const?int?BORDER?=?1;??????????????????????//邊界初始值
for?(int?i=0;i for?(int?j=0;j for?(int?l=0;l<9;l++)??{
//cells[0][i][j][k][l]?=?cells[1][i][j][k][l]?=?w[l];給一個(gè)格子的每一個(gè)方向向量上的粒子數(shù)(比例)賦初始化值,等于平衡狀態(tài)的粒子比例數(shù)
cellsN[(i?*?SIZE?+?j)?*?9?+?l
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件??????20480??2012-08-22?21:48??ForLBM2(D2Q9)\Debug\ForLBM.exe
?????文件?????323984??2012-08-22?21:48??ForLBM2(D2Q9)\Debug\ForLBM.ilk
?????文件?????437248??2012-08-22?21:48??ForLBM2(D2Q9)\Debug\ForLBM.pdb
?????文件??????61584??2012-08-22?20:31??ForLBM2(D2Q9)\Debug\outlbm_0000.ppm
?????文件??????12622??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\BuildLog.htm
?????文件????????663??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\Debug\ForLBM.exe.em
?????文件????????728??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\Debug\ForLBM.exe.em
?????文件????????621??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\ForLBM.exe.intermediate.manifest
?????文件??????21778??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\lbm.obj
?????文件?????????65??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\mt.dep
?????文件??????68608??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\vc90.idb
?????文件??????69632??2012-08-22?21:48??ForLBM2(D2Q9)\ForLBM\Debug\vc90.pdb
?????文件???????3978??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\ForLBM.vcproj
?????文件???????1415??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\ForLBM.vcproj.eMavaj-PC.eMavaj.user
?????文件???????1411??2012-08-22?21:49??ForLBM2(D2Q9)\ForLBM\ForLBM.vcproj.yang-PC.yang.user
?????文件???????8318??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0000.jpg
?????文件???????8808??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0050.jpg
?????文件???????8983??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0100.jpg
?????文件???????9050??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0150.jpg
?????文件???????9024??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0200.jpg
?????文件???????9135??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0250.jpg
?????文件???????9144??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0300.jpg
?????文件???????9282??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0350.jpg
?????文件???????9306??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0400.jpg
?????文件???????9209??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0450.jpg
?????文件???????9291??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0500.jpg
?????文件???????9391??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0550.jpg
?????文件???????9406??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0600.jpg
?????文件???????9388??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0650.jpg
?????文件???????9486??2012-07-07?10:34??ForLBM2(D2Q9)\ForLBM\JPEG\outlbm_0700.jpg
............此處省略113個(gè)文件信息
評(píng)論
共有 條評(píng)論