本文整理汇总了C++中EBISBox::bndryCentroid方法的典型用法代码示例。如果您正苦于以下问题:C++ EBISBox::bndryCentroid方法的具体用法?C++ EBISBox::bndryCentroid怎么用?C++ EBISBox::bndryCentroid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBISBox
的用法示例。
在下文中一共展示了EBISBox::bndryCentroid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vofit
void
kappaDivergence(EBCellFAB& a_divF,
const EBFluxFAB& a_flux,
const EBISBox& a_ebisBox,
const Box& a_box,
const Real& a_dx)
{
//set the divergence initially to zero
//then loop through directions and increment the divergence
//with each directions flux difference.
a_divF.setVal(0.0);
BaseFab<Real>& regDivF = a_divF.getSingleValuedFAB();
regDivF.setVal(0.);
for (int idir = 0; idir < SpaceDim; idir++)
{
//update for the regular vofs in the nonconservative
//case works for all single valued vofs.
/* do the regular vofs */
/**/
const EBFaceFAB& fluxDir = a_flux[idir];
const BaseFab<Real>& regFluxDir = fluxDir.getSingleValuedFAB();
int ncons = 1;
FORT_DIVERGEF( CHF_BOX(a_box),
CHF_FRA(regDivF),
CHF_CONST_FRA(regFluxDir),
CHF_CONST_INT(idir),
CHF_CONST_INT(ncons),
CHF_CONST_REAL(a_dx));
/**/
}
//update the irregular vofs using conservative diff
IntVectSet ivsIrreg = a_ebisBox.getIrregIVS(a_box);
for (VoFIterator vofit(ivsIrreg, a_ebisBox.getEBGraph()); vofit.ok(); ++vofit)
{
const VolIndex& vof = vofit();
//divergence was set in regular update. we reset it
// to zero and recalc.
Real update = 0.;
for ( int idir = 0; idir < SpaceDim; idir++)
{
const EBFaceFAB& fluxDir = a_flux[idir];
for (SideIterator sit; sit.ok(); ++sit)
{
int isign = sign(sit());
Vector<FaceIndex> faces =
a_ebisBox.getFaces(vof, idir, sit());
for (int iface = 0; iface < faces.size(); iface++)
{
const FaceIndex& face = faces[iface];
Real areaFrac = a_ebisBox.areaFrac(face);
Real faceFlux =fluxDir(face, 0);
update += isign*areaFrac*faceFlux;
}
}
}
//add EB boundary condtions in divergence
const IntVect& iv = vof.gridIndex();
Real bndryArea = a_ebisBox.bndryArea(vof);
RealVect bndryCent = a_ebisBox.bndryCentroid(vof);
RealVect normal = a_ebisBox.normal(vof);
RealVect bndryLoc;
RealVect exactF;
for (int idir = 0; idir < SpaceDim; idir++)
{
bndryLoc[idir] = a_dx*(iv[idir] + 0.5 + bndryCent[idir]);
}
for (int idir = 0; idir < SpaceDim; idir++)
{
exactF[idir] = exactFlux(bndryLoc, idir);
}
Real bndryFlux = PolyGeom::dot(exactF, normal);
update -= bndryFlux*bndryArea;
update /= a_dx; //note NOT divided by volfrac
a_divF(vof, 0) = update;
}
}