BISICLES AMR ice sheet model  0.9
IceThicknessIBC.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 //
12 // IceThicknessIBC.H
13 // ============
14 //
15 // Virtual base class through which a user specifies the initial and boundary
16 // conditions for a hyperbolic system of PDEs.
17 //
18 
19 #ifndef _ICETHICKNESSIBC_H_
20 #define _ICETHICKNESSIBC_H_
21 
22 #include "PhysIBC.H"
23 #include "LevelSigmaCS.H"
24 #include "PetscCompGridVTO.H"
25 #include "BCFunc.H"
26 
27 #include "NamespaceHeader.H"
28 
29 
31 class IceBCFuncWrapper: public CompGridVTOBC
32 {
33 public:
35  {
36  }
37 
38  IceBCFuncWrapper(BCFunc funcptr):m_funcptr(funcptr)
39  {
40  }
41 
43  virtual ~IceBCFuncWrapper()
44  {
45  }
46 
48  virtual void operator()(FArrayBox& a_state,
49  const Box& a_valid,
50  const ProblemDomain& a_domain,
51  Real a_dx,
52  bool a_homogeneous)
53  {
54  CH_assert(m_funcptr != NULL);
55  m_funcptr(a_state, a_valid, a_domain, a_dx, a_homogeneous);
56  }
57 
58  //explictly allow copy and assignment operators
60  {
61  }
62 
64  {
65  m_funcptr = src.m_funcptr;
66  return *this;
67  }
68 
69  protected:
70  BCFunc m_funcptr;
71 
72 };
73 
74 
75 
76 
77 
79 
84 class IceThicknessIBC : public PhysIBC
85 {
86 public:
88 
91 
93 
95  virtual ~IceThicknessIBC() {}
96 
98 
103  virtual void define(const ProblemDomain& a_domain,
104  const Real& a_dx)
105  {PhysIBC::define(a_domain, a_dx);}
106 
108 
112  virtual PhysIBC* new_physIBC()
113  {return static_cast<PhysIBC*>(new_thicknessIBC());}
114 
116  virtual IceThicknessIBC* new_thicknessIBC() = 0;
117 
118 
120 
122  virtual void initialize(LevelData<FArrayBox>& a_U) = 0;
123 
125  virtual void initializeIceGeometry(LevelSigmaCS& a_coords,
126  const RealVect& a_dx,
127  const RealVect& a_domainSize,
128  const Real& a_time,
129  const LevelSigmaCS* a_crseCoords,
130  const int a_refRatio) = 0;
131 
132 
134  /* Default is to do nothing, and return false,
135  in which case the topography probably needs
136  to be interpolated by the user.
137  */
138  virtual bool regridIceGeometry(LevelSigmaCS& a_coords,
139  const RealVect& a_dx,
140  const RealVect& a_domainSize,
141  const Real& a_time,
142  const LevelSigmaCS* a_crseCoords,
143  const int a_refRatio)
144  {
145  return false;
146  }
148 
150  virtual void primBC(FArrayBox& a_WGdnv,
151  const FArrayBox& a_Wextrap,
152  const FArrayBox& a_W,
153  const int& a_dir,
154  const Side::LoHiSide& a_side,
155  const Real& a_time) = 0;
156 
158 
163  virtual
164  void setBdrySlopes(FArrayBox& a_dW,
165  const FArrayBox& a_W,
166  const int& a_dir,
167  const Real& a_time) = 0;
168 
170 
172  virtual
173  void artViscBC(FArrayBox& a_F,
174  const FArrayBox& a_U,
175  const FArrayBox& a_divVel,
176  const int& a_dir,
177  const Real& a_time) = 0;
178 
180 
182  virtual RefCountedPtr<CompGridVTOBC> velocitySolveBC() = 0;
183 
184 
186 
199  virtual void velocityGhostBC(LevelData<FArrayBox>& a_velocity,
200  const LevelSigmaCS& a_coords,
201  const ProblemDomain& a_domain,
202  Real a_time)
203  {
204  RefCountedPtr<CompGridVTOBC> velBC = velocitySolveBC();
205  const RealVect& dx = a_coords.dx();
206  for (DataIterator dit=a_velocity.dataIterator(); dit.ok(); ++dit)
207  (*velBC)(a_velocity[dit],a_velocity.getBoxes()[dit],
208  a_domain, dx[0], dit(), false);
209  }
210 
211 
212 
214 
216  virtual void modifyVelocityRHS(LevelData<FArrayBox>& a_rhs,
217  LevelSigmaCS& a_coords,
218  const ProblemDomain& a_domain,
219  Real a_time, Real a_dt) {;}
220 
222 
224  virtual void modifyFaceVelocity(LevelData<FluxBox>& a_faceVel,
225  const LevelSigmaCS& a_coords,
226  const ProblemDomain& a_domain) const
227  {;}
228 
229 
230 
232 
235  virtual void setSurfaceHeightBCs(LevelData<FArrayBox>& a_zSurface,
236  LevelSigmaCS& a_coords,
237  const ProblemDomain& a_domain,
238  const RealVect& a_dx,
239  Real a_time, Real a_dt) {;}
240 
241 
243 
246  virtual void setGeometryBCs(LevelSigmaCS& a_coords,
247  const ProblemDomain& a_domain,
248  const RealVect& a_dx,
249  Real a_time, Real a_dt) {;}
250 
252 
255  virtual void setIceFractionBCs(LevelData<FArrayBox>& a_iceFrac,
256  const ProblemDomain& a_domain,
257  const RealVect& a_dx,
258  Real a_time, Real a_dt){;}
259 
260 
262  virtual void setGridHierarchy(Vector<RefCountedPtr<LevelSigmaCS > >& a_vectCS,
263  Vector<ProblemDomain>& a_vectDomain) {;}
264 
265 
266  // this is just here to so that FortranInterfaceIBC can re-implement it
267  // and I can pester it on a frequent basis to work out who is
268  // corrupting its memory
269  virtual void checkOK() const {;}
270 
271 protected:
272 
273 
274 
275 private:
276  // Disallowed for all the usual reasons
277  void operator=(const IceThicknessIBC& a_input)
278  {
279  MayDay::Error("invalid operator");
280  }
281 
282  // Disallowed for all the usual reasons
283  IceThicknessIBC(const IceThicknessIBC& a_input)
284  {
285  MayDay::Error("invalid operator");
286  }
287 };
288 
289 
291 
294 class IceVelBCFunction : public CompGridVTOBC
295 {
296 public:
298 
299  IceVelBCFunction(Vector<RefCountedPtr<LevelSigmaCS > >& a_vectCS,
300  Vector<ProblemDomain>& a_vectDomain) {;}
301 
302 
304 
305  virtual void define(Vector<RefCountedPtr<LevelSigmaCS> >& a_vectCS,
306  Vector<ProblemDomain>& a_vectDomain) =0;
307 
308 
309  virtual void operator()(FArrayBox& a_state,
310  const Box& a_valid,
311  const ProblemDomain& a_domain,
312  Real a_dx,
313  bool a_homogeneous) =0;
314 
315 
316 protected:
317  Vector<RefCountedPtr<LevelSigmaCS > > m_vectCS;
318 
319  Vector<ProblemDomain> m_vectDomain;
320 
321 
322 };
323 
324 
325 #include "NamespaceFooter.H"
326 #endif
327 
328 
IceBCFuncWrapper()
Definition: IceThicknessIBC.H:34
virtual bool regridIceGeometry(LevelSigmaCS &a_coords, const RealVect &a_dx, const RealVect &a_domainSize, const Real &a_time, const LevelSigmaCS *a_crseCoords, const int a_refRatio)
set up topography, etc at regrid time
Definition: IceThicknessIBC.H:138
virtual PhysIBC * new_physIBC()
Factory method - this object is its own factory.
Definition: IceThicknessIBC.H:112
virtual void checkOK() const
Definition: IceThicknessIBC.H:269
IceBCFuncWrapper(BCFunc funcptr)
Definition: IceThicknessIBC.H:38
virtual void setGeometryBCs(LevelSigmaCS &a_coords, const ProblemDomain &a_domain, const RealVect &a_dx, Real a_time, Real a_dt)
set non-periodic ghost cells for geometry
Definition: IceThicknessIBC.H:246
this BCFunction simply wraps a BCFunc
Definition: IceThicknessIBC.H:31
virtual void setGridHierarchy(Vector< RefCountedPtr< LevelSigmaCS > > &a_vectCS, Vector< ProblemDomain > &a_vectDomain)
set AMR grid hierarchy (for the BC&#39;s which need this)
Definition: IceThicknessIBC.H:262
BCFunction-derived class to handle velocity-solve BC&#39;s.
Definition: IceThicknessIBC.H:294
IceVelBCFunction(Vector< RefCountedPtr< LevelSigmaCS > > &a_vectCS, Vector< ProblemDomain > &a_vectDomain)
Definition: IceThicknessIBC.H:299
Physical/domain initial and boundary conditions for ice-sheet problems.
Definition: IceThicknessIBC.H:84
virtual void define(const ProblemDomain &a_domain, const Real &a_dx)
Define the object.
Definition: IceThicknessIBC.H:103
virtual void modifyVelocityRHS(LevelData< FArrayBox > &a_rhs, LevelSigmaCS &a_coords, const ProblemDomain &a_domain, Real a_time, Real a_dt)
if appropriate, modify velocity solve RHS in a problem-dependent way.
Definition: IceThicknessIBC.H:216
~IceVelBCFunction()
Definition: IceThicknessIBC.H:303
virtual void setIceFractionBCs(LevelData< FArrayBox > &a_iceFrac, const ProblemDomain &a_domain, const RealVect &a_dx, Real a_time, Real a_dt)
set non-periodic ghost cells for ice fraction
Definition: IceThicknessIBC.H:255
virtual void setSurfaceHeightBCs(LevelData< FArrayBox > &a_zSurface, LevelSigmaCS &a_coords, const ProblemDomain &a_domain, const RealVect &a_dx, Real a_time, Real a_dt)
set non-periodic ghost cells for surface height z_s.
Definition: IceThicknessIBC.H:235
virtual ~IceThicknessIBC()
Destructor.
Definition: IceThicknessIBC.H:95
virtual IceBCFuncWrapper & operator=(const IceBCFuncWrapper &src)
Definition: IceThicknessIBC.H:63
IceVelBCFunction()
Definition: IceThicknessIBC.H:297
IceThicknessIBC()
Constructor.
Definition: IceThicknessIBC.H:90
virtual void velocityGhostBC(LevelData< FArrayBox > &a_velocity, const LevelSigmaCS &a_coords, const ProblemDomain &a_domain, Real a_time)
fill ghost cells on velocity
Definition: IceThicknessIBC.H:199
virtual void modifyFaceVelocity(LevelData< FluxBox > &a_faceVel, const LevelSigmaCS &a_coords, const ProblemDomain &a_domain) const
if appropriate, modify face velocities in a problem-dependent way.
Definition: IceThicknessIBC.H:224
Basic Sigma fourth-order coordinate system on an AMR level.
Definition: LevelSigmaCS.H:48
Vector< ProblemDomain > m_vectDomain
Definition: IceThicknessIBC.H:319
virtual ~IceBCFuncWrapper()
Definition: IceThicknessIBC.H:43
IceBCFuncWrapper(const IceBCFuncWrapper &src)
Definition: IceThicknessIBC.H:59
Vector< RefCountedPtr< LevelSigmaCS > > m_vectCS
Definition: IceThicknessIBC.H:317
RealVect dx() const
Definition: LevelSigmaCS.H:97
BCFunc m_funcptr
Definition: IceThicknessIBC.H:70
virtual void operator()(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
simply calls through to bcFunc
Definition: IceThicknessIBC.H:48