Chombo + EB  3.2
ViscousBaseDomainBC.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 _VISCOUSBASEDOMAINBC_H_
12 #define _VISCOUSBASEDOMAINBC_H_
13 
14 #include "LoHiSide.H"
15 #include "RealVect.H"
16 #include "FArrayBox.H"
17 #include "BaseDomainBC.H"
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 "ViscousTensorOp.H"
27 #include "NamespaceHeader.H"
28 
29 
30 ///
31 /**
32  */
34 {
35 public:
36  ///
37  /**
38  */
40  {
41  m_coefSet = false;
42  m_value = 12345.6789;
44  m_isFunction = false;
45  }
46 
48  {
49  }
50  ///
51  /**
52  */
53  void setCoef(EBLevelGrid & a_eblg,
54  Real & a_beta,
57  {
58  m_coefSet = true;
59  m_eblg = a_eblg;
60  m_beta = a_beta;
61  m_eta = a_eta;
62  m_lambda = a_lambda;
63  }
64 
65  virtual void getFaceVel(Real& a_faceFlux,
66  const FaceIndex& a_vof,
67  const EBFluxFAB& a_vel,
68  const RealVect& a_probLo,
69  const RealVect& a_dx,
70  const int& a_idir,
71  const int& a_icomp,
72  const Real& a_time,
73  const Side::LoHiSide& a_side)
74  {
75  //projection thingy does not apply here
76  MayDay::Error();
77  }
78  virtual void getFaceGradPhi(Real& a_faceFlux,
79  const FaceIndex& a_face,
80  const int& a_comp,
81  const EBCellFAB& a_phi,
82  const RealVect& a_probLo,
83  const RealVect& a_dx,
84  const int& a_idir,
85  const Side::LoHiSide& a_side,
86  const DataIndex& a_dit,
87  const Real& a_time,
88  const bool& a_useAreaFrac,
89  const RealVect& a_centroid,
90  const bool& a_useHomogeneous)
91  {
92  //projection thingy does not apply here
93  MayDay::Error();
94  }
95  ///
96  /**
97  */
98  virtual void setValue(Real a_value)
99  {
100  m_value = a_value;
102 
103  m_isFunction = false;
104  }
105 
106 
107  ///
108  /**
109  */
111  {
112  m_value = 12345.6789;
113  m_func = a_func;
114 
115  m_isFunction = true;
116  }
117 
119  const FArrayBox& a_grad,
120  const DataIndex& a_dit,
121  const int& a_idir)
122  {
123  FArrayBox& fluxFAB = (FArrayBox&) a_flux;
124  FArrayBox faceDiv(a_flux.box(), 1);
125  faceDiv.setVal(0.);
126  //compute the derivs as the sum of the appropriate grads
127  for (int divDir = 0; divDir < SpaceDim; divDir++)
128  {
129  int gradComp = TensorCFInterp::gradIndex(divDir,divDir);
130  int srccomp = gradComp;
131  int dstcomp = 0;
132  faceDiv.plus(a_grad, srccomp, dstcomp, 1);
133  }
134 
135  //need to do this because there is an increment later
136  const Box& faceBox = fluxFAB.box();
137  fluxFAB.setVal(0.);
138  const FArrayBox& lamFace = (const FArrayBox&)((*m_lambda)[a_dit][a_idir].getSingleValuedFAB());
139  const FArrayBox& etaFace = (const FArrayBox&)((*m_eta )[a_dit][a_idir].getSingleValuedFAB());
140  ViscousTensorOp::getFluxFromDivAndGrad(fluxFAB, faceDiv, a_grad, etaFace, lamFace, faceBox, a_idir);
141  }
142 
143  //this makes applyOpRegular faster
144  virtual void
145  fillVelGhost(FArrayBox& a_state,
146  const Box& a_valid,
147  const Box& a_domain,
148  Real a_dx,
149  bool a_homogeneous) = 0;
150 
151 
152  RealVect bcvaluefunc(const RealVect & a_point,
153  const int & a_dir,
154  const Side::LoHiSide& a_side)
155  {
156  RealVect retval;
157  if(m_isFunction)
158  {
159  for(int idir = 0; idir < SpaceDim; idir++)
160  {
161  retval[idir]= m_func->value(a_point, idir);
162  }
163  }
164  else
165  {
166  for(int idir = 0; idir < SpaceDim; idir++)
167  {
168  retval[idir] = m_value;
169  }
170  }
171  return retval;
172  }
173 protected:
176 
179 
180 
182  bool m_coefSet;
186 };
187 
188 #include "NamespaceFooter.H"
189 #endif
virtual Real value(const RealVect &a_point, const int &a_comp) const =0
ViscousBaseDomainBC()
Definition: ViscousBaseDomainBC.H:39
RefCountedPtr< BaseBCFuncEval > m_func
Definition: ViscousBaseDomainBC.H:178
void getFluxFromGrad(BaseFab< Real > &a_flux, const FArrayBox &a_grad, const DataIndex &a_dit, const int &a_idir)
Definition: ViscousBaseDomainBC.H:118
Definition: BaseDomainBC.H:31
RefCountedPtr< LevelData< EBFluxFAB > > m_eta
Definition: ViscousBaseDomainBC.H:184
bool m_onlyHomogeneous
Definition: ViscousBaseDomainBC.H:174
void setVal(T a_x, const Box &a_bx, int a_nstart, int a_numcomp)
{ data modification functions}
Definition: BaseFabImplem.H:399
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: ViscousBaseDomainBC.H:78
Definition: FaceIndex.H:28
virtual ~ViscousBaseDomainBC()
Definition: ViscousBaseDomainBC.H:47
Definition: EBLevelGrid.H:30
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)
Definition: ViscousBaseDomainBC.H:65
static void getFluxFromDivAndGrad(FArrayBox &a_flux, const FArrayBox &a_faceDiv, const FArrayBox &a_faceGrad, const FArrayBox &a_etaFace, const FArrayBox &a_lambdaFace, const Box &a_faceBox, int a_dir)
static int gradIndex(int ivar, int gradDir)
returns component in gradient for variable ivar in direction gradDir
Definition: TensorCFInterp.H:142
const Box & box() const
Definition: BaseFabImplem.H:271
bool m_coefSet
Definition: ViscousBaseDomainBC.H:182
const int SpaceDim
Definition: SPACE.H:38
Definition: ViscousBaseDomainBC.H:33
A EBFaceFAB-like container for edge-centered fluxes.
Definition: EBFluxFAB.H:25
Definition: EBCellFAB.H:29
EBLevelGrid m_eblg
Definition: ViscousBaseDomainBC.H:183
double Real
Definition: REAL.H:33
virtual void setFunction(RefCountedPtr< BaseBCFuncEval > a_func)
Definition: ViscousBaseDomainBC.H:110
Real m_value
Definition: ViscousBaseDomainBC.H:177
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.
void setCoef(EBLevelGrid &a_eblg, Real &a_beta, RefCountedPtr< LevelData< EBFluxFAB > > &a_eta, RefCountedPtr< LevelData< EBFluxFAB > > &a_lambda)
Definition: ViscousBaseDomainBC.H:53
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: DataIndex.H:112
RealVect bcvaluefunc(const RealVect &a_point, const int &a_dir, const Side::LoHiSide &a_side)
Definition: ViscousBaseDomainBC.H:152
virtual void fillVelGhost(FArrayBox &a_state, const Box &a_valid, const Box &a_domain, Real a_dx, bool a_homogeneous)=0
Real m_beta
Definition: ViscousBaseDomainBC.H:181
virtual void setValue(Real a_value)
Definition: ViscousBaseDomainBC.H:98
Definition: FArrayBox.H:45
bool m_isFunction
Definition: ViscousBaseDomainBC.H:175
RefCountedPtr< LevelData< EBFluxFAB > > m_lambda
Definition: ViscousBaseDomainBC.H:185