00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _NEUMANNCONDUCTIVITYDOMAINBC_H_
00012 #define _NEUMANNCONDUCTIVITYDOMAINBC_H_
00013
00014 #include "RefCountedPtr.H"
00015 #include "ConductivityBaseDomainBC.H"
00016 #include "NeumannPoissonDomainBC.H"
00017 #include "BaseBCValue.H"
00018 #include "NamespaceHeader.H"
00019
00020 class NeumannConductivityDomainBC: public ConductivityBaseDomainBC
00021 {
00022 public:
00023 NeumannConductivityDomainBC();
00024
00025 virtual ~NeumannConductivityDomainBC();
00026
00027 virtual int whichBC(int a_idir,
00028 Side::LoHiSide a_side);
00029
00030 bool isDirichletDom(const VolIndex& a_ivof,
00031 const VolIndex& a_jvof,
00032 const EBCellFAB& a_phi) const
00033 {
00034 return false;
00035 }
00036
00037 virtual void getFaceFlux(BaseFab<Real>& a_faceFlux,
00038 const BaseFab<Real>& a_phi,
00039 const RealVect& a_probLo,
00040 const RealVect& a_dx,
00041 const int& a_idir,
00042 const Side::LoHiSide& a_side,
00043 const DataIndex& a_dit,
00044 const Real& a_time,
00045 const bool& a_useHomogeneous);
00046
00047 virtual void getFaceFlux(Real& a_faceFlux,
00048 const VolIndex& a_vof,
00049 const int& a_comp,
00050 const EBCellFAB& a_phi,
00051 const RealVect& a_probLo,
00052 const RealVect& a_dx,
00053 const int& a_idir,
00054 const Side::LoHiSide& a_side,
00055 const DataIndex& a_dit,
00056 const Real& a_time,
00057 const bool& a_useHomogeneous);
00058
00059 virtual void getFaceGradPhi(Real& a_faceFlux,
00060 const FaceIndex& a_face,
00061 const int& a_comp,
00062 const EBCellFAB& a_phi,
00063 const RealVect& a_probLo,
00064 const RealVect& a_dx,
00065 const int& a_idir,
00066 const Side::LoHiSide& a_side,
00067 const DataIndex& a_dit,
00068 const Real& a_time,
00069 const bool& a_useAreaFrac,
00070 const RealVect& a_centroid,
00071 const bool& a_useHomogeneous);
00072
00073 virtual void getFaceVel(Real& a_faceFlux,
00074 const FaceIndex& a_face,
00075 const EBFluxFAB& a_vel,
00076 const RealVect& a_probLo,
00077 const RealVect& a_dx,
00078 const int& a_idir,
00079 const int& a_icomp,
00080 const Real& a_time,
00081 const Side::LoHiSide& a_side);
00082
00083 virtual void
00084 fillPhiGhost(FArrayBox& a_phi,
00085 const Box& a_valid,
00086 const Box& a_domain,
00087 Real a_dx,
00088 bool a_homogeneous)
00089 {
00090 Box grownBox = a_valid;
00091 grownBox.grow(1);
00092
00093 for (int idir=0; idir<CH_SPACEDIM; ++idir)
00094 {
00095 for(SideIterator sit; sit.ok(); ++sit)
00096 {
00097 Box choppedBox = grownBox;
00098 choppedBox.grow(idir,-1);
00099 Box toRegion = adjCellBox(choppedBox, idir, sit(), 1);
00100
00101 if(!a_domain.contains(toRegion))
00102 {
00103 for (BoxIterator bit(toRegion); bit.ok(); ++bit)
00104 {
00105 const IntVect& iv = bit();
00106
00107 VolIndex vof(iv, 0);
00108 RealVect loc = EBArith::getVoFLocation(vof, a_dx, RealVect::Zero);
00109 int isign = sign(sit());
00110 IntVect ivneigh = iv - isign*BASISV(idir);
00111 Real value = bcvaluefunc(loc, idir, sit());
00112 if(a_homogeneous) value = 0;
00113 a_phi(iv, 0) = a_phi(ivneigh, 0) + a_dx*value;
00114 }
00115 }
00116 }
00117 }
00118 }
00119 private:
00120
00121
00122 };
00123
00124 class NeumannConductivityDomainBCFactory: public BaseDomainBCFactory
00125 {
00126 public:
00127 NeumannConductivityDomainBCFactory();
00128
00129 virtual ~NeumannConductivityDomainBCFactory();
00130
00131 virtual void setValue(Real a_value);
00132
00133 virtual void setFunction(RefCountedPtr<BaseBCFuncEval> a_flux);
00134
00135 virtual NeumannConductivityDomainBC* create(const ProblemDomain& a_domain,
00136 const EBISLayout& a_layout,
00137 const RealVect& a_dx);
00138
00139 private:
00140 bool m_onlyHomogeneous;
00141 bool m_isFunction;
00142
00143 Real m_value;
00144 RefCountedPtr<BaseBCFuncEval> m_flux;
00145
00146 };
00147
00148 #include "NamespaceFooter.H"
00149 #endif