Ejemplo n.º 1
0
int main(int argc, char* argv[])
{

  BoxLayout layoutCoar(s_numblockpower);
  BoxLayout layoutFine(s_numblockpower+1);
  double dxCoar = s_dx   ;
  double dxFine = s_dx/2.;
  LevelData<double, 1> errorFine(layoutFine, 0);
  LevelData<double, 1> errorCoar(layoutCoar, 0);

  double maxErrorFine, maxErrorCoar;
  getError(errorFine, maxErrorFine, dxFine);
  getError(errorCoar, maxErrorCoar, dxCoar);
  
  double order = log(maxErrorCoar/maxErrorFine)/log(2.);
  cout << "L_inf(Fine error) = " << maxErrorFine << endl;
  cout << "L_inf(Coar error) = " << maxErrorCoar << endl;

  cout << "order of laplacian operator = " <<  order << endl;

  return 0;
}
Ejemplo n.º 2
0
int
main(int argc, char** argv)

{

#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif
  int eekflag = 0;
  {//begin forever present scoping trick

    const char* in_file = "ramp.inputs";
    //parse input file
    ParmParse pp(0,NULL,NULL,in_file);
    //define the geometry object.
    //need the new and delete because of
    //strong construction
    //make the gometry.  this makes the first Chombo_EBIS
    Box domainFine, domainCoar;
    Real dxFine, dxCoar;

    //and defines it using a geometryservice
    eekflag =  makeGeometry(domainFine,  dxFine);
    CH_assert(eekflag == 0);

    domainCoar = coarsen(domainFine, 2);
    dxCoar = 2.0*dxFine;
    //make grids
    DisjointBoxLayout gridsFine, gridsCoar;
    eekflag = makeLayout(gridsFine, domainFine);
    CH_assert(eekflag == 0);
    coarsen(gridsCoar, gridsFine, 2);

    ///create ebislayout
    int nghost = 2;
    EBISLayout ebislFine, ebislCoar;
    eekflag = makeEBISL(ebislFine, gridsFine, domainFine, nghost);
    if (eekflag != 0) return eekflag;
    eekflag = makeEBISL(ebislCoar, gridsCoar, domainCoar, nghost);
    if (eekflag != 0) return eekflag;

    int nvar = 1;
    EBCellFactory ebcellfactFine(ebislFine);
    EBCellFactory ebcellfactCoar(ebislCoar);
    IntVect ivghost = nghost*IntVect::Unit;
    LevelData<EBCellFAB> errorFine(gridsFine, nvar,
                                   ivghost,ebcellfactFine);
    LevelData<EBCellFAB> errorCoar(gridsCoar, nvar,
                                   ivghost,ebcellfactCoar);

    eekflag = getError(errorFine,ebislFine, gridsFine, domainFine, dxFine);
    if (eekflag != 0) return eekflag;

    eekflag = getError(errorCoar,ebislCoar, gridsCoar, domainCoar, dxCoar);
    if (eekflag != 0) return eekflag;

    eekflag =  compareError(errorFine, ebislFine, gridsFine, domainFine,
                            errorCoar, ebislCoar, gridsCoar, domainCoar);
    if (eekflag != 0) return eekflag;

  }//end omnipresent scoping trick
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();
  if (eekflag == 0)
    {
      pout() << "aggpwlfpTest passed" << endl;
    }

#ifdef CH_MPI
  MPI_Finalize();
#endif
  return eekflag;
}