Changeset 191 for trunk/matml/src/castabox
- Timestamp:
- 09/26/2005 10:31:27 PM (6 years ago)
- Files:
-
- 1 modified
-
trunk/matml/src/castabox/castabox.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/matml/src/castabox/castabox.c
r180 r191 28 28 #ifdef DEBUG 29 29 #define DPRINTF(fmt, args...) ierr = PetscPrintf (PETSC_COMM_WORLD, "%s: " fmt, __FUNCT__, args); CHKERRQ (ierr) 30 #define NDPRINTF(fmt, args...)31 30 #else 32 31 #define DPRINTF(fmt, args...) 33 #define NDPRINTF(args...) ierr = PetscPrintf (PETSC_COMM_WORLD, args); CHKERRQ (ierr)34 32 #endif 35 33 … … 37 35 castabox -help */ 38 36 static char help[] = 39 "Cast-a-box version 0. 1 by Adam Powell March 21, 2003\n\37 "Cast-a-box version 0.5 by Adam Powell September 25, 2005\n\ 40 38 \n\ 41 39 This very simple program simulates 3-D heat conduction and solidification of\n\ … … 69 67 -top_tenv ## [default 0.0] -top_h ## [default 0.5]\n\ 70 68 -top_epssig ## [default 5.67e-11]\n\ 71 [The top surface has a mixed convection-radiation boundary condition which\n\72 defaults to radiation (h=0):q = h (T-Tenv) + epssig (T^4 - Tenv^4)]\n\69 [The top surface has a mixed convection-radiation boundary condition:\n\ 70 q = h (T-Tenv) + epssig (T^4 - Tenv^4)]\n\ 73 71 \n\ 74 72 The maximum possible explicit timestep size is calculated automatically from\n\ … … 273 271 0.,0.,1.,.5, 1.,0.,1.,.5 }; 274 272 int ts=0, plots=6, keepon=1, ierr; 273 char outstring [101]; 275 274 276 275 DPRINTF ("Calculating maximum stable explicit timestep size.\n",0); … … 292 291 ierr = DARestoreGlobalVector (box_da, &global); CHKERRQ (ierr); 293 292 294 DPRINTF ("Timestep %d (time %g): deltat = %g, Tmax=%g, Tmin=%g\n", 295 ts, current_time, deltat, Tmax, Tmin); 296 NDPRINTF ("\rTimestep %d (time %g): deltat=%g, Tmax=%g, Tmin=%g \n", 293 snprintf (outstring,100,"Timestep %d (time %g): deltat %g, Tmax %g, Tmin %g", 297 294 ts, current_time, deltat, Tmax, Tmin); 295 #ifdef DEBUG 296 ierr = PetscPrintf (PETSC_COMM_WORLD, "%s\n", outstring); CHKERRQ (ierr); 297 #else 298 strncat (outstring, " ", 79-strlen(outstring)); 299 ierr = PetscPrintf (PETSC_COMM_WORLD, "\r%s\n", outstring); CHKERRQ (ierr); 300 #endif 298 301 299 302 while (keepon) … … 352 355 PETSC_NULL, PETSC_NULL, PETSC_NULL); 353 356 CHKERRQ (ierr); 357 /* Work-around for illuminator non-periodic bug */ 358 minmax[1] = p.width_x * (p.grid_x-1) / p.grid_x; 359 minmax[3] = p.width_y * (p.grid_y-1) / p.grid_y; 360 minmax[5] = p.width_z * (p.grid_z-1) / p.grid_z; 354 361 ierr = GeomviewDisplayTriangulation 355 362 (PETSC_COMM_WORLD, minmax, "Temperature", PETSC_FALSE); CHKERRQ(ierr); … … 403 410 ts++; 404 411 405 DPRINTF ("Timestep %d (time %g): deltat = %g, Tmax=%g, Tmin=%g\n", 406 ts, current_time, deltat, Tmax, Tmin); 407 NDPRINTF ("\rTimestep %d (time %g): deltat=%g, Tmax=%g, Tmin=%g ", 412 snprintf (outstring,100,"Timestep %d (time %g): deltat %g, Tmax %g, Tmin %g", 408 413 ts, current_time, deltat, Tmax, Tmin); 414 #ifdef DEBUG 415 ierr = PetscPrintf (PETSC_COMM_WORLD, "%s\n", outstring); CHKERRQ (ierr); 416 #else 417 strncat (outstring, " ", 79-strlen(outstring)); 418 ierr = PetscPrintf (PETSC_COMM_WORLD, "\r%s", outstring); CHKERRQ (ierr); 419 #endif 409 420 410 421 if (plots) … … 417 428 PETSC_NULL, PETSC_NULL, PETSC_NULL); 418 429 CHKERRQ (ierr); 430 /* Work-around for illuminator non-periodic bug */ 431 minmax[1] = p.width_x * (p.grid_x-1) / p.grid_x; 432 minmax[3] = p.width_y * (p.grid_y-1) / p.grid_y; 433 minmax[5] = p.width_z * (p.grid_z-1) / p.grid_z; 419 434 ierr = GeomviewDisplayTriangulation 420 435 (PETSC_COMM_WORLD, minmax, "Temperature", PETSC_FALSE); CHKERRQ(ierr); 421 436 } 422 437 } 438 #ifndef DEBUG 423 439 if (count) 424 440 { 425 NDPRINTF ("\n");441 ierr = PetscPrintf (PETSC_COMM_WORLD, "\n"); CHKERRQ (ierr); 426 442 } 443 #endif 427 444 break; 428 445 } … … 520 537 ierr = PetscOptionsGetScalar (PETSC_NULL, "-top_epssig", &p.top_epssig, 521 538 PETSC_NULL); CHKERRQ (ierr); 539 540 DPRINTF ("Simulation parameters:\n",0); 541 DPRINTF ("Grid dimensions: %dx%dx%d, Physical dimensions: %gx%gx%g\n", 542 p.grid_x, p.grid_y, p.grid_z, p.width_x, p.width_y, p.width_z); 543 DPRINTF ("Liquid properties: k=%g, rho=%g, cp=%g, melt temp=%g\n", 544 p.liquid_k, p.liquid_rho, p.liquid_cp, p.melt_temp); 545 DPRINTF ("Solid properties: k=%g, rho=%g, cp=%g, latent heat=%g\n", 546 p.solid_k, p.solid_rho, p.solid_cp, p.latent_heat); 547 DPRINTF ("Env. temperatures: xmax=%g, ymax=%g, top=%g, bottom=%g\n", 548 p.xmax_tenv, p.ymax_tenv, p.top_tenv, p.bottom_tenv); 549 DPRINTF ("h values: xmax=%g, ymax=%g, top=%g, bottom=%g, epssig=%g\n", 550 p.xmax_h, p.ymax_h, p.bottom_h, p.top_h, p.top_epssig); 522 551 523 552 DPRINTF ("Creating the distributed array with box stencil of width 1,\n"