00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _CORRECT1D2D_H_ 00012 #define _CORRECT1D2D_H_ 00013 00014 #include "DisjointBoxLayout.H" 00015 #include "EBCellFAB.H" 00016 #include "EBFaceFAB.H" 00017 #include "LevelData.H" 00018 #include "EBLevelGrid.H" 00019 00020 #include "NamespaceHeader.H" 00021 00022 /// 00023 /** 00024 Given an EB application that uses one algorithm for fluxes on some 00025 boxes and another on other boxes, this will make the solution's fluxes 00026 match at box-box boundaries. In all this class, the winning algorithm 00027 at the boundary is denoted by 2D, the losing by 1D but this would work 00028 for whatever polyalgorithm you choose. 00029 */ 00030 class Correct1D2D 00031 { 00032 public: 00033 static void 00034 makeIntMap(LevelData< BaseFab<int> >& a_intmap, 00035 const LayoutData<bool>& a_is1D, 00036 const DisjointBoxLayout& a_dbl); 00037 00038 Correct1D2D(const EBLevelGrid& a_eblg, 00039 const LayoutData<bool>& a_is1D, 00040 int a_nvar); 00041 00042 ~Correct1D2D() 00043 {;} 00044 00045 00046 /// 00047 /** 00048 sets buffers to zero 00049 */ 00050 void setToZero(); 00051 00052 /// 00053 /** 00054 increments the 1D (losing) buffer by -flux*scale*sign(side) 00055 (side is which side of the changed cell we are talking about) 00056 typically scale = 1/dx[idir] 00057 */ 00058 void increment1D(const EBFaceFAB& a_1DFlux, 00059 const Real& a_scale, 00060 const DataIndex& a_dit); 00061 00062 00063 /// 00064 /** 00065 increments the 2D (winning) buffer by flux*scale*sign(side) 00066 (side is which side of the changed cell we are talking about) 00067 typically scale = 1/dx[idir] 00068 */ 00069 void increment2D(const EBFaceFAB& a_2DFlux, 00070 const Real& a_scale, 00071 const DataIndex& a_dit); 00072 00073 00074 /// 00075 /** 00076 subtracts off change in solution due to losing flux 00077 and adds in change in solution due to winning flux. 00078 */ 00079 void correctSolution(LevelData<EBCellFAB>& a_U); 00080 00081 protected: 00082 00083 LevelData< BaseFab<int> > m_1d2d; 00084 DisjointBoxLayout m_dbl1d[2*SpaceDim]; 00085 DisjointBoxLayout m_dbl2d[2*SpaceDim]; 00086 int m_nvar; 00087 EBLevelGrid m_eblg; 00088 00089 //which VoFs actually get changed 00090 LayoutData< Vector<VolIndex> > m_sets1d[2*SpaceDim]; 00091 LayoutData< Vector<VolIndex> > m_sets2d[2*SpaceDim]; 00092 00093 //change in solution due to 1d (losing) flux 00094 LevelData<EBCellFAB> m_deltaU1d[2*SpaceDim]; 00095 00096 //change in solution due to 2d (winning) flux 00097 LevelData<EBCellFAB> m_deltaU2d[2*SpaceDim]; 00098 00099 int index(int a_dir, Side::LoHiSide a_sd) 00100 { 00101 int retval = a_dir + a_sd*SpaceDim; 00102 return retval; 00103 } 00104 private: 00105 Correct1D2D() 00106 { 00107 MayDay::Error("weak construction disallowed"); 00108 } 00109 00110 Correct1D2D(const Correct1D2D& a_in) 00111 { 00112 MayDay::Error("copy construction disallowed"); 00113 } 00114 00115 void operator=(const Correct1D2D& a_in) 00116 { 00117 MayDay::Error("assignment disallowed"); 00118 } 00119 }; 00120 #include "NamespaceFooter.H" 00121 #endif