示例#1
0
void PolytropicPhysics::postNormalPred(FArrayBox&       a_dWMinus,
                                       FArrayBox&       a_dWPlus,
                                       const FArrayBox& a_W,
                                       const Real&      a_dt,
                                       const Real&      a_dx,
                                       const int&       a_dir,
                                       const Box&       a_box)
{
    // Bound "a_dWMinus" and "a_dWPlus" so that density and pressure will never
    // be less than "smallr" and "smallp", respectively
    FORT_POSTNORMALPREDF(CHF_FRA(a_dWMinus),
                         CHF_FRA(a_dWPlus),
                         CHF_CONST_FRA(a_W),
                         CHF_BOX(a_box));
}
示例#2
0
// ---------------------------------------------------------
void
NodeMGInterp::define(const DisjointBoxLayout& a_grids,
                     int a_numcomps,
                     int a_refRatio,
                     const ProblemDomain& a_domain)
{
  m_refRatio = a_refRatio;
  m_domain = a_domain;
  m_grids = a_grids;

  m_boxRef = Box(IntVect::Zero, (m_refRatio-1)*IntVect::Unit);
  Box corners(IntVect::Zero, IntVect::Unit);
  m_weights.define(corners, m_boxRef.numPts());
  FORT_NODEINTERPMG_GETWEIGHTS(CHF_CONST_INT(m_refRatio),
                               CHF_BOX(m_boxRef),
                               CHF_FRA(m_weights));

  // create the work array
  DisjointBoxLayout coarsenedGrids;
  coarsen(coarsenedGrids, a_grids, m_refRatio);

  m_coarsenedFine.define(coarsenedGrids, a_numcomps);

  is_defined = true;
}
示例#3
0
// Set boundary slopes:
//   The boundary slopes in a_dW are already set to one sided difference
//   approximations.  If this function doesn't change them they will be
//   used for the slopes at the boundaries.
void ExplosionIBC::setBdrySlopes(FArrayBox&       a_dW,
                                 const FArrayBox& a_W,
                                 const int&       a_dir,
                                 const Real&      a_time)
{
  CH_assert(m_isFortranCommonSet == true);
  CH_assert(m_isDefined == true);

  // In periodic case, this doesn't do anything
  if (!m_domain.isPeriodic(a_dir))
  {
    Box loBox,hiBox,centerBox,domain;
    int hasLo,hasHi;
    Box slopeBox = a_dW.box();
    slopeBox.grow(a_dir,1);

    // Generate the domain boundary boxes, loBox and hiBox, if there are
    // domain boundarys there
    loHiCenter(loBox,hasLo,hiBox,hasHi,centerBox,domain,
               slopeBox,m_domain,a_dir);

    // Set the boundary slopes if necessary
    if ((hasLo != 0) || (hasHi != 0))
    {
      FORT_SLOPEBCSF(CHF_FRA(a_dW),
                     CHF_CONST_FRA(a_W),
                     CHF_CONST_INT(a_dir),
                     CHF_BOX(loBox),
                     CHF_CONST_INT(hasLo),
                     CHF_BOX(hiBox),
                     CHF_CONST_INT(hasHi));
    }
  }
}
示例#4
0
// ----------------------------------------------------------
void
CoarseAverageEdge::averageGridData(FluxBox& a_coarsenedFine,
                                   const FluxBox& a_fine) const
{
  for (int dir=0; dir<SpaceDim; dir++)
    {
      FArrayBox& coarseFab = a_coarsenedFine[dir];
      const FArrayBox& fineFab = a_fine[dir];

      const Box& coarseBox = coarseFab.box();

      // set up refinement box
      int boxHi = m_nRef-1;
      IntVect hiVect(D_DECL(boxHi,boxHi,boxHi));
      // don't want to index at all in dir direction --
      // instead, want to just march along edge.
      hiVect.setVal(dir,0);
      IntVect loVect(D_DECL(0,0,0));
      Box refBox(loVect, hiVect);

      FORT_AVERAGEEDGE( CHF_FRA(coarseFab),
                        CHF_CONST_FRA(fineFab),
                        CHF_BOX(coarseBox),
                        CHF_CONST_INT(dir),
                        CHF_CONST_INT(m_nRef),
                        CHF_BOX(refBox));
    }
}
示例#5
0
// Set boundary fluxes
void RampIBC::primBC(FArrayBox&            a_WGdnv,
                     const FArrayBox&      a_Wextrap,
                     const FArrayBox&      a_W,
                     const int&            a_dir,
                     const Side::LoHiSide& a_side,
                     const Real&           a_time)
{
  CH_assert(m_isFortranCommonSet == true);
  CH_assert(m_isDefined == true);

  // Neither the x or y direction can be periodic
  if ((a_dir == 0 || a_dir == 1) && m_domain.isPeriodic(a_dir))
    {
      MayDay::Error("RampIBC::primBC: Neither the x or y boundaries can be periodic");
    }

  Box boundaryBox;
  getBoundaryFaces(boundaryBox, a_WGdnv.box(), a_dir, a_side);

  if (! boundaryBox.isEmpty() )
    {
      // Set the boundary fluxes
      int lohisign = sign(a_side);
      FORT_RAMPBCF(CHF_FRA(a_WGdnv),
                   CHF_CONST_FRA(a_Wextrap),
                   CHF_CONST_FRA(a_W),
                   CHF_CONST_REAL(a_time),
                   CHF_CONST_INT(lohisign),
                   CHF_CONST_REAL(m_dx),
                   CHF_CONST_INT(a_dir),
                   CHF_BOX(boundaryBox));
    }
}
示例#6
0
void NewPoissonOp::
levelGSRB(FArrayBox&       a_phi,
          const FArrayBox& a_rhs)
{
  CH_assert(a_phi.nComp() == a_rhs.nComp());

  Real dx = m_dx[0];

  // do first red, then black passes
  for (int whichPass =0; whichPass <= 1; whichPass++)
    {

      m_bc(a_phi,  m_domain.domainBox(), m_domain,  dx, true);

      // now step through grids...
      //fill in intersection of ghostcells and a_phi's boxes
      // dfm -- for a 5 point stencil, this should not be necessary
      //a_phi.exchange(a_phi.interval(), m_exchangeCopier);

      // invoke physical BC's where necessary
      //m_bc(a_phi,  m_domain,  dx, true); //new approach to help with checker
#ifndef NDEBUG

#endif

      FORT_GSRBLAPLACIAN(CHF_FRA(a_phi),
                         CHF_CONST_FRA(a_rhs),
                         CHF_BOX(a_rhs.box()),
                         CHF_CONST_REAL(dx),
                         CHF_CONST_INT(whichPass));

    } // end loop through red-black
}
示例#7
0
EBCellFAB&
EBCellFAB::divide(const EBCellFAB& a_src,
                  int a_srccomp,
                  int a_destcomp,
                  int a_numcomp)
{

  CH_assert(isDefined());
  CH_assert(a_src.isDefined());
  // Dan G. feels strongly that the assert below should NOT be commented out
  // Brian feels that a weaker version of the CH_assert (if possible) is needed
  // Terry is just trying to get his code to work
  //CH_assert(m_ebisBox == a_src.m_ebisBox);

  CH_assert(a_srccomp + a_numcomp <= a_src.m_nComp);
  CH_assert(a_destcomp + a_numcomp <= m_nComp);
  bool sameRegBox = (a_src.m_regFAB.box() == m_regFAB.box());

  Box locRegion = a_src.m_region & m_region;
  if (!locRegion.isEmpty())
    {
      FORT_DIVIDETWOFAB(CHF_FRA(m_regFAB),
                        CHF_CONST_FRA(a_src.m_regFAB),
                        CHF_BOX(locRegion),
                        CHF_INT(a_srccomp),
                        CHF_INT(a_destcomp),
                        CHF_INT(a_numcomp));
      if (sameRegBox && (locRegion == m_region && locRegion == a_src.m_region))
        {
          Real* l = m_irrFAB.dataPtr(a_destcomp);
          const Real* r = a_src.m_irrFAB.dataPtr(a_srccomp);
          int nvof = m_irrFAB.numVoFs();
          CH_assert(nvof == a_src.m_irrFAB.numVoFs());
          for (int i=0; i<a_numcomp*nvof; i++)
            l[i]/=r[i];
        }
      else
        {
          IntVectSet ivsMulti = a_src.getMultiCells();
          ivsMulti &= getMultiCells();
          ivsMulti &= locRegion;
          IVSIterator ivsit(ivsMulti);
          for (ivsit.reset(); ivsit.ok(); ++ivsit)
            {
              const IntVect& iv = ivsit();
              Vector<VolIndex> vofs = m_ebisBox.getVoFs(iv);
              for (int ivof = 0; ivof < vofs.size(); ivof++)
                {
                  const VolIndex& vof = vofs[ivof];
                  for (int icomp = 0; icomp < a_numcomp; ++icomp)
                    {
                      m_irrFAB(vof, a_destcomp+icomp) /=
                        a_src.m_irrFAB(vof, a_srccomp+icomp);
                    }
                }
            }
        }
    }
  return *this;
}
示例#8
0
EBCellFAB&
EBCellFAB::operator+=(const Real& a_src)
{
  CH_assert(isDefined());
  FORT_ADDFABR(CHF_FRA(m_regFAB),
               CHF_CONST_REAL(a_src),
               CHF_BOX(m_region));

  Real* l = m_irrFAB.dataPtr(0);
  int nvof = m_irrFAB.numVoFs();
  for (int i=0; i<m_nComp*nvof; i++)
    l[i] += a_src;

  // const IntVectSet& ivsMulti = getMultiCells();
  // IVSIterator ivsit(ivsMulti);
  // for (ivsit.reset(); ivsit.ok(); ++ivsit)
  //   {
  //     const IntVect& iv = ivsit();
  //     Vector<VolIndex> vofs = m_ebisBox.getVoFs(iv);
  //     for (int ivof = 0; ivof < vofs.size(); ivof++)
  //       {
  //         const VolIndex& vof = vofs[ivof];
  //         for (int icomp = 0; icomp < m_nComp; ++icomp)
  //           {
  //             m_irrFAB(vof, icomp) += a_src;
  //           }
  //       }
  //   }
  return *this;
}
示例#9
0
// ---------------------------------------------------------
void levelDivergenceMAC(LevelData<FArrayBox>& a_div,
                        const LevelData<FluxBox>& a_uEdge,
                        const Real a_dx)
{

  // silly way to do this until i figure out a better
  // way to make this dimensionally-independent
  CH_assert (a_uEdge.nComp() >= a_div.nComp());


  DataIterator dit = a_div.dataIterator();
  for (dit.reset(); dit.ok(); ++dit)
  {
    a_div[dit()].setVal(0.0);

    const FluxBox& thisFluxBox = a_uEdge[dit()];
    Box cellBox(thisFluxBox.box());
    // just to be sure we don't accidentally trash memory...
    cellBox &= a_div[dit()].box();

    // now loop over coordinate directions and add to divergence
    for (int dir=0; dir<SpaceDim; dir++)
    {
      const FArrayBox& uEdgeDir = thisFluxBox[dir];

      FORT_DIVERGENCE(CHF_CONST_FRA(uEdgeDir),
                      CHF_FRA(a_div[dit()]),
                      CHF_BOX(cellBox),
                      CHF_CONST_REAL(a_dx),
                      CHF_INT(dir));
    }

  }

}
示例#10
0
void NewPoissonOp::restrictResidual(FArrayBox& a_resCoarse,
                                    FArrayBox& a_phiFine,
                                    const FArrayBox& a_rhsFine)
{

  Real dx = m_dx[0];

  FArrayBox& phi = a_phiFine;
  m_bc(phi,  m_domain.domainBox(), m_domain,  dx, true);

  const FArrayBox& rhs = a_rhsFine;
  FArrayBox& res = a_resCoarse;

  Box region = rhs.box();

  res.setVal(0.0);
  Real alpha = 0;
  Real beta = 1.0;
  FORT_RESTRICTRES(CHF_FRA(res),
                   CHF_CONST_FRA(phi),
                   CHF_CONST_FRA(rhs),
                   CHF_CONST_REAL(alpha),
                   CHF_CONST_REAL(beta),
                   CHF_BOX(region),
                   CHF_CONST_REAL(dx));

}
示例#11
0
/**
  Given input left and right states in a direction, a_dir, compute a
  Riemann problem and generate fluxes at the faces within a_box.
  */
