Show
Ignore:
Timestamp:
09/26/2005 10:31:27 PM (6 years ago)
Author:
powell
Message:

0.5: illum bug workaround, params output at start, date and doc update.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/castabox/castabox.c

    r180 r191  
    2828#ifdef DEBUG 
    2929#define DPRINTF(fmt, args...) ierr = PetscPrintf (PETSC_COMM_WORLD, "%s: " fmt, __FUNCT__, args); CHKERRQ (ierr) 
    30 #define NDPRINTF(fmt, args...) 
    3130#else 
    3231#define DPRINTF(fmt, args...) 
    33 #define NDPRINTF(args...) ierr = PetscPrintf (PETSC_COMM_WORLD, args); CHKERRQ (ierr) 
    3432#endif 
    3533 
     
    3735   castabox -help */ 
    3836static 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\ 
    4038\n\ 
    4139This very simple program simulates 3-D heat conduction and solidification of\n\ 
     
    6967  -top_tenv ##    [default 0.0]     -top_h ##         [default 0.5]\n\ 
    7068  -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\ 
     70q = h (T-Tenv) + epssig (T^4 - Tenv^4)]\n\ 
    7371\n\ 
    7472The maximum possible explicit timestep size is calculated automatically from\n\ 
     
    273271                    0.,0.,1.,.5, 1.,0.,1.,.5 }; 
    274272  int ts=0, plots=6, keepon=1, ierr; 
     273  char outstring [101]; 
    275274 
    276275  DPRINTF ("Calculating maximum stable explicit timestep size.\n",0); 
     
    292291  ierr = DARestoreGlobalVector (box_da, &global); CHKERRQ (ierr); 
    293292 
    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", 
    297294            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 
    298301 
    299302  while (keepon) 
     
    352355                                      PETSC_NULL, PETSC_NULL, PETSC_NULL); 
    353356                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; 
    354361                ierr = GeomviewDisplayTriangulation 
    355362                  (PETSC_COMM_WORLD, minmax, "Temperature", PETSC_FALSE); CHKERRQ(ierr); 
     
    403410                ts++; 
    404411 
    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", 
    408413                          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 
    409420 
    410421                if (plots) 
     
    417428                                          PETSC_NULL, PETSC_NULL, PETSC_NULL); 
    418429                    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; 
    419434                    ierr = GeomviewDisplayTriangulation 
    420435                      (PETSC_COMM_WORLD, minmax, "Temperature", PETSC_FALSE); CHKERRQ(ierr); 
    421436                  } 
    422437              } 
     438#ifndef DEBUG 
    423439            if (count) 
    424440              { 
    425                 NDPRINTF ("\n"); 
     441                ierr = PetscPrintf (PETSC_COMM_WORLD, "\n"); CHKERRQ (ierr); 
    426442              } 
     443#endif 
    427444            break; 
    428445          } 
     
    520537  ierr = PetscOptionsGetScalar (PETSC_NULL, "-top_epssig", &p.top_epssig, 
    521538                                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); 
    522551 
    523552  DPRINTF ("Creating the distributed array with box stencil of width 1,\n"