BISICLES AMR ice sheet model  0.9
AMRMelange.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 _AMRMELANGE_H_
12 #define _AMRMELANGE_H_
13 
14 #include "AmrIce.H"
15 #include "LevelSigmaCS.H"
16 #include "SurfaceFlux.H"
17 #include "NamespaceHeader.H"
18 
19 #define MELANGE_N_GHOST 1
20 #define MELANGE_N_COMP 1
21 
23 
63 {
64 
65  int m_time_step;
66  Real m_time;
67  Real m_diffusion_factor;
68 
70  //Vector<LevelData<FArrayBox>*> m_melange;
72  int m_finestLevel;
73  Vector<DisjointBoxLayout> m_grids;
74  Vector<int> m_ratio;
75  Vector<RealVect> m_dx;
76  SurfaceFlux* m_external_source;
77 
78 public:
79  ~AMRMelange();
80  AMRMelange();
81 
82  const LevelData<FArrayBox>* melange(int a_level) const;
83  int finestLevel() const
84  {
85  return m_finestLevel;
86  }
87  void define(const Vector<DisjointBoxLayout>& a_grids,
88  const Vector<int>& a_ratio,
89  int a_finestLevel,
90  const RealVect& a_crseDx);
91 
93  void timestep(Real a_dt, AmrIce& a_amrIce);
94 
96  void increment(AmrIce& a_amrIce, Real a_scale);
97 
98 
99 #ifdef CH_USE_HDF5
100  //plot file methods
101 
103  void addPlotVars(Vector<std::string>& a_vars);
104 
106  void writePlotData(LevelData<FArrayBox>& a_data, int a_level);
107 
108  //check point methods
109 
111  void addCheckVars(Vector<std::string>& a_vars);
112 
114  void writeCheckData(HDF5Handle& a_handle, int a_level);
115 
117  void readCheckData(HDF5Handle& a_handle, HDF5HeaderData& a_header, int a_level, const DisjointBoxLayout& a_grids);
118 #endif
119 
120  const LevelData<FArrayBox>* melangeThickness(int lev)
121  {
122  return m_melange[lev];
123  }
124 
125 protected:
126  //cell-centered melange
127  mutable Vector<LevelData<FArrayBox>* > m_melange;
128 
129 private:
130 
131  void computeSource(Vector<LevelData<FArrayBox>* >& a_source,
132  AmrIce& a_amrIce, Real a_dt);
133 
134  void updateMelange(Vector<LevelData<FArrayBox>* >& a_melange,
135  const Vector<LevelData<FArrayBox>* >& a_source,
136  const Vector<RefCountedPtr<LevelSigmaCS> >& geometry,
137  Real a_dt);
138 
139 };
140 
141 
142 
145 {
146  AMRMelange* m_melangePtr;
147  bool m_next_increment_positive; //used to make sure that m_melangePtr->increment calls occur in pairs
148 
149 public:
150 
153 
154  AMRMelange& melange() const;
155 
157  void notify(AmrIce::Observer::Notification a_n, AmrIce& a_amrIce);
158 
160  void addPlotVars(Vector<std::string>& a_vars);
161 
163  void writePlotData(LevelData<FArrayBox>& a_data, int a_level);
164 
165  //check point methods
166 
168  void addCheckVars(Vector<std::string>& a_vars);
169 
171  void writeCheckData(HDF5Handle& a_handle, int a_level);
172 
174  void readCheckData(HDF5Handle& a_handle, HDF5HeaderData& a_header, int a_level, const DisjointBoxLayout& a_grids);
175 
176 };
177 
178 
180 class MelangePhysIBC : public PhysIBC
181 {
182 
183 public:
184 
186  {
187  }
188 
189  void define(const ProblemDomain& a_domain,
190  const Real& a_dx);
191 
193 
197  PhysIBC* new_physIBC();
198 
200  void initialize(LevelData<FArrayBox>& a_U);
201 
203  void primBC(FArrayBox& a_WGdnv,
204  const FArrayBox& a_Wextrap,
205  const FArrayBox& a_W,
206  const int& a_dir,
207  const Side::LoHiSide& a_side,
208  const Real& a_time);
209 
211 
216  void setBdrySlopes(FArrayBox& a_dW,
217  const FArrayBox& a_W,
218  const int& a_dir,
219  const Real& a_time);
220 
222 
224  void artViscBC(FArrayBox& a_F,
225  const FArrayBox& a_U,
226  const FArrayBox& a_divVel,
227  const int& a_dir,
228  const Real& a_time);
229 };
230 
231 
232 
233 #include "NamespaceFooter.H"
234 
235 #endif
Vector< LevelData< FArrayBox > *> m_melange
Definition: AMRMelange.H:127
void increment(AmrIce &a_amrIce, Real a_scale)
increment the melange thickness by a_scale * ice thickness
Definition: AMRMelange.cpp:293
void addCheckVars(Vector< std::string > &a_vars)
fill a_var with the names of variables to add to the checkpoint file
Definition: AMRMelange.cpp:498
part of Observer-Observee implementation
Definition: AmrIce.H:1407
const LevelData< FArrayBox > * melange(int a_level) const
Definition: AMRMelange.cpp:153
int finestLevel() const
Definition: AMRMelange.H:83
~AMRMelange()
Definition: AMRMelange.cpp:114
class to manage non-subcycled AMR ice-sheet model
Definition: AmrIce.H:40
Contains an AMRMelange, responds to changes in the ice sheet state.
Definition: AMRMelange.H:144
Continuum melange transport model.
Definition: AMRMelange.H:62
void writeCheckData(HDF5Handle &a_handle, int a_level)
copy level a_level checkpoint data to LevelData<FArrayBox>& a_data
Definition: AMRMelange.cpp:504
void writePlotData(LevelData< FArrayBox > &a_data, int a_level)
copy level a_level plot data to LevelData<FArrayBox>& a_data
Definition: AMRMelange.cpp:487
abstract class defining the surface flux interface
Definition: SurfaceFlux.H:39
void timestep(Real a_dt, AmrIce &a_amrIce)
advance by timestep a_dt. a_dt must satisfy CFL
Definition: AMRMelange.cpp:308
void readCheckData(HDF5Handle &a_handle, HDF5HeaderData &a_header, int a_level, const DisjointBoxLayout &a_grids)
read level a_level checkpoint data from LevelData<FArrayBox>& a_data
Definition: AMRMelange.cpp:510
const LevelData< FArrayBox > * melangeThickness(int lev)
Definition: AMRMelange.H:120
Notification
Definition: AmrIce.H:1427
void addPlotVars(Vector< std::string > &a_vars)
add the names of variables to add to the plot file to a_var, in the order they will be written ...
Definition: AMRMelange.cpp:482
void define(const Vector< DisjointBoxLayout > &a_grids, const Vector< int > &a_ratio, int a_finestLevel, const RealVect &a_crseDx)
Definition: AMRMelange.cpp:175
MelangePhysIBC()
Definition: AMRMelange.H:185
PhysIBC for the melange model.
Definition: AMRMelange.H:180
AMRMelange()
Definition: AMRMelange.cpp:133