void LinElastPhysics::riemann(/// face-centered solution to Riemann problem
    FArrayBox&       a_WStar,
    /// left state, on cells to left of each face
    const FArrayBox& a_WLeft,
    /// right state, on cells to right of each face
    const FArrayBox& a_WRight,
    /// state on cells, used to set boundary conditions
    const FArrayBox& a_W,
    /// current time
    const Real&      a_time,
    /// direction of faces
    const int&       a_dir,
    /// face-centered box on which to set a_WStar
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::riemann" << endl;
    CH_assert(isDefined());

    CH_assert(a_WStar.box().contains(a_box));

    // Get the numbers of relevant variables
    int numPrim = numPrimitives();

    CH_assert(a_WStar .nComp() == numPrim);
    CH_assert(a_WLeft .nComp() == numPrim);
    CH_assert(a_WRight.nComp() == numPrim);

    // Cast away "const" inputs so their boxes can be shifted left or right
    // 1/2 cell and then back again (no net change is made!)
    FArrayBox& shiftWLeft  = (FArrayBox&)a_WLeft;
    FArrayBox& shiftWRight = (FArrayBox&)a_WRight;

    // Solution to the Riemann problem

    // Shift the left and right primitive variable boxes 1/2 cell so they are
    // face centered
    shiftWLeft .shiftHalf(a_dir, 1);
    shiftWRight.shiftHalf(a_dir,-1);

    CH_assert(shiftWLeft .box().contains(a_box));
    CH_assert(shiftWRight.box().contains(a_box));

    // Riemann solver computes Wgdnv all edges that are not on the physical
    // boundary.
    FORT_RIEMANNF(CHF_FRA(a_WStar),
        CHF_CONST_FRA(shiftWLeft),
        CHF_CONST_FRA(shiftWRight),
        CHF_CONST_INT(a_dir),
        CHF_BOX(a_box));

    // Call boundary Riemann solver (note: periodic BC's are handled there).
    m_bc->primBC(a_WStar,shiftWLeft ,a_W,a_dir,Side::Hi,a_time);
    m_bc->primBC(a_WStar,shiftWRight,a_W,a_dir,Side::Lo,a_time);

    // Shift the left and right primitive variable boxes back to their original
    // position.
    shiftWLeft .shiftHalf(a_dir,-1);
    shiftWRight.shiftHalf(a_dir, 1);
}
示例#12
0
void VCAMRPoissonOp2::residualI(LevelData<FArrayBox>&       a_lhs,
                               const LevelData<FArrayBox>& a_phi,
                               const LevelData<FArrayBox>& a_rhs,
                               bool                        a_homogeneous)
{
  CH_TIME("VCAMRPoissonOp2::residualI");

  LevelData<FArrayBox>& phi = (LevelData<FArrayBox>&)a_phi;
  Real dx = m_dx;
  const DisjointBoxLayout& dbl = a_lhs.disjointBoxLayout();
  DataIterator dit = phi.dataIterator();
  {
    CH_TIME("VCAMRPoissonOp2::residualIBC");

    for (dit.begin(); dit.ok(); ++dit)
    {
      m_bc(phi[dit], dbl[dit()],m_domain, dx, a_homogeneous);
    }
  }

  phi.exchange(phi.interval(), m_exchangeCopier);

  for (dit.begin(); dit.ok(); ++dit)
    {
      const Box& region = dbl[dit()];
      const FluxBox& thisBCoef = (*m_bCoef)[dit];

#if CH_SPACEDIM == 1
      FORT_VCCOMPUTERES1D
#elif CH_SPACEDIM == 2
      FORT_VCCOMPUTERES2D
#elif CH_SPACEDIM == 3
      FORT_VCCOMPUTERES3D
#else
      This_will_not_compile!
#endif
                         (CHF_FRA(a_lhs[dit]),
                          CHF_CONST_FRA(phi[dit]),
                          CHF_CONST_FRA(a_rhs[dit]),
                          CHF_CONST_REAL(m_alpha),
                          CHF_CONST_FRA((*m_aCoef)[dit]),
                          CHF_CONST_REAL(m_beta),
#if CH_SPACEDIM >= 1
                          CHF_CONST_FRA(thisBCoef[0]),
#endif
#if CH_SPACEDIM >= 2
                          CHF_CONST_FRA(thisBCoef[1]),
#endif
#if CH_SPACEDIM >= 3
                          CHF_CONST_FRA(thisBCoef[2]),
#endif
#if CH_SPACEDIM >= 4
                          This_will_not_compile!
#endif
                          CHF_BOX(region),
                          CHF_CONST_REAL(m_dx));
    } // end loop over boxes
}
示例#13
0
// ---------------------------------------------------------
// interpolate from coarse level to fine level
void
NodeMGInterp::interpToFine(LevelData<NodeFArrayBox>& a_fine,
                           const LevelData<NodeFArrayBox>& a_coarse,
                           bool a_sameGrids) // a_sameGrids default false
{
  CH_assert(is_defined);
  const int nComp = a_fine.nComp();
  CH_assert(a_coarse.nComp() == nComp);

  // Copy a_coarse to m_coarsenedFine on grids of m_coarsenedFine.

  // petermc, 15 Nov 2002:
  // You don't need a Copier for this copyTo, because
  // the grid layout of the destination, m_coarsenedFine,
  // will be contained in that of the source, a_coarse.
  if (! a_sameGrids)
    {
      a_coarse.copyTo(a_coarse.interval(),
                      m_coarsenedFine,
                      m_coarsenedFine.interval() );
    }

  for (DataIterator dit = m_grids.dataIterator(); dit.ok(); ++dit)
    {
      Box fineBox = m_grids.get(dit());
      Box crseBox = coarsen(fineBox, m_refRatio);

      const FArrayBox& crseFab = (a_sameGrids) ?
        a_coarse[dit()].getFab() : m_coarsenedFine[dit()].getFab();

      FArrayBox& fineFab = a_fine[dit()].getFab();

      FORT_NODEINTERPMG(CHF_FRA(fineFab),
                        CHF_CONST_FRA(crseFab),
                        CHF_BOX(crseBox),
                        CHF_CONST_INT(m_refRatio),
                        CHF_BOX(m_boxRef),
                        CHF_FRA(m_weights));

      // dummy statement in order to get around gdb bug
      int dummy_unused = 0; dummy_unused = 0;
    }
}
示例#14
0
EBCellFAB& EBCellFAB::plus(const EBCellFAB& a_src,
                           const Box& a_region,
                           int a_srccomp,
                           int a_destcomp,
                           int a_numcomp)
{
  CH_assert(isDefined());
  CH_assert(a_src.isDefined());
  CH_assert(a_srccomp + a_numcomp <= a_src.m_nComp);
  CH_assert(a_destcomp + a_numcomp <= m_nComp);
  const Box& locRegion = a_region;
  bool sameRegBox = (a_src.m_regFAB.box() == m_regFAB.box());

  if (!locRegion.isEmpty())
    {
      FORT_ADDTWOFAB(CHF_FRA(m_regFAB),
                     CHF_CONST_FRA(a_src.m_regFAB),
                     CHF_BOX(locRegion),
                     CHF_INT(a_srccomp),
                     CHF_INT(a_destcomp),
                     CHF_INT(a_numcomp));

      if (sameRegBox && (locRegion == m_region && locRegion == a_src.m_region))
        {
          Real* l = m_irrFAB.dataPtr(a_destcomp);
          const Real* r = a_src.m_irrFAB.dataPtr(a_srccomp);
          int nvof = m_irrFAB.numVoFs();
          CH_assert(nvof == a_src.m_irrFAB.numVoFs());
          for (int i=0; i<a_numcomp*nvof; i++)
            l[i]+=r[i];
        }
      else
        {
          IntVectSet ivsMulti = a_src.getMultiCells();
          ivsMulti &= getMultiCells();
          ivsMulti &= locRegion;
          IVSIterator ivsit(ivsMulti);
          for (ivsit.reset(); ivsit.ok(); ++ivsit)
            {
              const IntVect& iv = ivsit();
              Vector<VolIndex> vofs = m_ebisBox.getVoFs(iv);
              for (int ivof = 0; ivof < vofs.size(); ivof++)
                {
                  const VolIndex& vof = vofs[ivof];
                  for (int icomp = 0; icomp < a_numcomp; ++icomp)
                    {
                      m_irrFAB(vof, a_destcomp+icomp) +=
                        a_src.m_irrFAB(vof, a_srccomp+icomp);
                    }
                }
            }
        }
    }
  return *this;
}
示例#15
0
文件: RSIBC.cpp 项目: jjle/tetemoko
void RSIBC::updateBoundary(const FArrayBox& a_WHalf,int a_dir,const Real& a_dt,const Real& a_dx,const Real& a_time,const bool a_final)
{
    if(a_dir == 1 && bdryLo(m_domain,a_dir).contains(bdryLo(a_WHalf.box(),a_dir)))
    {
        if(a_final)
        {
            FORT_RSSETBND(
                CHF_FRA((*m_bdryData)),
                CHF_BOX(bdryLo(a_WHalf.box(),a_dir)),
                CHF_CONST_FRA((*m_bdryData)),
                CHF_CONST_FRA(a_WHalf),
                CHF_CONST_REAL(a_dt),
                CHF_CONST_REAL(a_dx),
                CHF_CONST_REAL(a_time));
        }
        // THIS MAY BE NECESSARY IN 3-D, NOT SURE!!!
        // else if(m_tmpBdryDataSet)
        // {
        //     FORT_RSSETBND(
        //         CHF_FRA((*m_tmpBdryData)),
        //         CHF_BOX(bdryLo(a_WHalf.box(),a_dir)),
        //         CHF_CONST_FRA((*m_tmpBdryData)),
        //         CHF_CONST_FRA(a_WHalf),
        //         CHF_CONST_REAL(a_dt),
        //         CHF_CONST_REAL(a_dx),
        //         CHF_CONST_REAL(a_time));
        // }
        else
        {
            // m_tmpBdryData = new FArrayBox(m_bdryData->box(), m_numBdryVars);
            FORT_RSSETBND(
                CHF_FRA((*m_tmpBdryData)),
                CHF_BOX(bdryLo(a_WHalf.box(),a_dir)),
                CHF_CONST_FRA((*m_bdryData)),
                CHF_CONST_FRA(a_WHalf),
                CHF_CONST_REAL(a_dt),
                CHF_CONST_REAL(a_dx),
                CHF_CONST_REAL(a_time));
            m_tmpBdryDataSet = true;
        }
    }
}
示例#16
0
/**
  Compute the characteristic values (eigenvalues)

  IMPORTANT NOTE: It is assumed that the characteristic analysis puts the
  smallest eigenvalue first, the largest eigenvalue last, and orders the
  characteristic variables accordingly.
  */
