Real SphericalHarmonicBCValue::value(const RealVect& a_point,
                                     const RealVect& a_normal,
                                     const Real&     a_time,
                                     const int&      a_comp) const
{
 CH_assert(m_isDefined);

  Real value;

  FORT_GETSHPHIPOINT(CHF_REAL(value),
                     CHF_CONST_REALVECT(m_lmphase),
                     CHF_CONST_REALVECT(a_point),
                     CHF_CONST_REAL(a_time));

  return value;
}
Example #2
0
void
EBPoissonOp::
applyOpRegularAllDirs(Box * a_loBox,
                      Box * a_hiBox,
                      int * a_hasLo,
                      int * a_hasHi,
                      Box & a_curDblBox,
                      Box & a_curPhiBox,
                      int a_nComps,
                      BaseFab<Real> & a_curOpPhiFAB,
                      const BaseFab<Real> & a_curPhiFAB,
                      bool a_homogeneousPhysBC,
                      const DataIndex& a_dit,
                      const Real& a_beta)
{
  CH_TIME("EBPoissonOp::applyOpRegularAllDirs");
  CH_assert(m_domainBC != NULL);

  //need to monkey with the ghost cells to account for boundary conditions
  BaseFab<Real>& phiFAB = (BaseFab<Real>&) a_curPhiFAB;
  applyDomainFlux(a_loBox, a_hiBox, a_hasLo, a_hasHi,
                  a_curDblBox, a_nComps, phiFAB,
                  a_homogeneousPhysBC, a_dit,m_beta);

  for (int comp = 0; comp<a_nComps; comp++)
    {

      FORT_REGGET1DLAPLACIAN_INPLACE(CHF_FRA1(a_curOpPhiFAB,comp),
                                     CHF_CONST_FRA1(a_curPhiFAB,comp),
                                     CHF_CONST_REAL(a_beta),
                                     CHF_CONST_REALVECT(m_dx),
                                     CHF_BOX(a_curDblBox));
    }
}
Example #3
0
// Sets parameters in a common block used by Fortran routines:
//   a_smallPressure - Lower limit for pressure (returned)
//   a_gamma         - Gamma for polytropic, gamma-law gas
//   a_ms            - Mach shock number of the discontinuity
//   a_center        - Center of the explosion
//   a_size          - Initial radius of the explosion
//   a_velocity      - Initial velocity of the gas
//   a_artvisc       - Artificial viscosity coefficient
void
ExplosionIBC::setFortranCommon(Real&           a_smallPressure,
                               const Real&     a_gamma,
                               const Real&     a_ms,
                               const RealVect& a_center,
                               const Real&     a_size,
                               const RealVect& a_velocity,
                               const Real&     a_artvisc)
{
  CH_assert(m_isFortranCommonSet == false);

  FORT_EXPLOSIONSETF(CHF_REAL(a_smallPressure),
                     CHF_CONST_REAL(a_gamma),
                     CHF_CONST_REAL(a_ms),
                     CHF_CONST_REALVECT(a_center),
                     CHF_CONST_REAL(a_size),
                     CHF_CONST_REALVECT(a_velocity),
                     CHF_CONST_REAL(a_artvisc));

  m_isFortranCommonSet = true;
}
Example #4
0
void EBPoissonOp::
GSColorAllRegular(LevelData<EBCellFAB>&        a_phi,
                  const LevelData<EBCellFAB>&  a_rhs,
                  const IntVect&               a_color,
                  const Real&                  a_weight,
                  const bool&                  a_homogeneousPhysBC)
{
  CH_TIME("EBPoissonOp::GSColorAllRegular");
  CH_assert(a_rhs.ghostVect() == m_ghostCellsRHS);
  CH_assert(a_phi.ghostVect() == m_ghostCellsPhi);

  int nComps = a_phi.nComp();
  for (DataIterator dit = a_phi.dataIterator(); dit.ok(); ++dit)
    {
      Box dblBox(m_eblg.getDBL().get(dit()));
      BaseFab<Real>& phiFAB       = (a_phi[dit()] ).getSingleValuedFAB();
      const BaseFab<Real>& rhsFAB = (a_rhs[dit()] ).getSingleValuedFAB();

      Box loBox[SpaceDim],hiBox[SpaceDim];
      int hasLo[SpaceDim],hasHi[SpaceDim];

      applyDomainFlux(loBox, hiBox, hasLo, hasHi,
                      dblBox, nComps, phiFAB,
                      a_homogeneousPhysBC, dit(),m_beta);

      IntVect loIV = dblBox.smallEnd();
      IntVect hiIV = dblBox.bigEnd();

      for (int idir = 0; idir < SpaceDim; idir++)
        {
          if (loIV[idir] % 2 != a_color[idir])
            {
              loIV[idir]++;
            }
        }

      if (loIV <= hiIV)
        {
          Box coloredBox(loIV, hiIV);

          for (int comp=0; comp<a_phi.nComp(); comp++)
            {
              FORT_DOALLREGULARMULTICOLOR(CHF_FRA1(phiFAB,comp),
                                          CHF_CONST_FRA1(rhsFAB,comp),
                                          CHF_CONST_REAL(a_weight),
                                          CHF_CONST_REAL(m_alpha),
                                          CHF_CONST_REAL(m_beta),
                                          CHF_CONST_REALVECT(m_dx),
                                          CHF_BOX(coloredBox));
            }
        }
    }
}
Example #5
0
Real TrigBCBetaValue::beta(const RealVect& a_point,
                           const Real&     a_time) const
{
 CH_assert(m_isDefined);

  Real value;

  FORT_GETBETAPOINT(CHF_REAL(value),
                    CHF_CONST_INTVECT(m_trig),
                    CHF_CONST_REALVECT(a_point),
                    CHF_CONST_REAL(a_time));

  return value;
}
Real SphericalHarmonicBCBetaValue::beta(const RealVect& a_point,
                                        const Real&     a_time) const
{
 CH_assert(m_isDefined);

  Real value;

  FORT_GETBETAPOINT(CHF_REAL(value),
                    CHF_CONST_INTVECT(m_lmphase),
                    CHF_CONST_REALVECT(a_point),
                    CHF_CONST_REAL(a_time));

  return value;
}
Example #7
0
// Set up initial conditions
void AdvectTestIBC::initialize(LevelData<FArrayBox>& a_U)
{
  DisjointBoxLayout grids = a_U.disjointBoxLayout();
  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
    {
      const Box& grid = grids.get(dit());
      FORT_ADVECTINITF(CHF_FRA1(a_U[dit()],0),
                       CHF_CONST_REALVECT(m_center),
                       CHF_CONST_REAL(m_size),
                       CHF_CONST_REAL(m_dx),
                       CHF_BOX(grid));

    }

}
Example #8
0
// Sets parameters in a common block used by Fortran routines:
//   a_smallPressure  - Lower limit for pressure (returned)
//   a_gamma          - Gamma for polytropic, gamma-law gas
//   a_ambientDensity - Ambient density add to the plane-wave
//   a_deltaDensity   - Mean of the plane-wave
//   a_pressure       - If 0, use isentropic pressure
//                      if 1, use the constant pressure of 1.0
//   a_waveNumber     - The wave number of the plane-wave
//   a_velocity       - Initial velocity of the gas
//   a_center         - Position of a maximum of the plane-wave
//   a_artvisc        - Artificial viscosity coefficient
void WaveIBC::setFortranCommon(Real&           a_smallPressure,
                               const Real&     a_gamma,
                               const Real&     a_ambientDensity,
                               const Real&     a_deltaDensity,
                               const int&      a_pressure,
                               const IntVect&  a_waveNumber,
                               const RealVect& a_center,
                               const RealVect& a_velocity,
                               const Real&     a_artvisc)
{
  CH_assert(m_isFortranCommonSet == false);

  FORT_WAVESETF(CHF_REAL(a_smallPressure),
                CHF_CONST_REAL(a_gamma),
                CHF_CONST_REAL(a_ambientDensity),
                CHF_CONST_REAL(a_deltaDensity),
                CHF_CONST_INT(a_pressure),
                CHF_CONST_INTVECT(a_waveNumber),
                CHF_CONST_REALVECT(a_center),
                CHF_CONST_REALVECT(a_velocity),
                CHF_CONST_REAL(a_artvisc));

  m_isFortranCommonSet = true;
}
Example #9
0
Real TrigBCBetaValue::value(const RealVect& a_point,
                            const RealVect& a_normal,
                            const Real&     a_time,
                            const int&      a_comp) const
{
 CH_assert(m_isDefined);

  Real value;

  FORT_GETPHIPOINT(CHF_REAL(value),
                   CHF_CONST_INTVECT(m_trig),
                   CHF_CONST_REALVECT(a_point),
                   CHF_CONST_REAL(a_time));

  return value;
}
Example #10
0
Real MarshaFlux::value(const RealVect& a_point,
                       const RealVect& a_normal,
                       const Real&     a_time,
                       const int&      a_comp)  const
{
  RealVect gradient;
  FORT_GETMARSHAGRADPHIPOINT(CHF_REALVECT(gradient),
                             CHF_CONST_REALVECT(a_point));

  Real flux = 0.0;
  for (int idir = 0; idir < SpaceDim; idir++)
  {
    flux += gradient[idir] * a_normal[idir];
  }

  return flux;
}
Example #11
0
void NewPoissonOp::
levelRelaxColor(FArrayBox&       a_phi,
                const FArrayBox& a_rhs,
                const IntVect&   a_color,
                const Real&      a_weight,
                const bool&      a_homogeneousPhysBC)
{
  CH_assert(a_phi.nComp() == 1);

  Box dblBox = a_rhs.box();

  //apply domain boundary condtions
  m_bc(a_phi, m_domain.domainBox(), m_domain, m_dx[0], a_homogeneousPhysBC);

  //find box over which we are iterating
  IntVect loIV = dblBox.smallEnd();
  IntVect hiIV = dblBox.bigEnd();

  for (int idir = 0; idir < SpaceDim; idir++)
    {
      if (loIV[idir] % 2 != a_color[idir])
        {
          loIV[idir]++;
        }
    }

  if (loIV <= hiIV)
    {
      Box coloredBox(loIV, hiIV);
      int comp = 0;
      Real alpha = 0;
      Real beta = 1.;
      FORT_AMRPMULTICOLOR(CHF_FRA1(a_phi,comp),
                          CHF_CONST_FRA1(a_rhs,comp),
                          CHF_CONST_REAL(a_weight),
                          CHF_CONST_REAL(alpha),
                          CHF_CONST_REAL(beta),
                          CHF_CONST_REALVECT(m_dx),
                          CHF_BOX(coloredBox));
    }
}