BISICLES AMR ice sheet model  0.9
FortranInterfaceIBC.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 // FortranInterfaceIBC.H
13 // ============
14 //
15 // PhysIBC-derived class for interfacing with fortran -- IBC fields like
16 // initial ice thickness and topography are passed in as fortran arrays, which
17 // are then used to set values in the BISICLES code
18 //
19 
20 #ifndef _FORTRANTHICKNESSIBC_H_
21 #define _FORTRANTHICKNESSIBC_H_
22 
23 #include "IceThicknessIBC.H"
24 #include "RefCountedPtr.H"
25 #include "NamespaceHeader.H"
26 
27 class AmrIce;
28 
34 
35 
37 
41 {
42 
43 
44 public:
46 
49 
51 
53  virtual ~FortranInterfaceIBC();
54 
56 
60  virtual void define(const ProblemDomain& a_domain,
61  const Real& a_dx);
62 
64 
69  static void setFAB(Real* a_data_ptr,
70  const int* a_dimInfo,
71  const int* boxlo, const int* boxhi,
72  const Real* a_dew, const Real* a_dns,
73  const IntVect& a_offset,
74  const IntVect& a_nGhost,
75  FArrayBox& a_fab,
76  FArrayBox& a_ccFab,
77  const bool a_nodal,
78  const bool a_verbose = false);
79 
81 
86  virtual void setVelFAB(Real* a_uVelPtr, Real* a_vVelPtr,
87  const int* a_dimInfo,
88  const int* boxlo, const int* boxhi,
89  const Real* a_dew, const Real* a_dns,
90  const IntVect& a_offset,
91  const IntVect& a_nGhost,
92  FArrayBox& a_uFab,
93  FArrayBox& a_vFab,
94  FArrayBox& a_uccFab,
95  FArrayBox& a_vccFab,
96  const bool a_nodal = false,
97  const bool a_fillData = false);
98 
99 
101  virtual void setThickness(Real* a_data_ptr,
102  const int* a_dimInfo,
103  const int* boxlo, const int* boxhi,
104  const Real* a_dew, const Real* a_dns,
106  const IntVect& a_offset,
107  const IntVect& a_nGhost = IntVect::Zero,
108  const bool a_nodal = false);
109 
110  virtual void setTopography(Real* a_data_ptr,
111  const int* a_dimInfo,
112  const int* boxlo, const int* boxhi,
113  const Real* a_dew, const Real* a_dns,
115  const IntVect& a_offset,
116  const IntVect& a_nGhost = IntVect::Zero,
117  const bool a_nodal = false);
118 
120 
122  virtual void setSurface(Real* a_data_ptr,
123  const int* a_dimInfo,
124  const int* boxlo, const int* boxhi,
125  const Real* a_dew, const Real* a_dns,
127  const IntVect& a_offset,
128  const IntVect& a_nGhost = IntVect::Zero,
129  const bool a_nodal = false);
130 
131 
133 
140  virtual void setThicknessClearRegions(const Vector<Box>& a_clearRegions);
141 
143 
149 
150 
151 
153 
155  virtual void initialize(LevelData<FArrayBox>& a_U);
156 
158 
160  virtual void initializeIceGeometry(LevelSigmaCS& a_coords,
161  const RealVect& a_dx,
162  const RealVect& a_domainSize,
163  const Real& a_time,
164  const LevelSigmaCS* a_crseCoords,
165  const int a_refRatio) ;
166 
168  virtual bool regridIceGeometry(LevelSigmaCS& a_coords,
169  const RealVect& a_dx,
170  const RealVect& a_domainSize,
171  const Real& a_time,
172  const LevelSigmaCS* a_crseCoords,
173  const int a_refRatio) ;
174 
176 
180  virtual void flattenIceGeometry(const Vector<RefCountedPtr<LevelSigmaCS> > & a_amrGeometry);
181 
183  virtual void flattenData(Real* a_data_ptr,
184  const int* a_dimInfo,
185  const int* a_boxlo, const int* a_boxhi,
186  const Real* a_dew, const Real* a_dns,
187  const IntVect& a_offset,
188  const Vector<LevelData<FArrayBox>* >& a_amrData,
189  const Vector<int>& a_vectRefRatio,
190  const Vector<Real>& a_amrDx,
191  int a_srcComp,
192  int a_destComp,
193  int a_nComp,
194  const IntVect& a_nGhost,
195  const bool a_nodal);
196 
197 
199  void flattenVelocity(Real* a_uVelPtr, Real* a_vVelPtr,
200  const int* a_dimInfo,
201  const int* a_boxlo, const int* a_boxhi,
202  const Real* a_dew, const Real* a_dns,
203  const IntVect& a_offset,
204  const Vector<LevelData<FArrayBox>* >& a_amrVel,
205  const Vector<int>& a_vectRefRatio,
206  const Vector<Real>& a_amrDx,
207  const IntVect& a_nGhost,
208  const bool a_nodal);
209 
210 
212 
214  virtual void primBC(FArrayBox& a_WGdnv,
215  const FArrayBox& a_Wextrap,
216  const FArrayBox& a_W,
217  const int& a_dir,
218  const Side::LoHiSide& a_side,
219  const Real& a_time);
220 
222 
227  virtual
228  void setBdrySlopes(FArrayBox& a_dW,
229  const FArrayBox& a_W,
230  const int& a_dir,
231  const Real& a_time);
232 
234 
236  virtual
237  void artViscBC(FArrayBox& a_F,
238  const FArrayBox& a_U,
239  const FArrayBox& a_divVel,
240  const int& a_dir,
241  const Real& a_time);
242 
244 
246  virtual RefCountedPtr<CompGridVTOBC> velocitySolveBC();
247 
248  void setVerbose(bool a_verbose) {m_verbose = a_verbose;}
249 
251  virtual void setSurfaceHeightBCs(LevelData<FArrayBox>& a_zSurface,
252  LevelSigmaCS& a_coords,
253  const ProblemDomain& a_domain,
254  const RealVect& a_dx,
255  Real a_time, Real a_dt);
256 
258  virtual void setGeometryBCs(LevelSigmaCS& a_coords,
259  const ProblemDomain& a_domain,
260  const RealVect& a_dx,
261  Real a_time, Real a_dt);
262 
264 
266  static void setGrids(DisjointBoxLayout& a_grids,
267  const Box& a_gridBox,
268  const ProblemDomain& a_domain,
269  bool a_verbose);
270 
272  bool gridsSet() const {return m_gridsSet;}
273 
274 
276 
278  virtual void fillTopographyHoles(Real holeVal);
279 
280  virtual void checkOK() const;
281 
282  // accessor
283  const RefCountedPtr<LevelData<FArrayBox> >& inputThicknessPtr() const
284  {return m_inputThicknessLDF;}
285 
286 protected:
287 
288  // ice sheet thickness at domain boundaries
290 
291  RealVect m_domainSize;
292 
293  bool m_verbose;
294 
295  // have bc's been set up?
297 
299  void setupBCs();
300 
301  bool m_extrapBoundary; //extrapolate the boundary geoemtry? or reflect it?
302 
303  RefCountedPtr<CompGridVTOBC> m_velBCs;
304 
305  DisjointBoxLayout m_grids;
307 
308  // ice sheet thickness from glimmer
310  FArrayBox m_inputThickness;
314 
319 
323  RefCountedPtr<LevelData<FArrayBox> > m_inputThicknessLDF;
324 
327 
329  FArrayBox m_inputTopography;
330  // true if m_inputTopography is nodal
333 
339 
343  RefCountedPtr<LevelData<FArrayBox> > m_inputTopographyLDF;
344 
345 
347  FArrayBox m_inputSurface;
348  // true if m_inputSurface is nodal
351 
356  FArrayBox m_ccInputSurface;
357 
359  IntVect m_surfaceGhost;
361  RefCountedPtr<LevelData<FArrayBox> > m_inputSurfaceLDF;
362 
363 private:
364  // Disallowed for all the usual reasons
365  void operator=(const FortranInterfaceIBC& a_input)
366  {
367  MayDay::Error("invalid operator");
368  }
369 
370  // Disallowed for all the usual reasons
372  {
373  MayDay::Error("invalid operator");
374  }
375 };
376 
377 #include "NamespaceFooter.H"
378 #endif
bool m_isBCsetUp
Definition: FortranInterfaceIBC.H:296
virtual ~FortranInterfaceIBC()
Destructor.
Definition: FortranInterfaceIBC.cpp:252
FArrayBox m_ccInputTopography
cell-centered input topography
Definition: FortranInterfaceIBC.H:338
Physical/domain initial and boundary conditions.
Definition: FortranInterfaceIBC.H:40
Definition: FortranInterfaceIBC.H:33
bool m_nodalTopography
Definition: FortranInterfaceIBC.H:331
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)
update the topgraphy in LevelSigmaCS but not the thickness
Definition: FortranInterfaceIBC.cpp:1230
virtual void setThickness(Real *a_data_ptr, const int *a_dimInfo, const int *boxlo, const int *boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const IntVect &a_nGhost=IntVect::Zero, const bool a_nodal=false)
nGhost is the number of ghost cells in in the input data (which are ignored)
Definition: FortranInterfaceIBC.cpp:464
FArrayBox m_ccInputThickness
cell-centered input thickness
Definition: FortranInterfaceIBC.H:318
FArrayBox m_inputThickness
alias to data array passed in from glimmer-CISM
Definition: FortranInterfaceIBC.H:310
RefCountedPtr< LevelData< FArrayBox > > m_inputTopographyLDF
distributed version of topography
Definition: FortranInterfaceIBC.H:343
void flattenVelocity(Real *a_uVelPtr, Real *a_vVelPtr, const int *a_dimInfo, const int *a_boxlo, const int *a_boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const Vector< LevelData< FArrayBox > * > &a_amrVel, const Vector< int > &a_vectRefRatio, const Vector< Real > &a_amrDx, const IntVect &a_nGhost, const bool a_nodal)
flatten velocity field to the 3D velocity data holder
Definition: FortranInterfaceIBC.cpp:1605
virtual void checkOK() const
Definition: FortranInterfaceIBC.cpp:1865
RefCountedPtr< LevelData< FArrayBox > > m_inputSurfaceLDF
distributed version of topography
Definition: FortranInterfaceIBC.H:361
Definition: FortranInterfaceIBC.H:30
RealVect m_inputSurfaceDx
Definition: FortranInterfaceIBC.H:358
bool m_nodalThickness
true if m_inputThickness is nodal
Definition: FortranInterfaceIBC.H:312
IntVect m_topographyGhost
Definition: FortranInterfaceIBC.H:341
RealVect m_domainSize
Definition: FortranInterfaceIBC.H:291
FortranInterfaceIBC()
Constructor.
Definition: FortranInterfaceIBC.cpp:237
Definition: FortranInterfaceIBC.H:29
class to manage non-subcycled AMR ice-sheet model
Definition: AmrIce.H:40
Physical/domain initial and boundary conditions for ice-sheet problems.
Definition: IceThicknessIBC.H:84
virtual void setVelFAB(Real *a_uVelPtr, Real *a_vVelPtr, const int *a_dimInfo, const int *boxlo, const int *boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const IntVect &a_nGhost, FArrayBox &a_uFab, FArrayBox &a_vFab, FArrayBox &a_uccFab, FArrayBox &a_vccFab, const bool a_nodal=false, const bool a_fillData=false)
sets reference fabs for (horizontal) velocity
Definition: FortranInterfaceIBC.cpp:341
virtual IceThicknessIBC * new_thicknessIBC()
Factory method - this object is its own factory.
Definition: FortranInterfaceIBC.cpp:717
void setVerbose(bool a_verbose)
Definition: FortranInterfaceIBC.H:248
const RefCountedPtr< LevelData< FArrayBox > > & inputThicknessPtr() const
Definition: FortranInterfaceIBC.H:283
virtual RefCountedPtr< CompGridVTOBC > velocitySolveBC()
return boundary condition for Ice velocity solve
Definition: FortranInterfaceIBC.cpp:865
virtual void setThicknessClearRegions(const Vector< Box > &a_clearRegions)
regions where we artificially set thickness to zero
Definition: FortranInterfaceIBC.cpp:705
FArrayBox m_inputTopography
alias to data array passed in from glimmer-CISM
Definition: FortranInterfaceIBC.H:329
Definition: FortranInterfaceIBC.H:31
static void setFAB(Real *a_data_ptr, const int *a_dimInfo, const int *boxlo, const int *boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const IntVect &a_nGhost, FArrayBox &a_fab, FArrayBox &a_ccFab, const bool a_nodal, const bool a_verbose=false)
static function to set reference fabs
Definition: FortranInterfaceIBC.cpp:276
virtual void initialize(LevelData< FArrayBox > &a_U)
Set up initial conditions.
Definition: FortranInterfaceIBC.cpp:776
virtual void flattenIceGeometry(const Vector< RefCountedPtr< LevelSigmaCS > > &a_amrGeometry)
flatten thickness and basal topography back to input FArrayBoxes
Definition: FortranInterfaceIBC.cpp:1293
RefCountedPtr< CompGridVTOBC > m_velBCs
Definition: FortranInterfaceIBC.H:303
void setupBCs()
set up bc&#39;s based on parmparse inputs
Definition: FortranInterfaceIBC.cpp:1747
Vector< Box > m_thicknessClearRegions
regions where we will artificially set ice thickness to zero
Definition: FortranInterfaceIBC.H:326
FArrayBox m_inputSurface
alias to data array passed in from glimmer-CISM
Definition: FortranInterfaceIBC.H:347
virtual void setSurface(Real *a_data_ptr, const int *a_dimInfo, const int *boxlo, const int *boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const IntVect &a_nGhost=IntVect::Zero, const bool a_nodal=false)
sets storage for upper surface.
Definition: FortranInterfaceIBC.cpp:630
static void setGrids(DisjointBoxLayout &a_grids, const Box &a_gridBox, const ProblemDomain &a_domain, bool a_verbose)
set grids using Boxes passed in from CISM
Definition: FortranInterfaceIBC.cpp:937
virtual void artViscBC(FArrayBox &a_F, const FArrayBox &a_U, const FArrayBox &a_divVel, const int &a_dir, const Real &a_time)
Adjust boundary fluxes to account for artificial viscosity.
Definition: FortranInterfaceIBC.cpp:849
Definition: FortranInterfaceIBC.H:32
RealVect m_inputThicknessDx
Definition: FortranInterfaceIBC.H:320
Basic Sigma fourth-order coordinate system on an AMR level.
Definition: LevelSigmaCS.H:48
bool m_gridsSet
Definition: FortranInterfaceIBC.H:306
FArrayBox m_ccInputSurface
cell-centered input upper ice surface
Definition: FortranInterfaceIBC.H:356
virtual void flattenData(Real *a_data_ptr, const int *a_dimInfo, const int *a_boxlo, const int *a_boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const Vector< LevelData< FArrayBox > * > &a_amrData, const Vector< int > &a_vectRefRatio, const Vector< Real > &a_amrDx, int a_srcComp, int a_destComp, int a_nComp, const IntVect &a_nGhost, const bool a_nodal)
flatten an arbitrary dataset back to input FArrayBoxes
Definition: FortranInterfaceIBC.cpp:1500
Real m_boundaryThickness
Definition: FortranInterfaceIBC.H:289
RealVect m_inputTopographyDx
Definition: FortranInterfaceIBC.H:340
DisjointBoxLayout m_grids
Definition: FortranInterfaceIBC.H:305
FIBC_types
Definition: FortranInterfaceIBC.H:29
virtual void setGeometryBCs(LevelSigmaCS &a_coords, const ProblemDomain &a_domain, const RealVect &a_dx, Real a_time, Real a_dt)
set non-periodic geometry (thickness, topography) ghost cells
Definition: FortranInterfaceIBC.cpp:905
bool m_extrapBoundary
Definition: FortranInterfaceIBC.H:301
bool m_nodalSurface
Definition: FortranInterfaceIBC.H:349
virtual void fillTopographyHoles(Real holeVal)
utility function to fill in holes in topography
Definition: FortranInterfaceIBC.cpp:970
bool m_verbose
Definition: FortranInterfaceIBC.H:293
virtual void setBdrySlopes(FArrayBox &a_dW, const FArrayBox &a_W, const int &a_dir, const Real &a_time)
Set boundary slopes.
Definition: FortranInterfaceIBC.cpp:837
RefCountedPtr< LevelData< FArrayBox > > m_inputThicknessLDF
distributed version of thickness
Definition: FortranInterfaceIBC.H:323
IntVect m_surfaceGhost
Definition: FortranInterfaceIBC.H:359
virtual void define(const ProblemDomain &a_domain, const Real &a_dx)
Define the object.
Definition: FortranInterfaceIBC.cpp:267
virtual void primBC(FArrayBox &a_WGdnv, const FArrayBox &a_Wextrap, const FArrayBox &a_W, const int &a_dir, const Side::LoHiSide &a_side, const Real &a_time)
Set boundary fluxes.
Definition: FortranInterfaceIBC.cpp:789
virtual void initializeIceGeometry(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 initial ice state
Definition: FortranInterfaceIBC.cpp:1036
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: FortranInterfaceIBC.cpp:879
IntVect m_thicknessGhost
Definition: FortranInterfaceIBC.H:321
bool gridsSet() const
has setGrids been called?
Definition: FortranInterfaceIBC.H:272
virtual void setTopography(Real *a_data_ptr, const int *a_dimInfo, const int *boxlo, const int *boxhi, const Real *a_dew, const Real *a_dns, const IntVect &a_offset, const IntVect &a_nGhost=IntVect::Zero, const bool a_nodal=false)
Definition: FortranInterfaceIBC.cpp:563