void LinElastPhysics::charValues(FArrayBox&       a_lambda,
    const FArrayBox& a_W,
    const int&       a_dir,
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::charValues" << endl;
    CH_assert(isDefined());

    FORT_CHARVALUESF(CHF_FRA(a_lambda),
        CHF_BOX(a_box));
}
示例#17
0
void LinElastPhysics::plasticUpdate(FArrayBox& a_U,
    const Real&      a_dt,
    const Box&       a_box)
{
    // pout() << "LinElastPhysics::plasticUpdate - Box : " << a_box << endl;
    // pout() << "LinElastPhysics::plasticUpdate - dt  : " << a_dt << endl;
    FORT_PLASTICCORRECTION(
        CHF_FRA(a_U),
        CHF_CONST_REAL(a_dt),
        CHF_BOX(a_box));
}
示例#18
0
void PolytropicPhysics::charValues(FArrayBox&       a_lambda,
                                   const FArrayBox& a_W,
                                   const int&       a_dir,
                                   const Box&       a_box)
{
    CH_assert(isDefined());

    FORT_CHARVALUESF(CHF_FRA(a_lambda),
                     CHF_CONST_FRA(a_W),
                     CHF_CONST_INT(a_dir),
                     CHF_BOX(a_box));
}
示例#19
0
// Compute the primitive variables from the conserved variables
void PolytropicPhysics::consToPrim(FArrayBox&       a_W,
                                   const FArrayBox& a_U,
                                   const Box&       a_box)
{
    CH_assert(isDefined());
    CH_assert(a_U.box().contains(a_box));
    CH_assert(a_W.box().contains(a_box));

    FORT_CONSTOPRIMF(CHF_FRA(a_W),
                     CHF_CONST_FRA(a_U),
                     CHF_BOX(a_box));
}
示例#20
0
void PolytropicPhysics::charSynthesis(FArrayBox&       a_dW,
                                      const FArrayBox& a_W,
                                      const int&       a_dir,
                                      const Box&       a_box)
{
    CH_assert(isDefined());

    FORT_CHARSYNTHESISF(CHF_FRA(a_dW),
                        CHF_CONST_FRA(a_W),
                        CHF_CONST_INT(a_dir),
                        CHF_BOX(a_box));
}
示例#21
0
void PolytropicPhysics::getFlux(FArrayBox&       a_flux,
                                const FArrayBox& a_whalf,
                                const int&       a_dir,
                                const Box&       a_box)
{
    CH_assert(isDefined());

    FORT_GETFLUXF(CHF_FRA(a_flux),
                  CHF_CONST_FRA(a_whalf),
                  CHF_CONST_INT(a_dir),
                  CHF_BOX(a_box));
}
示例#22
0
void LinElastPhysics::getFlux(FArrayBox&       a_flux,
    const FArrayBox& a_whalf,
    const int&       a_dir,
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::getFlux :: " << a_dir << endl;
    CH_assert(isDefined());

    FORT_GETFLUXF(CHF_FRA(a_flux),
        CHF_CONST_FRA(a_whalf),
        CHF_CONST_INT(a_dir),
        CHF_BOX(a_box));
}
示例#23
0
/**
  On input, a_dW contains the increments of the characteristic variables.
  On output, it contains the increments in the primitive variables.

  IMPORTANT NOTE: It is assumed that the characteristic analysis puts the
  smallest eigenvalue first, the largest eigenvalue last, and orders the
  characteristic variables accordingly.
  */
