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