Beispiel #1
0
 double 
 BoundaryCondition::getDistance(const Particle& p1, const Particle& p2)
 {
   Vector rij = p1.getPosition() - p2.getPosition();
   applyBC(rij);
   return rij.nrm();
 }
Beispiel #2
0
void Equipotential::InitializeLaplaceSolution()
{
   int j,k,J,K;
   Scalar **rho;  //we need a zero array!  Wasteful, but we only need it once.
   Scalar Vt;

   J=fields->getJ();
   K=fields->getK();
   LaplaceSolution= new Scalar * [J+1];
   for(j=0;j<=J;j++) LaplaceSolution[j]= new Scalar [K+1];

   rho= new Scalar * [J+1];
   for(j=0;j<=J;j++)  { 
      rho[j]= new Scalar [K+1];
      for(k=0;k<=K;k++)
         rho[j][k]=0;
   }

   for(j=0;j<=J;j++) 
      for(k=0;k<=K;k++)
         LaplaceSolution[j][k]=0;
   Vt=V;
   V=1.0;
   applyBC(LaplaceSolution);
   V=Vt;

   if (!(fields->getBoltzmannFlag()))
      fields->getPoissonSolve()->laplace_solve(LaplaceSolution,rho,100,(fields->getpresidue()/**0.01*/));

   //now to delete those things we so painstakingly created
   for(j=0;j<=J;j++)
      delete [] rho[j];
   delete [] rho;
}
Beispiel #3
0
  void 
  BCLeesEdwards::applyBC(Vector& pos, Vector& vel) const 
  {
    //Adjust the velocity due to the box shift
    vel[0] -= rint(pos[1] / Sim->primaryCellSize[1]) * _shearRate * Sim->primaryCellSize[1];

    applyBC(pos);
  }
Beispiel #4
0
void
MCLinOp::apply (MultiFab& out,
		MultiFab& in,
		int       level,
		MCBC_Mode bc_mode)
{
    applyBC(in,level,bc_mode);
    Fapply(out,in,level);
}
Beispiel #5
0
void
LinOp::jacobi_smooth (MultiFab&       solnL,
                      const MultiFab& rhsL,
                      int             level,
                      LinOp::BC_Mode  bc_mode)
{        
    applyBC(solnL, 0, 1, level, bc_mode);
    Fsmooth_jacobi(solnL, rhsL, level);
}
Beispiel #6
0
void
MCLinOp::smooth (MultiFab&       solnL,
		 const MultiFab& rhsL,
		 int             level,
		 MCBC_Mode       bc_mode)
{
    for (int phaseflag = 0; phaseflag < numphase; phaseflag++)
    {
	applyBC(solnL, level, bc_mode);
	Fsmooth(solnL, rhsL, level, phaseflag);
    }
}
Beispiel #7
0
void
LinOp::smooth (MultiFab&       solnL,
               const MultiFab& rhsL,
               int             level,
               LinOp::BC_Mode  bc_mode)
{
    for (int redBlackFlag = 0; redBlackFlag < 2; redBlackFlag++)
    {
        applyBC(solnL, 0, 1, level, bc_mode);
        Fsmooth(solnL, rhsL, level, redBlackFlag);
    }
}
Beispiel #8
0
void BCManager::run()
{
  if (jacT != Teuchos::null) isAdjoint = true;
  typedef ParameterList::ConstIterator ParamIter;
  for (ParamIter i = bcParams.begin(); i != bcParams.end(); ++i)
  {
    std::string const& name = bcParams.name(i);
    Teuchos::ParameterEntry const& entry = bcParams.entry(i);
    assert(entry.isList());
    applyBC(Teuchos::getValue<ParameterList>(entry));
  }
}
Beispiel #9
0
  void 
  BCPeriodicExceptX::applyBC(Vector  &pos, const double&) const 
  { 
    double x = pos[0];

    for (size_t n = 0; n < NDIM; ++n)
      pos[n] -= Sim->primaryCellSize[n] *
	lrint(pos[n] / Sim->primaryCellSize[n]);    
  
    applyBC(pos); 

    pos[0] = x;
  }
Beispiel #10
0
void
LinOp::apply (MultiFab&      out,
              MultiFab&      in,
              int            level,
              LinOp::BC_Mode bc_mode,
              bool           local,
	      int            src_comp,
	      int            dst_comp,
	      int            num_comp,
	      int            bndry_comp)
{
    applyBC(in,src_comp,num_comp,level,bc_mode,local,bndry_comp);
    Fapply(out,dst_comp,in,src_comp,num_comp,level);
}
Beispiel #11
0
void
ABec4::compFlux (D_DECL(MultiFab &xflux, MultiFab &yflux, MultiFab &zflux),
		 MultiFab& in, bool do_ApplyBC, const BC_Mode& bc_mode,
		 int src_comp, int dst_comp, int num_comp, int bnd_comp)
{
    const int level = 0;
    BL_ASSERT(num_comp==1);

    if (do_ApplyBC)
      applyBC(in,src_comp,num_comp,level,bc_mode,bnd_comp);

    const MultiFab& a = aCoefficients(level);
    const MultiFab& b = bCoefficients(level);

    const bool tiling = true;

#ifdef _OPENMP
#pragma omp parallel
#endif
    for (MFIter inmfi(in,tiling); inmfi.isValid(); ++inmfi)
    {
        D_TERM(const Box& xbx   = inmfi.nodaltilebox(0);,
	       const Box& ybx   = inmfi.nodaltilebox(1);,
Beispiel #12
0
 void 
 BCPeriodicXOnly::applyBC(Vector  &pos, const double&) const 
 { 
   applyBC(pos); 
 }
Beispiel #13
0
 void 
 BCPeriodicXOnly::applyBC(Vector & pos, Vector&) const
 { 
   applyBC(pos);
 }
Beispiel #14
0
 void ParticleSet::applyBC(const ParticlePos_t& pin, ParticlePos_t& pout) {
   applyBC(pin,pout,0,pin.size());
 }