BISICLES AMR ice sheet model  0.9
FASIceSolver.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 _FASICESOLVER_H_
12 #define _FASICESOLVER_H_
13 
14 #include "IceVelocitySolver.H"
15 #include "ViscousTensorOp.H"
16 #include "AMRFAS.H"
17 
18 #include "NamespaceHeader.H"
19 
21 
24 class FASIceViscouseTensorOpFactory: public AMRFAS_LDFOpFactory
25 {
26 public:
29  BasalFrictionRelation* a_basalFrictionRelPtr,
30  IceThicknessIBC* a_bc// ,
31  // int a_sizeA
32  );
33 
35  {
36  if(m_VTOFactory) delete m_VTOFactory;
37  }
38 
39  // overide base class' define to add VTO stuff, create m_VTOFactory
40  virtual void define( const ProblemDomain& a_coarseDomain,
41  const RealVect& a_crsDx,
42  const Vector<DisjointBoxLayout>& a_grids,
43  const Vector<int>& a_refRatios,
44  int a_nSRGrids = 0
45  );
46 
48  virtual RefCountedPtr<AMRFASOp<LevelData<FArrayBox> > >
49  AMRNewOp(int a_ilev,
50  const DisjointBoxLayout& a_grid,
51  bool a_isSR = false );
52 
53  // Ice op data, copy into op
56 
57  ViscousTensorOpFactory* m_VTOFactory;
58  IceThicknessIBC* m_bc; // this masks m_bc in base class
59 
60  //const int m_sizeA; // need to get this early to allocate m_A
61 };
62 
66 class FASIceViscouseTensorOp : public AMRFAS_LDFOp
67 {
69 public:
71  FASIceViscouseTensorOp( int a_o,
72  const DisjointBoxLayout &a_grid,
73  const ConstitutiveRelation* a_constRelPtr,
74  const BasalFrictionRelation* a_basalFrictionRelPtr,
75  IceThicknessIBC* a_bc
76  );
77 
79  {
80  if(m_VTO) delete m_VTO;
81  }
82 
83  virtual void restrictState( RefCountedPtr<AMRFASOp<LevelData<FArrayBox> > >,
84  Copier &a_copier );
85 
86  virtual bool computeState( RefCountedPtr<LevelData<FArrayBox> > a_phi,
87  const RefCountedPtr<LevelData<FArrayBox> > a_CrsPhi,
88  const RefCountedPtr<LevelData<FArrayBox> > a_FinePhi
89  );
90 
91 protected:
92  virtual void applyLevel( LevelData<FArrayBox>& a_LofPhi,
93  const LevelData<FArrayBox>& a_phi
94  );
95 
96  virtual void reflux(const LevelData<FArrayBox>& a_phiFine,
97  const LevelData<FArrayBox>& a_phi,
98  LevelData<FArrayBox>& a_residual,
99  AMRFASOp<LevelData<FArrayBox> >* a_finerOp );
100 
101  virtual void levelGSRB( RefCountedPtr<LevelData<FArrayBox> > a_phi,
102  const RefCountedPtr<LevelData<FArrayBox> > a_rhs
103  );
104 
105  virtual void levelRich( RefCountedPtr<LevelData<FArrayBox> > a_phi,
106  const RefCountedPtr<LevelData<FArrayBox> > a_rhs
107  );
108 
109  // compute face-centered coefficients for tensor solver (really
110  // winds up being H*mu) -- non-isothermal version...
111  void computeMu( LevelData<FArrayBox> &a_vel,
112  const LevelData<FArrayBox>* a_crseVel,
113  const LevelData<FArrayBox>*
114  );
115 
116 public:
117  // constant op data
118  const Real m_constThetaVal;
119  const Real m_vtopSafety;
120 
121  // passed from solver to factory to op
124 
125  // cached in solver
126  Real m_time;
127  RefCountedPtr<LevelSigmaCS> m_coordSys;
128 
129  // beta is used to scale C below
130  RefCountedPtr<LevelData<FArrayBox> > m_Beta; // set in solver from a_beta
131  RefCountedPtr<LevelData<FArrayBox> > m_Beta0; // set in solver from a_beta0
132  RefCountedPtr<LevelData<FluxBox> > m_faceA; // derived in solver from m_A
133  // Viscous tensor operator
134  ViscousTensorOp* m_VTO;
135  IceThicknessIBC* m_bc; // this masks m_bc in base class
136 
137  virtual void CFInterp( LevelData<FArrayBox>& a_phi,
138  const LevelData<FArrayBox>& a_phiCoarse);
139 };
140 
143 class FASIceSolver : public IceVelocitySolver, public AMRFAS<LevelData<FArrayBox> >
144 {
145 
146 public:
147 
148  FASIceSolver(// int a_sizeA
149  ) // : m_sizeA(a_sizeA)
150  {
151  }
152 
153  virtual ~FASIceSolver()
154  {
155  }
156 
157  virtual void define(const ProblemDomain& a_coarseDomain,
158  ConstitutiveRelation* a_constRel,
159  BasalFrictionRelation* a_basalFrictionRel,
160  const Vector<DisjointBoxLayout>& a_vectGrids,
161  const Vector<int>& a_vectRefRatio,
162  const RealVect& a_dxCrse,
163  IceThicknessIBC* a_bc,
164  int a_numLevels);
165 
166  virtual void setTolerance( Real a_tolerance ) { m_rtol = a_tolerance; }
167 
169 
173  //virtual void setAbsoluteTolerance(Real a_tolerance) {m_atol = a_tolerance;}
174 
176  virtual void setMaxIterations(int a_max_iter) { m_max_iter = a_max_iter; }
177 
178  virtual void setVerbosity(int a_verbosity) {
179  IceVelocitySolver::m_verbosity = a_verbosity;
180  AMRFAS<LevelData<FArrayBox> >::m_verbosity = a_verbosity;
181  }
182 
184  virtual int solve( Vector<LevelData<FArrayBox>* >& a_horizontalVel,
185  Vector<LevelData<FArrayBox>* >& a_calvedIce,
186  Vector<LevelData<FArrayBox>* >& a_addedIce,
187  Vector<LevelData<FArrayBox>* >& a_removedIce,
188  Real& a_initialResidualNorm,
189  Real& a_finalResidualNorm,
190  const Real a_convergenceMetric,
191  const Vector<LevelData<FArrayBox>* >& a_rhs,
192  const Vector<LevelData<FArrayBox>* >& a_C, // beta
193  const Vector<LevelData<FArrayBox>* >& a_C0,
194  const Vector<LevelData<FArrayBox>* >& a_A,
195  const Vector<LevelData<FluxBox>* >& a_muCoef,
196  Vector<RefCountedPtr<LevelSigmaCS > >& a_coordSys,
197  Real a_time,
198  int a_lbase,
199  int a_maxLevel
200  );
201 
202 protected:
203  RefCountedPtr<FASIceViscouseTensorOpFactory> m_opFactoryPtr;
205  //const int m_sizeA;
206 };
207 
208 #include "NamespaceFooter.H"
209 
210 #endif
RefCountedPtr< LevelData< FluxBox > > m_faceA
Definition: FASIceSolver.H:132
virtual ~FASIceViscouseTensorOp()
Definition: FASIceSolver.H:78
const Real m_vtopSafety
Definition: FASIceSolver.H:119
Definition: FASIceSolver.H:66
virtual void setTolerance(Real a_tolerance)
if relevant, set solver tolerance
Definition: FASIceSolver.H:166
Abstract class to manage the nonlinear solve for the ice-sheet momentum.
Definition: IceVelocitySolver.H:32
virtual ~FASIceSolver()
Definition: FASIceSolver.H:153
RefCountedPtr< LevelData< FArrayBox > > m_Beta0
Definition: FASIceSolver.H:131
Abstract class around the englacial constitutive relations for ice.
Definition: ConstitutiveRelation.H:34
ViscousTensorOp * m_VTO
Definition: FASIceSolver.H:134
IceThicknessIBC * m_bc
Definition: FASIceSolver.H:58
const ConstitutiveRelation * m_constRelPtr
Definition: FASIceSolver.H:54
Physical/domain initial and boundary conditions for ice-sheet problems.
Definition: IceThicknessIBC.H:84
FASIceSolver()
Definition: FASIceSolver.H:148
const ConstitutiveRelation * m_constRelPtr
Definition: FASIceSolver.H:122
int m_verbosity
Definition: IceVelocitySolver.H:113
RefCountedPtr< LevelData< FArrayBox > > m_Beta
Definition: FASIceSolver.H:130
Real m_time
Definition: FASIceSolver.H:126
virtual void setMaxIterations(int a_max_iter)
set "absolute tolerance"
Definition: FASIceSolver.H:176
virtual ~FASIceViscouseTensorOpFactory()
Definition: FASIceSolver.H:34
virtual void define(const ProblemDomain &a_coarseDomain, const RealVect &a_crsDx, const Vector< DisjointBoxLayout > &a_grids, const Vector< int > &a_refRatios, int a_nSRGrids=0)
Definition: FASIceSolverI.H:319
RefCountedPtr< LevelSigmaCS > m_coordSys
Definition: FASIceSolver.H:127
virtual RefCountedPtr< AMRFASOp< LevelData< FArrayBox > > > AMRNewOp(int a_ilev, const DisjointBoxLayout &a_grid, bool a_isSR=false)
override base
Definition: FASIceSolverI.H:256
Definition: FASIceSolver.H:24
virtual void setVerbosity(int a_verbosity)
Definition: FASIceSolver.H:178
const Real m_constThetaVal
Definition: FASIceSolver.H:118
RefCountedPtr< FASIceViscouseTensorOpFactory > m_opFactoryPtr
Definition: FASIceSolver.H:203
ViscousTensorOpFactory * m_VTOFactory
Definition: FASIceSolver.H:57
Virtual base class for basal friction relations.
Definition: BasalFrictionRelation.H:27
bool m_writeResidToPlotFile
Definition: FASIceSolver.H:204
const BasalFrictionRelation * m_basalFrictionRelPtr
Definition: FASIceSolver.H:123
IceThicknessIBC * m_bc
Definition: FASIceSolver.H:135
Definition: FASIceSolver.H:143
const BasalFrictionRelation * m_basalFrictionRelPtr
Definition: FASIceSolver.H:55
FASIceViscouseTensorOpFactory(ConstitutiveRelation *a_constRelPtr, BasalFrictionRelation *a_basalFrictionRelPtr, IceThicknessIBC *a_bc)
Constructor.
Definition: FASIceSolverI.H:238