⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 一个关于LB的经典程序。希望大家有好的东东就那出来
💻 C
字号:
#include "global.h"
int main()
{int test,               /* dummy Variable */ 
     t,
     t_max,	         /* max  of timesteps */  
     postproc_intervall, /* timesteps between two Postprocessing files */ 
     y;	                 /* Initialisation */	
     f=NULL;
     wall=NULL;

printf("/*****************************************/\n");
printf("/*  Lattice-BGK TUTORIAL Version 1.0     */\n");
printf("/*  Driven Cavity, hard wired            */\n");
printf("/*  Copyright CAB, TU Braunschweig       */\n");
printf("/*  http://www.cab.bau.tu-braunschweig.de*/\n");
printf("/*  NO guarantee whatsoever              */\n");
printf("/*  published under GNU License          */\n");
printf("/*  Questions to:                        */\n");
printf("/*  kraft@cab.bau.tu-bs.de               */\n");
printf("/*  toelke@cab.bau.tu-bs.de              */\n");
printf("/*****************************************/\n\n\n");

/*---------------------------------------------------------------------------*/
                           /* read parameters */

printf("max_x, max_y, t_max, postproc_intervall, kin. viscosity ?\n");
scanf("%d %d %d %d %lf",&max_x, &max_y, &t_max, &postproc_intervall, &tau);
printf("max_x=%d, max_y=%d t_max=%d, postproc_intervall=%d, nu=%g\n",
max_x,max_y, t_max, postproc_intervall, tau);

/*---------------------------------------------------------------------------*/

if((tau<0.005) || (tau>0.2))
{printf("viscosity should be in the range [0.005,0.2] ...\n");
 exit(1);
}
                           /* compute tau from viscosity */
tau=(6.0 * tau + 1.0) / 2.0;
allocate();                /* initialise mass and momentum (u=v=0, rho_0 from defines.h) */
init();                    /* initialise Geometry */
nit_geo();

/*---------------------------------------------------------------------------*/

                           /* time loop (explicit scheme) */
for(t=1;t<=t_max;t++)	
{collision();
 propagate();	
                           /* plug in your favourite postprocessing routine here */
    if(!(t%postproc_intervall)) 
        {
         write_avs_field_file(t);
        }
		
/*---------------------------------------------------------------------------*/

                            /* that's it */
return(0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -