📄 params.h
字号:
skip_label( in); fscanf( in, "%d", &lattice->param.zeroconcgrad_s ); skip_label( in); fscanf( in, "%d", &lattice->param.zeroconcgrad_e ); skip_label( in); fscanf( in, "%d", &lattice->param.zeroconcgrad_w ); skip_label( in); fscanf( in, "%d", &lattice->param.zeroconcgrad_full ); } else { skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); skip_label( in); fscanf( in, "%d", &blank ); } skip_label( in); fscanf( in, "%d", &( lattice->param.plot_scale_dynamic) ); skip_label( in); fscanf( in, "%d", &( lattice->param.use_colormap ) ); skip_label( in); fscanf( in, "%d", &( lattice->param.initial_condition ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.x0 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.y0 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.r0 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.cut ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.x1 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.x2 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.y1 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.y2 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.rel_x1 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.rel_x2 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.rel_y1 ) ); skip_label( in); fscanf( in, "%lf",&( lattice->param.rel_y2 ) ); skip_label( in); fscanf( in, "%d", &( lattice->param.dump_rho ) ); skip_label( in); fscanf( in, "%d", &( lattice->param.dump_u ) ); skip_label( in); fscanf( in, "%d", &( lattice->param.dump_force ) ); skip_label( in); fscanf( in, "%d", &( lattice->param.dump_vor ) ); lattice->NumTimeSteps = lattice->param.NumFrames * lattice->param.FrameRate;#if 0 for( subs=0; subs<NUM_FLUID_COMPONENTS; subs++) { lattice->param.gforce[subs][0] *= lattice->param.tau[subs]; lattice->param.gforce[subs][1] *= lattice->param.tau[subs]; }#endif if( NUM_FLUID_COMPONENTS==2) { lattice->param.rho_A[1] = lattice->param.rho_B[0]; lattice->param.rho_B[1] = lattice->param.rho_A[0]; } if( lattice->param.incompressible) { if( INAMURO_SIGMA_COMPONENT==0) { printf("\n"); printf("\n"); printf("%s (%d) -- ERROR: " "Support for incompressible flow with " "two fluid components (as opposed to Inamuro solute component) " "is pending. (Exiting!)\n", __FILE__, __LINE__); printf("\n"); printf("\n"); exit(1); } } if( lattice->param.simple_diffusion) { if( INAMURO_SIGMA_COMPONENT==0) { printf("\n"); printf("\n"); printf("%s (%d) -- ERROR: " "Support for simplified diffusion with " "two fluid components (as opposed to Inamuro solute component) " "is pending. (Exiting!)\n", __FILE__, __LINE__); printf("\n"); printf("\n"); exit(1); } } // Set default values for x0, y0 and r0 if they are negative. if( lattice->param.x0 < 0.) { lattice->param.x0 = lattice->param.LX/2.; } if( lattice->param.y0 < 0.) { lattice->param.y0 = lattice->param.LY/2.; } if( lattice->param.r0 < 0.) { lattice->param.r0 = (lattice->param.LX+lattice->param.LY)/8.; } // Set default value for cut if it is negative. if( lattice->param.cut < 0.) { lattice->param.cut = .4; } // Set default values for x1, x2, y1, y2 if they are negative. if( lattice->param.x1 < 0.) { if( lattice->param.rel_x1 < 0.) { lattice->param.x1 = lattice->param.LX/4.-1; } else { lattice->param.x1 = lattice->param.rel_x1*lattice->param.LX-1; } } if( lattice->param.x2 < 0.) { if( lattice->param.rel_x2 < 0.) { lattice->param.x2 = lattice->param.LX/2.-1; } else { lattice->param.x2 = lattice->param.rel_x2*lattice->param.LX-1; } } if( lattice->param.y1 < 0.) { if( lattice->param.rel_y1 < 0.) { lattice->param.y1 = lattice->param.LY/4.-1; } else { lattice->param.y1 = lattice->param.rel_y1*lattice->param.LY-1; } } if( lattice->param.y2 < 0.) { if( lattice->param.rel_y2 < 0.) { lattice->param.y2 = lattice->param.LY/2.-1; } else { lattice->param.y2 = lattice->param.rel_y2*lattice->param.LY-1; } } fclose(in);#if VERBOSITY_LEVEL >= 1 printf("lbio.c: read_params() -- Read file \"params.in\".\n");#endif /* VERBOSITY_LEVEL >= 1 */} /* void read_params( struct lattice_struct *lattice) */// void dump_params( struct lattice_struct *lattice)//##############################################################################//// D U M P P A R A M S //// - Output the problem parameters to a file.//void dump_params( struct lattice_struct *lattice){ FILE *o; char filename[1024]; sprintf( filename, "%s", "./out/params.dat"); if( !( o = fopen(filename,"w+"))) { printf("%s %d >> ERROR: fopen(\"%s\",\"w+\") = NULL. Bye, bye!\n", __FILE__, __LINE__, filename); exit(1); } fprintf( o, "LX %d\n", lattice->param.LX ); fprintf( o, "LY %d\n", lattice->param.LY ); fprintf( o, "length_scale %d\n", lattice->param.length_scale ); fprintf( o, "NumNodes %d\n", lattice->NumNodes ); fprintf( o, "NumFrames %d\n", lattice->param.NumFrames ); fprintf( o, "FrameRate %d\n", lattice->param.FrameRate ); fprintf( o, "NumTimeSteps %d\n", lattice->NumTimeSteps ); fprintf( o, "tau[0] %f\n", lattice->param.tau[0] ); fprintf( o, "gforce[0][0] %f\n", lattice->param.gforce[0][0] ); fprintf( o, "gforce[0][1] %f\n", lattice->param.gforce[0][1] ); fprintf( o, "end_grav[0] %d\n", lattice->param.end_grav[0] ); if( NUM_FLUID_COMPONENTS==2) { fprintf( o, "tau[1] %f\n", lattice->param.tau[1] ); fprintf( o, "gforce[1][0] %f\n", lattice->param.gforce[1][0] ); fprintf( o, "gforce[1][1] %f\n", lattice->param.gforce[1][1] ); fprintf( o, "end_grav[1] %d\n", lattice->param.end_grav[1] ); } else if( NUM_FLUID_COMPONENTS==1) { fprintf( o, "tau[1] %s\n", "--" ); fprintf( o, "gforce[1][0] %s\n", "--" ); fprintf( o, "gforce[1][1] %s\n", "--" ); fprintf( o, "end_grav[1] %s\n", "--" ); } else { printf( "read_params() -- " "Unhandled case " "NUM_FLUID_COMPONENTS = %d . " "Exiting!\n", NUM_FLUID_COMPONENTS); exit(1); } fprintf( o, "buoyancy %d\n", lattice->param.buoyancy ); fprintf( o, "incompressible %d\n", lattice->param.incompressible ); fprintf( o, "simple_diffusion %d\n", lattice->param.simple_diffusion); fprintf( o, "rho_A[0] %f\n", lattice->param.rho_A[0] ); fprintf( o, "rho_B[0] %f\n", lattice->param.rho_B[0] ); if( NUM_FLUID_COMPONENTS==2) { fprintf( o, "rho_A[1] %f\n", lattice->param.rho_A[1] ); fprintf( o, "rho_B[1] %f\n", lattice->param.rho_B[1] ); } else if( NUM_FLUID_COMPONENTS==1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -