BISICLES AMR ice sheet model  0.9
LevelDataSurfaceFlux.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 // concrete class encapsulating surface fluxes determined
12 // by copying, coarsening, or interpolating a LevelData<FArrayBox>
13 // covering an entire domain. Objects can be defined either
14 // by specifying a RefCountedPtr<LevelData<FArrayBox> > , or by specifying
15 // a std::map<Real,string> mapping time ti to an hdf5 file f. In the
16 // latter case, the flux at time t is found by linear interploation
17 // between time max(ti <= t) and min(ti > t)
18 
19 // \todo replace the std::map<Real,string> mechanism with
20 // a suitable abstraction
21 
22 #ifndef _LEVELDATASURFACEFLUX_H_
23 #define _LEVELDATASURFACEFLUX_H_
24 
25 #include "SurfaceFlux.H"
26 #include <map>
27 #include "NamespaceHeader.H"
28 
30 {
31 public:
32 
33  LevelDataSurfaceFlux(RefCountedPtr<LevelData<FArrayBox> > a_flux,
34  const RealVect& a_dx, const Real& a_defaultValue=0.0)
35  :m_timeFileMap(NULL), m_startTime(-1.2345678e+300), m_endTime(1.2345678e+300),
36  m_defaultValue(a_defaultValue),
37  m_startFlux(a_flux), m_endFlux(a_flux),m_dx(a_dx),m_verbose(true),m_name(""),
38  m_linearInterp(true)
39 
40  {
41  }
42 
43  LevelDataSurfaceFlux(RefCountedPtr<std::map<Real,
44  std::string> >& a_timeFileMap,
45  const std::string& a_name,
46  const bool& a_linearInterp,
47  const Real& a_defaultValue=0.0)
48  :m_timeFileMap(a_timeFileMap), m_startTime(1.2345678e+300), m_endTime(-1.2345678e+300),
49  m_defaultValue(a_defaultValue),
50  m_startFlux(new LevelData<FArrayBox>()),m_endFlux(new LevelData<FArrayBox>()),
51  m_verbose(true),m_name(a_name),m_linearInterp(a_linearInterp)
52  {
53  }
54 
55 
56 
57 
59  virtual ~LevelDataSurfaceFlux() {};
60 
62 
65  {
67  if (m_timeFileMap != NULL)
68  {
70  }
71  else
72  {
74  }
75 
76  return static_cast<SurfaceFlux*>(ptr);
77  }
78 
80 
83  virtual void surfaceThicknessFlux(LevelData<FArrayBox>& a_flux,
84  const AmrIceBase& a_amrIce,
85  int a_level, Real a_dt);
86 
87 
88 protected:
89 
90  RefCountedPtr<std::map<Real,std::string> > m_timeFileMap;
92  RefCountedPtr< LevelData<FArrayBox> > m_startFlux;
93  RefCountedPtr< LevelData<FArrayBox> > m_endFlux;
94  RealVect m_dx;
95  bool m_verbose;
96  std::string m_name;
98 
99 private:
100  // Disallowed for all the usual reasons
101  void operator=(const LevelDataSurfaceFlux& a_input)
102  {
103  MayDay::Error("invalid operator");
104  }
105 
106  // public interfaces disallowed for all the usual reasons
108  {
109  MayDay::Error("invalid operator");
110  }
111 
112 };
113 
114 
116 {
117 public:
118 
119 
120  MultiLevelDataSurfaceFlux(RefCountedPtr<std::map<Real,std::string> >& a_timeFileMap,
121  const std::string& a_name,
122  const bool& a_linearInterp,
123  const Real& a_defaultValue=0.0)
124  :m_timeFileMap(a_timeFileMap), m_startTime(1.2345678e+300), m_endTime(-1.2345678e+300), m_defaultValue(a_defaultValue),
125  m_verbose(true),m_name(a_name), m_linearInterp(a_linearInterp)
126  {
127  }
128 
129 
130 
131 
134 
136 
139  {
141  if (m_timeFileMap != NULL)
142  {
145  }
146  // else
147  // {
148  // ptr = new MultiLevelDataSurfaceFlux(m_startFlux,m_dx);
149  // }
150 
151  return static_cast<SurfaceFlux*>(ptr);
152  }
153 
155 
158  virtual void surfaceThicknessFlux(LevelData<FArrayBox>& a_flux,
159  const AmrIceBase& a_amrIce,
160  int a_level, Real a_dt);
161 
162 
163 protected:
164 
165  RefCountedPtr<std::map<Real,std::string> > m_timeFileMap;
167  Vector<RefCountedPtr< LevelData<FArrayBox> > > m_startFlux;
168  Vector<RefCountedPtr< LevelData<FArrayBox> > > m_endFlux;
169  RealVect m_dxCrse;
170  Vector<int> m_ratio;
171  bool m_verbose;
172  std::string m_name;
174 
175 private:
176  // Disallowed for all the usual reasons
177  void operator=(const MultiLevelDataSurfaceFlux& a_input)
178  {
179  MayDay::Error("invalid operator");
180  }
181 
182  // public interfaces disallowed for all the usual reasons
184  {
185  MayDay::Error("invalid operator");
186  }
187 
188 };
189 
190 
191 #include "NamespaceFooter.H"
192 
193 #endif
Vector< RefCountedPtr< LevelData< FArrayBox > > > m_startFlux
Definition: LevelDataSurfaceFlux.H:167
std::string m_name
Definition: LevelDataSurfaceFlux.H:96
LevelDataSurfaceFlux(RefCountedPtr< std::map< Real, std::string > > &a_timeFileMap, const std::string &a_name, const bool &a_linearInterp, const Real &a_defaultValue=0.0)
Definition: LevelDataSurfaceFlux.H:43
Definition: LevelDataSurfaceFlux.H:115
RefCountedPtr< LevelData< FArrayBox > > m_endFlux
Definition: LevelDataSurfaceFlux.H:93
MultiLevelDataSurfaceFlux(RefCountedPtr< std::map< Real, std::string > > &a_timeFileMap, const std::string &a_name, const bool &a_linearInterp, const Real &a_defaultValue=0.0)
Definition: LevelDataSurfaceFlux.H:120
Real m_endTime
Definition: LevelDataSurfaceFlux.H:91
bool m_verbose
Definition: LevelDataSurfaceFlux.H:171
Real m_defaultValue
Definition: LevelDataSurfaceFlux.H:91
RefCountedPtr< std::map< Real, std::string > > m_timeFileMap
Definition: LevelDataSurfaceFlux.H:90
Real m_startTime
Definition: LevelDataSurfaceFlux.H:166
RefCountedPtr< LevelData< FArrayBox > > m_startFlux
Definition: LevelDataSurfaceFlux.H:92
LevelDataSurfaceFlux(RefCountedPtr< LevelData< FArrayBox > > a_flux, const RealVect &a_dx, const Real &a_defaultValue=0.0)
Definition: LevelDataSurfaceFlux.H:33
RealVect m_dxCrse
Definition: LevelDataSurfaceFlux.H:169
std::string m_name
Definition: LevelDataSurfaceFlux.H:172
virtual ~LevelDataSurfaceFlux()
destructor
Definition: LevelDataSurfaceFlux.H:59
bool m_linearInterp
Definition: LevelDataSurfaceFlux.H:97
abstract class defining the surface flux interface
Definition: SurfaceFlux.H:39
Definition: LevelDataSurfaceFlux.H:29
bool m_verbose
Definition: LevelDataSurfaceFlux.H:95
Vector< RefCountedPtr< LevelData< FArrayBox > > > m_endFlux
Definition: LevelDataSurfaceFlux.H:168
virtual ~MultiLevelDataSurfaceFlux()
destructor
Definition: LevelDataSurfaceFlux.H:133
virtual SurfaceFlux * new_surfaceFlux()
factory method
Definition: LevelDataSurfaceFlux.H:138
virtual void surfaceThicknessFlux(LevelData< FArrayBox > &a_flux, const AmrIceBase &a_amrIce, int a_level, Real a_dt)
define source term for thickness evolution and place it in flux
Definition: LevelDataSurfaceFlux.cpp:30
RealVect m_dx
Definition: LevelDataSurfaceFlux.H:94
Real m_startTime
Definition: LevelDataSurfaceFlux.H:91
RefCountedPtr< std::map< Real, std::string > > m_timeFileMap
Definition: LevelDataSurfaceFlux.H:165
Vector< int > m_ratio
Definition: LevelDataSurfaceFlux.H:170
abstract base class for amr ice sheet models (AmrIce, AMRIceControl)
Definition: AmrIceBase.H:21
virtual SurfaceFlux * new_surfaceFlux()
factory method
Definition: LevelDataSurfaceFlux.H:64
bool m_linearInterp
Definition: LevelDataSurfaceFlux.H:173