Chombo + EB + MF  3.2
InterfaceJump.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 _INTERFACEJUMP_H_
12 #define _INTERFACEJUMP_H_
13 
14 #include "LevelData.H"
15 #include "EBCellFAB.H"
16 #include "MFIndexSpace.H"
17 #include "Stencils.H"
18 #include "VoFIterator.H"
19 #include "BaseBCValue.H"
20 #include "NamespaceHeader.H"
21 
23 {
24 public:
25 
26  //constructor
27  InterfaceJump();
28 
29  //destructor
31 
32  void define(const MFIndexSpace & a_MFIS,
33  const ProblemDomain & a_domain,
34  const DisjointBoxLayout& a_dbl,
35  const RealVect & a_vectDx,
36  const RealVect & a_physOrigin,
37  const bool a_isVectorJump = false);
38 
39  void setJump(const Real& a_gD,
40  const Real& a_gN);
41 
42  void setJump(const RealVect& a_gD,
43  const RealVect& a_gN);
44 
45  void setJump(const Vector< RefCountedPtr<BaseBCValue> >& a_phiValVect,
46  const Vector< RefCountedPtr<BaseBCValue> >& a_flxValVect,
47  const Vector<Real>& a_alpha,
48  const Vector<Real>& a_beta,
49  const Real& a_time = 0.0);
50 
51  void resetJump(const Vector<Real>& a_alpha,
52  const Vector<Real>& a_beta,
53  const Real& a_time);
54 
55  void getFaceStencil(VoFStencil& a_istencil,
56  VoFStencil& a_jstencil,
57  const Vector<Real>& a_beta,
58  const VolIndex& a_ivof,
59  const DataIndex& a_dix,
60  const int& a_iphase,
61  const int& a_iface);
62 
63  void computeScalarBV(const EBCellFAB & a_P0,
64  const EBCellFAB & a_P1,
65  const Vector<Real> & a_beta,
66  const DataIndex & a_dataInd,
67  BaseIVFAB<Real> & a_PBV0,
68  BaseIVFAB<Real> & a_PBV1,
69  BaseIVFAB<Real> & a_dpDN0,
70  BaseIVFAB<Real> & a_dpDN1,
71  bool homogeneous = false);
72 
73  void computeVectorBV(const EBCellFAB & a_P0,
74  const EBCellFAB & a_P1,
75  const Vector<Real> & a_beta,
76  const DataIndex & a_dataInd,
77  BaseIVFAB<Real> & a_PBV0,
78  BaseIVFAB<Real> & a_PBV1,
79  BaseIVFAB<Real> & a_dpDN0,
80  BaseIVFAB<Real> & a_dpDN1,
81  bool homogeneous = false);
82 
83 protected:
84 
85  //check is defined
87  // scalar or vector jump conditions
89 
95  int m_nComp;
96 
97  // jump values. defined on phase 0 VoFs
100 
102 
103  //used for calculating phase 1 dpDn
109 
110  //used for calculating phase 2 dpDn
116 
117  //vofIterators
119 
120  //multiPhase ebisl
123 
124  //one box layout for all phases
126 
127  void calculateJump(const Vector<Real>& a_alpha,
128  const Vector<Real>& a_beta,
129  const Real& a_time);
130 
131  //defines the stencil data structures
132  void defineLayoutData(EBISLayout& a_ebisl,
133  LayoutData< BaseIVFAB< Vector<VoFStencil> > >& a_stencils,
134  LayoutData< BaseIVFAB< Vector<Real> > >& a_inHomDirichWeight,
135  LayoutData< BaseIVFAB< Vector<int> > >& a_dirichletDropOrder,
136  LayoutData< BaseIVFAB< Vector<VolIndex> > >& a_boundaryVofs,
137  LayoutData< BaseIVFAB< Vector<int> > >& a_boundaryFaceIndices);
138 
139  // defines the jump for scalar case
141  LayoutData< BaseIVFAB< Vector<Real> > >& a_scalarGD,
142  LayoutData< BaseIVFAB< Vector<Real> > >& a_scalarGN);
143 
144  // defines the jump for vector case
146  LayoutData< BaseIVFAB< Vector<RealVect> > >& a_vectorGD,
147  LayoutData< BaseIVFAB< Vector<RealVect> > >& a_vectorGN);
148 
149  //build vofIterators
150  void cacheVoFIt();
151 
152  //builds the stencil per phase
153  void definePhase(const MFIndexSpace& a_MFIS,
154  const ProblemDomain& a_domain,
155  const DisjointBoxLayout& a_dbl,
156  EBISLayout& a_ebisl,
157  LayoutData< BaseIVFAB< Vector<VoFStencil> > >& a_stencils,
158  LayoutData< BaseIVFAB< Vector<Real> > >& a_inHomDirichWeight,
159  LayoutData< BaseIVFAB< Vector<int> > >& a_dirichletDropOrder,
160  LayoutData< BaseIVFAB< Vector<VolIndex> > >& a_boundaryVofs,
161  LayoutData< BaseIVFAB< Vector<int> > >& a_boundaryFaceIndices,
162  const int& a_numEBISLGhost,
163  const int& a_phase);
164 
165  // computes the vofs lying across the boundary from a given vof
166  void
168  LayoutData< BaseIVFAB< Vector<VolIndex> > >& a_1boundaryVofs,
169  LayoutData< BaseIVFAB< Vector<int> > >& a_0boundaryFaceIndices,
170  LayoutData< BaseIVFAB< Vector<int> > >& a_1boundaryFaceIndices);
171 
172  //Drop Order stencil if geometry too constricted
173  void leastSquaresDirichStencil(VoFStencil& a_stencil,
174  Real& a_weight,
175  const RealVect& a_normal,
176  const RealVect& a_centroid,
177  const Real& a_bndryArea,
178  const VolIndex& a_vof,
179  const EBISBox& a_ebisBox,
180  const RealVect& a_dx,
181  const ProblemDomain& a_domain,
182  int a_ivar);
183 
184  // Johansen stencil
185  void johanDirichletStencil(const RealVect& a_normal,
186  const RealVect& a_centroid,
187  const VolIndex& a_vof,
188  const EBISBox& a_ebisBox,
189  VoFStencil& a_vofStencil,
190  int& a_dirichletDropOrder,
191  Real& a_inHomDirichWeight);
192 
193  void boundarySlope(Real* a_dPhiDn,
194  const RealVect& a_normal,
195  const VolIndex& a_vof,
196  const EBCellFAB& a_phiFab,
197  const EBISBox& a_ebisBox,
198  const int& a_ivar = 0);
199 
200  void setDxConstants();
201 
202  void invert2x2(const Real& a_betaZeta1,
203  const Real& a_betaZeta2,
204  const Real& a_r1,
205  const Real& a_r2,
206  Real& a_pB1,
207  Real& a_pB2);
208 
209  void normalDeriv(const Real& a_qs,
210  const Real& a_zetas,
211  const Real& a_pBs,
212  Real& a_dPdns);
213 
214  //debug stuff
215  void findTangentPlane(RealVect& a_t1,
216  RealVect& a_t2,
217  const RealVect a_normal);
218 
219  void crossProduct( Real a_cp[3],
220  const Real a_c1[3],
221  const Real a_c2[3]);
222 
223  Real euclidianNorm(const RealVect a_vect);
224 
225  Real innerProduct(const RealVect& a_v1,
226  const RealVect& a_v2);
227 
228  void AInvTimesVelocity3D(RealVect& a_answer,
229  const RealVect& a_velocity,
230  const RealVect& a_normal,
231  const RealVect& a_t1,
232  const RealVect& a_t2,
233  const Vector<Real>& a_nu,
234  const Vector<Real>& a_zeta);
235 
236  void AInvTimesVelocity2D(RealVect& a_answer,
237  const RealVect& a_velocity,
238  const RealVect& a_normal,
239  const RealVect& a_t1,
240  const Vector<Real>& a_nu,
241  const Vector<Real>& a_zeta);
242 
243  void AInvTimesVelocity(RealVect& a_answer,
244  const RealVect& a_velocity,
245  const RealVect& a_normal,
246  const RealVect& a_t1,
247  const RealVect& a_t2,
248  const Vector<Real>& a_nu,
249  const Vector<Real>& a_zeta);
250 
251  void ATimesQ3D( RealVect& a_answer,
252  const RealVect& a_q,
253  const RealVect& a_normal,
254  const RealVect& a_t1,
255  const RealVect& a_t2,
256  const Real a_nu);
257 
258  void ATimesQ2D( RealVect& a_answer,
259  const RealVect& a_q,
260  const RealVect& a_normal,
261  const RealVect& a_t1,
262  const Real a_nu);
263 
264  void ATimesQ( RealVect& a_answer,
265  const RealVect& a_q,
266  const RealVect& a_normal,
267  const RealVect& a_t1,
268  const RealVect& a_t2,
269  const Real a_nu);
270 
271 };
272 #include "NamespaceFooter.H"
273 #endif
void findTangentPlane(RealVect &a_t1, RealVect &a_t2, const RealVect a_normal)
void normalDeriv(const Real &a_qs, const Real &a_zetas, const Real &a_pBs, Real &a_dPdns)
void leastSquaresDirichStencil(VoFStencil &a_stencil, Real &a_weight, const RealVect &a_normal, const RealVect &a_centroid, const Real &a_bndryArea, const VolIndex &a_vof, const EBISBox &a_ebisBox, const RealVect &a_dx, const ProblemDomain &a_domain, int a_ivar)
void defineVectorJumpLayoutData(EBISLayout &a_ebisl, LayoutData< BaseIVFAB< Vector< RealVect > > > &a_vectorGD, LayoutData< BaseIVFAB< Vector< RealVect > > > &a_vectorGN)
Definition: MFIndexSpace.H:17
ProblemDomain m_domain
Definition: InterfaceJump.H:94
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Real innerProduct(const RealVect &a_v1, const RealVect &a_v2)
void resetJump(const Vector< Real > &a_alpha, const Vector< Real > &a_beta, const Real &a_time)
void boundarySlope(Real *a_dPhiDn, const RealVect &a_normal, const VolIndex &a_vof, const EBCellFAB &a_phiFab, const EBISBox &a_ebisBox, const int &a_ivar=0)
Real euclidianNorm(const RealVect a_vect)
LayoutData< BaseIVFAB< Vector< int > > > m_1boundaryFaceIndices
Definition: InterfaceJump.H:115
RealVect m_d2Vect
Definition: InterfaceJump.H:91
DisjointBoxLayout m_dbl
Definition: InterfaceJump.H:125
one dimensional dynamic array
Definition: Vector.H:53
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
int m_nComp
Definition: InterfaceJump.H:95
void setDxConstants()
void cacheVoFIt()
Definition: EBISBox.H:46
LayoutData< BaseIVFAB< Vector< Real > > > m_scalarGN
Definition: InterfaceJump.H:98
Vector< RefCountedPtr< BaseBCValue > > m_flxValVect
Definition: InterfaceJump.H:101
EBISLayout m_1ebisl
Definition: InterfaceJump.H:122
Vector< RefCountedPtr< BaseBCValue > > m_phiValVect
Definition: InterfaceJump.H:101
LayoutData< BaseIVFAB< Vector< int > > > m_0dirichletDropOrder
Definition: InterfaceJump.H:106
LayoutData< BaseIVFAB< Vector< VolIndex > > > m_0boundaryVofs
Definition: InterfaceJump.H:107
LayoutData< BaseIVFAB< Vector< VolIndex > > > m_1boundaryVofs
Definition: InterfaceJump.H:114
VoF-centered stencil.
Definition: Stencils.H:60
void calculateJump(const Vector< Real > &a_alpha, const Vector< Real > &a_beta, const Real &a_time)
bool m_isDefined
Definition: InterfaceJump.H:86
void define(const MFIndexSpace &a_MFIS, const ProblemDomain &a_domain, const DisjointBoxLayout &a_dbl, const RealVect &a_vectDx, const RealVect &a_physOrigin, const bool a_isVectorJump=false)
void ATimesQ(RealVect &a_answer, const RealVect &a_q, const RealVect &a_normal, const RealVect &a_t1, const RealVect &a_t2, const Real a_nu)
void computeBoundaryLayoutData(LayoutData< BaseIVFAB< Vector< VolIndex > > > &a_0boundaryVofs, LayoutData< BaseIVFAB< Vector< VolIndex > > > &a_1boundaryVofs, LayoutData< BaseIVFAB< Vector< int > > > &a_0boundaryFaceIndices, LayoutData< BaseIVFAB< Vector< int > > > &a_1boundaryFaceIndices)
void setJump(const Real &a_gD, const Real &a_gN)
LayoutData< BaseIVFAB< Vector< Real > > > m_0inHomDirichWeight
Definition: InterfaceJump.H:105
Definition: EBCellFAB.H:29
void definePhase(const MFIndexSpace &a_MFIS, const ProblemDomain &a_domain, const DisjointBoxLayout &a_dbl, EBISLayout &a_ebisl, LayoutData< BaseIVFAB< Vector< VoFStencil > > > &a_stencils, LayoutData< BaseIVFAB< Vector< Real > > > &a_inHomDirichWeight, LayoutData< BaseIVFAB< Vector< int > > > &a_dirichletDropOrder, LayoutData< BaseIVFAB< Vector< VolIndex > > > &a_boundaryVofs, LayoutData< BaseIVFAB< Vector< int > > > &a_boundaryFaceIndices, const int &a_numEBISLGhost, const int &a_phase)
double Real
Definition: REAL.H:33
LayoutData< BaseIVFAB< Vector< Real > > > m_1inHomDirichWeight
Definition: InterfaceJump.H:112
void getFaceStencil(VoFStencil &a_istencil, VoFStencil &a_jstencil, const Vector< Real > &a_beta, const VolIndex &a_ivof, const DataIndex &a_dix, const int &a_iphase, const int &a_iface)
void ATimesQ3D(RealVect &a_answer, const RealVect &a_q, const RealVect &a_normal, const RealVect &a_t1, const RealVect &a_t2, const Real a_nu)
void defineLayoutData(EBISLayout &a_ebisl, LayoutData< BaseIVFAB< Vector< VoFStencil > > > &a_stencils, LayoutData< BaseIVFAB< Vector< Real > > > &a_inHomDirichWeight, LayoutData< BaseIVFAB< Vector< int > > > &a_dirichletDropOrder, LayoutData< BaseIVFAB< Vector< VolIndex > > > &a_boundaryVofs, LayoutData< BaseIVFAB< Vector< int > > > &a_boundaryFaceIndices)
void johanDirichletStencil(const RealVect &a_normal, const RealVect &a_centroid, const VolIndex &a_vof, const EBISBox &a_ebisBox, VoFStencil &a_vofStencil, int &a_dirichletDropOrder, Real &a_inHomDirichWeight)
LayoutData< VoFIterator > m_vofItBndry
Definition: InterfaceJump.H:118
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void AInvTimesVelocity3D(RealVect &a_answer, const RealVect &a_velocity, const RealVect &a_normal, const RealVect &a_t1, const RealVect &a_t2, const Vector< Real > &a_nu, const Vector< Real > &a_zeta)
EBISLayout m_0ebisl
Definition: InterfaceJump.H:121
LayoutData< BaseIVFAB< Vector< int > > > m_1dirichletDropOrder
Definition: InterfaceJump.H:113
LayoutData< BaseIVFAB< Vector< Real > > > m_scalarGD
Definition: InterfaceJump.H:98
Definition: InterfaceJump.H:22
LayoutData< BaseIVFAB< Vector< VoFStencil > > > m_0stencils
Definition: InterfaceJump.H:104
LayoutData< BaseIVFAB< Vector< RealVect > > > m_vectorGD
Definition: InterfaceJump.H:99
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
void invert2x2(const Real &a_betaZeta1, const Real &a_betaZeta2, const Real &a_r1, const Real &a_r2, Real &a_pB1, Real &a_pB2)
Definition: DataIndex.H:114
void ATimesQ2D(RealVect &a_answer, const RealVect &a_q, const RealVect &a_normal, const RealVect &a_t1, const Real a_nu)
Real m_dxScale
Definition: InterfaceJump.H:92
LayoutData< BaseIVFAB< Vector< RealVect > > > m_vectorGN
Definition: InterfaceJump.H:99
LayoutData< BaseIVFAB< Vector< int > > > m_0boundaryFaceIndices
Definition: InterfaceJump.H:108
LayoutData< BaseIVFAB< Vector< VoFStencil > > > m_1stencils
Definition: InterfaceJump.H:111
Volume of Fluid Index.
Definition: VolIndex.H:31
void AInvTimesVelocity(RealVect &a_answer, const RealVect &a_velocity, const RealVect &a_normal, const RealVect &a_t1, const RealVect &a_t2, const Vector< Real > &a_nu, const Vector< Real > &a_zeta)
RealVect m_origin
Definition: InterfaceJump.H:93
bool m_isVectorJump
Definition: InterfaceJump.H:88
Definition: EBISLayout.H:39
void defineScalarJumpLayoutData(EBISLayout &a_ebisl, LayoutData< BaseIVFAB< Vector< Real > > > &a_scalarGD, LayoutData< BaseIVFAB< Vector< Real > > > &a_scalarGN)
void computeScalarBV(const EBCellFAB &a_P0, const EBCellFAB &a_P1, const Vector< Real > &a_beta, const DataIndex &a_dataInd, BaseIVFAB< Real > &a_PBV0, BaseIVFAB< Real > &a_PBV1, BaseIVFAB< Real > &a_dpDN0, BaseIVFAB< Real > &a_dpDN1, bool homogeneous=false)
RealVect m_vectDx
Definition: InterfaceJump.H:90
void crossProduct(Real a_cp[3], const Real a_c1[3], const Real a_c2[3])
void AInvTimesVelocity2D(RealVect &a_answer, const RealVect &a_velocity, const RealVect &a_normal, const RealVect &a_t1, const Vector< Real > &a_nu, const Vector< Real > &a_zeta)
void computeVectorBV(const EBCellFAB &a_P0, const EBCellFAB &a_P1, const Vector< Real > &a_beta, const DataIndex &a_dataInd, BaseIVFAB< Real > &a_PBV0, BaseIVFAB< Real > &a_PBV1, BaseIVFAB< Real > &a_dpDN0, BaseIVFAB< Real > &a_dpDN1, bool homogeneous=false)