BISICLES AMR ice sheet model  0.9
NonlinearViscousTensor.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 _NONLINEARVISCOUSTENSOR_H_
12 #define _NONLINEARVISCOUSTENSOR_H_
13 
14 
15 #include "IceVelocitySolver.H"
16 #include "AMRMultiGrid.H"
17 #include "MultilevelIceVelOp.H"
18 #include "ViscousTensorOp.H"
19 #ifdef CH_USE_PETSC
20 #include "PetscAMRSolver.H"
21 
22 #endif
23 
24 //#31556926.0;
25 #include "NamespaceHeader.H"
26 
34 {
35 public:
40 
45  virtual void setState(const Vector<LevelData<FArrayBox>*>& a_state)=0;
46 
48  virtual void applyBC(Vector<LevelData<FArrayBox>*>& a_phi)=0;
49 
51 
54  virtual const Vector<LevelData<FArrayBox>*>& getState() = 0;
55 
57 
61  virtual Vector<RefCountedPtr< LevelData<FArrayBox> > >& alpha() =0;
62 
64 
69  virtual Vector<RefCountedPtr< LevelData<FluxBox> > >& mu() =0;
70 
72 
77  virtual Vector<RefCountedPtr< LevelData<FluxBox> > >& lambda() =0;
78 
80  virtual RefCountedPtr< AMRLevelOpFactory<LevelData<FArrayBox> > > opFactoryPtr()=0;
81 };
82 
84 
106 {
107 
108  Vector<LevelData<FArrayBox>*> m_u;
109  Vector<LevelData<FArrayBox>*> m_C;
110  Vector<LevelData<FArrayBox>*> m_C0;
111  RefCountedPtr<AMRLevelOpFactory<LevelData<FArrayBox> > > m_opFactoryPtr;
112 
113  //mesh parameters
114  Vector<DisjointBoxLayout> m_grids;
115  Vector<int> m_refRatio;
116  Vector<ProblemDomain> m_domains;
117  Vector<RealVect> m_dxs;
118  int m_finestLevel;
119  Vector<RefCountedPtr<LevelSigmaCS > > m_coordSys;
120 
121  //constitutive relations
122  const ConstitutiveRelation* m_constRelPtr;
123  const BasalFrictionRelation* m_basalFrictionRelPtr;
124 
125  //boundary conditions
126  IceThicknessIBC* m_bcPtr;
127 
128  //pointers to temperature fields
129  Vector<LevelData<FArrayBox>*> m_A;
130  Vector<LevelData<FluxBox>*> m_faceA;
131 
132  //additional face-centred coefficient of H*mu, usually NULL
133  Vector<LevelData<FluxBox>*> m_muCoef;
134 
135  // time : this class doesn't care, but m_bcPtr does
136  Real m_time;
137 
138  // safety factor for VicousTensorOp
139  Real m_vtopSafety;
140  // minimum number of smnooths in viscous tensor op mg relax
141  int m_vtopRelaxMinIter;
142  // relax tolerance for viscous tensor op
143  Real m_vtopRelaxTol;
144 
145  //lower and upper bounds on the viscosity
146  Real m_muMin, m_muMax;
147 
148  Real m_scale; // scale mu,alpha by 1/m_scale
149 
150 
151  // artificial drag that applies everywhere
152  /* if used, need to ensure that
153  (m_artificial_drag * |u|)^m_artifical_drag_power << rho * g * h * grad(s) ~ 10^4
154  when |u| ~ 10^4
155  */
156  Real m_artificialDragCoef, m_artificialDragPower;
157 
158 
159  // BCHolder
160  RefCountedPtr<BCFunction> m_velSolveBC;
161 
162  //coefficient storage.
163  Vector<RefCountedPtr<LevelData<FluxBox> > > m_mu;
164  Vector<RefCountedPtr<LevelData<FluxBox> > > m_lambda;
165  Vector<RefCountedPtr<LevelData<FArrayBox> > > m_alpha;
166 
167  void setupCoeffs();
168 
169 public:
170 
172 
174 
176 
199  (const Vector<DisjointBoxLayout>& a_grids,
200  const Vector<int>& a_refRatio,
201  const Vector<ProblemDomain>& a_domains,
202  const Vector<RealVect>& a_dxs,
203  const Vector<RefCountedPtr<LevelSigmaCS > >& a_coordSys,
204  const Vector<LevelData<FArrayBox>*>& a_u,
205  const Vector<LevelData<FArrayBox>*>& a_C,
206  const Vector<LevelData<FArrayBox>*>& a_C0,
207  const int a_finestLevel,
208  const ConstitutiveRelation& a_constRel,
209  const BasalFrictionRelation& a_basalFrictionRel,
210  IceThicknessIBC& a_bc,
211  const Vector<LevelData<FArrayBox>*>& a_A,
212  const Vector<LevelData<FluxBox>*>& a_faceFlowLawCoefficient,
213  Real a_time,
214  Real a_vtopSafety,
215  int a_vtopRelaxMinIter,
216  Real a_vtopRelaxTol,
217  Real a_muMin = 0.0,
218  Real a_muMax = 1.234567e+300,
219  Real a_scale = 1.0,
220  Real a_artificialDragCoef = 0.0, Real a_artificialDragPower=8.0);
221 
222  //implementation of NonlinearViscousTensor interface
223  virtual void setState(const Vector<LevelData<FArrayBox>*>& a_u);
224 
225  virtual void applyBC(Vector<LevelData<FArrayBox>*>& a_phi)
226  {
227  for (int lev =0; lev < a_phi.size(); lev++)
228  {
229  for (DataIterator dit(m_grids[lev]); dit.ok(); ++dit)
230  {
231  (*m_velSolveBC)((*a_phi[lev])[dit], m_grids[lev][dit], m_domains[lev],
232  m_dxs[lev][0], dit(), false);
233  }
234  }
235  }
236 
237 
238  virtual Vector<LevelData<FArrayBox>*>& getState()
239  {
240  return m_u;
241  }
242 
243  virtual Vector<RefCountedPtr<LevelData<FluxBox> > >& mu()
244  {
245  return m_mu;
246  }
247  virtual Vector<RefCountedPtr<LevelData<FluxBox> > >& lambda()
248  {
249  return m_lambda;
250  }
251  virtual Vector<RefCountedPtr<LevelData<FArrayBox> > >& alpha()
252  {
253  return m_alpha;
254  }
255 
256  virtual RefCountedPtr< AMRLevelOpFactory<LevelData<FArrayBox> > >
258  return m_opFactoryPtr;
259  }
260 
264  virtual Vector<LevelData<FArrayBox>*>& getC()
265  {
266  return m_C;
267  }
268 
272  virtual void setState(const Vector<LevelData<FArrayBox>*>& a_u,
273  const Vector<LevelData<FArrayBox>*>& a_basalFrictionCoefficent)
274  {
275  m_C = a_basalFrictionCoefficent;
276  setState(a_u);
277  }
278 
283  virtual void setFaceViscCoef(const Vector<LevelData<FluxBox>*>& a_muCoef)
284  {
285  int nlev = min(a_muCoef.size(),m_muCoef.size());
286 
287  for (int lev=0; lev < nlev; lev++)
288  {
289  m_muCoef[lev] = a_muCoef[lev];
290  }
291  }
292 
296  virtual void unsetFaceViscCoef()
297  {
298  for (int lev=0; lev < m_muCoef.size(); lev++)
299  {
300  m_muCoef[lev] = NULL;
301  }
302  }
303 
308  virtual void computeViscousTensorFace(const Vector<LevelData<FluxBox>*>& a_viscousTensor);
309 
310 };
311 
312 #include "NamespaceFooter.H"
313 #endif
virtual Vector< LevelData< FArrayBox > * > & getState()
retrieve the state
Definition: NonlinearViscousTensor.H:238
Implement NonlinearViscousTensor for typical (velocity-depenendent) ice rheology. ...
Definition: NonlinearViscousTensor.H:105
virtual Vector< RefCountedPtr< LevelData< FluxBox > > > & mu()
Retrieve the viscosity coefficient, mu.
Definition: NonlinearViscousTensor.H:243
virtual Vector< RefCountedPtr< LevelData< FArrayBox > > > & alpha()
Retrieve the drag coefficient, alpha.
Definition: NonlinearViscousTensor.H:251
virtual Vector< LevelData< FArrayBox > * > & getC()
Definition: NonlinearViscousTensor.H:264
virtual Vector< RefCountedPtr< LevelData< FluxBox > > > & mu()=0
Retrieve the viscosity coefficient, mu.
virtual NonlinearViscousTensor * newNonlinearViscousTensor()=0
factory method
virtual RefCountedPtr< AMRLevelOpFactory< LevelData< FArrayBox > > > opFactoryPtr()=0
provide a pointer to an AMRLevelOpFactory<LevelData<FArrayBox> > defined at the current state ...
virtual void unsetFaceViscCoef()
Definition: NonlinearViscousTensor.H:296
Abstract class around the englacial constitutive relations for ice.
Definition: ConstitutiveRelation.H:34
Physical/domain initial and boundary conditions for ice-sheet problems.
Definition: IceThicknessIBC.H:84
virtual ~NonlinearViscousTensor()
Definition: NonlinearViscousTensor.H:36
virtual void setState(const Vector< LevelData< FArrayBox > *> &a_state)=0
set the state (velocity)
virtual const Vector< LevelData< FArrayBox > * > & getState()=0
retrieve the state
virtual Vector< RefCountedPtr< LevelData< FArrayBox > > > & alpha()=0
Retrieve the drag coefficient, alpha.
Virtual base class for basal friction relations.
Definition: BasalFrictionRelation.H:27
virtual void applyBC(Vector< LevelData< FArrayBox > *> &a_phi)=0
fill ghost cells of a_state as per the boundary conditions
Definition: NonlinearViscousTensor.H:33
virtual RefCountedPtr< AMRLevelOpFactory< LevelData< FArrayBox > > > opFactoryPtr()
provide a pointer to an AMRLevelOpFactory<LevelData<FArrayBox> > defined at the current state ...
Definition: NonlinearViscousTensor.H:257
virtual void applyBC(Vector< LevelData< FArrayBox > *> &a_phi)
fill ghost cells of a_state as per the boundary conditions
Definition: NonlinearViscousTensor.H:225
virtual Vector< RefCountedPtr< LevelData< FluxBox > > > & lambda()
Retrieve the compressibility coefficient, lambda.
Definition: NonlinearViscousTensor.H:247
virtual void setState(const Vector< LevelData< FArrayBox > *> &a_u, const Vector< LevelData< FArrayBox > *> &a_basalFrictionCoefficent)
Definition: NonlinearViscousTensor.H:272
virtual Vector< RefCountedPtr< LevelData< FluxBox > > > & lambda()=0
Retrieve the compressibility coefficient, lambda.
virtual void setFaceViscCoef(const Vector< LevelData< FluxBox > *> &a_muCoef)
Definition: NonlinearViscousTensor.H:283