BISICLES AMR ice sheet model  0.9
AMRDamage.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 _AMRDAMAGE_H_
12 #define _AMRDAMAGE_H_
13 
14 #include "AmrIce.H"
15 #include "LevelSigmaCS.H"
16 #include "CalvingModel.H"
17 #include "IceConstants.H"
18 #include "ParmParse.H"
19 #include "NamespaceHeader.H"
20 
22 class DamageCalvingModel;
23 #define DAMAGE_MAX_VAL 0.9
24 #define DAMAGE_N_GHOST 4
25 #define DAMAGE_N_COMP 1
26 #define WATER_N_GHOST 4
27 #define WATER_N_COMP 1
28 
30 class AMRDamage
31 {
32 
34  friend class DamageCalvingModel;
35  int m_time_step;
36  Real m_time;
37 
39  //Vector<LevelData<FArrayBox>*> m_damage;
41  int m_finestLevel;
42  Vector<DisjointBoxLayout> m_grids;
43  Vector<int> m_ratio;
44  Vector<RealVect> m_dx;
45 
46  //storage for the face-centered minimum damage. This
47  //actually gets written to by an external object (a DamageConstitutiveRelation),
48  //so, maybe a be of redesign is in order... for now:
49  Vector<LevelData<FluxBox>*> m_faceMinDamage;
50 
51 
52 public:
53  ~AMRDamage();
54  AMRDamage();
55 
56  const LevelData<FArrayBox>* damage(int a_level) const;
57 
58  const LevelData<FArrayBox>* water(int a_level) const;
59 
60  int finestLevel() const
61  {
62  return m_finestLevel;
63  }
64  void define(const Vector<DisjointBoxLayout>& a_grids,
65  const Vector<int>& a_ratio,
66  int a_finestLevel,
67  const RealVect& a_crseDx);
68 
70  void timestep(Real a_dt, AmrIce& a_amrIce);
71 
72 #ifdef CH_USE_HDF5
73  //plot file methods
74 
76  void addPlotVars(Vector<std::string>& a_vars);
77 
79  void writePlotData(LevelData<FArrayBox>& a_data, int a_level);
80 
81  //check point methods
82 
84  void addCheckVars(Vector<std::string>& a_vars);
85 
87  void writeCheckData(HDF5Handle& a_handle, int a_level);
88 
89 
91  void readCheckData(HDF5Handle& a_handle, HDF5HeaderData& a_header, int a_level, const DisjointBoxLayout& a_grids);
92 #endif
93 
94 protected:
95  //cell-centered damage
96  mutable Vector<LevelData<FArrayBox>* > m_damage;
97  //cell-centered 'water depth' parameter, which affects crevasse depth calculations.
98  mutable Vector<LevelData<FArrayBox>* > m_water;
99 
100 private:
101 
102  void computeDamageSource(Vector<LevelData<FArrayBox>* >& a_source,
103  const Vector<LevelData<FArrayBox>* >& a_damage,
104  const Vector<RefCountedPtr<LevelSigmaCS> >& geometry,
105  const Vector<LevelData<FArrayBox>const *>& a_visTensor,
106  const Vector<LevelData<FArrayBox>const * >& a_surfThickSource,
107  const Vector<LevelData<FArrayBox>const * >& a_baseThickSource,
108  Real a_dt);
109 
110  void computeWaterSource(Vector<LevelData<FArrayBox>* >& a_source, Real a_dt, AmrIce& a_amrIce);
111 
112  void updateWater(Vector<LevelData<FArrayBox>* >& a_water,
113  const Vector<LevelData<FluxBox>* >& a_faceFlux,
114  const Vector<LevelData<FluxBox>* >& a_faceVel,
115  const Vector<LevelData<FArrayBox>* >& a_source,
116  Real a_dt);
117 
118  void computeFlux( Vector<LevelData<FluxBox>* >& a_faceFlux,
119  const Vector<LevelData<FArrayBox>* >& a_damage,
120  const Vector<LevelData<FArrayBox>* >& a_source,
121  const Vector<LevelData<FArrayBox>* >& a_cellVel,
122  const Vector<LevelData<FluxBox>* >& a_faceVel,
123  Real a_dt);
124 
125  void updateDamage(Vector<LevelData<FArrayBox>* >& a_damage,
126  const Vector<LevelData<FluxBox>* >& a_faceFlux,
127  const Vector<LevelData<FluxBox>* >& a_faceMinDamage,
128  const Vector<LevelData<FluxBox>* >& a_faceVel,
129  const Vector<LevelData<FArrayBox>* >& a_source,
130  const Vector<RefCountedPtr<LevelSigmaCS> >& geometry,
131  const Vector<LevelData<FArrayBox> const * >& a_vt,
132  Real a_dt);
133 
134  void initField(Vector<LevelData<FArrayBox>* >& a_field,
135  int a_nComp,
136  const IntVect& a_ghost,
137  bool a_setToScalar = false,
138  const Real& a_scalar = 1.12345678e+300);
139 
140  void regridField(Vector<LevelData<FArrayBox>* >& a_field);
141 
142 
144  LevelData<FArrayBox>* readCheckData(
145  const std::string& a_varLabel,
146  const std::string& a_dataLabel,
147  HDF5Handle& a_handle,
148  HDF5HeaderData& a_header,
149  const DisjointBoxLayout& a_grids);
150 };
151 
152 
153 
156 {
157  AMRDamage* m_damagePtr;
158 
159 public:
160 
162 
164 
165  AMRDamage& damage() const;
166 
168  void notify(AmrIce::Observer::Notification a_n, AmrIce& a_amrIce);
169 
170  // plot file methods
171 
173  void addPlotVars(Vector<std::string>& a_vars);
174 
176  void writePlotData(LevelData<FArrayBox>& a_data, int a_level);
177 
178  //check point methods
179 
181  void addCheckVars(Vector<std::string>& a_vars);
182 
184  void writeCheckData(HDF5Handle& a_handle, int a_level);
185 
187  void readCheckData(HDF5Handle& a_handle, HDF5HeaderData& a_header, int a_level, const DisjointBoxLayout& a_grids);
188 
189 };
190 
191 
193 class DamagePhysIBC : public PhysIBC
194 {
195 
196 public:
197 
199  {
200  }
201 
202  void define(const ProblemDomain& a_domain,
203  const Real& a_dx);
204 
206 
210  PhysIBC* new_physIBC();
211 
213  void initialize(LevelData<FArrayBox>& a_U);
214 
216  void primBC(FArrayBox& a_WGdnv,
217  const FArrayBox& a_Wextrap,
218  const FArrayBox& a_W,
219  const int& a_dir,
220  const Side::LoHiSide& a_side,
221  const Real& a_time);
222 
224 
229  void setBdrySlopes(FArrayBox& a_dW,
230  const FArrayBox& a_W,
231  const int& a_dir,
232  const Real& a_time);
233 
235 
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 };
243 
244 
246 {
247 
248  CalvingModel* m_calvingModelPtr;
249  AMRDamage* m_damageModelPtr;
250 public:
251 
252  DamageCalvingModel(CalvingModel* a_calvingModelPtr, AMRDamage* a_damageModelPtr):
253  m_calvingModelPtr(a_calvingModelPtr), m_damageModelPtr(a_damageModelPtr)
254  {
255 
256  }
257 
259  {
260  m_calvingModelPtr = a.m_calvingModelPtr->new_CalvingModel();
261  m_damageModelPtr = a.m_damageModelPtr;
262  }
263 
265  {
266  return new DamageCalvingModel( *this);
267  }
268  virtual void applyCriterion(LevelData<FArrayBox>& a_thickness,
269  LevelData<FArrayBox>& a_calvedIce,
270  LevelData<FArrayBox>& a_addedIce,
271  LevelData<FArrayBox>& a_removedIce,
272  LevelData<FArrayBox>& a_iceFrac,
273  const AmrIce& a_amrIce,
274  int a_level,
275  CalvingModel::Stage a_stage);
276 
277 
278 
279 };
280 
281 
282 #include "NamespaceFooter.H"
283 
284 #endif
void timestep(Real a_dt, AmrIce &a_amrIce)
advance by timestep a_dt. a_dt must satisfy CFL
Definition: AMRDamage.cpp:350
PhysIBC for the damage model.
Definition: AMRDamage.H:193
void readCheckData(HDF5Handle &a_handle, HDF5HeaderData &a_header, int a_level, const DisjointBoxLayout &a_grids)
read level a_level checkpoint data
Definition: AMRDamage.cpp:780
part of Observer-Observee implementation
Definition: AmrIce.H:1407
DamageCalvingModel(const DamageCalvingModel &a)
Definition: AMRDamage.H:258
Continuum damage model.
Definition: AMRDamage.H:30
~AMRDamage()
Definition: AMRDamage.cpp:95
friend class DamageCalvingModel
Definition: AMRDamage.H:34
DamagePhysIBC()
Definition: AMRDamage.H:198
AMRDamage()
Definition: AMRDamage.cpp:123
Vector< LevelData< FArrayBox > *> m_water
Definition: AMRDamage.H:98
class to manage non-subcycled AMR ice-sheet model
Definition: AmrIce.H:40
virtual CalvingModel * new_CalvingModel()=0
factory method
DamageCalvingModel(CalvingModel *a_calvingModelPtr, AMRDamage *a_damageModelPtr)
Definition: AMRDamage.H:252
Contains an AMRDamage, responds to changes in the ice sheet state.
Definition: AMRDamage.H:155
Computes the effective viscosity including a factor due to crevassing.
Definition: DamageConstitutiveRelation.H:29
const LevelData< FArrayBox > * damage(int a_level) const
Definition: AMRDamage.cpp:129
virtual CalvingModel * new_CalvingModel()
factory method
Definition: AMRDamage.H:264
const LevelData< FArrayBox > * water(int a_level) const
Definition: AMRDamage.cpp:150
int finestLevel() const
Definition: AMRDamage.H:60
void writeCheckData(HDF5Handle &a_handle, int a_level)
write level a_level checkpoint data
Definition: AMRDamage.cpp:736
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: AMRDamage.cpp:710
void computeFlux(Vector< LevelData< FluxBox > * > &fluxOfIce, const Vector< RefCountedPtr< LevelSigmaCS > > &coords, Vector< LevelData< FArrayBox > * > &topography, Vector< LevelData< FArrayBox > * > &thickness, Vector< LevelData< FArrayBox > * > &surfaceThicknessSource, Vector< LevelData< FArrayBox > * > &basalThicknessSource, Vector< Real > &dx, Vector< int > &ratio, Vector< std::string > &name, Vector< LevelData< FArrayBox > * > &data)
Definition: diagnostics.cpp:211
void writePlotData(LevelData< FArrayBox > &a_data, int a_level)
copy level a_level plot data to LevelData<FArrayBox>& a_data
Definition: AMRDamage.cpp:716
void addCheckVars(Vector< std::string > &a_vars)
fill a_var with the names of variables to add to the checkpoint file
Definition: AMRDamage.cpp:729
Notification
Definition: AmrIce.H:1427
void define(const Vector< DisjointBoxLayout > &a_grids, const Vector< int > &a_ratio, int a_finestLevel, const RealVect &a_crseDx)
Definition: AMRDamage.cpp:281
Stage
Definition: CalvingModel.H:28
virtual base for calving models
Definition: CalvingModel.H:23
Vector< LevelData< FArrayBox > *> m_damage
Definition: AMRDamage.H:96
Definition: AMRDamage.H:245