void LinElastPhysics::charSynthesis(FArrayBox&       a_dW,
    const FArrayBox& a_W,
    const int&       a_dir,
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::charSynthesis" << endl;
    CH_assert(isDefined());

    FORT_CHARSYNTHESISF(CHF_FRA(a_dW),
        CHF_CONST_FRA(a_W),
        CHF_CONST_INT(a_dir),
        CHF_BOX(a_box));
}
示例#24
0
// Compute a Riemann problem and generate fluxes at the faces.
void PolytropicPhysics::riemann(FArrayBox&       a_WGdnv,
                                const FArrayBox& a_WLeft,
                                const FArrayBox& a_WRight,
                                const FArrayBox& a_W,
                                const Real&      a_time,
                                const int&       a_dir,
                                const Box&       a_box)
{
    CH_assert(isDefined());

    CH_assert(a_WGdnv.box().contains(a_box));

    // Get the numbers of relevant variables
    int numPrim = numPrimitives();

    CH_assert(a_WGdnv .nComp() == numPrim);
    CH_assert(a_WLeft .nComp() == numPrim);
    CH_assert(a_WRight.nComp() == numPrim);

    // Cast away "const" inputs so their boxes can be shifted left or right
    // 1/2 cell and then back again (no net change is made!)
    FArrayBox& shiftWLeft  = (FArrayBox&)a_WLeft;
    FArrayBox& shiftWRight = (FArrayBox&)a_WRight;

    // Solution to the Riemann problem

    // Shift the left and right primitive variable boxes 1/2 cell so they are
    // face centered
    shiftWLeft .shiftHalf(a_dir, 1);
    shiftWRight.shiftHalf(a_dir,-1);

    CH_assert(shiftWLeft .box().contains(a_box));
    CH_assert(shiftWRight.box().contains(a_box));

    // Riemann solver computes Wgdnv all edges that are not on the physical
    // boundary.
    FORT_RIEMANNF(CHF_FRA(a_WGdnv),
                  CHF_CONST_FRA(shiftWLeft),
                  CHF_CONST_FRA(shiftWRight),
                  CHF_CONST_INT(a_dir),
                  CHF_BOX(a_box));

    // Call boundary Riemann solver (note: periodic BC's are handled there).
    m_bc->primBC(a_WGdnv,shiftWLeft ,a_W,a_dir,Side::Hi,a_time);
    m_bc->primBC(a_WGdnv,shiftWRight,a_W,a_dir,Side::Lo,a_time);

    // Shift the left and right primitive variable boxes back to their original
    // position.
    shiftWLeft .shiftHalf(a_dir,-1);
    shiftWRight.shiftHalf(a_dir, 1);
}
示例#25
0
void LinElastPhysics::consToPrim(FArrayBox&       a_W,
    const FArrayBox& a_U,
    const Box&       a_box)
{
    //JK Our primitives are our conserved variables
    //JK pout() << "LinElastPhysics::consToPrim" << endl;
    CH_assert(isDefined());
    CH_assert(a_U.box().contains(a_box));
    CH_assert(a_W.box().contains(a_box));

    FORT_COPYF(CHF_FRA(a_W),
        CHF_CONST_FRA(a_U),
        CHF_BOX(a_box));
}
示例#26
0
EBCellFAB&
EBCellFAB::operator/=(const Real& a_src)
{
  CH_assert(isDefined());
  FORT_DIVIDEFABR(CHF_FRA(m_regFAB),
                  CHF_CONST_REAL(a_src),
                  CHF_BOX(m_region));

  Real* l = m_irrFAB.dataPtr(0);
  int nvof = m_irrFAB.numVoFs();
  for (int i=0; i<m_nComp*nvof; i++)
    l[i] /= a_src;

  return *this;
}
示例#27
0
/**
  On input, a_dW contains the increments of the primitive variables. On
  output, it contains the increments in the characteristic variables.

  IMPORTANT NOTE: It is assumed that the characteristic analysis puts the
  smallest eigenvalue first, the largest eigenvalue last, and orders the
  characteristic variables accordingly.
  */
