Chombo + EB  3.0
BaseDomainBC.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _BASEDOMAINBC_H_
12 #define _BASEDOMAINBC_H_
13 
14 #include "LoHiSide.H"
15 #include "RealVect.H"
16 #include "FArrayBox.H"
17 
18 #include "VolIndex.H"
19 #include "EBCellFAB.H"
20 #include "EBFaceFAB.H"
21 #include "EBFluxFAB.H"
22 #include "EBISLayout.H"
23 #include "EBLevelGrid.H"
24 #include "TensorCFInterp.H"
25 #include "BaseBCFuncEval.H"
26 #include "NamespaceHeader.H"
27 
28 ///
29 /**
30  */
32 {
33 public:
34  ///
35  /**
36  */
38  {
39  }
40 
41  ///
42  /**
43  */
44  virtual ~BaseDomainBC()
45  {
46  }
47 
48  ///
49  /**
50  */
51  virtual void getFaceFlux(BaseFab<Real>& a_faceFlux,
52  const BaseFab<Real>& a_phi,
53  const RealVect& a_probLo,
54  const RealVect& a_dx,
55  const int& a_idir,
56  const Side::LoHiSide& a_side,
57  const DataIndex& a_dit,
58  const Real& a_time,
59  const bool& a_useHomogeneous) = 0;
60 
61  // virtual LayoutData<BaseIVFAB<VoFStencil> >* getFluxStencil(int ivar)= 0;
62 
63  virtual void getFluxStencil( VoFStencil& a_stencil,
64  const VolIndex& a_vof,
65  const int& a_comp,
66  const RealVect& a_dx,
67  const int& a_idir,
68  const Side::LoHiSide& a_side,
69  const EBISBox& a_ebisBox)
70  {
71  a_stencil.clear();
72  }
73 
74  virtual void getFluxStencil( VoFStencil& a_stencil,
75  const FaceIndex& a_face,
76  const int& a_comp,
77  const RealVect& a_dx,
78  const int& a_idir,
79  const Side::LoHiSide& a_side,
80  const EBISBox& a_ebisBox)
81  {
82  a_stencil.clear();
83  }
84 
85  ///
86  /**
87  This is used by the elliptic solvers to get
88  the flux of stuff through domain faces.
89  */
90  virtual void getFaceFlux(Real& a_faceFlux,
91  const VolIndex& a_vof,
92  const int& a_comp,
93  const EBCellFAB& a_phi,
94  const RealVect& a_probLo,
95  const RealVect& a_dx,
96  const int& a_idir,
97  const Side::LoHiSide& a_side,
98  const DataIndex& a_dit,
99  const Real& a_time,
100  const bool& a_useHomogeneous) = 0;
101 
102 
103  ///
104  /**
105  A query of whether a_jvof is Dirichlet Domain boundary to a_ivof. a_jvof is the ghost vof; a_ivof is the valid computational vof.
106  For now this is mainly used in form_matrix, which needs to know the type of BC at the boundary.
107  Default implementation is MayDay::Error();
108  */
109  virtual bool isDirichletDom(const VolIndex& a_ivof,
110  const VolIndex& a_jvof,
111  const EBCellFAB& a_phi) const
112  {
113  MayDay::Error("BaseDomainBC:: isDirichletDom:: default implementation is invalid");
114  return true;
115  }
116 
117 
118  ///
119  /**
120  This is used by the elliptic solvers to get
121  the flux of stuff through domain faces.
122  */
123  virtual void getInhomFaceFlux(Real& a_faceFlux,
124  const VolIndex& a_vof,
125  const int& a_comp,
126  const EBCellFAB& a_phi,
127  const RealVect& a_probLo,
128  const RealVect& a_dx,
129  const int& a_idir,
130  const Side::LoHiSide& a_side,
131  const DataIndex& a_dit,
132  const Real& a_time)
133  {
134  MayDay::Error();
135  }
136 
137  ///
138  /**
139  This is used by the projections to get
140  a) grad(phi) at domain faces.
141  */
142  virtual void getFaceGradPhi(Real& a_faceFlux,
143  const FaceIndex& a_face,
144  const int& a_comp,
145  const EBCellFAB& a_phi,
146  const RealVect& a_probLo,
147  const RealVect& a_dx,
148  const int& a_idir,
149  const Side::LoHiSide& a_side,
150  const DataIndex& a_dit,
151  const Real& a_time,
152  const bool& a_useAreaFrac,
153  const RealVect& a_centroid,
154  const bool& a_useHomogeneous) = 0;
155 
156 
157  virtual void enforceFaceVel(LevelData<EBFluxFAB>& a_velocity,
158  const DisjointBoxLayout& a_grids,
159  const EBISLayout& a_ebisl,
160  const ProblemDomain& a_domain,
161  const RealVect& a_dx,
162  const Real& a_time,
163  const RealVect& a_origin,
164  const bool& a_doDivFreeOutflow);
165 
166  virtual void enforceFaceVel(LevelData<EBFluxFAB>& a_velocity,
167  const DisjointBoxLayout& a_grids,
168  const EBISLayout& a_ebisl,
169  const ProblemDomain& a_domain,
170  const RealVect& a_dx,
171  const Real& a_time,
172  const RealVect& a_origin,
173  const bool& a_doDivFreeOutflow,
174  const int& a_comp);
175 
176  ///
177  /**
178  This is used by the projections to get
179  velocity at domain faces.
180  */
181  virtual void getFaceVel(Real& a_faceFlux,
182  const FaceIndex& a_vof,
183  const EBFluxFAB& a_vel,
184  const RealVect& a_probLo,
185  const RealVect& a_dx,
186  const int& a_idir,
187  const int& a_icomp,
188  const Real& a_time,
189  const Side::LoHiSide& a_side,
190  const bool& a_doDivFreeOutflow) = 0;
191 
192 };
193 
194 ///
195 /**
196  */
198 {
199 public:
200  ///
201  /**
202  */
204  {
205  m_coefSet = false;
206  m_value = 12345.6789;
208  m_isFunction = false;
209  }
210 
212  {
213  }
214  ///
215  /**
216  */
217  void setCoef(EBLevelGrid & a_eblg,
218  Real & a_beta,
221  {
222  m_coefSet = true;
223  m_eblg = a_eblg;
224  m_beta = a_beta;
225  m_eta = a_eta;
226  m_lambda = a_lambda;
227  }
228 
229  virtual void getFaceVel(Real& a_faceFlux,
230  const FaceIndex& a_vof,
231  const EBFluxFAB& a_vel,
232  const RealVect& a_probLo,
233  const RealVect& a_dx,
234  const int& a_idir,
235  const int& a_icomp,
236  const Real& a_time,
237  const Side::LoHiSide& a_side,
238  const bool& a_doDivFreeOutflow)
239  {
240  //projection thingy does not apply here
241  MayDay::Error();
242  }
243  virtual void getFaceGradPhi(Real& a_faceFlux,
244  const FaceIndex& a_face,
245  const int& a_comp,
246  const EBCellFAB& a_phi,
247  const RealVect& a_probLo,
248  const RealVect& a_dx,
249  const int& a_idir,
250  const Side::LoHiSide& a_side,
251  const DataIndex& a_dit,
252  const Real& a_time,
253  const bool& a_useAreaFrac,
254  const RealVect& a_centroid,
255  const bool& a_useHomogeneous)
256  {
257  //projection thingy does not apply here
258  MayDay::Error();
259  }
260  ///
261  /**
262  */
263  virtual void setValue(Real a_value)
264  {
265  m_value = a_value;
267 
268  m_isFunction = false;
269  }
270 
271 
272  ///
273  /**
274  */
276  {
277  m_value = 12345.6789;
278  m_func = a_func;
279 
280  m_isFunction = true;
281  }
282 
283  void getFluxFromGrad(BaseFab<Real>& a_flux,
284  const FArrayBox& a_grad,
285  const DataIndex& a_dit,
286  const int& a_idir);
287 
288 protected:
290 
291 
294 
296  bool m_coefSet;
300 };
301 
302 ///
303 /**
304  */
306 {
307 public:
308  ///
309  /**
310  */
312  {
313  m_coefSet = false;
314  }
315 
317  {
318  }
319 
320  ///
321  /**
322  */
323  void setCoef(EBLevelGrid & a_eblg,
324  Real & a_beta,
326  {
327  m_coefSet = true;
328  m_eblg = a_eblg;
329  m_beta = a_beta;
330  m_bcoef = a_bcoef;
331  }
332 
333 
334 protected:
335  bool m_coefSet;
339 };
340 ///
341 /**
342  */
344 {
345 public:
346  ///
347  /**
348  */
350  {
351  }
352 
353  ///
354  /**
355  */
357  {
358  }
359 
360  ///
361  /**
362  */
363  virtual BaseDomainBC* create(const ProblemDomain& a_domain,
364  const EBISLayout& a_layout,
365  const RealVect& a_dx) = 0;
366 };
367 #include "NamespaceFooter.H"
368 #endif
virtual void enforceFaceVel(LevelData< EBFluxFAB > &a_velocity, const DisjointBoxLayout &a_grids, const EBISLayout &a_ebisl, const ProblemDomain &a_domain, const RealVect &a_dx, const Real &a_time, const RealVect &a_origin, const bool &a_doDivFreeOutflow)
virtual void getFaceFlux(BaseFab< Real > &a_faceFlux, const BaseFab< Real > &a_phi, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const DataIndex &a_dit, const Real &a_time, const bool &a_useHomogeneous)=0
ViscousBaseDomainBC()
Definition: BaseDomainBC.H:203
RefCountedPtr< BaseBCFuncEval > m_func
Definition: BaseDomainBC.H:293
virtual ~BaseDomainBCFactory()
Definition: BaseDomainBC.H:356
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: BaseDomainBC.H:31
RefCountedPtr< LevelData< EBFluxFAB > > m_eta
Definition: BaseDomainBC.H:298
void clear()
virtual void getFaceGradPhi(Real &a_faceFlux, const FaceIndex &a_face, const int &a_comp, const EBCellFAB &a_phi, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const DataIndex &a_dit, const Real &a_time, const bool &a_useAreaFrac, const RealVect &a_centroid, const bool &a_useHomogeneous)
Definition: BaseDomainBC.H:243
Definition: FaceIndex.H:28
RefCountedPtr< LevelData< EBFluxFAB > > m_bcoef
Definition: BaseDomainBC.H:338
Definition: BaseDomainBC.H:305
Definition: EBISBox.H:46
virtual ~ViscousBaseDomainBC()
Definition: BaseDomainBC.H:211
Definition: EBLevelGrid.H:30
ConductivityBaseDomainBC()
Definition: BaseDomainBC.H:311
Real m_beta
Definition: BaseDomainBC.H:337
virtual ~BaseDomainBC()
Definition: BaseDomainBC.H:44
virtual bool isDirichletDom(const VolIndex &a_ivof, const VolIndex &a_jvof, const EBCellFAB &a_phi) const
Definition: BaseDomainBC.H:109
virtual ~ConductivityBaseDomainBC()
Definition: BaseDomainBC.H:316
bool m_coefSet
Definition: BaseDomainBC.H:296
virtual void getInhomFaceFlux(Real &a_faceFlux, const VolIndex &a_vof, const int &a_comp, const EBCellFAB &a_phi, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const DataIndex &a_dit, const Real &a_time)
Definition: BaseDomainBC.H:123
VoF-centered stencil.
Definition: Stencils.H:59
Definition: BaseDomainBC.H:197
A EBFaceFAB-like container for edge-centered fluxes.
Definition: EBFluxFAB.H:25
virtual void getFluxStencil(VoFStencil &a_stencil, const VolIndex &a_vof, const int &a_comp, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const EBISBox &a_ebisBox)
Definition: BaseDomainBC.H:63
virtual void getFaceVel(Real &a_faceFlux, const FaceIndex &a_vof, const EBFluxFAB &a_vel, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const int &a_icomp, const Real &a_time, const Side::LoHiSide &a_side, const bool &a_doDivFreeOutflow)
Definition: BaseDomainBC.H:229
Definition: EBCellFAB.H:29
EBLevelGrid m_eblg
Definition: BaseDomainBC.H:297
double Real
Definition: REAL.H:33
virtual void setFunction(RefCountedPtr< BaseBCFuncEval > a_func)
Definition: BaseDomainBC.H:275
Definition: BaseDomainBC.H:343
BaseDomainBC()
Definition: BaseDomainBC.H:37
virtual void getFaceVel(Real &a_faceFlux, const FaceIndex &a_vof, const EBFluxFAB &a_vel, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const int &a_icomp, const Real &a_time, const Side::LoHiSide &a_side, const bool &a_doDivFreeOutflow)=0
virtual void getFluxStencil(VoFStencil &a_stencil, const FaceIndex &a_face, const int &a_comp, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const EBISBox &a_ebisBox)
Definition: BaseDomainBC.H:74
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
Real m_value
Definition: BaseDomainBC.H:292
LoHiSide
Definition: LoHiSide.H:27
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
BaseDomainBCFactory()
Definition: BaseDomainBC.H:349
void setCoef(EBLevelGrid &a_eblg, Real &a_beta, RefCountedPtr< LevelData< EBFluxFAB > > &a_eta, RefCountedPtr< LevelData< EBFluxFAB > > &a_lambda)
Definition: BaseDomainBC.H:217
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
bool m_coefSet
Definition: BaseDomainBC.H:335
Definition: DataIndex.H:112
EBLevelGrid m_eblg
Definition: BaseDomainBC.H:336
Real m_beta
Definition: BaseDomainBC.H:295
virtual void setValue(Real a_value)
Definition: BaseDomainBC.H:263
Definition: FArrayBox.H:44
virtual void getFaceGradPhi(Real &a_faceFlux, const FaceIndex &a_face, const int &a_comp, const EBCellFAB &a_phi, const RealVect &a_probLo, const RealVect &a_dx, const int &a_idir, const Side::LoHiSide &a_side, const DataIndex &a_dit, const Real &a_time, const bool &a_useAreaFrac, const RealVect &a_centroid, const bool &a_useHomogeneous)=0
Volume of Fluid Index.
Definition: VolIndex.H:31
bool m_isFunction
Definition: BaseDomainBC.H:289
Definition: EBISLayout.H:39
RefCountedPtr< LevelData< EBFluxFAB > > m_lambda
Definition: BaseDomainBC.H:299
void setCoef(EBLevelGrid &a_eblg, Real &a_beta, RefCountedPtr< LevelData< EBFluxFAB > > &a_bcoef)
Definition: BaseDomainBC.H:323