Example #1
0
void save_output()
{
    if( xyz_file && (step % save_xyz_freq) == 0 ) save_xyz();
    if( dcd_file && (step % save_dcd_freq) == 0 ) save_dcd();
    if( enr_file && (step % save_enr_freq) == 0  ) save_energy();

    if( (step % save_rst_freq) == 0  ) restart_write( rst_filename );/* must be last */
}
Example #2
0
// This function reads header and data (primitives and conserved quantities)
// GODMARK: fills in *global* quantities
// It then outputs restart file for user to check consistency
// CHANGINGMARK: Note that for evolving metric should really store old metric in restart file
int restart_init(int which)
{



  trifprintf("begin restart init\n");

  ////////////////
  //
  // set random seed
  //
  ////////////////
  ranc(1,0);

  ////////////////
  //
  // get restart header and grid data
  //
  ////////////////
  restart_read(which);


  ////////////////
  //
  // set any extra things (only used with restart.rebeccaoldcode.c)
  //
  ////////////////
  trifprintf("before extrarestartfunction()\n");
  extrarestartfunction();


  ////////////////
  //
  // get restart old metric
  //
  ////////////////
  if(DOEVOLVEMETRIC){
    trifprintf("before restartmetric_read(which)\n");
    restartmetric_read(which);
  }

  ////////////////
  //
  // process variables not written to file
  //
  ////////////////
  trifprintf("before restart_process_extra_variables()\n");
  restart_process_extra_variables();
    

  ////////////////
  //
  // set all CPUs to have same restart header stuff (needed in mpicombine==1 mode)
  //
  ////////////////
  trifprintf("before restart_read_defs()\n");
  restart_read_defs();

  ////////////////
  //
  // set coordinate parameters by reading coordparms.dat
  // assumes doesn't overwrite what just set (i.e. what's written to restart file)
  //
  ////////////////
  trifprintf("before read_coord_parms()\n");
  read_coord_parms(defcoord);

  ////////////////
  //
  // write header to screen to all CPUs
  //
  ////////////////
  trifprintf("before write_restart_header(TEXTOUTPUT,log_file)\n");
  fprintf(log_file,"header contents below\n"); fflush(log_file);
  write_restart_header(RESTARTDUMPTYPE,dnumversion[RESTARTDUMPTYPE],dnumcolumns[RESTARTDUMPTYPE],TEXTOUTPUT,log_file);

  ////////////////
  //
  // check if failed inside rdump file
  //
  ////////////////
  if(failed!=0){
    dualfprintf(log_file,"WARNING: failed=%d in rdump file.  Must clense the way between us.\n",failed);
    dualfprintf(log_file,"Setting failed=0\n");
    failed=0;
  }

  // certain global.h parameters may override restart parameters.  This happens, say, when the user decides not to DOAVG after restart, but DOAVGDIAG is still set.  Without this the code will segfault in diag.c
  // corresponds to "if" statements in initbase.c as well, where user has either choice or no choice.
  if(DOAVG==0) DOAVGDIAG=0;



  ////////////////////////
  //
  // test read by looking at written file
  //
  ////////////////////////
  trifprintf("before restart_write(3)\n");
  restart_write(3);

  // can't check (e.g.) images here if wanting to look at conserved quantities

  trifprintf("proc: %d t=%21.15g failed=%d\n", myid, t, failed);



  trifprintf("end restart_init\n");


  return(0);

}