📄 lbm.c
字号:
// lbm.c#include <stdio.h>#include "D2Q9.h"#include <sys/times.h>#include <sys/time.h>double CPU_time(){ #ifndef CLK_TCK #define CLK_TCK 100.0 #endif struct tms t; times(&t); return (1.0*t.tms_utime + t.tms_stime)/CLK_TCK;}void ShowBdy(){ int i, j; for(j=0; j<Ny; j++) { for(i=0; i<Nx; i++) printf("%d", boundary[i][j]); printf("\n"); }}int main(int argc, char *argv[]){ double ctime; int i; if(argc>1) Init(argv[1]); else Init("bdy.lbm"); printf("Re=%f, omega=%f\n", Re, omega); ShowBdy(); ctime = CPU_time(); for(i=0; i<5000; i++) { evolution();// printf("\rn=%d, t=%f ", n, t); } ctime = CPU_time() - ctime; SaveFile(); Finish(); printf("\nCPU_time: %lf(s)", ctime); printf("\nu.dat, v.dat, rho.dat AND u.txt, v.txt, rho.txt are saved.\n"); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -