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

📄 lb2d_prime.c

📁 基于格子Boltzmann方法开源可视化软件的源代码 具有很高的实用价值。对学习LBM方法及其软件开发非常游泳
💻 C
字号:
//##############################################################################//// Copyright (C), 2005, Michael Sukop and Danny Thorne//// lb2d_prime.c////  - Lattice Boltzmann//#include "lb2d_prime.h"int main( int argc, char **argv){  int n;  double k;  int time, frame;  clock_t tic, ticf;  double t0, t1, tf;  struct lattice_struct *lattice;  struct report_struct report;#if OSTYPE==darwin  printf("%s %d >> Darwin \n",__FILE__,__LINE__);#endif /* (OSTYPE=="DARWIN") */#if PARALLEL  lbmpi_ptr lbmpi;#endif /* (PARALLEL) */  report_flags();  tic = clock();  construct_lattice( &lattice, argc, argv);#if PARALLEL  lbmpi_construct( lbmpi, lattice, argc, argv);#endif /* (PARALLEL) */  lattice->time = 0;  init_problem( lattice);  output_frame( lattice);  printf("\n");  t0 = ((double)clock() - (double)tic)/(double)CLK_TCK;  printf("Overhead time:  %f seconds\n", t0);  tic = clock();  ticf = clock(); for( frame = 0; frame<get_NumFrames( lattice); frame++) {  for( time=frame*get_FrameRate(lattice)+1;        time<=(frame+1)*get_FrameRate(lattice); time++)  {    lattice->time = time; run_man( lattice);    stream( lattice); /* ftemp <- f */ dump( lattice, 1);    bcs( lattice); dump( lattice, 2);    compute_macro_vars( lattice);    compute_feq( lattice); dump( lattice, 3);    collide( lattice); /* f <- ftemp */  } /* for( time=frame*get_FrameRate(lattice); ... */    output_frame( lattice);    tf = ((double)clock() - (double)ticf)/(double)CLK_TCK;    ticf = clock();    printf("Time for frame: %f\n", tf); } /* for( frame = 0; frame<get_NumFrames( lattice); time++) */  t1 = ((double)clock() - (double)tic)/(double)CLK_TCK;  report_open(          &report, "./out/report");  report_ratio_entry(   &report,"Overhead time", t0, 1., "seconds");  report_ratio_entry(   &report,"Time in loop", t1, 1., "seconds");  report_ratio_entry(   &report,"Time in loop", t1, 60., "minutes");  report_ratio_entry(   &report,"Relative overhead time", 100.*t0, t1, "%");  report_integer_entry( &report,"Number of frame", frame, "");  report_ratio_entry(   &report,"Average time per frame",                          t1, (double)frame , "seconds");  report_integer_entry( &report,"Number of timesteps", --time, "");  report_ratio_entry(   &report,"Average time per timestep",                          t1, (double)time, "seconds");  report_partition(     &report);  report_integer_entry( &report,"Size of lattice structure",                          get_sizeof_lattice_structure( lattice), "bytes");  report_integer_entry( &report,"Size of lattice",                          get_sizeof_lattice( lattice), "bytes");  report_ratio_entry(   &report,"Size of lattice",                          get_sizeof_lattice( lattice),                          pow(2.,20.),                         "MB");  report_ratio_entry(   &report,"Percentage of active nodes",                          100.*(double)get_num_active_nodes( lattice),                          (double)lattice->NumNodes,                         "%");  report_close(         &report);#if INAMURO_SIGMA_COMPONENT  dump_sigma_btc( lattice);#endif /* INAMURO_SIGMA_COMPONENT */  destruct_lattice( lattice);#if VERBOSITY_LEVEL > 0  printf("\n");  printf("lb2d_prime.c: main() -- Terminating normally.\n");  printf("\n");#endif /* VERBOSITY_LEVEL > 0 */  return 0;} /* int main( int argc, char **argv) */

⌨️ 快捷键说明

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