void LinElastPhysics::charAnalysis(FArrayBox&       a_dW,
    const FArrayBox& a_W,
    const int&       a_dir,
    const Box&       a_box)
{
    //JK pout() << "LinElastPhysics::charAnalysis" << endl;
    CH_assert(isDefined());

    /*
     * This routine assumes that cp >= cs
     */
    FORT_CHARANALYSISF(CHF_FRA(a_dW),
        CHF_CONST_FRA(a_W),
        CHF_CONST_INT(a_dir),
        CHF_BOX(a_box));
}
示例#28
0
void VCAMRPoissonOp2::applyOpNoBoundary(LevelData<FArrayBox>&      a_lhs,
                                        const LevelData<FArrayBox>& a_phi)
{
  CH_TIME("VCAMRPoissonOp2::applyOpNoBoundary");

  LevelData<FArrayBox>& phi = (LevelData<FArrayBox>&)a_phi;

  const DisjointBoxLayout& dbl = a_lhs.disjointBoxLayout();
  DataIterator dit = phi.dataIterator();

  phi.exchange(phi.interval(), m_exchangeCopier);

  for (dit.begin(); dit.ok(); ++dit)
    {
      const Box& region = dbl[dit()];
      const FluxBox& thisBCoef = (*m_bCoef)[dit];

#if CH_SPACEDIM == 1
      FORT_VCCOMPUTEOP1D
#elif CH_SPACEDIM == 2
      FORT_VCCOMPUTEOP2D
#elif CH_SPACEDIM == 3
      FORT_VCCOMPUTEOP3D
#else
      This_will_not_compile!
#endif
                        (CHF_FRA(a_lhs[dit]),
                         CHF_CONST_FRA(phi[dit]),
                         CHF_CONST_REAL(m_alpha),
                         CHF_CONST_FRA((*m_aCoef)[dit]),
                         CHF_CONST_REAL(m_beta),
#if CH_SPACEDIM >= 1
                         CHF_CONST_FRA(thisBCoef[0]),
#endif
#if CH_SPACEDIM >= 2
                         CHF_CONST_FRA(thisBCoef[1]),
#endif
#if CH_SPACEDIM >= 3
                         CHF_CONST_FRA(thisBCoef[2]),
#endif
#if CH_SPACEDIM >= 4
                         This_will_not_compile!
#endif
                         CHF_BOX(region),
                         CHF_CONST_REAL(m_dx));
    } // end loop over boxes
}
示例#29
0
// Set boundary fluxes
void ExplosionIBC::primBC(FArrayBox&            a_WGdnv,
                          const FArrayBox&      a_Wextrap,
                          const FArrayBox&      a_W,
                          const int&            a_dir,
                          const Side::LoHiSide& a_side,
                          const Real&           a_time)
{
  CH_assert(m_isFortranCommonSet == true);
  CH_assert(m_isDefined == true);

  // In periodic case, this doesn't do anything
  if (!m_domain.isPeriodic(a_dir))
  {
    int lohisign;
    Box tmp = a_WGdnv.box();

    // Determine which side and thus shifting directions
    lohisign = sign(a_side);
    tmp.shiftHalf(a_dir,lohisign);

    // Is there a domain boundary next to this grid
    if (!m_domain.contains(tmp))
    {
      tmp &= m_domain;

      Box boundaryBox;

      // Find the strip of cells next to the domain boundary
      if (a_side == Side::Lo)
      {
        boundaryBox = bdryLo(tmp,a_dir);
      }
      else
      {
        boundaryBox = bdryHi(tmp,a_dir);
      }

      // Set the boundary fluxes
      FORT_SOLIDBCF(CHF_FRA(a_WGdnv),
                    CHF_CONST_FRA(a_Wextrap),
                    CHF_CONST_FRA(a_W),
                    CHF_CONST_INT(lohisign),
                    CHF_CONST_INT(a_dir),
                    CHF_BOX(boundaryBox));
    }
  }
}
示例#30
0
// Compute increment of primitive variables.
void PolytropicPhysics::quasilinearUpdate(FArrayBox&       a_dWdx,
        const FArrayBox& a_WHalf,
        const FArrayBox& a_W,
        const Real&      a_scale,
        const int&       a_dir,
        const Box&       a_box)
{
    CH_assert(isDefined());
    CH_assert(a_dWdx.box().contains(a_box));

    FORT_GETADWDXF(CHF_FRA(a_dWdx),
                   CHF_CONST_FRA(a_WHalf),
                   CHF_CONST_FRA(a_W),
                   CHF_CONST_REAL(a_scale),
                   CHF_CONST_INT(a_dir),
                   CHF_BOX(a_box));
}