00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBGRADDIVFILTER_H_
00012 #define _EBGRADDIVFILTER_H_
00013
00014 #include <iostream>
00015 #include <cmath>
00016 #include "SPACE.H"
00017 #include <cstdlib>
00018 #include <REAL.H>
00019 #include <IntVect.H>
00020 #include <Box.H>
00021 #include <DisjointBoxLayout.H>
00022 #include <LevelData.H>
00023 #include <BaseFab.H>
00024 #include "EBCellFAB.H"
00025 #include "EBTensorCFInterp.H"
00026 #include "CFIVS.H"
00027 #include "EBFluxFAB.H"
00028 #include "EBFaceFAB.H"
00029 #include "NamespaceHeader.H"
00030
00031
00033
00037 class EBGradDivFilter
00038 {
00039 public:
00040
00041
00043
00047 EBGradDivFilter(const DisjointBoxLayout& a_fineGrids,
00048 const DisjointBoxLayout* a_coarGridsPtr,
00049 const EBISLayout& a_ebislFine,
00050 const EBISLayout* a_ebislCoarPtr,
00051 const ProblemDomain& a_domainFine,
00052 const RealVect& a_dxFine,
00053 const int& a_refRat,
00054 const Real& a_lambdaScale = 0.125);
00055
00056
00058 ~EBGradDivFilter();
00059
00060
00062
00070 void filter(LevelData<EBCellFAB>& a_velFine,
00071 const LevelData<EBFluxFAB>& a_fluxVelFine,
00072 const LevelData<EBCellFAB>* a_velCoar,
00073 bool a_lowOrderOneSidedGrad = false,
00074 bool a_noExtrapToCovered = false);
00075
00077
00087 void
00088 gradDiv(LevelData<EBCellFAB>& a_gradDivVel,
00089 LevelData<EBCellFAB>& a_velFine,
00090 const LevelData<EBFluxFAB>& a_fluxVelFine,
00091 const LevelData<EBCellFAB>* a_velCoar,
00092 bool a_lowOrderOneSidedGrad = false,
00093 bool a_noExtrapToCovered = false);
00094
00096 Real getDomainDivergence(const EBCellFAB& a_gradVel,
00097 const EBCellFAB& a_vel,
00098 const EBFluxFAB& a_fluxVel,
00099 const Box& a_grid,
00100 const EBISBox& a_ebisBox,
00101 const int& a_faceDir,
00102 const FaceIndex& a_face,
00103 const Side::LoHiSide& a_side);
00104
00106
00111 void gradDiv(EBCellFAB& a_gradDivVel,
00112 const EBCellFAB& a_gradVel,
00113 const EBCellFAB& a_velFine,
00114 const EBFluxFAB& a_fluxVelFine,
00115 const EBFluxFAB& a_divUFaceCent,
00116 const Box& a_gridFine,
00117 const EBISBox& a_ebisBoxFine,
00118 const DataIndex& a_dit,
00119 bool a_multiplyByLambda,
00120 bool a_noExtrapToCovered);
00121
00123
00129 int getGradComp(int a_velDir, int a_derivDir);
00130
00132
00141 void
00142 gradVel(EBCellFAB& a_gradVel,
00143 const EBCellFAB& a_velFine,
00144 const Box& a_gridFine,
00145 const EBISBox& a_ebisBoxFine,
00146 bool a_lowOrderOneSidedGrad);
00147 void
00148 faceDivergence(EBFaceFAB& a_divVel,
00149 const EBCellFAB& a_gradVel,
00150 const EBCellFAB& a_velFine,
00151 const EBFluxFAB& a_fluxVelFine,
00152 const Box& a_gridFine,
00153 const EBISBox& a_ebisBoxFine,
00154 const int& a_faceDir);
00155
00156 void
00157 cellGradient(EBCellFAB& a_gradDivVel,
00158 const EBCellFAB& a_gradVel,
00159 const EBCellFAB& a_velFine,
00160 const EBFluxFAB& a_fluxVelFine,
00161 const EBFluxFAB& a_divVel,
00162 const Box& a_gridFine,
00163 const EBISBox& a_ebisBoxFine,
00164 const DataIndex& a_dit,
00165 bool a_multiplyByLambda,
00166 bool a_noExtrapToCovered);
00167 protected:
00168
00169 void getAreaFracs(Vector<FaceIndex> a_facesLo[SpaceDim],
00170 Vector<FaceIndex> a_facesHi[SpaceDim],
00171 bool a_hasFacesLo[SpaceDim],
00172 bool a_hasFacesHi[SpaceDim],
00173 RealVect& a_areaFracLo,
00174 RealVect& a_areaFracHi,
00175 const VolIndex& a_vof,
00176 const EBISBox& a_ebisBox);
00177
00178 void fillLambda();
00179
00180 DisjointBoxLayout m_gridsFine;
00181 EBISLayout m_ebislFine;
00182
00183 const DisjointBoxLayout* m_gridsCoarPtr;
00184 const EBISLayout* m_ebislCoarPtr;
00185
00186 ProblemDomain m_domainCoar;
00187 ProblemDomain m_domainFine;
00188 int m_refRat;
00189 bool m_hasCoarser;
00190 EBTensorCFInterp* m_tensorCFI;
00191 RealVect m_dxFine;
00192
00193
00194 LevelData<EBCellFAB> m_gradVel;
00195 LevelData<EBFluxFAB> m_faceDivCell;
00196 LevelData<EBFluxFAB> m_faceDivCent;
00197 LayoutData<BaseIVFAB<VoFStencil> > m_johanStencil;
00198 LayoutData<BaseIVFAB<bool> > m_dropOrder;
00199 LayoutData<BaseIVFAB<Real> > m_distanceAlongLine;
00200 LevelData<EBCellFAB> m_lambda;
00201
00202 Real m_lambdaScale;
00203
00204 private:
00205
00206
00207 EBGradDivFilter()
00208 {
00209 MayDay::Error("invalid operator");
00210 }
00211
00212
00213 EBGradDivFilter(const EBGradDivFilter& a_input)
00214 {
00215 MayDay::Error("invalid operator");
00216 }
00217
00218
00219 void operator=(const EBGradDivFilter& a_input)
00220 {
00221 MayDay::Error("invalid operator");
00222 }
00223 };
00224 #include "NamespaceFooter.H"
00225 #endif