示例#1
0
int main(int argc, char* argv[])
{ 
  int status = 0;
#ifdef CH_USE_PETSC
  PetscInt nlev;
  PetscErrorCode ierr;
  char string[64]; 
  PetscBool set;
  PetscInitialize(&argc,&argv,(char*)0,help);

  PetscOptionsGetInt(PETSC_NULL,"-n",&s_nCells0,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-bc_debug",&s_debug,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-plot_fas",&s_amrfas,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-plot_mg",&s_amrmg,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-corner_stencil",&s_corner_stencil,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-matlab",&s_matlab,PETSC_NULL);
  PetscOptionsGetBool(PETSC_NULL,"-plot",&s_plot,PETSC_NULL);
  PetscOptionsGetReal(PETSC_NULL,"-error_thresh",&s_error_thresh,PETSC_NULL);
  PetscOptionsGetInt(PETSC_NULL,"-blocking_factor",&s_blockingfactor,PETSC_NULL);
  PetscOptionsGetInt(PETSC_NULL,"-order",&s_order,PETSC_NULL);
  PetscOptionsGetInt(PETSC_NULL,"-nesting",&s_nesting,PETSC_NULL);
  PetscOptionsGetInt(PETSC_NULL,"-max_box_size",&s_maxboxsz,PETSC_NULL);
  PetscOptionsGetInt(PETSC_NULL,"-refinement_ratio",&s_refRatio,PETSC_NULL);
  PetscOptionsGetString(PETSC_NULL,"-amr_type",string,64,&set);
  if (set && strcmp(string,"error")==0) s_amr_type_iserror = true;
  else s_amr_type_iserror = false;

  nlev = 4;
  PetscOptionsGetInt(PETSC_NULL,"-nlevels",&nlev,PETSC_NULL);
  ierr = go(nlev,status); CHKERRQ(ierr);

  CH_TIMER_REPORT();

  ierr = PetscFinalize(); CHKERRQ(ierr);
#endif
  return status;
}
示例#2
0
文件: plane.cpp 项目: rsnemmen/Chombo
int main (int argc, char** argv)
{
#ifdef CH_MPI
  MPI_Init(&argc,&argv);
#endif

  // Begin forever present scoping trick
  {
    const char* in_file = "plane.inputs";

    if (argc > 1)
    {
      in_file = argv[1];
    }

    // Parse input file
    ParmParse pp(0,NULL,NULL,in_file);

    Box domain;
    RealVect origin;
    Real dx;

    BaseIF* implicit;

    // Make geometry
    implicit = makeGeometry(domain,origin,dx);

    // Make grids
    DisjointBoxLayout grids;
    makeLayout(grids,domain);

    // Create ebislayout
    int nghost = 0;
    EBISLayout ebisl;
    makeEBISL(ebisl,grids,domain,nghost);

    // Make a LevelData
    int nComps = 1;

    IntVect ghost = IntVect::Unit;
    ghost *= nghost;

    RefCountedPtr<DataFactory<EBCellFAB> > rcpFactory(new EBCellFactory(ebisl));
    LevelData<EBCellFAB> level(grids,nComps,ghost,*rcpFactory);

    // Put some data in the data holders
    fillData(level,origin,dx,*implicit);

    // Done with this object
    delete implicit;

    // Write the data and the EB out
    const char* basename = "plane";

    char name[1000];
    sprintf(name,"%s%dd.hdf5",basename,SpaceDim);
#ifdef CH_USE_HDF5
    writeEBLevelname(&level,name);
#endif
  } // End scoping trick

  // Clean up
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();

  CH_TIMER_REPORT();

#ifdef CH_MPI
  MPI_Finalize();
#endif

  return 0;
}
int
main(int a_argc, char* a_argv[])
{
#ifdef CH_MPI
  MPI_Init(&a_argc,&a_argv);
#endif
  //Scoping trick
  {
    CH_TIMERS("uber_timers");
    CH_TIMER("define_geometry", t1);
    CH_TIMER("run", t2);

#ifdef CH_MPI
    MPI_Barrier(Chombo_MPI::comm);
#endif

    //Check for an input file
    char* inFile = NULL;
    if (a_argc > 1)
      {
        inFile = a_argv[1];
      }
    else
      {
        pout() << "Usage: <executable name> <inputfile>" << endl;
        pout() << "No input file specified" << endl;
        return -1;
      }

    //Parse the command line and the input file (if any)
    ParmParse pp(a_argc-2,a_argv+2,NULL,inFile);

    ProblemDomain coarsestDomain;
    RealVect coarsestDx;
    AMRParameters params;
    getAMRINSParameters(params, coarsestDomain);
    int numFilt;
    pp.get("num_filter_iterations", numFilt);
    params.m_numFilterIterations = numFilt;

    int gphiIterations;
    pp.get("num_gphi_iterations", gphiIterations);
    params.m_gphiIterations = gphiIterations;

    int initIterations;
    pp.get("num_init_iterations", initIterations);
    params.m_initIterations = initIterations;

    bool doRegridSmoothing;
    pp.get("do_regrid_smoothing", doRegridSmoothing);
    params.m_doRegridSmoothing = doRegridSmoothing;

    CH_START(t1);

    //define geometry
    AMRINSGeometry(params, coarsestDomain);

    CH_STOP(t1);

    CH_START(t2);
    ebamriTransport(params, coarsestDomain);
    CH_STOP(t2);

    EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
    ebisPtr->clear();

  }//end scoping trick
#ifdef CH_MPI
  CH_TIMER_REPORT();
  dumpmemoryatexit();
  MPI_Finalize();
#endif
}