BISICLES AMR ice sheet model  0.9
VelocityBC.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 // VelocityBC.H
11 // ============
12 // Collection of CompGridVTOBC classes
13 
14 #ifndef _VELOCITYBC_H_
15 #define _VELOCITYBC_H_
16 
17 #include "PetscCompGridVTO.H"
18 #include "ReflectGhostCells.H"
19 #include "ExtrapGhostCells.H"
20 #include "NamespaceHeader.H"
21 
23 
27 class NoSlipCompGridVTOBC : public CompGridVTOBC
28 {
29 
30 public:
31 
32  NoSlipCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
33  {
34  m_dir = a_dir;
35  m_side = a_side;
36  for (int comp = 0; comp < SpaceDim; comp++)
37  {
38  CompGridVTOBC::setDiri(m_dir,m_side,comp,true);
39  }
40  }
41 
42  virtual void operator()(FArrayBox& a_vel,
43  const Box& a_valid,
44  const ProblemDomain& a_domain,
45  Real a_dx,
46  bool a_homogeneous)
47  {
48  const IntVect ghostVect = IntVect::Unit;
49 
50  if (!(a_domain.isPeriodic(m_dir)))
51  {
52  ReflectGhostCells(a_vel, a_domain,ghostVect, m_dir, m_side);
53  Box ghostBox = adjCellBox(a_valid, m_dir, m_side, 1);
54  if(!a_domain.domainBox().contains(ghostBox))
55  {
56  ghostBox &= a_vel.box();
57  a_vel.mult(-1.0,ghostBox,0,SpaceDim);
58  }
59  }
60  }
61 
62 private:
63  int m_dir;
64  Side::LoHiSide m_side;
67  {
68  MayDay::Error(" NoSlipCompGridVTOBC(const NoSlipCompGridVTOBC&) not implemented");
69  }
70 
71  NoSlipCompGridVTOBC& operator=(const NoSlipCompGridVTOBC&)
72  {
73  MayDay::Error(" NoSlipCompGridVTOBC& operator= (const NoSlipCompGridVTOBC&) not implemented");
74  return *this;
75  }
76 };
77 
79 
83 class IceDivideCompGridVTOBC : public CompGridVTOBC
84 {
85 
86 public:
87 
88  IceDivideCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
89  {
90  m_dir = a_dir;
91  m_side = a_side;
92 
93  CompGridVTOBC::setDiri(m_dir,m_side,m_dir,true);
94  for (int i = 1; i < SpaceDim; i++)
95  CompGridVTOBC::setDiri(m_dir,m_side,(m_dir+i)%SpaceDim,false);
96 
97  }
98 
99  virtual void operator()(FArrayBox& a_vel,
100  const Box& a_valid,
101  const ProblemDomain& a_domain,
102  Real a_dx,
103  bool a_homogeneous)
104  {
105  const IntVect ghostVect = IntVect::Unit;
106 
107  if (!(a_domain.isPeriodic(m_dir)))
108  {
109  ReflectGhostCells(a_vel, a_domain,ghostVect, m_dir, m_side);
110  Box ghostBox = adjCellBox(a_valid, m_dir, m_side, 1);
111  if(!a_domain.domainBox().contains(ghostBox))
112  {
113  ghostBox &= a_vel.box();
114  a_vel.mult(-1.0,ghostBox,m_dir,1);
115  }
116  }
117  }
118 
119 private:
120  int m_dir;
121  Side::LoHiSide m_side;
124  {
125  MayDay::Error(" IceDivideCompGridVTOBC(const IceDivideCompGridVTOBC&) not implemented");
126  }
127 
129  {
130  MayDay::Error(" IceDivideCompGridVTOBC& operator= (const IceDivideCompGridVTOBC&) not implemented");
131  return *this;
132  }
133 };
134 
135 
137 
141 class NaturalCompGridVTOBC : public CompGridVTOBC
142 {
143 
144 public:
145 
146  NaturalCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
147  {
148  m_dir = a_dir;
149  m_side = a_side;
150  for (int comp = 0; comp < SpaceDim; comp++)
151  {
152  CompGridVTOBC::setDiri(m_dir,m_side,comp,false);
153  }
154  }
155 
156  virtual void operator()(FArrayBox& a_vel,
157  const Box& a_valid,
158  const ProblemDomain& a_domain,
159  Real a_dx,
160  bool a_homogeneous)
161  {
162  const IntVect ghostVect = IntVect::Unit;
163 
164  if (!(a_domain.isPeriodic(m_dir)))
165  {
166  ReflectGhostCells(a_vel, a_domain,ghostVect, m_dir, m_side);
167  }
168  }
169 
170 private:
171  int m_dir;
172  Side::LoHiSide m_side;
175  {
176  MayDay::Error(" NaturalCompGridVTOBC(const NaturalCompGridVTOBC&) not implemented");
177  }
178 
179  NaturalCompGridVTOBC& operator=(const NaturalCompGridVTOBC&)
180  {
181  MayDay::Error(" NaturalCompGridVTOBC& operator= (const NaturalCompGridVTOBC&) not implemented");
182  return *this;
183  }
184 };
185 
186 
188 class PerEdgeCompGridVTOBC : public CompGridVTOBC
189 {
190  Vector<RefCountedPtr<CompGridVTOBC> > m_loBC;
191  Vector<RefCountedPtr<CompGridVTOBC> > m_hiBC;
192 
193 public:
194 
195  PerEdgeCompGridVTOBC(Vector<RefCountedPtr<CompGridVTOBC> > a_loBC,
196  Vector<RefCountedPtr<CompGridVTOBC> > a_hiBC)
197  :m_loBC(a_loBC), m_hiBC(a_hiBC)
198  {
199  CH_assert(m_loBC.size() == SpaceDim);
200  CH_assert(m_hiBC.size() == SpaceDim);
201  for (int dir = 0; dir < SpaceDim; dir++)
202  {
203  for (int comp = 0; comp < SpaceDim; comp++)
204  {
205  CompGridVTOBC::setDiri(dir,Side::Lo,comp,a_loBC[dir]->isDiri(dir,Side::Lo,comp));
206  CompGridVTOBC::setDiri(dir,Side::Hi,comp,a_hiBC[dir]->isDiri(dir,Side::Hi,comp));
207  }
208  }
209  }
210 
212  {
213  }
214 
216  {
217  MayDay::Error(" PerEdgeCompGridVTOBC(const PerEdgeCompGridVTOBC&) not implemented");
218  }
219 
221  {
222  MayDay::Error(" PerEdgeCompGridVTOBC& operator= (const PerEdgeCompGridVTOBC&) not implemented");
223  return *this;
224  }
225 
226 
227  virtual void operator()(FArrayBox& a_vel,
228  const Box& a_valid,
229  const ProblemDomain& a_domain,
230  Real a_dx,
231  bool a_homogeneous)
232  {
233  for (int dir = 0; dir < SpaceDim; dir++)
234  {
235  (*m_loBC[dir])(a_vel, a_valid, a_domain, a_dx, a_homogeneous);
236  (*m_hiBC[dir])(a_vel, a_valid, a_domain, a_dx, a_homogeneous);
237  }
238  }
239 
240 
241 };
242 
243 
244 
245 
246 #include "NamespaceFooter.H"
247 
248 #endif
NaturalCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
Definition: VelocityBC.H:146
virtual void operator()(FArrayBox &a_vel, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: VelocityBC.H:156
Apply natural conditions along one boundary.
Definition: VelocityBC.H:141
Apply ice divide conditions along one boundary.
Definition: VelocityBC.H:83
virtual void operator()(FArrayBox &a_vel, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: VelocityBC.H:227
Apply no-slip conditions along one boundary.
Definition: VelocityBC.H:27
PerEdgeCompGridVTOBC(const PerEdgeCompGridVTOBC &)
Definition: VelocityBC.H:215
PerEdgeCompGridVTOBC & operator=(const PerEdgeCompGridVTOBC &)
Definition: VelocityBC.H:220
NoSlipCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
Definition: VelocityBC.H:32
virtual void operator()(FArrayBox &a_vel, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: VelocityBC.H:42
IceDivideCompGridVTOBC(int a_dir, Side::LoHiSide a_side)
Definition: VelocityBC.H:88
Apply a different CompGridVTOBC along each boundary.
Definition: VelocityBC.H:188
void ReflectGhostCells(LevelData< FArrayBox > &a_phi, const ProblemDomain &a_domain, const int a_dir, const Side::LoHiSide a_side)
Definition: ReflectGhostCells.cpp:15
PerEdgeCompGridVTOBC(Vector< RefCountedPtr< CompGridVTOBC > > a_loBC, Vector< RefCountedPtr< CompGridVTOBC > > a_hiBC)
Definition: VelocityBC.H:195
virtual void operator()(FArrayBox &a_vel, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: VelocityBC.H:99
PerEdgeCompGridVTOBC()
Definition: VelocityBC.H:211