Chombo + EB + MF  3.2
PoissonOp4.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 _POISSONOP4_H_
12 #define _POISSONOP4_H_
13 
14 #include "AMRMultiGrid.H"
15 #include "REAL.H"
16 #include "Box.H"
17 #include "LevelDataOps.H"
18 #include "BCFunc.H"
19 #include "FArrayBox.H"
20 #include "LevelData.H"
21 #include "NamespaceHeader.H"
22 
23 class PoissonOp4 : public MGLevelOp<LevelData<FArrayBox> >
24 {
25 public:
27  {
28  }
29 
30  virtual ~PoissonOp4()
31  {
32  }
33 
34  static const int m_nGhost = 2;
35 
36  /**
37  \name LinearOp functions */
38  /*@{*/
39 
40  void define(const RealVect& a_dx,
41  const ProblemDomain& a_domain,
42  BCFunc a_bc);
43 
44  virtual void createCoarsened(LevelData<FArrayBox>& a_lhs,
45  const LevelData<FArrayBox>& a_rhs,
46  const int& a_refRat);
47 
48  virtual void residual(LevelData<FArrayBox>& a_lhs,
49  const LevelData<FArrayBox>& a_phi,
50  const LevelData<FArrayBox>& a_rhs,
51  bool a_homogeneous = false);
52 
53  virtual void preCond(LevelData<FArrayBox>& a_correction,
54  const LevelData<FArrayBox>& a_residual);
55 
56  virtual void applyOp(LevelData<FArrayBox>& a_lhs,
57  const LevelData<FArrayBox>& a_phi,
58  bool a_homogeneous = false);
59 
60  virtual void create(LevelData<FArrayBox>& a_lhs,
61  const LevelData<FArrayBox>& a_rhs);
62 
63  virtual void assign(LevelData<FArrayBox>& a_lhs,
64  const LevelData<FArrayBox>& a_rhs) ;
65 
66  virtual Real dotProduct(const LevelData<FArrayBox>& a_1,
67  const LevelData<FArrayBox>& a_2) ;
68 
69  virtual void incr(LevelData<FArrayBox>& a_lhs,
70  const LevelData<FArrayBox>& a_x,
71  Real a_scale) ;
72 
73  virtual void axby(LevelData<FArrayBox>& a_lhs,
74  const LevelData<FArrayBox>& a_x,
75  const LevelData<FArrayBox>& a_y,
76  Real a, Real b) ;
77 
78  virtual void scale(LevelData<FArrayBox>& a_lhs,
79  const Real& a_scale) ;
80 
81  virtual Real norm(const LevelData<FArrayBox>& a_x, int a_ord);
82 
83  virtual void setToZero(LevelData<FArrayBox>& a_x);
84 
85  /*@}*/
86 
87  /**
88  \name MGLevelOp functions */
89  /*@{*/
90 
91  virtual void relax(LevelData<FArrayBox>& a_e,
92  const LevelData<FArrayBox>& a_residual,
93  int iterations);
94 
95  virtual void createCoarser(LevelData<FArrayBox>& a_coarse,
96  const LevelData<FArrayBox>& a_fine,
97  bool ghost);
98  /**
99  calculate restricted residual
100  a_resCoarse[2h] = I[h->2h] (rhsFine[h] - L[h](phiFine[h])
101  */
102  virtual void restrictResidual(LevelData<FArrayBox>& a_resCoarse,
103  LevelData<FArrayBox>& a_phiFine,
104  const LevelData<FArrayBox>& a_rhsFine);
105 
106  /**
107  correct the fine solution based on coarse correction
108  a_phiThisLevel += I[2h->h](a_correctCoarse)
109  */
110  virtual void prolongIncrement(LevelData<FArrayBox>& a_phiThisLevel,
111  const LevelData<FArrayBox>& a_correctCoarse);
112 
113  /*@}*/
114 
115 
116 protected:
117 
122 
125 
126  void levelGSRB(LevelData<FArrayBox>& a_e,
127  const LevelData<FArrayBox>& a_residual);
128 
129 };
130 
131 class PoissonOp4Factory : public MGLevelOpFactory<LevelData<FArrayBox> >
132 {
133 public:
134 
136 
137  PoissonOp4Factory(RealVect& a_dx, BCFunc a_bc);
138 
139  void define(const RealVect& m_dx, BCFunc m_bc);
140 
142  {
143  }
144 
145  virtual PoissonOp4* MGnewOp(const ProblemDomain& a_FineindexSpace,
146  int a_depth,
147  bool a_homoOnly = true);
148 
149  virtual void MGreclaim(PoissonOp4* a_reclaim);
150 
153 
154 };
155 
156 #include "NamespaceFooter.H"
157 #endif
virtual void restrictResidual(LevelData< FArrayBox > &a_resCoarse, LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_rhsFine)
virtual void residual(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_rhs, bool a_homogeneous=false)
virtual void preCond(LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_residual)
BCFunc m_bc
Definition: PoissonOp4.H:152
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual void incr(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_x, Real a_scale)
virtual void create(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
virtual ~PoissonOp4Factory()
Definition: PoissonOp4.H:141
static const int m_nGhost
Definition: PoissonOp4.H:34
LevelDataOps< FArrayBox > m_levelOps
Definition: PoissonOp4.H:123
PoissonOp4()
Definition: PoissonOp4.H:26
DisjointBoxLayout m_coarsenedMGrids
Definition: PoissonOp4.H:124
virtual void scale(LevelData< FArrayBox > &a_lhs, const Real &a_scale)
Definition: PoissonOp4.H:23
virtual void axby(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_x, const LevelData< FArrayBox > &a_y, Real a, Real b)
virtual Real dotProduct(const LevelData< FArrayBox > &a_1, const LevelData< FArrayBox > &a_2)
virtual void prolongIncrement(LevelData< FArrayBox > &a_phiThisLevel, const LevelData< FArrayBox > &a_correctCoarse)
void levelGSRB(LevelData< FArrayBox > &a_e, const LevelData< FArrayBox > &a_residual)
virtual PoissonOp4 * MGnewOp(const ProblemDomain &a_FineindexSpace, int a_depth, bool a_homoOnly=true)
Definition: MultiGrid.H:294
ProblemDomain m_domain
Definition: PoissonOp4.H:120
void define(const RealVect &m_dx, BCFunc m_bc)
virtual void MGreclaim(PoissonOp4 *a_reclaim)
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
Definition: PoissonOp4.H:131
BCFunc m_bc
Definition: PoissonOp4.H:121
virtual ~PoissonOp4()
Definition: PoissonOp4.H:30
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void(* BCFunc)(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: BCFunc.H:30
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual void assign(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
virtual void applyOp(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi, bool a_homogeneous=false)
RealVect m_dx
Definition: PoissonOp4.H:151
virtual void createCoarser(LevelData< FArrayBox > &a_coarse, const LevelData< FArrayBox > &a_fine, bool ghost)
virtual void setToZero(LevelData< FArrayBox > &a_x)
RealVect m_dxCrse
Definition: PoissonOp4.H:119
virtual Real norm(const LevelData< FArrayBox > &a_x, int a_ord)
RealVect m_dx
Definition: PoissonOp4.H:118
void define(const RealVect &a_dx, const ProblemDomain &a_domain, BCFunc a_bc)
virtual void createCoarsened(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs, const int &a_refRat)
virtual void relax(LevelData< FArrayBox > &a_e, const LevelData< FArrayBox > &a_residual, int iterations)